react-native-update 10.25.3 → 10.25.4
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.
- package/package.json +1 -1
- package/src/client.ts +11 -6
package/package.json
CHANGED
package/src/client.ts
CHANGED
|
@@ -82,13 +82,13 @@ export class Pushy {
|
|
|
82
82
|
};
|
|
83
83
|
})();
|
|
84
84
|
|
|
85
|
-
constructor(options: ClientOptions) {
|
|
85
|
+
constructor(options: ClientOptions, clientType?: 'Pushy' | 'Cresc') {
|
|
86
86
|
if (Platform.OS === 'ios' || Platform.OS === 'android') {
|
|
87
87
|
if (!options.appKey) {
|
|
88
88
|
throw new Error('appKey is required');
|
|
89
89
|
}
|
|
90
90
|
}
|
|
91
|
-
this.clientType =
|
|
91
|
+
this.clientType = clientType || 'Pushy';
|
|
92
92
|
this.options.server = SERVER_PRESETS[this.clientType];
|
|
93
93
|
this.setOptions(options);
|
|
94
94
|
if (isRolledBack) {
|
|
@@ -226,10 +226,11 @@ export class Pushy {
|
|
|
226
226
|
// @ts-ignore
|
|
227
227
|
delete fetchBody.buildTime;
|
|
228
228
|
}
|
|
229
|
+
const stringifyBody = JSON.stringify(fetchBody);
|
|
229
230
|
// harmony fetch body is not string
|
|
230
231
|
let body: any = fetchBody;
|
|
231
232
|
if (Platform.OS === 'ios' || Platform.OS === 'android') {
|
|
232
|
-
body =
|
|
233
|
+
body = stringifyBody;
|
|
233
234
|
}
|
|
234
235
|
const fetchPayload = {
|
|
235
236
|
method: 'POST',
|
|
@@ -243,13 +244,13 @@ export class Pushy {
|
|
|
243
244
|
try {
|
|
244
245
|
this.report({
|
|
245
246
|
type: 'checking',
|
|
246
|
-
message: this.options.appKey + ': ' +
|
|
247
|
+
message: this.options.appKey + ': ' + stringifyBody,
|
|
247
248
|
});
|
|
248
249
|
resp = await fetch(this.getCheckUrl(), fetchPayload);
|
|
249
250
|
} catch (e: any) {
|
|
250
251
|
this.report({
|
|
251
252
|
type: 'errorChecking',
|
|
252
|
-
message:
|
|
253
|
+
message: `Can not connect to update server: ${e.message}. Trying backup endpoints.`,
|
|
253
254
|
});
|
|
254
255
|
const backupEndpoints = await this.getBackupEndpoints();
|
|
255
256
|
if (backupEndpoints) {
|
|
@@ -520,4 +521,8 @@ export class Pushy {
|
|
|
520
521
|
}
|
|
521
522
|
|
|
522
523
|
// for international users
|
|
523
|
-
export class Cresc extends Pushy {
|
|
524
|
+
export class Cresc extends Pushy {
|
|
525
|
+
constructor(options: ClientOptions) {
|
|
526
|
+
super(options, 'Cresc');
|
|
527
|
+
}
|
|
528
|
+
}
|