airbridge-react-native-sdk-restricted 2.7.3 → 2.8.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -24,7 +24,7 @@ Pod::Spec.new do |s|
24
24
  s.public_header_files = 'ios/AirbridgeRN/AirbridgeRN.h'
25
25
 
26
26
  s.dependency 'React'
27
- s.dependency 'AirBridgeRestricted', '1.35.1'
27
+ s.dependency 'AirBridgeRestricted', '1.36.0'
28
28
 
29
29
  s.pod_target_xcconfig = {
30
30
  'DEFINES_MODULE' => 'YES'
@@ -20,7 +20,7 @@ rootProject.allprojects {
20
20
 
21
21
  dependencies {
22
22
  implementation 'com.facebook.react:react-native:+'
23
- api 'io.airbridge:sdk-android-restricted:2.23.0'
23
+ api 'io.airbridge:sdk-android-restricted:2.24.0'
24
24
  implementation 'com.android.installreferrer:installreferrer:2.1'
25
25
  }
26
26
 
package/changelog.md CHANGED
@@ -1,3 +1,15 @@
1
+ ## 2.8.1
2
+
3
+ **FIXED**
4
+ * Fixed a bug that iOS APNS token double encoding issue
5
+
6
+ ## 2.8.0
7
+
8
+ **FIXED**
9
+ * Update `Airbridge Android SDK` to 2.24.0
10
+ * Update `Airbridge iOS SDK` to 1.36.0
11
+ * Fixed an issue where duplicate decoding of the airbridge_deeplink parameter of deep link URI occurred.
12
+
1
13
  ## 2.7.3
2
14
 
3
15
  **FIXED**
@@ -0,0 +1,16 @@
1
+ //
2
+ // Hex.h
3
+ // AirbridgeRN
4
+ //
5
+
6
+ #import <Foundation/Foundation.h>
7
+
8
+ NS_ASSUME_NONNULL_BEGIN
9
+
10
+ @interface ARNHex : NSObject
11
+
12
+ + (nullable NSData *)dataFromHexString:(NSString *)string;
13
+
14
+ @end
15
+
16
+ NS_ASSUME_NONNULL_END
@@ -0,0 +1,44 @@
1
+ //
2
+ // Hex.m
3
+ // AirbridgeRN
4
+ //
5
+
6
+ #import "ARNHex.h"
7
+
8
+ @implementation ARNHex
9
+
10
+ + (nullable NSData *)dataFromHexString:(NSString *)string {
11
+ // Convert the string to lowercase only once
12
+ string = [string lowercaseString];
13
+ NSUInteger length = [string length];
14
+
15
+ // Reserve capacity for the mutable data to avoid frequent reallocation
16
+ NSMutableData* data = [NSMutableData dataWithCapacity:length / 2];
17
+
18
+ // Define constants for hex characters
19
+ static const char hexCharacters[] = "0123456789abcdef";
20
+
21
+ for (NSUInteger i = 0; i < length; i += 2) {
22
+ // Get two characters at once for better performance
23
+ char highCharacter = [string characterAtIndex:i];
24
+ char lowCharacter = (i + 1 < length) ? [string characterAtIndex:i + 1] : 0;
25
+
26
+ // Convert hex characters to bytes
27
+ const char *highCharacterPointer = strchr(hexCharacters, highCharacter);
28
+ const char *lowCharacterPointer = strchr(hexCharacters, lowCharacter);
29
+ if (!highCharacterPointer || !lowCharacterPointer) {
30
+ // catch invalid characters
31
+ return nil;
32
+ }
33
+
34
+ // Calculate the byte from the hex characters
35
+ uint8_t byte = ((highCharacterPointer - hexCharacters) << 4) | (lowCharacterPointer - hexCharacters);
36
+
37
+ // Append the byte to the data
38
+ [data appendBytes:&byte length:1];
39
+ }
40
+
41
+ return data;
42
+ }
43
+
44
+ @end
@@ -12,6 +12,7 @@
12
12
  #import <AirBridge/AirBridge.h>
13
13
 
14
14
  #import "ARNGet.h"
15
+ #import "ARNHex.h"
15
16
 
16
17
  @implementation AirbridgeState
17
18
 
@@ -82,7 +83,11 @@ RCT_EXPORT_METHOD(clearDeviceAlias) {
82
83
  }
83
84
 
84
85
  RCT_EXPORT_METHOD(registerPushToken:(nullable NSString*)token) {
85
- NSData* data = [token dataUsingEncoding:NSUTF8StringEncoding];
86
+ if (token == nil) return;
87
+
88
+ NSData* data = [ARNHex dataFromHexString:token];
89
+ if (data == nil) return;
90
+
86
91
  [AirBridge registerPushToken:data];
87
92
  }
88
93
 
@@ -7,6 +7,8 @@
7
7
  objects = {
8
8
 
9
9
  /* Begin PBXBuildFile section */
10
+ 9F2C4C132B9EC9EE0064A9B7 /* ARNHex.m in Sources */ = {isa = PBXBuildFile; fileRef = 9F2C4C112B9EC9EE0064A9B7 /* ARNHex.m */; };
11
+ 9F2C4C142B9EC9EE0064A9B7 /* ARNHex.h in Headers */ = {isa = PBXBuildFile; fileRef = 9F2C4C122B9EC9EE0064A9B7 /* ARNHex.h */; };
10
12
  C300721F24A0B6C3003F8073 /* ARNConfigReader.h in Headers */ = {isa = PBXBuildFile; fileRef = C300721D24A0B6C3003F8073 /* ARNConfigReader.h */; };
11
13
  C300722024A0B6C3003F8073 /* ARNConfigReader.m in Sources */ = {isa = PBXBuildFile; fileRef = C300721E24A0B6C3003F8073 /* ARNConfigReader.m */; };
12
14
  C34284B62266E7040060226A /* AirbridgeRN.h in Headers */ = {isa = PBXBuildFile; fileRef = C34284B42266E7040060226A /* AirbridgeRN.h */; };
@@ -53,6 +55,8 @@
53
55
 
54
56
  /* Begin PBXFileReference section */
55
57
  134814201AA4EA6300B7C361 /* libAirbridgeRN.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libAirbridgeRN.a; sourceTree = BUILT_PRODUCTS_DIR; };
58
+ 9F2C4C112B9EC9EE0064A9B7 /* ARNHex.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ARNHex.m; sourceTree = "<group>"; };
59
+ 9F2C4C122B9EC9EE0064A9B7 /* ARNHex.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ARNHex.h; sourceTree = "<group>"; };
56
60
  C300721D24A0B6C3003F8073 /* ARNConfigReader.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ARNConfigReader.h; sourceTree = "<group>"; };
57
61
  C300721E24A0B6C3003F8073 /* ARNConfigReader.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ARNConfigReader.m; sourceTree = "<group>"; };
58
62
  C34284B42266E7040060226A /* AirbridgeRN.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AirbridgeRN.h; sourceTree = "<group>"; };
@@ -110,6 +114,8 @@
110
114
  C3BF1EDF2264485C00271B03 /* AirbridgeRN */ = {
111
115
  isa = PBXGroup;
112
116
  children = (
117
+ 9F2C4C122B9EC9EE0064A9B7 /* ARNHex.h */,
118
+ 9F2C4C112B9EC9EE0064A9B7 /* ARNHex.m */,
113
119
  C34284B42266E7040060226A /* AirbridgeRN.h */,
114
120
  C34284B52266E7040060226A /* AirbridgeRN.m */,
115
121
  C35560322264267700D6D240 /* AirbridgeDeeplink.h */,
@@ -135,6 +141,7 @@
135
141
  isa = PBXHeadersBuildPhase;
136
142
  buildActionMask = 2147483647;
137
143
  files = (
144
+ 9F2C4C142B9EC9EE0064A9B7 /* ARNHex.h in Headers */,
138
145
  C37E9CF9249856EC00BC790F /* ARNGet.h in Headers */,
139
146
  C34284B62266E7040060226A /* AirbridgeRN.h in Headers */,
140
147
  C39C1CD123029BD100CECBD8 /* AirbridgePlacement.h in Headers */,
@@ -231,6 +238,7 @@
231
238
  C35819CB2273324400DCD619 /* AirbridgeState.m in Sources */,
232
239
  C300722024A0B6C3003F8073 /* ARNConfigReader.m in Sources */,
233
240
  C37E9CFA249856EC00BC790F /* ARNGet.m in Sources */,
241
+ 9F2C4C132B9EC9EE0064A9B7 /* ARNHex.m in Sources */,
234
242
  C34284B72266E7040060226A /* AirbridgeRN.m in Sources */,
235
243
  C35560352264267700D6D240 /* AirbridgeDeeplink.m in Sources */,
236
244
  );
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "airbridge-react-native-sdk-restricted",
3
- "version": "2.7.3",
3
+ "version": "2.8.1",
4
4
  "description": "Airbridge SDK for React Native",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -26,7 +26,7 @@ class WebInterface {
26
26
 
27
27
  const getScript = function (webToken, postCommand) {
28
28
  const jsonSchemaVersion = 4;
29
- const sdkVersion = '2.7.3';
29
+ const sdkVersion = '2.8.1';
30
30
 
31
31
  return `
32
32
  AirbridgeNative = {};
@@ -1,32 +0,0 @@
1
- require 'json'
2
- require_relative 'ios/copy-config.rb'
3
-
4
- package = JSON.parse(File.read(File.join(__dir__, 'package.json')))
5
-
6
- Pod::Spec.new do |s|
7
- s.name = package['name']
8
- s.version = package['version']
9
- s.summary = package['description']
10
- s.description = package['description']
11
- s.license = package['license']
12
- s.author = package['author']
13
- s.homepage = package['homepage']
14
- s.source = { :http => 'file:' + __dir__ }
15
-
16
- s.requires_arc = true
17
- s.platform = :ios, '11.0'
18
-
19
- s.preserve_paths = 'README.md', 'package.json', 'index.js'
20
-
21
- s.source_files = 'ios/AirbridgeRN/*.{h,m}'
22
-
23
- s.header_dir = 'AirbridgeRN'
24
- s.public_header_files = 'ios/AirbridgeRN/AirbridgeRN.h'
25
-
26
- s.dependency 'React'
27
- s.dependency 'AirBridge', '1.35.1'
28
-
29
- s.pod_target_xcconfig = {
30
- 'DEFINES_MODULE' => 'YES'
31
- }
32
- end
@@ -1,27 +0,0 @@
1
- apply plugin: 'com.android.library'
2
-
3
- android {
4
- compileSdkVersion 30
5
- buildToolsVersion '29.0.2'
6
-
7
- defaultConfig {
8
- minSdkVersion 16
9
- targetSdkVersion 30
10
- versionCode 1
11
- versionName '1.0.0'
12
- }
13
- }
14
-
15
- rootProject.allprojects {
16
- repositories {
17
- maven { url 'https://sdk-download.airbridge.io/maven' }
18
- }
19
- }
20
-
21
- dependencies {
22
- implementation 'com.facebook.react:react-native:+'
23
- api 'io.airbridge:sdk-android:2.23.0'
24
- implementation 'com.android.installreferrer:installreferrer:2.1'
25
- }
26
-
27
- apply from: 'copy-config.gradle'
package/index.d.ts.bak DELETED
@@ -1,292 +0,0 @@
1
- declare module "airbridge-react-native-sdk" {
2
-
3
- /**
4
- * main class (singleton)
5
- */
6
- class Airbridge {
7
- event: Event;
8
- deeplink: Deeplink;
9
- state: State;
10
- placement: Placement;
11
-
12
- /**
13
- * Set device alias
14
- * @param {string} key - device alias key
15
- * @param {string} value - device alias value
16
- */
17
- setDeviceAlias(key: string, value: string): void;
18
-
19
- /**
20
- * Remove device alias
21
- * @param {string} key - callback of attribution
22
- */
23
- removeDeviceAlias(key: string): void;
24
-
25
- /**
26
- * clear device alias
27
- */
28
- clearDeviceAlias(): void;
29
-
30
- /**
31
- * Send event to server.
32
- * @param {string} category event name
33
- * @param {EventOption} [option={}] event options
34
- */
35
- trackEvent(category: string, option?: EventOption): void;
36
-
37
- /**
38
- * register push token
39
- * @param {string} token - push token
40
- */
41
- registerPushToken(token: string): void;
42
-
43
- /**
44
- * create interface of webview
45
- * @param webToken token for airbridge web sdk that using on webview
46
- * @param postCommandFunction notify to interface how to post command to native
47
- * @returns {WebInterface} Web Interface
48
- */
49
- createWebInterface(
50
- webToken: string,
51
- postCommandFunction: (command: string) => string,
52
- ): WebInterface;
53
- }
54
-
55
- /**
56
- * class for interface of webview
57
- */
58
- class WebInterface {
59
- script: string;
60
- /**
61
- * handle command from webview
62
- * @param {String} command command from webview
63
- */
64
- handle(command: string): void;
65
- }
66
-
67
- /**
68
- * @param deeplink - URL of deeplink
69
- */
70
- type DeeplinkListener = (deeplink: string | null) => void;
71
-
72
- /**
73
- * class for set SDK's deeplink behavior (singleton)
74
- */
75
- class Deeplink {
76
- /**
77
- * Set DeeplinkListener (listen deeplink or deferred-deeplink)<br/>
78
- * @param listener - callback of deeplink & deferred-deeplink
79
- */
80
- setDeeplinkListener(listener: DeeplinkListener): void;
81
- }
82
-
83
- /**
84
- * class for send event (singleton)
85
- */
86
- class Event {
87
- /**
88
- * Send event to server.
89
- * @param {string} category event name
90
- * @param {EventOption} [option={}] event options
91
- */
92
- trackEvent(category: string, option?: EventOption): void;
93
- }
94
-
95
- /**
96
- * class for use SDK's placement function (singleton)
97
- */
98
- class Placement {
99
- /**
100
- * 1. send +1 click statistics to server<br/>
101
- * 2. get deeplink and fallback from server<br/>
102
- * 3. open deeplink. when fail, open fallback<br/>
103
- * 4. parameter's deeplink, fallback is spare for network-fail
104
- * @param trackingLink - created on dashboard
105
- */
106
- click(trackingLink: string): void;
107
- /**
108
- * send +1 impression statistics to server<br/>
109
- * @param trackingLink - created on dashboard
110
- */
111
- impression(trackingLink: string): void;
112
- }
113
-
114
- /**
115
- * @param attribution - URL of attribution
116
- */
117
- type AttributionListener = (attribution: {
118
- [key: string]: string;
119
- }) => void;
120
-
121
- /**
122
- * class for manage SDK's state (singleton)
123
- */
124
- class State {
125
- /**
126
- * set current user<br/>
127
- *
128
- * user.property is null, if input.property is null
129
- * @param user - user infomation
130
- */
131
- setUser(user: User): void;
132
- /**
133
- * update current user<br/>
134
- *
135
- * user.property not be changed, if input.property is null
136
- * @param user - user infomation
137
- */
138
- updateUser(user: User): void;
139
- /**
140
- * make airbridge start tracking
141
- */
142
- startTracking(): void;
143
- /**
144
- * get deviceUUID of Airbridge SDK.
145
- */
146
- deviceUUID(): Promise<string>;
147
- /**
148
- * Set AttributionListener (listen attribution)<br/>
149
- * @param listener - callback of attribution
150
- */
151
- setAttributionListener(listener: AttributionListener): void;
152
-
153
- /**
154
- * Set device alias
155
- * @param {string} key - device alias key
156
- * @param {string} value - device alias value
157
- */
158
- setDeviceAlias(key: string, value: string): void;
159
-
160
- /**
161
- * Remove device alias
162
- * @param {string} key - callback of attribution
163
- */
164
- removeDeviceAlias(key: string): void;
165
-
166
- /**
167
- * clear device alias
168
- */
169
- clearDeviceAlias(): void;
170
-
171
- /**
172
- * register push token
173
- * @param {string} token - push token
174
- */
175
- registerPushToken(token: string): void;
176
- }
177
-
178
- class WebInterface {
179
-
180
- /**
181
- * handle command from webview
182
- */
183
- public readonly script: string;
184
-
185
- /**
186
- * handle command from webview
187
- * @param {String} command command from webview
188
- */
189
- handle(command: string): void;
190
- }
191
-
192
- /**
193
- * @property {string} [action] event group name 1
194
- * @property {string} [label] event group name 2
195
- * @property {number} [value] event custom value
196
- * @property {{}} [customAttributes] event custom attributes
197
- * @property {{}} [semanticAttributes] event semantic attributes
198
- */
199
- type EventOption = {
200
- action?: string;
201
- label?: string;
202
- value?: number;
203
- customAttributes?: {
204
- [key: string]: string;
205
- };
206
- semanticAttributes?: {
207
- [key: string]: any;
208
- };
209
- };
210
-
211
- /**
212
- * @property {string} [ID] - Product's unique identifier
213
- * @property {string} [name] - Product's name
214
- * @property {string} [currency] - currency in <a href='https://en.wikipedia.org/wiki/ISO_4217'>ISO 4217<a/>
215
- * @property {number} [price] - Product's price
216
- * @property {number} [quantity] - Purchased quantity
217
- * @property {number} [position] - Product's index in list
218
- */
219
- type Product = {
220
- ID?: string;
221
- name?: string;
222
- currency?: string;
223
- price?: number;
224
- quantity?: number;
225
- position?: number;
226
- };
227
-
228
- /**
229
- * @property {string} [ID] - User's ID (not allow empty string)
230
- * @property {string} [email] - User's Email (not allow empty string)
231
- * @property {string} [phone] - User's Phone Number (not allow empty string)
232
- * @property {{}} [alias] - User's Alias
233
- * @property {{}} [attributes] - User's Attributes
234
- */
235
- type User = {
236
- ID?: string;
237
- email?: string;
238
- phone?: string;
239
- alias?: {
240
- [key: string]: string;
241
- };
242
- attributes?: {
243
- [key: string]: any;
244
- };
245
- };
246
-
247
- const AirbridgeCategory: {
248
- SIGN_UP: string
249
- SIGN_IN: string
250
- SIGN_OUT: string
251
-
252
- HOME_VIEW: string
253
- SEARCH_RESULT_VIEW: string
254
- PRODUCT_LIST_VIEW: string
255
- PRODUCT_DETAILS_VIEW: string
256
-
257
- ADD_TO_CART: string
258
- ORDER_COMPLETED: string
259
- }
260
-
261
- const AirbridgeAttributes: {
262
- QUERY: string
263
- PRODUCT_LIST_ID: string
264
- CART_ID: string
265
- TRANSACTION_ID: string
266
- PRODUCTS: string
267
- IN_APP_PURCHASED: string
268
- CURRENCY: string
269
- TOTAL_VALUE: string
270
- TOTAL_QUANTITY: string
271
- }
272
-
273
- const AirbridgeProduct: {
274
- PRODUCT_ID: string
275
- NAME: string
276
- CURRENCY: string
277
- PRICE: string
278
- QUANTITY: string
279
- POSITION: string
280
- }
281
-
282
- const airbridge: Airbridge;
283
-
284
- export default airbridge;
285
-
286
- export {
287
- AirbridgeCategory,
288
- AirbridgeAttributes,
289
- AirbridgeProduct,
290
- WebInterface,
291
- }
292
- }