@inngageregistry/inngage-react 3.0.2 → 3.0.3

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/Inngage.ts +79 -35
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inngageregistry/inngage-react",
3
- "version": "3.0.2",
3
+ "version": "3.0.3",
4
4
  "description": "Inngage react integration",
5
5
  "main": "src/index.ts",
6
6
  "types": "src/index.d.ts",
package/src/Inngage.ts CHANGED
@@ -133,45 +133,89 @@ const Inngage = {
133
133
  const app_installed_in = formatDate(installTime);
134
134
  const app_updated_in = formatDate(lastUpdateTime);
135
135
  const androidId = DeviceInfo.getAndroidId();
136
- var advertiserId = "Unknown"
137
- var idFa = "Unknown"
138
- try{
139
- const rnAdvertisingId = await RNAdvertisingId.getAdvertisingId();
140
- advertiserId = rnAdvertisingId.advertisingId;
141
- idFa = rnAdvertisingId.advertisingId;
142
- }catch(e){
136
+
137
+ let systemName = DeviceInfo.getSystemName();
138
+
139
+ if(systemName === "Android"){
140
+ var advertiserId = "Unknown"
141
+
142
+ try{
143
+ const rnAdvertisingId = await RNAdvertisingId.getAdvertisingId();
144
+ advertiserId = rnAdvertisingId.advertisingId;
145
+ }catch(e){
146
+
147
+ }
148
+ const rawRequest = {
149
+ registerSubscriberRequest: {
150
+ app_token: appToken,
151
+ identifier: friendlyIdentifier,
152
+ registration: respToken,
153
+ phone_Number: phoneNumber,
154
+ platform: DeviceInfo.getSystemName(),
155
+ sdk: DeviceInfo.getBuildNumber(),
156
+ device_model: DeviceInfo.getModel(),
157
+ device_manufacturer,
158
+ os_locale: RNLocalize.getCountry(),
159
+ os_language,
160
+ os_version: DeviceInfo.getReadableVersion(),
161
+ app_version: DeviceInfo.getBuildNumber(),
162
+ app_installed_in,
163
+ app_updated_in,
164
+ uuid: DeviceInfo.getUniqueId(),
165
+ advertiser_id:advertiserId,
166
+ android_id:androidId,
167
+ authKey,
168
+ }
169
+ };
170
+
171
+ const request = subscriptionRequestAdapter(rawRequest, customData, customFields)
172
+ const subscribe = await subscriptionApi(request, dev);
173
+ console.log(await subscribe.json())
174
+ return subscribe;
175
+
176
+ }else{
177
+ var idFa = "Unknown"
178
+ try{
179
+ const rnAdvertisingId = await RNAdvertisingId.getAdvertisingId();
180
+ idFa = rnAdvertisingId.advertisingId;
181
+ }catch(e){
182
+
183
+ }
143
184
 
185
+ const rawRequest = {
186
+ registerSubscriberRequest: {
187
+ app_token: appToken,
188
+ identifier: friendlyIdentifier,
189
+ registration: respToken,
190
+ phone_Number: phoneNumber,
191
+ platform: DeviceInfo.getSystemName(),
192
+ sdk: DeviceInfo.getBuildNumber(),
193
+ device_model: DeviceInfo.getModel(),
194
+ device_manufacturer,
195
+ os_locale: RNLocalize.getCountry(),
196
+ os_language,
197
+ os_version: DeviceInfo.getReadableVersion(),
198
+ app_version: DeviceInfo.getBuildNumber(),
199
+ app_installed_in,
200
+ app_updated_in,
201
+ uuid: DeviceInfo.getUniqueId(),
202
+ android_id:androidId,
203
+ idfa:idFa,
204
+ authKey,
205
+ }
206
+ };
207
+
208
+ const request = subscriptionRequestAdapter(rawRequest, customData, customFields)
209
+ const subscribe = await subscriptionApi(request, dev);
210
+ console.log(await subscribe.json())
211
+ return subscribe;
144
212
  }
213
+
214
+
215
+
145
216
 
146
217
 
147
- const rawRequest = {
148
- registerSubscriberRequest: {
149
- app_token: appToken,
150
- identifier: friendlyIdentifier,
151
- registration: respToken,
152
- phone_Number: phoneNumber,
153
- platform: DeviceInfo.getSystemName(),
154
- sdk: DeviceInfo.getBuildNumber(),
155
- device_model: DeviceInfo.getModel(),
156
- device_manufacturer,
157
- os_locale: RNLocalize.getCountry(),
158
- os_language,
159
- os_version: DeviceInfo.getReadableVersion(),
160
- app_version: DeviceInfo.getBuildNumber(),
161
- app_installed_in,
162
- app_updated_in,
163
- uuid: DeviceInfo.getUniqueId(),
164
- advertiser_id:advertiserId,
165
- android_id:androidId,
166
- idfa:idFa,
167
- authKey,
168
- }
169
- };
170
-
171
- const request = subscriptionRequestAdapter(rawRequest, customData, customFields)
172
- const subscribe = await subscriptionApi(request, dev);
173
- console.log(await subscribe.json())
174
- return subscribe;
218
+
175
219
  } catch (e) {
176
220
  console.error(e);
177
221
  return { subscribed: false };