Skip to content

Commit 1388462

Browse files
committed
0.10.0
1 parent e0448a2 commit 1388462

File tree

8 files changed

+202
-195
lines changed

8 files changed

+202
-195
lines changed

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
# 0.10.0
2+
3+
## Update
4+
* Migrated to TypeScript
5+
* support android channel-io 12.5.2
6+
* support iOS channel-io 12.4.1
7+
18
# 0.9.3
29

310
## Update

RNChannelIO.podspec

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Pod::Spec.new do |s|
22
s.name = "RNChannelIO"
3-
s.version = "0.3.0"
3+
s.version = "0.4.0"
44
s.summary = "RNChannelIO"
55
s.description = "channel plugin for react native"
66
s.homepage = "https://channel.io"
@@ -15,5 +15,5 @@ Pod::Spec.new do |s|
1515
s.ios.deployment_target = '12.0'
1616

1717
s.dependency "React"
18-
s.dependency "ChannelIOSDK", '~> 12'
18+
s.dependency "ChannelIOSDK", '12.4.1'
1919
end

index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,12 +66,12 @@ export interface PopupData {
6666
}
6767

6868
export interface UserData {
69-
language: Language
69+
language?: Language
7070
tags?: string[]
7171
profile?: Profile
7272
profileOnce?: Record<string, any>
73-
unsubscribeEmail: boolean
74-
unsubscribeTexting: boolean
73+
unsubscribeEmail?: boolean
74+
unsubscribeTexting?: boolean
7575
}
7676

7777
export interface BootConfig {

ios/RCTConvert+ChannelIO.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@
1313
NS_ASSUME_NONNULL_BEGIN
1414

1515
@interface RCTConvert (ChannelIO)
16-
+ (BootConfig *)bootConfig:(id)json;
17-
+ (Profile *)profile:(id)json;
18-
+ (ChannelButtonOption *)channelButtonOption:(id)json;
16+
+ (CHTBootConfig *)bootConfig:(id)json;
17+
+ (CHTProfile *)profile:(id)json;
18+
+ (CHTChannelButtonOption *)channelButtonOption:(id)json;
1919
@end
2020

2121
// LanguageOption

ios/RCTConvert+ChannelIO.m

Lines changed: 113 additions & 113 deletions
Large diffs are not rendered by default.

ios/RNChannelIO.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
NS_ASSUME_NONNULL_BEGIN
1515

16-
@interface RNChannelIO : RCTEventEmitter <RCTBridgeModule, ChannelPluginDelegate>
16+
@interface RNChannelIO : RCTEventEmitter <RCTBridgeModule, CHTChannelPluginDelegate>
1717
@end
1818

1919
// event key

ios/RNChannelIO.m

Lines changed: 71 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -57,59 +57,59 @@ -(void)stopObserving {
5757
- (NSDictionary *)constantsToExport {
5858
return @{
5959
EVENT: @{
60-
KEY_EVENT_ON_BADGE_CHANGED: EVENT_ON_BADGE_CHANGED,
61-
KEY_EVENT_ON_FOLLOW_UP_CHANGED: EVENT_ON_FOLLOW_UP_CHANGED,
62-
KEY_EVENT_ON_POPUP_DATA_RECEIVED: EVENT_ON_POPUP_DATA_RECEIVED,
63-
KEY_EVENT_ON_SHOW_MESSENGER: EVENT_ON_SHOW_MESSENGER,
64-
KEY_EVENT_ON_HIDE_MESSENGER: EVENT_ON_HIDE_MESSENGER,
65-
KEY_EVENT_ON_CHAT_CREATED: EVENT_ON_CHAT_CREATED,
66-
KEY_EVENT_ON_PRE_URL_CLICKED: EVENT_ON_PRE_URL_CLICKED,
67-
KEY_EVENT_ON_URL_CLICKED: EVENT_ON_URL_CLICKED
60+
KEY_EVENT_ON_BADGE_CHANGED: EVENT_ON_BADGE_CHANGED,
61+
KEY_EVENT_ON_FOLLOW_UP_CHANGED: EVENT_ON_FOLLOW_UP_CHANGED,
62+
KEY_EVENT_ON_POPUP_DATA_RECEIVED: EVENT_ON_POPUP_DATA_RECEIVED,
63+
KEY_EVENT_ON_SHOW_MESSENGER: EVENT_ON_SHOW_MESSENGER,
64+
KEY_EVENT_ON_HIDE_MESSENGER: EVENT_ON_HIDE_MESSENGER,
65+
KEY_EVENT_ON_CHAT_CREATED: EVENT_ON_CHAT_CREATED,
66+
KEY_EVENT_ON_PRE_URL_CLICKED: EVENT_ON_PRE_URL_CLICKED,
67+
KEY_EVENT_ON_URL_CLICKED: EVENT_ON_URL_CLICKED
6868
},
6969
LANGUAGE: @{
70-
KEY_LANGUAGE_KOREAN: @(LanguageOptionKorean),
71-
KEY_LANGUAGE_ENGLISH: @(LanguageOptionEnglish),
72-
KEY_LANGUAGE_JAPANESE: @(LanguageOptionJapanese),
73-
KEY_LANGUAGE_DEVICE: @(LanguageOptionDevice)
70+
KEY_LANGUAGE_KOREAN: @(CHTLanguageOptionKorean),
71+
KEY_LANGUAGE_ENGLISH: @(CHTLanguageOptionEnglish),
72+
KEY_LANGUAGE_JAPANESE: @(CHTLanguageOptionJapanese),
73+
KEY_LANGUAGE_DEVICE: @(CHTLanguageOptionDevice)
7474
},
7575
BOOT_STATUS: @{
76-
KEY_BOOT_STATUS_SUCCESS: @(BootStatusSuccess),
77-
KEY_BOOT_STATUS_NOT_INITIALIZED: @(BootStatusNotInitialized),
78-
KEY_BOOT_STATUS_NETWORK_TIMEOUT: @(BootStatusNetworkTimeout),
79-
KEY_BOOT_STATUS_NOT_AVAILABLE_VERSION: @(BootStatusNotAvailableVersion),
80-
KEY_BOOT_STATUS_SERVICE_UNDER_CONSTRUCTION: @(BootStatusServiceUnderConstruction),
81-
KEY_BOOT_STATUS_REQUIRE_PAYMENT: @(BootStatusRequirePayment),
82-
KEY_BOOT_STATUS_ACCESS_DENIED: @(BootStatusAccessDenied),
83-
KEY_BOOT_STATUS_UNKNOWN_ERROR: @(BootStatusUnknown)
76+
KEY_BOOT_STATUS_SUCCESS: @(CHTBootStatusSuccess),
77+
KEY_BOOT_STATUS_NOT_INITIALIZED: @(CHTBootStatusNotInitialized),
78+
KEY_BOOT_STATUS_NETWORK_TIMEOUT: @(CHTBootStatusNetworkTimeout),
79+
KEY_BOOT_STATUS_NOT_AVAILABLE_VERSION: @(CHTBootStatusNotAvailableVersion),
80+
KEY_BOOT_STATUS_SERVICE_UNDER_CONSTRUCTION: @(CHTBootStatusServiceUnderConstruction),
81+
KEY_BOOT_STATUS_REQUIRE_PAYMENT: @(CHTBootStatusRequirePayment),
82+
KEY_BOOT_STATUS_ACCESS_DENIED: @(CHTBootStatusAccessDenied),
83+
KEY_BOOT_STATUS_UNKNOWN_ERROR: @(CHTBootStatusUnknown)
8484
},
8585
CHANNEL_BUTTON_ICON: @{
86-
KEY_CHANNEL_BUTTON_OPTION_ICON_CHANNEL: @(ChannelButtonIconChannel),
87-
KEY_CHANNEL_BUTTON_OPTION_ICON_CHAT_BUBBLE_FILLED: @(ChannelButtonIconChatBubbleFilled),
88-
KEY_CHANNEL_BUTTON_OPTION_ICON_CHAT_PROGRESS_FILLED: @(ChannelButtonIconChatProgressFilled),
89-
KEY_CHANNEL_BUTTON_OPTION_ICON_CHAT_QUESTION_FILLED: @(ChannelButtonIconChatQuestionFilled),
90-
KEY_CHANNEL_BUTTON_OPTION_ICON_CHAT_LIGHTNING_FILLED: @(ChannelButtonIconChatLightningFilled),
91-
KEY_CHANNEL_BUTTON_OPTION_ICON_CHAT_BUBBLE_ALT_FILLED: @(ChannelButtonIconChatBubbleAltFilled),
92-
KEY_CHANNEL_BUTTON_OPTION_ICON_SMS_FILLED: @(ChannelButtonIconSmsFilled),
93-
KEY_CHANNEL_BUTTON_OPTION_ICON_COMMENT_FILLED: @(ChannelButtonIconCommentFilled),
94-
KEY_CHANNEL_BUTTON_OPTION_ICON_SEND_FORWARD_FILLED: @(ChannelButtonIconSendForwardFilled),
95-
KEY_CHANNEL_BUTTON_OPTION_ICON_HELP_FILLED: @(ChannelButtonIconHelpFilled),
96-
KEY_CHANNEL_BUTTON_OPTION_ICON_CHAT_PROGRESS: @(ChannelButtonIconChatProgress),
97-
KEY_CHANNEL_BUTTON_OPTION_ICON_CHAT_QUESTION: @(ChannelButtonIconChatQuestion),
98-
KEY_CHANNEL_BUTTON_OPTION_ICON_CHAT_BUBBLE_ALT: @(ChannelButtonIconChatBubbleAlt),
99-
KEY_CHANNEL_BUTTON_OPTION_ICON_SMS: @(ChannelButtonIconSms),
100-
KEY_CHANNEL_BUTTON_OPTION_ICON_COMMENT: @(ChannelButtonIconComment),
101-
KEY_CHANNEL_BUTTON_OPTION_ICON_SEND_FORWARD: @(ChannelButtonIconSendForward),
102-
KEY_CHANNEL_BUTTON_OPTION_ICON_COMMUNICATION: @(ChannelButtonIconCommunication),
103-
KEY_CHANNEL_BUTTON_OPTION_ICON_HEADSET: @(ChannelButtonIconHeadset)
86+
KEY_CHANNEL_BUTTON_OPTION_ICON_CHANNEL: @(CHTChannelButtonIconChannel),
87+
KEY_CHANNEL_BUTTON_OPTION_ICON_CHAT_BUBBLE_FILLED: @(CHTChannelButtonIconChatBubbleFilled),
88+
KEY_CHANNEL_BUTTON_OPTION_ICON_CHAT_PROGRESS_FILLED: @(CHTChannelButtonIconChatProgressFilled),
89+
KEY_CHANNEL_BUTTON_OPTION_ICON_CHAT_QUESTION_FILLED: @(CHTChannelButtonIconChatQuestionFilled),
90+
KEY_CHANNEL_BUTTON_OPTION_ICON_CHAT_LIGHTNING_FILLED: @(CHTChannelButtonIconChatLightningFilled),
91+
KEY_CHANNEL_BUTTON_OPTION_ICON_CHAT_BUBBLE_ALT_FILLED: @(CHTChannelButtonIconChatBubbleAltFilled),
92+
KEY_CHANNEL_BUTTON_OPTION_ICON_SMS_FILLED: @(CHTChannelButtonIconSmsFilled),
93+
KEY_CHANNEL_BUTTON_OPTION_ICON_COMMENT_FILLED: @(CHTChannelButtonIconCommentFilled),
94+
KEY_CHANNEL_BUTTON_OPTION_ICON_SEND_FORWARD_FILLED: @(CHTChannelButtonIconSendForwardFilled),
95+
KEY_CHANNEL_BUTTON_OPTION_ICON_HELP_FILLED: @(CHTChannelButtonIconHelpFilled),
96+
KEY_CHANNEL_BUTTON_OPTION_ICON_CHAT_PROGRESS: @(CHTChannelButtonIconChatProgress),
97+
KEY_CHANNEL_BUTTON_OPTION_ICON_CHAT_QUESTION: @(CHTChannelButtonIconChatQuestion),
98+
KEY_CHANNEL_BUTTON_OPTION_ICON_CHAT_BUBBLE_ALT: @(CHTChannelButtonIconChatBubbleAlt),
99+
KEY_CHANNEL_BUTTON_OPTION_ICON_SMS: @(CHTChannelButtonIconSms),
100+
KEY_CHANNEL_BUTTON_OPTION_ICON_COMMENT: @(CHTChannelButtonIconComment),
101+
KEY_CHANNEL_BUTTON_OPTION_ICON_SEND_FORWARD: @(CHTChannelButtonIconSendForward),
102+
KEY_CHANNEL_BUTTON_OPTION_ICON_COMMUNICATION: @(CHTChannelButtonIconCommunication),
103+
KEY_CHANNEL_BUTTON_OPTION_ICON_HEADSET: @(CHTChannelButtonIconHeadset)
104104
},
105105
CHANNEL_BUTTON_POSITION: @{
106-
KEY_CHANNEL_BUTTON_OPTION_POSITION_RIGHT: @(ChannelButtonPositionRight),
107-
KEY_CHANNEL_BUTTON_OPTION_POSITION_LEFT: @(ChannelButtonPositionLeft)
106+
KEY_CHANNEL_BUTTON_OPTION_POSITION_RIGHT: @(CHTChannelButtonPositionRight),
107+
KEY_CHANNEL_BUTTON_OPTION_POSITION_LEFT: @(CHTChannelButtonPositionLeft)
108108
},
109109
CHANNEL_APPEARANCE: @{
110-
KEY_APPEARANCE_SYSTEM: @(AppearanceSystem),
111-
KEY_APPEARANCE_DARK: @(AppearanceDark),
112-
KEY_APPEARANCE_LIGHT: @(AppearanceLight)
110+
KEY_APPEARANCE_SYSTEM: @(CHTAppearanceSystem),
111+
KEY_APPEARANCE_DARK: @(CHTAppearanceDark),
112+
KEY_APPEARANCE_LIGHT: @(CHTAppearanceLight)
113113
},
114114
};
115115
}
@@ -130,38 +130,38 @@ - (NSDictionary *)constantsToExport {
130130
RCT_EXPORT_METHOD(boot:(id)bootConfig
131131
resolver:(RCTPromiseResolveBlock)resolve
132132
rejecter:(RCTPromiseRejectBlock)reject) {
133-
BootConfig * config = [RCTConvert bootConfig:bootConfig];
134-
135-
[ChannelIO bootWith:config completion:^(BootStatus status, User *user) {
133+
CHTBootConfig * config = [RCTConvert bootConfig:bootConfig];
134+
135+
[ChannelIO bootWith:config completion:^(CHTBootStatus status, CHTUser *user) {
136136
NSString * stringStatus = BOOT_STATUS_UNKNOWN_ERROR;
137137
switch (status) {
138-
case BootStatusSuccess:
138+
case CHTBootStatusSuccess:
139139
stringStatus = BOOT_STATUS_SUCCESS;
140140
break;
141-
case BootStatusNotInitialized:
141+
case CHTBootStatusNotInitialized:
142142
stringStatus = BOOT_STATUS_NOT_INITIALIZED;
143143
break;
144-
case BootStatusNetworkTimeout:
144+
case CHTBootStatusNetworkTimeout:
145145
stringStatus = BOOT_STATUS_NETWORK_TIMEOUT;
146146
break;
147-
case BootStatusNotAvailableVersion:
147+
case CHTBootStatusNotAvailableVersion:
148148
stringStatus = BOOT_STATUS_NOT_AVAILABLE_VERSION;
149149
break;
150-
case BootStatusServiceUnderConstruction:
150+
case CHTBootStatusServiceUnderConstruction:
151151
stringStatus = BOOT_STATUS_SERVICE_UNDER_CONSTRUCTION;
152152
break;
153-
case BootStatusRequirePayment:
153+
case CHTBootStatusRequirePayment:
154154
stringStatus = BOOT_STATUS_REQUIRE_PAYMENT;
155155
break;
156-
case BootStatusAccessDenied:
156+
case CHTBootStatusAccessDenied:
157157
stringStatus = BOOT_STATUS_ACCESS_DENIED;
158158
break;
159159
default:
160160
stringStatus = BOOT_STATUS_UNKNOWN_ERROR;
161161
break;
162162
}
163163

164-
if (status == BootStatusSuccess && user != nil) {
164+
if (status == CHTBootStatusSuccess && user != nil) {
165165
resolve(@{KEY_STATUS: stringStatus, KEY_USER: user.toJson});
166166
} else {
167167
resolve(@{KEY_STATUS: stringStatus});
@@ -245,29 +245,29 @@ - (NSDictionary *)constantsToExport {
245245
RCT_EXPORT_METHOD(updateUser:(NSDictionary<NSString *, id> *)userData
246246
resolver:(RCTPromiseResolveBlock)resolve
247247
rejecter:(RCTPromiseRejectBlock)reject) {
248-
UpdateUserParamObjcBuilder *builder = [[UpdateUserParamObjcBuilder alloc] init];
248+
CHTUpdateUserParamObjcBuilder *builder = [[CHTUpdateUserParamObjcBuilder alloc] init];
249249

250250
if ([[userData allKeys] containsObject:KEY_LANGUAGE]) {
251251
NSString *language = [RCTConvert NSString:userData[KEY_LANGUAGE]];
252252
if ([language isEqualToString:LANGUAGE_OPTION_KO]) {
253-
[builder withLanguage:LanguageOptionKorean];
253+
[builder withLanguage:CHTLanguageOptionKorean];
254254
} else if ([language isEqualToString:LANGUAGE_OPTION_JA]) {
255-
[builder withLanguage:LanguageOptionJapanese];
255+
[builder withLanguage:CHTLanguageOptionJapanese];
256256
} else if ([language isEqualToString:LANGUAGE_OPTION_EN]) {
257-
[builder withLanguage:LanguageOptionEnglish];
257+
[builder withLanguage:CHTLanguageOptionEnglish];
258258
} else {
259-
[builder withLanguage:LanguageOptionDevice];
259+
[builder withLanguage:CHTLanguageOptionDevice];
260260
}
261261
} else if ([[userData allKeys] containsObject:KEY_LOCALE]) {
262262
NSString *locale = [RCTConvert NSString:userData[KEY_LOCALE]];
263263
if ([locale isEqualToString:LANGUAGE_OPTION_KO]) {
264-
[builder withLanguage:LanguageOptionKorean];
264+
[builder withLanguage:CHTLanguageOptionKorean];
265265
} else if ([locale isEqualToString:LANGUAGE_OPTION_JA]) {
266-
[builder withLanguage:LanguageOptionJapanese];
266+
[builder withLanguage:CHTLanguageOptionJapanese];
267267
} else if ([locale isEqualToString:LANGUAGE_OPTION_EN]) {
268-
[builder withLanguage:LanguageOptionEnglish];
268+
[builder withLanguage:CHTLanguageOptionEnglish];
269269
} else {
270-
[builder withLanguage:LanguageOptionDevice];
270+
[builder withLanguage:CHTLanguageOptionDevice];
271271
}
272272
}
273273

@@ -300,8 +300,8 @@ - (NSDictionary *)constantsToExport {
300300
[builder withTags:[RCTConvert NSArray:userData[KEY_TAGS]]];
301301
}
302302
}
303-
304-
[ChannelIO updateUserWithParam:[builder build] completion:^(NSError *error, User *user) {
303+
304+
[ChannelIO updateUserWithParam:[builder build] completion:^(NSError *error, CHTUser *user) {
305305
NSMutableDictionary<NSString *, id> *result = [NSMutableDictionary dictionary];
306306

307307
if (user != nil) {
@@ -323,7 +323,7 @@ - (NSDictionary *)constantsToExport {
323323
RCT_EXPORT_METHOD(addTags:(NSArray<NSString *> *)tags
324324
resolver:(RCTPromiseResolveBlock)resolve
325325
rejecter:(RCTPromiseRejectBlock)reject) {
326-
[ChannelIO addTags:tags completion:^(NSError *error, User *user) {
326+
[ChannelIO addTags:tags completion:^(NSError *error, CHTUser *user) {
327327
NSMutableDictionary<NSString *, id> *result = [NSMutableDictionary dictionary];
328328

329329
if (user != nil) {
@@ -345,7 +345,7 @@ - (NSDictionary *)constantsToExport {
345345
RCT_EXPORT_METHOD(removeTags:(NSArray<NSString *> *)tags
346346
resolver:(RCTPromiseResolveBlock)resolve
347347
rejecter:(RCTPromiseRejectBlock)reject) {
348-
[ChannelIO removeTags:tags completion:^(NSError *error, User *user) {
348+
[ChannelIO removeTags:tags completion:^(NSError *error, CHTUser *user) {
349349
NSMutableDictionary<NSString *, id> *result = [NSMutableDictionary dictionary];
350350

351351
if (user != nil) {
@@ -391,11 +391,11 @@ - (NSDictionary *)constantsToExport {
391391
RCT_EXPORT_METHOD(setAppearance:(NSString *)appearance) {
392392
if (appearance != nil) {
393393
if ([appearance isEqualToString:APPEARANCE_SYSTEM]) {
394-
[ChannelIO setAppearance:AppearanceSystem];
394+
[ChannelIO setAppearance:CHTAppearanceSystem];
395395
} else if ([appearance isEqualToString:APPEARANCE_LIGHT]) {
396-
[ChannelIO setAppearance:AppearanceLight];
396+
[ChannelIO setAppearance:CHTAppearanceLight];
397397
} else if ([appearance isEqualToString:APPEARANCE_DARK]) {
398-
[ChannelIO setAppearance:AppearanceDark];
398+
[ChannelIO setAppearance:CHTAppearanceDark];
399399
}
400400
}
401401
}
@@ -411,7 +411,7 @@ - (void)onBadgeChangedWithUnread:(NSInteger)unread alert:(NSInteger)alert {
411411
}
412412
}
413413

414-
- (void)onPopupDataReceivedWithEvent:(PopupData *)event {
414+
- (void)onPopupDataReceivedWithEvent:(CHTPopupData *)event {
415415
if (hasListeners) {
416416
[self sendEventWithName:EVENT_ON_POPUP_DATA_RECEIVED body:@{KEY_POPUP: event.toJson}];
417417
}

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
22
"name": "react-native-channel-plugin",
3-
"version": "0.9.3",
3+
"version": "0.10.0",
44
"description": "react native module for channel io",
5-
"main": "index.js",
5+
"main": "index.ts",
66
"scripts": {
77
"test": "echo \"Error: no test specified\" && exit 1"
88
},

0 commit comments

Comments
 (0)