@novacraft-engineering/pulsar-code-push 1.5.3 → 1.5.5
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/CodePush.js
CHANGED
|
@@ -4,7 +4,7 @@ import requestFetchAdapter from "./request-fetch-adapter";
|
|
|
4
4
|
import { AppState, Platform } from "react-native";
|
|
5
5
|
import log from "./logging";
|
|
6
6
|
import hoistStatics from 'hoist-non-react-statics';
|
|
7
|
-
import { setTargetingInfo } from "./targeting";
|
|
7
|
+
import { setTargetingInfo, getTargetingInfo } from "./targeting";
|
|
8
8
|
|
|
9
9
|
let NativeCodePush = require("react-native").NativeModules.CodePush;
|
|
10
10
|
const PackageMixins = require("./package-mixins")(NativeCodePush);
|
|
@@ -20,6 +20,11 @@ async function checkForUpdate(deploymentKey = null, handleBinaryVersionMismatchC
|
|
|
20
20
|
* different from the CodePush update they have already installed.
|
|
21
21
|
*/
|
|
22
22
|
const nativeConfig = await getConfiguration();
|
|
23
|
+
// The native module reports the hardware model; use it for Pulsar device-model targeting unless
|
|
24
|
+
// the host app already supplied one explicitly (e.g. via react-native-device-info).
|
|
25
|
+
if (nativeConfig && nativeConfig.deviceModel && !getTargetingInfo().deviceModel) {
|
|
26
|
+
setTargetingInfo({ deviceModel: nativeConfig.deviceModel });
|
|
27
|
+
}
|
|
23
28
|
/*
|
|
24
29
|
* If a deployment key was explicitly provided,
|
|
25
30
|
* then let's override the one we retrieved
|
|
@@ -501,6 +501,7 @@ public class CodePushNativeModule extends BaseJavaModule {
|
|
|
501
501
|
configMap.putString("clientUniqueId", mClientUniqueId);
|
|
502
502
|
configMap.putString("deploymentKey", mCodePush.getDeploymentKey());
|
|
503
503
|
configMap.putString("serverUrl", mCodePush.getServerUrl());
|
|
504
|
+
configMap.putString("deviceModel", android.os.Build.MODEL);
|
|
504
505
|
|
|
505
506
|
// The binary hash may be null in debug builds
|
|
506
507
|
if (mBinaryContentsHash != null) {
|
package/ios/CodePush/CodePush.m
CHANGED
|
@@ -16,6 +16,14 @@
|
|
|
16
16
|
#endif
|
|
17
17
|
|
|
18
18
|
#import "CodePush.h"
|
|
19
|
+
#import <sys/utsname.h>
|
|
20
|
+
|
|
21
|
+
// Hardware model identifier (e.g. "iPhone15,3"), used for Pulsar device-model targeting.
|
|
22
|
+
static NSString *CPDeviceModel(void) {
|
|
23
|
+
struct utsname systemInfo;
|
|
24
|
+
uname(&systemInfo);
|
|
25
|
+
return [NSString stringWithCString:systemInfo.machine encoding:NSUTF8StringEncoding];
|
|
26
|
+
}
|
|
19
27
|
|
|
20
28
|
@interface CodePush () <RCTBridgeModule, RCTFrameUpdateObserver>
|
|
21
29
|
@end
|
|
@@ -562,11 +570,19 @@ static NSString *const LatestRollbackCountKey = @"count";
|
|
|
562
570
|
} else {
|
|
563
571
|
CPLog(@"Attempted to perform a rollback when there is no current update");
|
|
564
572
|
}
|
|
565
|
-
|
|
566
|
-
//
|
|
567
|
-
|
|
573
|
+
// Nothing to roll back to. This happens when a pending update was
|
|
574
|
+
// recorded before a binary update: bundleURL clears the packages
|
|
575
|
+
// because the app version changed, but CODE_PUSH_PENDING_UPDATE lives
|
|
576
|
+
// in NSUserDefaults and survives. Reloading here re-enters this same
|
|
577
|
+
// path on the new bridge, so the app reload-loops on a blank screen
|
|
578
|
+
// until it is killed. Drop the stale flag and keep the loaded bundle.
|
|
579
|
+
[CodePush removePendingUpdate];
|
|
580
|
+
return;
|
|
568
581
|
}
|
|
569
582
|
|
|
583
|
+
// Write the current package's metadata to the "failed list"
|
|
584
|
+
[self saveFailedUpdate:failedPackage];
|
|
585
|
+
|
|
570
586
|
// Rollback to the previous version and de-register the new update
|
|
571
587
|
[CodePushPackage rollbackPackage];
|
|
572
588
|
[CodePush removePendingUpdate];
|
|
@@ -806,7 +822,8 @@ RCT_EXPORT_METHOD(downloadUpdate:(NSDictionary*)updatePackage
|
|
|
806
822
|
RCT_EXPORT_METHOD(getConfiguration:(RCTPromiseResolveBlock)resolve
|
|
807
823
|
rejecter:(RCTPromiseRejectBlock)reject)
|
|
808
824
|
{
|
|
809
|
-
|
|
825
|
+
NSMutableDictionary *configuration = [[[CodePushConfig current] configuration] mutableCopy];
|
|
826
|
+
configuration[@"deviceModel"] = CPDeviceModel();
|
|
810
827
|
NSError *error;
|
|
811
828
|
if (isRunningBinaryVersion) {
|
|
812
829
|
// isRunningBinaryVersion will not get set to "YES" if running against the packager.
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@novacraft-engineering/pulsar-code-push",
|
|
3
|
-
"version": "1.5.
|
|
4
|
-
"description": "Pulsar OTA client for React Native
|
|
3
|
+
"version": "1.5.5",
|
|
4
|
+
"description": "Pulsar OTA client for React Native — over-the-air JavaScript updates. A CodePush-compatible client (RevoPush lineage) pointed at Pulsar.",
|
|
5
5
|
"main": "CodePush.js",
|
|
6
6
|
"typings": "typings/react-native-code-push.d.ts",
|
|
7
7
|
"homepage": "https://pulsar.novacraft.africa",
|
|
@@ -62,4 +62,4 @@
|
|
|
62
62
|
]
|
|
63
63
|
}
|
|
64
64
|
}
|
|
65
|
-
}
|
|
65
|
+
}
|