@revopush/react-native-code-push 2.5.1 → 2.5.2
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/.claude/settings.local.json +5 -1
- package/README.md +2 -1
- package/android/build.gradle +12 -1
- package/android/codepush.gradle +21 -44
- package/android/gradle.properties +2 -0
- package/android/proguard-rules.pro +18 -2
- package/android/settings.gradle +8 -9
- package/android/src/main/java/com/microsoft/codepush/react/BaseBundleStore.java +78 -0
- package/android/src/main/java/com/microsoft/codepush/react/CodePush.java +15 -4
- package/android/src/main/java/com/microsoft/codepush/react/CodePushConstants.java +2 -0
- package/android/src/main/java/com/microsoft/codepush/react/CodePushNativeModule.java +74 -18
- package/android/src/main/java/com/microsoft/codepush/react/CodePushUpdateManager.java +56 -11
- package/android/src/main/java/com/microsoft/codepush/react/FileUtils.java +7 -5
- package/docs/setup-android.md +27 -1
- package/ios/CodePush/CodePush.h +14 -0
- package/ios/CodePush/CodePush.m +17 -44
- package/ios/CodePush/CodePushBaseBundleStore.m +104 -0
- package/ios/CodePush/CodePushPackage.m +82 -9
- package/ios/CodePush.xcodeproj/project.pbxproj +6 -0
- package/ios/Frameworks/DiffUpdates.xcframework/ios-arm64/DiffUpdates.framework/DiffUpdates +0 -0
- package/ios/Frameworks/DiffUpdates.xcframework/ios-arm64/DiffUpdates.framework/Headers/DiffUpdates.h +18 -0
- package/ios/Frameworks/DiffUpdates.xcframework/ios-arm64/DiffUpdates.framework/Headers/hpatch_objc.h +23 -0
- package/ios/Frameworks/DiffUpdates.xcframework/ios-arm64/DiffUpdates.framework/Info.plist +0 -0
- package/ios/Frameworks/DiffUpdates.xcframework/ios-arm64_x86_64-simulator/DiffUpdates.framework/DiffUpdates +0 -0
- package/ios/Frameworks/DiffUpdates.xcframework/ios-arm64_x86_64-simulator/DiffUpdates.framework/Headers/DiffUpdates.h +18 -0
- package/ios/Frameworks/DiffUpdates.xcframework/ios-arm64_x86_64-simulator/DiffUpdates.framework/Headers/hpatch_objc.h +23 -0
- package/ios/Frameworks/DiffUpdates.xcframework/ios-arm64_x86_64-simulator/DiffUpdates.framework/Info.plist +0 -0
- package/ios/Frameworks/DiffUpdates.xcframework/ios-arm64_x86_64-simulator/DiffUpdates.framework/_CodeSignature/CodeDirectory +0 -0
- package/ios/Frameworks/DiffUpdates.xcframework/ios-arm64_x86_64-simulator/DiffUpdates.framework/_CodeSignature/CodeResources +12 -9
- package/package.json +10 -14
- package/tsconfig.json +1 -4
- package/typings/react-native-code-push.d.ts +18 -0
- package/ios/Frameworks/DiffUpdates.xcframework/ios-arm64_x86_64-simulator/DiffUpdates.framework/_CodeSignature/CodeRequirements-1 +0 -0
- package/scripts/postlink/android/postlink.js +0 -87
- package/scripts/postlink/ios/postlink.js +0 -116
- package/scripts/postlink/run.js +0 -11
- package/scripts/postunlink/android/postunlink.js +0 -74
- package/scripts/postunlink/ios/postunlink.js +0 -87
- package/scripts/postunlink/run.js +0 -11
- package/scripts/tools/linkToolsAndroid.js +0 -57
- package/scripts/tools/linkToolsIos.js +0 -130
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
var fs = require("fs");
|
|
2
|
-
var glob = require("glob");
|
|
3
|
-
var path = require("path");
|
|
4
|
-
|
|
5
|
-
var ignoreFolders = { ignore: ["node_modules/**", "**/build/**"] };
|
|
6
|
-
var manifestPath = glob.sync("**/AndroidManifest.xml", ignoreFolders)[0];
|
|
7
|
-
|
|
8
|
-
exports.getJSBundleFileOverride = `
|
|
9
|
-
@Override
|
|
10
|
-
protected String getJSBundleFile(){
|
|
11
|
-
return CodePush.getJSBundleFile();
|
|
12
|
-
}
|
|
13
|
-
`;
|
|
14
|
-
exports.reactNativeHostInstantiation = "new ReactNativeHost(this) {";
|
|
15
|
-
exports.mainActivityClassDeclaration = "public class MainActivity extends ReactActivity {";
|
|
16
|
-
exports.codePushGradleLink = `\napply from: "../../node_modules/@revopush/react-native-code-push/android/codepush.gradle"`;
|
|
17
|
-
exports.deploymentKeyName = "CodePushDeploymentKey";
|
|
18
|
-
|
|
19
|
-
exports.getMainApplicationLocation = function () {
|
|
20
|
-
return findMainApplication() || glob.sync("**/MainApplication.java", ignoreFolders)[0];
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
exports.getMainActivityPath = function () {
|
|
24
|
-
return glob.sync("**/MainActivity.java", ignoreFolders)[0]
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
exports.getStringsResourcesPath = function () {
|
|
28
|
-
return glob.sync("**/strings.xml", ignoreFolders)[0];
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
exports.getBuildGradlePath = function () {
|
|
32
|
-
return path.join("android", "build.gradle");
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
exports.isJsBundleOverridden = function (codeContents) {
|
|
36
|
-
return /@Override\s*\n\s*protected String getJSBundleFile\(\)\s*\{[\s\S]*?\}/.test(codeContents);
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
function findMainApplication() {
|
|
40
|
-
if (!manifestPath) {
|
|
41
|
-
return null;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
var manifest = fs.readFileSync(manifestPath, "utf8");
|
|
45
|
-
|
|
46
|
-
// Android manifest must include single 'application' element
|
|
47
|
-
var matchResult = manifest.match(/application\s+android:name\s*=\s*"(.*?)"/);
|
|
48
|
-
if (matchResult) {
|
|
49
|
-
var appName = matchResult[1];
|
|
50
|
-
} else {
|
|
51
|
-
return null;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
var nameParts = appName.split('.');
|
|
55
|
-
var searchPath = glob.sync("**/" + nameParts[nameParts.length - 1] + ".java", ignoreFolders)[0];
|
|
56
|
-
return searchPath;
|
|
57
|
-
}
|
|
@@ -1,130 +0,0 @@
|
|
|
1
|
-
var glob = require("glob");
|
|
2
|
-
var path = require("path");
|
|
3
|
-
var xcode = require("xcode");
|
|
4
|
-
var packageFile = require('../../../../package.json');
|
|
5
|
-
|
|
6
|
-
var ignoreNodeModules = { ignore: "node_modules/**" };
|
|
7
|
-
var ignoreNodeModulesAndPods = { ignore: ["node_modules/**", "ios/Pods/**"] };
|
|
8
|
-
var appDelegatePaths = glob.sync("**/AppDelegate.+(mm|m)", ignoreNodeModules);
|
|
9
|
-
|
|
10
|
-
exports.codePushHeaderImportStatement = `#import <CodePush/CodePush.h>`;
|
|
11
|
-
exports.codePushHeaderImportStatementFormatted = `\n${this.codePushHeaderImportStatement}`;
|
|
12
|
-
exports.codePushBundleUrl = "[CodePush bundleURL]";
|
|
13
|
-
exports.oldBundleUrl = "[[NSBundle mainBundle] URLForResource:@\"main\" withExtension:@\"jsbundle\"]";
|
|
14
|
-
exports.linkedJsCodeLocationAssignmentStatement = "jsCodeLocation = [CodePush bundleURL];";
|
|
15
|
-
|
|
16
|
-
exports.getJsCodeLocationPatch = function(defaultJsCodeLocationAssignmentStatement) {
|
|
17
|
-
return `
|
|
18
|
-
#ifdef DEBUG
|
|
19
|
-
${defaultJsCodeLocationAssignmentStatement}
|
|
20
|
-
#else
|
|
21
|
-
${this.linkedJsCodeLocationAssignmentStatement}
|
|
22
|
-
#endif`;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
// Fix for https://github.com/microsoft/react-native-code-push/issues/477
|
|
26
|
-
// Typical location of AppDelegate.m for newer RN versions: $PROJECT_ROOT/ios/<project_name>/AppDelegate.m
|
|
27
|
-
// Let's try to find that path by filtering the whole array for any path containing <project_name>
|
|
28
|
-
// If we can't find it there, play dumb and pray it is the first path we find.
|
|
29
|
-
exports.getAppDeletePath = function() {
|
|
30
|
-
return findFileByAppName(appDelegatePaths, packageFile ? packageFile.name : null) || appDelegatePaths[0];
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
exports.getPlistPath = function() {
|
|
34
|
-
var xcodeProjectPaths = glob.sync(`**/*.xcodeproj/project.pbxproj`, ignoreNodeModulesAndPods);
|
|
35
|
-
if (!xcodeProjectPaths){
|
|
36
|
-
return getDefaultPlistPath();
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
if (xcodeProjectPaths.length !== 1) {
|
|
40
|
-
console.log('Could not determine correct xcode proj path to retrieve related plist file, there are multiple xcodeproj under the solution.');
|
|
41
|
-
return getDefaultPlistPath();
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
var xcodeProjectPath = xcodeProjectPaths[0];
|
|
45
|
-
var parsedXCodeProj;
|
|
46
|
-
|
|
47
|
-
try {
|
|
48
|
-
var proj = xcode.project(xcodeProjectPath);
|
|
49
|
-
//use sync version because there are some problems with async version of xcode lib as of current version
|
|
50
|
-
parsedXCodeProj = proj.parseSync();
|
|
51
|
-
}
|
|
52
|
-
catch(e) {
|
|
53
|
-
console.log('Couldn\'t read info.plist path from xcode project - error: ' + e.message);
|
|
54
|
-
return getDefaultPlistPath();
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
var INFO_PLIST_PROJECT_KEY = 'INFOPLIST_FILE';
|
|
58
|
-
var RELEASE_BUILD_PROPERTY_NAME = "Release";
|
|
59
|
-
var targetProductName = packageFile ? packageFile.name : null;
|
|
60
|
-
|
|
61
|
-
//Try to get 'Release' build of ProductName matching the package name first and if it doesn't exist then try to get any other if existing
|
|
62
|
-
var plistPathValue = getBuildSettingsPropertyMatchingTargetProductName(parsedXCodeProj, INFO_PLIST_PROJECT_KEY, targetProductName, RELEASE_BUILD_PROPERTY_NAME) ||
|
|
63
|
-
getBuildSettingsPropertyMatchingTargetProductName(parsedXCodeProj, INFO_PLIST_PROJECT_KEY, targetProductName) ||
|
|
64
|
-
getBuildSettingsPropertyMatchingTargetProductName(parsedXCodeProj, INFO_PLIST_PROJECT_KEY, null, RELEASE_BUILD_PROPERTY_NAME) ||
|
|
65
|
-
getBuildSettingsPropertyMatchingTargetProductName(parsedXCodeProj, INFO_PLIST_PROJECT_KEY) ||
|
|
66
|
-
parsedXCodeProj.getBuildProperty(INFO_PLIST_PROJECT_KEY, RELEASE_BUILD_PROPERTY_NAME) ||
|
|
67
|
-
parsedXCodeProj.getBuildProperty(INFO_PLIST_PROJECT_KEY);
|
|
68
|
-
|
|
69
|
-
if (!plistPathValue){
|
|
70
|
-
return getDefaultPlistPath();
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
//also remove surrounding quotes from plistPathValue to get correct path resolved
|
|
74
|
-
//(see https://github.com/microsoft/react-native-code-push/issues/534#issuecomment-302069326 for details)
|
|
75
|
-
return path.resolve(path.dirname(xcodeProjectPath), '..', plistPathValue.replace(/^"(.*)"$/, '$1'));
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
// Helper that filters an array with AppDelegate.m paths for a path with the app name inside it
|
|
79
|
-
// Should cover nearly all cases
|
|
80
|
-
function findFileByAppName(array, appName) {
|
|
81
|
-
if (array.length === 0 || !appName) return null;
|
|
82
|
-
|
|
83
|
-
for (var i = 0; i < array.length; i++) {
|
|
84
|
-
var path = array[i];
|
|
85
|
-
if (path && path.indexOf(appName) !== -1) {
|
|
86
|
-
return path;
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
return null;
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
function getDefaultPlistPath() {
|
|
94
|
-
//this is old logic in case we are unable to find PLIST from xcode/pbxproj - at least we can fallback to default solution
|
|
95
|
-
return glob.sync(`**/${packageFile.name}/*Info.plist`, ignoreNodeModules)[0];
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
// This is enhanced version of standard implementation of xcode 'getBuildProperty' function
|
|
99
|
-
// but allows us to narrow results by PRODUCT_NAME property also.
|
|
100
|
-
// So we suppose that proj name should be the same as package name, otherwise fallback to default plist path searching logic
|
|
101
|
-
function getBuildSettingsPropertyMatchingTargetProductName(parsedXCodeProj, prop, targetProductName, build) {
|
|
102
|
-
var target;
|
|
103
|
-
var COMMENT_KEY = /_comment$/;
|
|
104
|
-
var PRODUCT_NAME_PROJECT_KEY = 'PRODUCT_NAME';
|
|
105
|
-
var TV_OS_DEPLOYMENT_TARGET_PROPERTY_NAME = 'TVOS_DEPLOYMENT_TARGET';
|
|
106
|
-
var TEST_HOST_PROPERTY_NAME = 'TEST_HOST';
|
|
107
|
-
|
|
108
|
-
var configs = parsedXCodeProj.pbxXCBuildConfigurationSection();
|
|
109
|
-
for (var configName in configs) {
|
|
110
|
-
if (!COMMENT_KEY.test(configName)) {
|
|
111
|
-
var config = configs[configName];
|
|
112
|
-
if ( (build && config.name === build) || (build === undefined) ) {
|
|
113
|
-
if (targetProductName) {
|
|
114
|
-
if (config.buildSettings[prop] !== undefined && config.buildSettings[PRODUCT_NAME_PROJECT_KEY] == targetProductName) {
|
|
115
|
-
target = config.buildSettings[prop];
|
|
116
|
-
}
|
|
117
|
-
} else {
|
|
118
|
-
if (config.buildSettings[prop] !== undefined &&
|
|
119
|
-
//exclude tvOS projects
|
|
120
|
-
config.buildSettings[TV_OS_DEPLOYMENT_TARGET_PROPERTY_NAME] == undefined &&
|
|
121
|
-
//exclude test app
|
|
122
|
-
config.buildSettings[TEST_HOST_PROPERTY_NAME] == undefined) {
|
|
123
|
-
target = config.buildSettings[prop];
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
return target;
|
|
130
|
-
}
|