@novacraft-engineering/pulsar-code-push 1.5.3 → 1.5.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/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
|
|
@@ -806,7 +814,8 @@ RCT_EXPORT_METHOD(downloadUpdate:(NSDictionary*)updatePackage
|
|
|
806
814
|
RCT_EXPORT_METHOD(getConfiguration:(RCTPromiseResolveBlock)resolve
|
|
807
815
|
rejecter:(RCTPromiseRejectBlock)reject)
|
|
808
816
|
{
|
|
809
|
-
|
|
817
|
+
NSMutableDictionary *configuration = [[[CodePushConfig current] configuration] mutableCopy];
|
|
818
|
+
configuration[@"deviceModel"] = CPDeviceModel();
|
|
810
819
|
NSError *error;
|
|
811
820
|
if (isRunningBinaryVersion) {
|
|
812
821
|
// 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.4",
|
|
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
|
+
}
|