1
0
mirror of https://gitcode.com/gh_mirrors/re/react-native-pushy.git synced 2025-09-17 23:56:11 +08:00
Code Issues Packages Projects Releases Wiki Activity GitHub Gitee

Compare commits

..

58 Commits

Author SHA1 Message Date
sunnylqm
7780f9985e v10.7.2 2024-07-18 10:23:56 +08:00
sunnylqm
de69746937 fix typo 2024-07-18 10:22:52 +08:00
Sunny Luo
7cce998277 Update domains.json 2024-07-14 22:49:19 +08:00
Sunny Luo
9faeaf881f Update endpoints.json 2024-07-14 22:49:03 +08:00
Sunny Luo
e0f526aac8 Update domains.json 2024-07-09 17:57:13 +08:00
Sunny Luo
da2046b213 Update endpoints.json 2024-07-09 17:55:48 +08:00
sunnylqm
78186ddf1e fix example 2024-07-08 23:39:26 +08:00
sunnylqm
d9f1c2edb2 v10.7.1 2024-06-25 12:34:49 +08:00
sunnylqm
4fb0c691e6 v10.7.0 2024-06-25 12:26:18 +08:00
sunnylqm
b62e6d64cf v10.6.0 2024-06-11 12:25:45 +08:00
sunnylqm
9af0538a2a update example 2024-06-11 10:59:27 +08:00
sunnylqm
e63fa0fdb6 v10.6.0-beta.0 2024-06-11 10:44:18 +08:00
sunnylqm
6244bb9af2 v10.5.4 2024-04-23 09:31:16 +08:00
sunnylqm
9fd6293037 emptymodule 2024-04-23 00:24:32 +08:00
sunnylqm
e9e67b011c v10.5.3 2024-04-23 00:15:38 +08:00
sunnylqm
5996a7aa75 v10.5.2 2024-04-23 00:09:07 +08:00
sunnylqm
ad9b0778ba v10.5.1 2024-04-22 23:15:34 +08:00
sunnylqm
3e60cfd80f v10.5.0 2024-04-22 23:11:07 +08:00
sunnylqm
782b0e5227 v10.4.2 2024-04-22 09:57:53 +08:00
sunnylqm
d1ecfb3f93 v10.4.1 2024-04-18 22:50:20 +08:00
sunnylqm
571c2819b9 v10.4.0 2024-04-18 22:41:00 +08:00
sunnylqm
1f75688b92 Refactor assertRelease function 2024-04-18 22:39:03 +08:00
sunnylqm
de332c1796 Update PushyOptions strategy to allow null value 2024-04-02 21:21:15 +08:00
sunnylqm
80e0451983 v10.3.1 2024-03-21 22:11:38 +08:00
sunnylqm
b512ae18b7 do not show alert if no downloadurl 2024-03-21 22:11:09 +08:00
sunnylqm
fe75a2ca9e Remove blockUpdate method from UpdateContext and UpdateModule 2024-03-21 13:03:32 +08:00
sunnylqm
d84ad103fb v10.3.0 2024-03-20 21:50:18 +08:00
sunnylqm
208034fa7d fix module name 2024-03-20 21:49:44 +08:00
sunnylqm
c6430a9ed4 v10.2.9 2024-03-20 21:48:31 +08:00
sunnylqm
f2aec36705 remove blockupdate 2024-03-20 21:47:44 +08:00
sunnylqm
71e5b947d3 v10.2.8 2024-03-20 21:43:13 +08:00
sunnylqm
5dc8d8defc fix module name 2024-03-20 21:42:44 +08:00
sunnylqm
30687dddf2 v10.2.7 2024-03-20 21:38:51 +08:00
sunnylqm
57ddcc7758 fix codegenconfig 2024-03-20 21:37:59 +08:00
sunnylqm
a93bbe553d v10.3.0-beta.0 2024-03-20 20:54:48 +08:00
sunnylqm
356050d839 Add NativePushy module to the project 2024-03-20 20:42:31 +08:00
sunnylqm
5df3cb65b3 Merge branch 'master' of github.com:reactnativecn/react-native-pushy 2024-03-20 10:16:11 +08:00
sunnylqm
699eb0ea05 Update jsSrcsDir in package.json 2024-03-20 10:15:49 +08:00
Sunny Luo
36c4ff085c Create tea.yaml 2024-03-10 20:39:13 +08:00
sunnylqm
8c13dd69b1 v10.2.6 2024-03-08 16:05:08 +08:00
sunnylqm
2df04cb377 fix a wrong dep 2024-03-08 16:04:16 +08:00
sunnylqm
e39d4fa370 v10.2.5 2024-03-08 11:27:31 +08:00
sunnylqm
94cf96a0e5 chore: lint 2024-03-07 22:11:44 +08:00
sunnylqm
22c4b01ead v10.2.4 2024-03-07 18:10:16 +08:00
sunnylqm
f655a1d954 fix: avoid double check when init 2024-03-07 18:09:55 +08:00
sunnylqm
2bdc64ba1b v10.2.3 2024-03-07 17:58:30 +08:00
sunnylqm
f5242017b9 fix: ignore checkupdate in dev env 2024-03-07 17:58:03 +08:00
sunnylqm
42e2051290 fix: add timeout 2024-03-04 12:30:00 +08:00
sunnylqm
a66f354c3b v10.2.1 2024-03-03 08:50:19 +08:00
sunnylqm
592e13b77b return null if error 2024-03-03 08:49:46 +08:00
sunnylqm
2845a4302a v10.2.0 2024-03-02 12:25:11 +08:00
sunnylqm
84ef668102 feat: test urls 2024-03-02 12:24:41 +08:00
sunnylqm
c63e1501fe v10.1.3 2024-02-25 22:24:35 +08:00
sunnylqm
45bfa2560e feat: add getCurrentVersionInfo 2024-02-25 22:23:46 +08:00
sunnylqm
ab9c40bf2e v10.1.2 2024-02-25 00:05:14 +08:00
sunnylqm
d184beabaf fix: type 2024-02-25 00:04:55 +08:00
sunnylqm
68a6235145 v10.1.1 2024-02-25 00:03:58 +08:00
sunnylqm
a98a48d665 fix: type 2024-02-25 00:03:35 +08:00
40 changed files with 976 additions and 1085 deletions

View File

@@ -1,4 +0,0 @@
{
"root": true,
"extends": "@react-native"
}

4
.eslintrc.js Normal file
View File

@@ -0,0 +1,4 @@
module.exports = {
root: true,
extends: '@react-native',
};

View File

@@ -41,14 +41,17 @@ export const testFunctionDefaultRegion = functions.https.onCall(data => {
const { type, asError, inputData } = data; const { type, asError, inputData } = data;
if (!Object.hasOwnProperty.call(SAMPLE_DATA, type)) { if (!Object.hasOwnProperty.call(SAMPLE_DATA, type)) {
throw new functions.https.HttpsError('invalid-argument', 'Invalid test requested.'); throw new functions.https.HttpsError(
'invalid-argument',
'Invalid test requested.',
);
} }
const outputData = SAMPLE_DATA[type]; const outputData = SAMPLE_DATA[type];
try { try {
assert.deepEqual(outputData, inputData); assert.deepEqual(outputData, inputData);
} catch (e) { } catch (e: any) {
console.error(e); console.error(e);
throw new functions.https.HttpsError( throw new functions.https.HttpsError(
'invalid-argument', 'invalid-argument',

View File

@@ -48,3 +48,5 @@ yarn.lock
domains.json domains.json
endpoints.json endpoints.json
tea.yaml

View File

@@ -1,4 +1,6 @@
module.exports = { module.exports = {
trailingComma: 'all', arrowParens: 'avoid',
bracketSameLine: true,
singleQuote: true, singleQuote: true,
trailingComma: 'all',
}; };

View File

@@ -29,13 +29,6 @@ describe('测试Native模块的方法', () => {
await expect(element(by.id('done'))).toBeNotVisible(); await expect(element(by.id('done'))).toBeNotVisible();
}); });
it('setBlockUpdate', async () => {
await element(by.id('setBlockUpdate')).longPress();
await element(by.id('submit')).longPress();
await expect(element(by.text('done'))).toBeVisible();
await element(by.id('done')).longPress();
await expect(element(by.id('done'))).toBeNotVisible();
});
if (device.getPlatform() === 'android') { if (device.getPlatform() === 'android') {
it('reloadUpdate', async () => { it('reloadUpdate', async () => {
await element(by.id('reloadUpdate')).longPress(); await element(by.id('reloadUpdate')).longPress();

View File

@@ -7,29 +7,14 @@
objects = { objects = {
/* Begin PBXBuildFile section */ /* Begin PBXBuildFile section */
00E356F31AD99517003FC87E /* AwesomeProjectTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 00E356F21AD99517003FC87E /* AwesomeProjectTests.m */; };
0C80B921A6F3F58F76C31292 /* libPods-AwesomeProject.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 5DCACB8F33CDC322A6C60F78 /* libPods-AwesomeProject.a */; }; 0C80B921A6F3F58F76C31292 /* libPods-AwesomeProject.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 5DCACB8F33CDC322A6C60F78 /* libPods-AwesomeProject.a */; };
13B07FBC1A68108700A75B9A /* AppDelegate.mm in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB01A68108700A75B9A /* AppDelegate.mm */; }; 13B07FBC1A68108700A75B9A /* AppDelegate.mm in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB01A68108700A75B9A /* AppDelegate.mm */; };
13B07FBF1A68108700A75B9A /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 13B07FB51A68108700A75B9A /* Images.xcassets */; }; 13B07FBF1A68108700A75B9A /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 13B07FB51A68108700A75B9A /* Images.xcassets */; };
13B07FC11A68108700A75B9A /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB71A68108700A75B9A /* main.m */; }; 13B07FC11A68108700A75B9A /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB71A68108700A75B9A /* main.m */; };
7699B88040F8A987B510C191 /* libPods-AwesomeProject-AwesomeProjectTests.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 19F6CBCC0A4E27FBF8BF4A61 /* libPods-AwesomeProject-AwesomeProjectTests.a */; };
81AB9BB82411601600AC10FF /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 81AB9BB72411601600AC10FF /* LaunchScreen.storyboard */; }; 81AB9BB82411601600AC10FF /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 81AB9BB72411601600AC10FF /* LaunchScreen.storyboard */; };
/* End PBXBuildFile section */ /* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
00E356F41AD99517003FC87E /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 83CBB9F71A601CBA00E9B192 /* Project object */;
proxyType = 1;
remoteGlobalIDString = 13B07F861A680F5B00A75B9A;
remoteInfo = AwesomeProject;
};
/* End PBXContainerItemProxy section */
/* Begin PBXFileReference section */ /* Begin PBXFileReference section */
00E356EE1AD99517003FC87E /* AwesomeProjectTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = AwesomeProjectTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
00E356F11AD99517003FC87E /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
00E356F21AD99517003FC87E /* AwesomeProjectTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AwesomeProjectTests.m; sourceTree = "<group>"; };
13B07F961A680F5B00A75B9A /* AwesomeProject.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = AwesomeProject.app; sourceTree = BUILT_PRODUCTS_DIR; }; 13B07F961A680F5B00A75B9A /* AwesomeProject.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = AwesomeProject.app; sourceTree = BUILT_PRODUCTS_DIR; };
13B07FAF1A68108700A75B9A /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AppDelegate.h; path = AwesomeProject/AppDelegate.h; sourceTree = "<group>"; }; 13B07FAF1A68108700A75B9A /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AppDelegate.h; path = AwesomeProject/AppDelegate.h; sourceTree = "<group>"; };
13B07FB01A68108700A75B9A /* AppDelegate.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = AppDelegate.mm; path = AwesomeProject/AppDelegate.mm; sourceTree = "<group>"; }; 13B07FB01A68108700A75B9A /* AppDelegate.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = AppDelegate.mm; path = AwesomeProject/AppDelegate.mm; sourceTree = "<group>"; };
@@ -47,14 +32,6 @@
/* End PBXFileReference section */ /* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */ /* Begin PBXFrameworksBuildPhase section */
00E356EB1AD99517003FC87E /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
7699B88040F8A987B510C191 /* libPods-AwesomeProject-AwesomeProjectTests.a in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
13B07F8C1A680F5B00A75B9A /* Frameworks */ = { 13B07F8C1A680F5B00A75B9A /* Frameworks */ = {
isa = PBXFrameworksBuildPhase; isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647; buildActionMask = 2147483647;
@@ -66,23 +43,6 @@
/* End PBXFrameworksBuildPhase section */ /* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */ /* Begin PBXGroup section */
00E356EF1AD99517003FC87E /* AwesomeProjectTests */ = {
isa = PBXGroup;
children = (
00E356F21AD99517003FC87E /* AwesomeProjectTests.m */,
00E356F01AD99517003FC87E /* Supporting Files */,
);
path = AwesomeProjectTests;
sourceTree = "<group>";
};
00E356F01AD99517003FC87E /* Supporting Files */ = {
isa = PBXGroup;
children = (
00E356F11AD99517003FC87E /* Info.plist */,
);
name = "Supporting Files";
sourceTree = "<group>";
};
13B07FAE1A68108700A75B9A /* AwesomeProject */ = { 13B07FAE1A68108700A75B9A /* AwesomeProject */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
@@ -118,7 +78,6 @@
children = ( children = (
13B07FAE1A68108700A75B9A /* AwesomeProject */, 13B07FAE1A68108700A75B9A /* AwesomeProject */,
832341AE1AAA6A7D00B99B32 /* Libraries */, 832341AE1AAA6A7D00B99B32 /* Libraries */,
00E356EF1AD99517003FC87E /* AwesomeProjectTests */,
83CBBA001A601CBA00E9B192 /* Products */, 83CBBA001A601CBA00E9B192 /* Products */,
2D16E6871FA4F8E400B85C8A /* Frameworks */, 2D16E6871FA4F8E400B85C8A /* Frameworks */,
BBD78D7AC51CEA395F1C20DB /* Pods */, BBD78D7AC51CEA395F1C20DB /* Pods */,
@@ -132,7 +91,6 @@
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
13B07F961A680F5B00A75B9A /* AwesomeProject.app */, 13B07F961A680F5B00A75B9A /* AwesomeProject.app */,
00E356EE1AD99517003FC87E /* AwesomeProjectTests.xctest */,
); );
name = Products; name = Products;
sourceTree = "<group>"; sourceTree = "<group>";
@@ -151,27 +109,6 @@
/* End PBXGroup section */ /* End PBXGroup section */
/* Begin PBXNativeTarget section */ /* Begin PBXNativeTarget section */
00E356ED1AD99517003FC87E /* AwesomeProjectTests */ = {
isa = PBXNativeTarget;
buildConfigurationList = 00E357021AD99517003FC87E /* Build configuration list for PBXNativeTarget "AwesomeProjectTests" */;
buildPhases = (
A55EABD7B0C7F3A422A6CC61 /* [CP] Check Pods Manifest.lock */,
00E356EA1AD99517003FC87E /* Sources */,
00E356EB1AD99517003FC87E /* Frameworks */,
00E356EC1AD99517003FC87E /* Resources */,
C59DA0FBD6956966B86A3779 /* [CP] Embed Pods Frameworks */,
F6A41C54EA430FDDC6A6ED99 /* [CP] Copy Pods Resources */,
);
buildRules = (
);
dependencies = (
00E356F51AD99517003FC87E /* PBXTargetDependency */,
);
name = AwesomeProjectTests;
productName = AwesomeProjectTests;
productReference = 00E356EE1AD99517003FC87E /* AwesomeProjectTests.xctest */;
productType = "com.apple.product-type.bundle.unit-test";
};
13B07F861A680F5B00A75B9A /* AwesomeProject */ = { 13B07F861A680F5B00A75B9A /* AwesomeProject */ = {
isa = PBXNativeTarget; isa = PBXNativeTarget;
buildConfigurationList = 13B07F931A680F5B00A75B9A /* Build configuration list for PBXNativeTarget "AwesomeProject" */; buildConfigurationList = 13B07F931A680F5B00A75B9A /* Build configuration list for PBXNativeTarget "AwesomeProject" */;
@@ -182,7 +119,6 @@
13B07F8C1A680F5B00A75B9A /* Frameworks */, 13B07F8C1A680F5B00A75B9A /* Frameworks */,
13B07F8E1A680F5B00A75B9A /* Resources */, 13B07F8E1A680F5B00A75B9A /* Resources */,
00DD1BFF1BD5951E006B06BC /* Bundle React Native code and images */, 00DD1BFF1BD5951E006B06BC /* Bundle React Native code and images */,
00EEFC60759A1932668264C0 /* [CP] Embed Pods Frameworks */,
E235C05ADACE081382539298 /* [CP] Copy Pods Resources */, E235C05ADACE081382539298 /* [CP] Copy Pods Resources */,
); );
buildRules = ( buildRules = (
@@ -202,10 +138,6 @@
attributes = { attributes = {
LastUpgradeCheck = 1210; LastUpgradeCheck = 1210;
TargetAttributes = { TargetAttributes = {
00E356ED1AD99517003FC87E = {
CreatedOnToolsVersion = 6.2;
TestTargetID = 13B07F861A680F5B00A75B9A;
};
13B07F861A680F5B00A75B9A = { 13B07F861A680F5B00A75B9A = {
LastSwiftMigration = 1120; LastSwiftMigration = 1120;
}; };
@@ -225,19 +157,11 @@
projectRoot = ""; projectRoot = "";
targets = ( targets = (
13B07F861A680F5B00A75B9A /* AwesomeProject */, 13B07F861A680F5B00A75B9A /* AwesomeProject */,
00E356ED1AD99517003FC87E /* AwesomeProjectTests */,
); );
}; };
/* End PBXProject section */ /* End PBXProject section */
/* Begin PBXResourcesBuildPhase section */ /* Begin PBXResourcesBuildPhase section */
00E356EC1AD99517003FC87E /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
13B07F8E1A680F5B00A75B9A /* Resources */ = { 13B07F8E1A680F5B00A75B9A /* Resources */ = {
isa = PBXResourcesBuildPhase; isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647; buildActionMask = 2147483647;
@@ -266,45 +190,6 @@
shellPath = /bin/sh; shellPath = /bin/sh;
shellScript = "set -e\n\nWITH_ENVIRONMENT=\"../node_modules/react-native/scripts/xcode/with-environment.sh\"\nREACT_NATIVE_XCODE=\"../node_modules/react-native/scripts/react-native-xcode.sh\"\n\n/bin/sh -c \"$WITH_ENVIRONMENT $REACT_NATIVE_XCODE\"\n"; shellScript = "set -e\n\nWITH_ENVIRONMENT=\"../node_modules/react-native/scripts/xcode/with-environment.sh\"\nREACT_NATIVE_XCODE=\"../node_modules/react-native/scripts/react-native-xcode.sh\"\n\n/bin/sh -c \"$WITH_ENVIRONMENT $REACT_NATIVE_XCODE\"\n";
}; };
00EEFC60759A1932668264C0 /* [CP] Embed Pods Frameworks */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-AwesomeProject/Pods-AwesomeProject-frameworks-${CONFIGURATION}-input-files.xcfilelist",
);
name = "[CP] Embed Pods Frameworks";
outputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-AwesomeProject/Pods-AwesomeProject-frameworks-${CONFIGURATION}-output-files.xcfilelist",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-AwesomeProject/Pods-AwesomeProject-frameworks.sh\"\n";
showEnvVarsInLog = 0;
};
A55EABD7B0C7F3A422A6CC61 /* [CP] Check Pods Manifest.lock */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
);
inputPaths = (
"${PODS_PODFILE_DIR_PATH}/Podfile.lock",
"${PODS_ROOT}/Manifest.lock",
);
name = "[CP] Check Pods Manifest.lock";
outputFileListPaths = (
);
outputPaths = (
"$(DERIVED_FILE_DIR)/Pods-AwesomeProject-AwesomeProjectTests-checkManifestLockResult.txt",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
showEnvVarsInLog = 0;
};
C38B50BA6285516D6DCD4F65 /* [CP] Check Pods Manifest.lock */ = { C38B50BA6285516D6DCD4F65 /* [CP] Check Pods Manifest.lock */ = {
isa = PBXShellScriptBuildPhase; isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647; buildActionMask = 2147483647;
@@ -327,23 +212,6 @@
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
showEnvVarsInLog = 0; showEnvVarsInLog = 0;
}; };
C59DA0FBD6956966B86A3779 /* [CP] Embed Pods Frameworks */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-AwesomeProject-AwesomeProjectTests/Pods-AwesomeProject-AwesomeProjectTests-frameworks-${CONFIGURATION}-input-files.xcfilelist",
);
name = "[CP] Embed Pods Frameworks";
outputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-AwesomeProject-AwesomeProjectTests/Pods-AwesomeProject-AwesomeProjectTests-frameworks-${CONFIGURATION}-output-files.xcfilelist",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-AwesomeProject-AwesomeProjectTests/Pods-AwesomeProject-AwesomeProjectTests-frameworks.sh\"\n";
showEnvVarsInLog = 0;
};
E235C05ADACE081382539298 /* [CP] Copy Pods Resources */ = { E235C05ADACE081382539298 /* [CP] Copy Pods Resources */ = {
isa = PBXShellScriptBuildPhase; isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647; buildActionMask = 2147483647;
@@ -361,23 +229,6 @@
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-AwesomeProject/Pods-AwesomeProject-resources.sh\"\n"; shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-AwesomeProject/Pods-AwesomeProject-resources.sh\"\n";
showEnvVarsInLog = 0; showEnvVarsInLog = 0;
}; };
F6A41C54EA430FDDC6A6ED99 /* [CP] Copy Pods Resources */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-AwesomeProject-AwesomeProjectTests/Pods-AwesomeProject-AwesomeProjectTests-resources-${CONFIGURATION}-input-files.xcfilelist",
);
name = "[CP] Copy Pods Resources";
outputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-AwesomeProject-AwesomeProjectTests/Pods-AwesomeProject-AwesomeProjectTests-resources-${CONFIGURATION}-output-files.xcfilelist",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-AwesomeProject-AwesomeProjectTests/Pods-AwesomeProject-AwesomeProjectTests-resources.sh\"\n";
showEnvVarsInLog = 0;
};
FD10A7F022414F080027D42C /* Start Packager */ = { FD10A7F022414F080027D42C /* Start Packager */ = {
isa = PBXShellScriptBuildPhase; isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647; buildActionMask = 2147483647;
@@ -400,14 +251,6 @@
/* End PBXShellScriptBuildPhase section */ /* End PBXShellScriptBuildPhase section */
/* Begin PBXSourcesBuildPhase section */ /* Begin PBXSourcesBuildPhase section */
00E356EA1AD99517003FC87E /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
00E356F31AD99517003FC87E /* AwesomeProjectTests.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
13B07F871A680F5B00A75B9A /* Sources */ = { 13B07F871A680F5B00A75B9A /* Sources */ = {
isa = PBXSourcesBuildPhase; isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647; buildActionMask = 2147483647;
@@ -419,66 +262,7 @@
}; };
/* End PBXSourcesBuildPhase section */ /* End PBXSourcesBuildPhase section */
/* Begin PBXTargetDependency section */
00E356F51AD99517003FC87E /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = 13B07F861A680F5B00A75B9A /* AwesomeProject */;
targetProxy = 00E356F41AD99517003FC87E /* PBXContainerItemProxy */;
};
/* End PBXTargetDependency section */
/* Begin XCBuildConfiguration section */ /* Begin XCBuildConfiguration section */
00E356F61AD99517003FC87E /* Debug */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 5B7EB9410499542E8C5724F5 /* Pods-AwesomeProject-AwesomeProjectTests.debug.xcconfig */;
buildSettings = {
BUNDLE_LOADER = "$(TEST_HOST)";
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
"$(inherited)",
);
INFOPLIST_FILE = AwesomeProjectTests/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 12.4;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
"@loader_path/Frameworks",
);
OTHER_LDFLAGS = (
"-ObjC",
"-lc++",
"$(inherited)",
);
PRODUCT_BUNDLE_IDENTIFIER = "org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(TARGET_NAME)";
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/AwesomeProject.app/AwesomeProject";
};
name = Debug;
};
00E356F71AD99517003FC87E /* Release */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 89C6BE57DB24E9ADA2F236DE /* Pods-AwesomeProject-AwesomeProjectTests.release.xcconfig */;
buildSettings = {
BUNDLE_LOADER = "$(TEST_HOST)";
COPY_PHASE_STRIP = NO;
INFOPLIST_FILE = AwesomeProjectTests/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 12.4;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
"@loader_path/Frameworks",
);
OTHER_LDFLAGS = (
"-ObjC",
"-lc++",
"$(inherited)",
);
PRODUCT_BUNDLE_IDENTIFIER = "org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(TARGET_NAME)";
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/AwesomeProject.app/AwesomeProject";
};
name = Release;
};
13B07F941A680F5B00A75B9A /* Debug */ = { 13B07F941A680F5B00A75B9A /* Debug */ = {
isa = XCBuildConfiguration; isa = XCBuildConfiguration;
baseConfigurationReference = 3B4392A12AC88292D35C810B /* Pods-AwesomeProject.debug.xcconfig */; baseConfigurationReference = 3B4392A12AC88292D35C810B /* Pods-AwesomeProject.debug.xcconfig */;
@@ -669,15 +453,6 @@
/* End XCBuildConfiguration section */ /* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */ /* Begin XCConfigurationList section */
00E357021AD99517003FC87E /* Build configuration list for PBXNativeTarget "AwesomeProjectTests" */ = {
isa = XCConfigurationList;
buildConfigurations = (
00E356F61AD99517003FC87E /* Debug */,
00E356F71AD99517003FC87E /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
13B07F931A680F5B00A75B9A /* Build configuration list for PBXNativeTarget "AwesomeProject" */ = { 13B07F931A680F5B00A75B9A /* Build configuration list for PBXNativeTarget "AwesomeProject" */ = {
isa = XCConfigurationList; isa = XCConfigurationList;
buildConfigurations = ( buildConfigurations = (

View File

@@ -1,66 +0,0 @@
#import <UIKit/UIKit.h>
#import <XCTest/XCTest.h>
#import <React/RCTLog.h>
#import <React/RCTRootView.h>
#define TIMEOUT_SECONDS 600
#define TEXT_TO_LOOK_FOR @"Welcome to React"
@interface AwesomeProjectTests : XCTestCase
@end
@implementation AwesomeProjectTests
- (BOOL)findSubviewInView:(UIView *)view matching:(BOOL (^)(UIView *view))test
{
if (test(view)) {
return YES;
}
for (UIView *subview in [view subviews]) {
if ([self findSubviewInView:subview matching:test]) {
return YES;
}
}
return NO;
}
- (void)testRendersWelcomeScreen
{
UIViewController *vc = [[[RCTSharedApplication() delegate] window] rootViewController];
NSDate *date = [NSDate dateWithTimeIntervalSinceNow:TIMEOUT_SECONDS];
BOOL foundElement = NO;
__block NSString *redboxError = nil;
#ifdef DEBUG
RCTSetLogFunction(
^(RCTLogLevel level, RCTLogSource source, NSString *fileName, NSNumber *lineNumber, NSString *message) {
if (level >= RCTLogLevelError) {
redboxError = message;
}
});
#endif
while ([date timeIntervalSinceNow] > 0 && !foundElement && !redboxError) {
[[NSRunLoop mainRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]];
[[NSRunLoop mainRunLoop] runMode:NSRunLoopCommonModes beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]];
foundElement = [self findSubviewInView:vc.view
matching:^BOOL(UIView *view) {
if ([view.accessibilityLabel isEqualToString:TEXT_TO_LOOK_FOR]) {
return YES;
}
return NO;
}];
}
#ifdef DEBUG
RCTSetLogFunction(RCTDefaultLogFunction);
#endif
XCTAssertNil(redboxError, @"RedBox error: %@", redboxError);
XCTAssertTrue(foundElement, @"Couldn't find element with text '%@' in %d seconds", TEXT_TO_LOOK_FOR, TIMEOUT_SECONDS);
}
@end

View File

@@ -1,24 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>BNDL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1</string>
</dict>
</plist>

View File

@@ -18,16 +18,11 @@ target 'AwesomeProject' do
:production => production, :production => production,
:hermes_enabled => flags[:hermes_enabled], :hermes_enabled => flags[:hermes_enabled],
:fabric_enabled => flags[:fabric_enabled], :fabric_enabled => flags[:fabric_enabled],
:flipper_configuration => FlipperConfiguration.enabled, :flipper_configuration => false,
# An absolute path to your application root. # An absolute path to your application root.
:app_path => "#{Pod::Config.instance.installation_root}/.." :app_path => "#{Pod::Config.instance.installation_root}/.."
) )
target 'AwesomeProjectTests' do
inherit! :complete
# Pods for testing
end
post_install do |installer| post_install do |installer|
react_native_post_install(installer) react_native_post_install(installer)
__apply_Xcode_12_5_M1_post_install_workaround(installer) __apply_Xcode_12_5_M1_post_install_workaround(installer)

View File

@@ -1,6 +1,5 @@
PODS: PODS:
- boost (1.76.0) - boost (1.76.0)
- CocoaAsyncSocket (7.6.5)
- DoubleConversion (1.1.6) - DoubleConversion (1.1.6)
- FBLazyVector (0.69.8) - FBLazyVector (0.69.8)
- FBReactNativeSpec (0.69.8): - FBReactNativeSpec (0.69.8):
@@ -10,71 +9,8 @@ PODS:
- React-Core (= 0.69.8) - React-Core (= 0.69.8)
- React-jsi (= 0.69.8) - React-jsi (= 0.69.8)
- ReactCommon/turbomodule/core (= 0.69.8) - ReactCommon/turbomodule/core (= 0.69.8)
- Flipper (0.125.0):
- Flipper-Folly (~> 2.6)
- Flipper-RSocket (~> 1.4)
- Flipper-Boost-iOSX (1.76.0.1.11)
- Flipper-DoubleConversion (3.2.0.1)
- Flipper-Fmt (7.1.7)
- Flipper-Folly (2.6.10):
- Flipper-Boost-iOSX
- Flipper-DoubleConversion
- Flipper-Fmt (= 7.1.7)
- Flipper-Glog
- libevent (~> 2.1.12)
- OpenSSL-Universal (= 1.1.1100)
- Flipper-Glog (0.5.0.5)
- Flipper-PeerTalk (0.0.4)
- Flipper-RSocket (1.4.3):
- Flipper-Folly (~> 2.6)
- FlipperKit (0.125.0):
- FlipperKit/Core (= 0.125.0)
- FlipperKit/Core (0.125.0):
- Flipper (~> 0.125.0)
- FlipperKit/CppBridge
- FlipperKit/FBCxxFollyDynamicConvert
- FlipperKit/FBDefines
- FlipperKit/FKPortForwarding
- SocketRocket (~> 0.6.0)
- FlipperKit/CppBridge (0.125.0):
- Flipper (~> 0.125.0)
- FlipperKit/FBCxxFollyDynamicConvert (0.125.0):
- Flipper-Folly (~> 2.6)
- FlipperKit/FBDefines (0.125.0)
- FlipperKit/FKPortForwarding (0.125.0):
- CocoaAsyncSocket (~> 7.6)
- Flipper-PeerTalk (~> 0.0.4)
- FlipperKit/FlipperKitHighlightOverlay (0.125.0)
- FlipperKit/FlipperKitLayoutHelpers (0.125.0):
- FlipperKit/Core
- FlipperKit/FlipperKitHighlightOverlay
- FlipperKit/FlipperKitLayoutTextSearchable
- FlipperKit/FlipperKitLayoutIOSDescriptors (0.125.0):
- FlipperKit/Core
- FlipperKit/FlipperKitHighlightOverlay
- FlipperKit/FlipperKitLayoutHelpers
- YogaKit (~> 1.18)
- FlipperKit/FlipperKitLayoutPlugin (0.125.0):
- FlipperKit/Core
- FlipperKit/FlipperKitHighlightOverlay
- FlipperKit/FlipperKitLayoutHelpers
- FlipperKit/FlipperKitLayoutIOSDescriptors
- FlipperKit/FlipperKitLayoutTextSearchable
- YogaKit (~> 1.18)
- FlipperKit/FlipperKitLayoutTextSearchable (0.125.0)
- FlipperKit/FlipperKitNetworkPlugin (0.125.0):
- FlipperKit/Core
- FlipperKit/FlipperKitReactPlugin (0.125.0):
- FlipperKit/Core
- FlipperKit/FlipperKitUserDefaultsPlugin (0.125.0):
- FlipperKit/Core
- FlipperKit/SKIOSNetworkPlugin (0.125.0):
- FlipperKit/Core
- FlipperKit/FlipperKitNetworkPlugin
- fmt (6.2.1) - fmt (6.2.1)
- glog (0.3.5) - glog (0.3.5)
- libevent (2.1.12)
- OpenSSL-Universal (1.1.1100)
- RCT-Folly (2021.06.28.00-v2): - RCT-Folly (2021.06.28.00-v2):
- boost - boost
- DoubleConversion - DoubleConversion
@@ -286,17 +222,17 @@ PODS:
- glog - glog
- react-native-safe-area-context (4.8.2): - react-native-safe-area-context (4.8.2):
- React-Core - React-Core
- react-native-update (10.0.0-beta.1): - react-native-update (10.7.1):
- React - React
- React-Core - React-Core
- react-native-update/HDiffPatch (= 10.0.0-beta.1) - react-native-update/HDiffPatch (= 10.7.1)
- react-native-update/RCTPushy (= 10.0.0-beta.1) - react-native-update/RCTPushy (= 10.7.1)
- SSZipArchive - SSZipArchive
- react-native-update/HDiffPatch (10.0.0-beta.1): - react-native-update/HDiffPatch (10.7.1):
- React - React
- React-Core - React-Core
- SSZipArchive - SSZipArchive
- react-native-update/RCTPushy (10.0.0-beta.1): - react-native-update/RCTPushy (10.7.1):
- React - React
- React-Core - React-Core
- SSZipArchive - SSZipArchive
@@ -368,40 +304,15 @@ PODS:
- React-perflogger (= 0.69.8) - React-perflogger (= 0.69.8)
- RNVectorIcons (10.0.3): - RNVectorIcons (10.0.3):
- React-Core - React-Core
- SocketRocket (0.6.0)
- SSZipArchive (2.4.3) - SSZipArchive (2.4.3)
- Yoga (1.14.0) - Yoga (1.14.0)
- YogaKit (1.18.1):
- Yoga (~> 1.14)
DEPENDENCIES: DEPENDENCIES:
- boost (from `../node_modules/react-native/third-party-podspecs/boost.podspec`) - boost (from `../node_modules/react-native/third-party-podspecs/boost.podspec`)
- DoubleConversion (from `../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec`) - DoubleConversion (from `../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec`)
- FBLazyVector (from `../node_modules/react-native/Libraries/FBLazyVector`) - FBLazyVector (from `../node_modules/react-native/Libraries/FBLazyVector`)
- FBReactNativeSpec (from `../node_modules/react-native/React/FBReactNativeSpec`) - FBReactNativeSpec (from `../node_modules/react-native/React/FBReactNativeSpec`)
- Flipper (= 0.125.0)
- Flipper-Boost-iOSX (= 1.76.0.1.11)
- Flipper-DoubleConversion (= 3.2.0.1)
- Flipper-Fmt (= 7.1.7)
- Flipper-Folly (= 2.6.10)
- Flipper-Glog (= 0.5.0.5)
- Flipper-PeerTalk (= 0.0.4)
- Flipper-RSocket (= 1.4.3)
- FlipperKit (= 0.125.0)
- FlipperKit/Core (= 0.125.0)
- FlipperKit/CppBridge (= 0.125.0)
- FlipperKit/FBCxxFollyDynamicConvert (= 0.125.0)
- FlipperKit/FBDefines (= 0.125.0)
- FlipperKit/FKPortForwarding (= 0.125.0)
- FlipperKit/FlipperKitHighlightOverlay (= 0.125.0)
- FlipperKit/FlipperKitLayoutPlugin (= 0.125.0)
- FlipperKit/FlipperKitLayoutTextSearchable (= 0.125.0)
- FlipperKit/FlipperKitNetworkPlugin (= 0.125.0)
- FlipperKit/FlipperKitReactPlugin (= 0.125.0)
- FlipperKit/FlipperKitUserDefaultsPlugin (= 0.125.0)
- FlipperKit/SKIOSNetworkPlugin (= 0.125.0)
- glog (from `../node_modules/react-native/third-party-podspecs/glog.podspec`) - glog (from `../node_modules/react-native/third-party-podspecs/glog.podspec`)
- OpenSSL-Universal (= 1.1.1100)
- RCT-Folly (from `../node_modules/react-native/third-party-podspecs/RCT-Folly.podspec`) - RCT-Folly (from `../node_modules/react-native/third-party-podspecs/RCT-Folly.podspec`)
- RCTRequired (from `../node_modules/react-native/Libraries/RCTRequired`) - RCTRequired (from `../node_modules/react-native/Libraries/RCTRequired`)
- RCTTypeSafety (from `../node_modules/react-native/Libraries/TypeSafety`) - RCTTypeSafety (from `../node_modules/react-native/Libraries/TypeSafety`)
@@ -410,7 +321,6 @@ DEPENDENCIES:
- React-callinvoker (from `../node_modules/react-native/ReactCommon/callinvoker`) - React-callinvoker (from `../node_modules/react-native/ReactCommon/callinvoker`)
- React-Codegen (from `build/generated/ios`) - React-Codegen (from `build/generated/ios`)
- React-Core (from `../node_modules/react-native/`) - React-Core (from `../node_modules/react-native/`)
- React-Core/DevSupport (from `../node_modules/react-native/`)
- React-Core/RCTWebSocket (from `../node_modules/react-native/`) - React-Core/RCTWebSocket (from `../node_modules/react-native/`)
- React-CoreModules (from `../node_modules/react-native/React/CoreModules`) - React-CoreModules (from `../node_modules/react-native/React/CoreModules`)
- React-cxxreact (from `../node_modules/react-native/ReactCommon/cxxreact`) - React-cxxreact (from `../node_modules/react-native/ReactCommon/cxxreact`)
@@ -437,22 +347,8 @@ DEPENDENCIES:
SPEC REPOS: SPEC REPOS:
trunk: trunk:
- CocoaAsyncSocket
- Flipper
- Flipper-Boost-iOSX
- Flipper-DoubleConversion
- Flipper-Fmt
- Flipper-Folly
- Flipper-Glog
- Flipper-PeerTalk
- Flipper-RSocket
- FlipperKit
- fmt - fmt
- libevent
- OpenSSL-Universal
- SocketRocket
- SSZipArchive - SSZipArchive
- YogaKit
EXTERNAL SOURCES: EXTERNAL SOURCES:
boost: boost:
@@ -528,23 +424,11 @@ EXTERNAL SOURCES:
SPEC CHECKSUMS: SPEC CHECKSUMS:
boost: a7c83b31436843459a1961bfd74b96033dc77234 boost: a7c83b31436843459a1961bfd74b96033dc77234
CocoaAsyncSocket: 065fd1e645c7abab64f7a6a2007a48038fdc6a99
DoubleConversion: 5189b271737e1565bdce30deb4a08d647e3f5f54 DoubleConversion: 5189b271737e1565bdce30deb4a08d647e3f5f54
FBLazyVector: c7b6997d41fffaaaf4d18c82bc93885df731e2d0 FBLazyVector: c7b6997d41fffaaaf4d18c82bc93885df731e2d0
FBReactNativeSpec: b1217c558a3ae84c2057d9c2ddce88af21379a68 FBReactNativeSpec: b1217c558a3ae84c2057d9c2ddce88af21379a68
Flipper: 26fc4b7382499f1281eb8cb921e5c3ad6de91fe0
Flipper-Boost-iOSX: fd1e2b8cbef7e662a122412d7ac5f5bea715403c
Flipper-DoubleConversion: 2dc99b02f658daf147069aad9dbd29d8feb06d30
Flipper-Fmt: 60cbdd92fc254826e61d669a5d87ef7015396a9b
Flipper-Folly: 584845625005ff068a6ebf41f857f468decd26b3
Flipper-Glog: 70c50ce58ddaf67dc35180db05f191692570f446
Flipper-PeerTalk: 116d8f857dc6ef55c7a5a75ea3ceaafe878aadc9
Flipper-RSocket: d9d9ade67cbecf6ac10730304bf5607266dd2541
FlipperKit: cbdee19bdd4e7f05472a66ce290f1b729ba3cb86
fmt: ff9d55029c625d3757ed641535fd4a75fedc7ce9 fmt: ff9d55029c625d3757ed641535fd4a75fedc7ce9
glog: 3d02b25ca00c2d456734d0bcff864cbc62f6ae1a glog: 3d02b25ca00c2d456734d0bcff864cbc62f6ae1a
libevent: 4049cae6c81cdb3654a443be001fb9bdceff7913
OpenSSL-Universal: ebc357f1e6bc71fa463ccb2fe676756aff50e88c
RCT-Folly: b9d9fe1fc70114b751c076104e52f3b1b5e5a95a RCT-Folly: b9d9fe1fc70114b751c076104e52f3b1b5e5a95a
RCTRequired: 344fd6fb3c669da87e91294be7ee0199bf35c701 RCTRequired: 344fd6fb3c669da87e91294be7ee0199bf35c701
RCTTypeSafety: ca608cc1d3a81229632bc0c1136b698b9337c1d8 RCTTypeSafety: ca608cc1d3a81229632bc0c1136b698b9337c1d8
@@ -560,7 +444,7 @@ SPEC CHECKSUMS:
React-jsinspector: 0eda09e9cf22bbb5dbb1d23143b03a31acf37d67 React-jsinspector: 0eda09e9cf22bbb5dbb1d23143b03a31acf37d67
React-logger: 5997ab008583826c10ffe4e1ff990363e975639d React-logger: 5997ab008583826c10ffe4e1ff990363e975639d
react-native-safe-area-context: 0ee144a6170530ccc37a0fd9388e28d06f516a89 react-native-safe-area-context: 0ee144a6170530ccc37a0fd9388e28d06f516a89
react-native-update: 767449a2cf592387b9aecb97980ec0536d72c890 react-native-update: 04844fca9567508fa79649e23e7209904d9d7a5a
React-perflogger: ad1416a715d86b32f456e5d0aed99c3b52f1de37 React-perflogger: ad1416a715d86b32f456e5d0aed99c3b52f1de37
React-RCTActionSheet: cbf7c6a953982562418ee72a1084ff7b9447b558 React-RCTActionSheet: cbf7c6a953982562418ee72a1084ff7b9447b558
React-RCTAnimation: 33df3e25824dd7313edec28dded2745542f9352b React-RCTAnimation: 33df3e25824dd7313edec28dded2745542f9352b
@@ -574,11 +458,9 @@ SPEC CHECKSUMS:
React-runtimeexecutor: 9df680f18497367bcf5c15b6b6406c0f2dfa2b6a React-runtimeexecutor: 9df680f18497367bcf5c15b6b6406c0f2dfa2b6a
ReactCommon: c10f046f3ef8561e7c8e7e9b9dae2ecc9ffc48ef ReactCommon: c10f046f3ef8561e7c8e7e9b9dae2ecc9ffc48ef
RNVectorIcons: bc7ee28cadf39c77a49232a14738dfce690f66cd RNVectorIcons: bc7ee28cadf39c77a49232a14738dfce690f66cd
SocketRocket: fccef3f9c5cedea1353a9ef6ada904fde10d6608
SSZipArchive: fe6a26b2a54d5a0890f2567b5cc6de5caa600aef SSZipArchive: fe6a26b2a54d5a0890f2567b5cc6de5caa600aef
Yoga: d3820731e0ca3a4933f061ad29defaf7726e3251 Yoga: d3820731e0ca3a4933f061ad29defaf7726e3251
YogaKit: f782866e155069a2cca2517aafea43200b01fd5a
PODFILE CHECKSUM: 618d17df10f335f1d113daac849a7997894646b2 PODFILE CHECKSUM: d91298a06dc138c1778443a87db930ad51725939
COCOAPODS: 1.14.3 COCOAPODS: 1.15.2

View File

@@ -1,4 +1,4 @@
const path = require('path'); // const path = require('path');
// const extraNodeModules = { // const extraNodeModules = {
// react: path.resolve(__dirname, 'node_modules/react'), // react: path.resolve(__dirname, 'node_modules/react'),

View File

@@ -18,7 +18,7 @@
"react-native": "0.69.8", "react-native": "0.69.8",
"react-native-paper": "^5.12.1", "react-native-paper": "^5.12.1",
"react-native-safe-area-context": "^4.8.2", "react-native-safe-area-context": "^4.8.2",
"react-native-update": "^10.0.2", "react-native-update": "^10.7.1",
"react-native-vector-icons": "^10.0.3" "react-native-vector-icons": "^10.0.3"
}, },
"devDependencies": { "devDependencies": {

View File

@@ -19,8 +19,7 @@ const UUID = '00000000-0000-0000-0000-000000000000';
const DownloadUrl = const DownloadUrl =
'http://cos.pgyer.com/697913e94d7441f20c686e2b0996a1aa.apk?sign=7a8f11b1df82cba45c8ac30b1acec88c&t=1680404102&response-content-disposition=attachment%3Bfilename%3DtestHotupdate_1.0.apk'; 'http://cos.pgyer.com/697913e94d7441f20c686e2b0996a1aa.apk?sign=7a8f11b1df82cba45c8ac30b1acec88c&t=1680404102&response-content-disposition=attachment%3Bfilename%3DtestHotupdate_1.0.apk';
const CustomDialog = ({title, visible, onConfirm}) => {
const CustomDialog = ({title, visible, onConfirm}) => {
if (!visible) { if (!visible) {
return null; return null;
} }
@@ -29,13 +28,16 @@ const DownloadUrl =
<View style={styles.overlay}> <View style={styles.overlay}>
<View style={styles.dialog}> <View style={styles.dialog}>
<Text style={styles.title}>{title}</Text> <Text style={styles.title}>{title}</Text>
<TouchableOpacity testID='done' style={styles.button} onLongPress={onConfirm}> <TouchableOpacity
testID="done"
style={styles.button}
onLongPress={onConfirm}>
<Text style={styles.buttonText}>确认</Text> <Text style={styles.buttonText}>确认</Text>
</TouchableOpacity> </TouchableOpacity>
</View> </View>
</View> </View>
); );
}; };
export default function TestConsole({visible}) { export default function TestConsole({visible}) {
const [text, setText] = useState(''); const [text, setText] = useState('');
const [running, setRunning] = useState(false); const [running, setRunning] = useState(false);
@@ -64,13 +66,6 @@ export default function TestConsole({visible}) {
setText(`setUuid\n${UUID}`); setText(`setUuid\n${UUID}`);
}, },
}, },
{
name: 'setBlockUpdate',
invoke: () => {
setText('setBlockUpdate');
setOptions({reason: 'application has been block', until: 1673082950});
},
},
{ {
name: 'reloadUpdate', name: 'reloadUpdate',
invoke: () => { invoke: () => {
@@ -132,8 +127,7 @@ export default function TestConsole({visible}) {
testID={NativeTestMethod[i].name} testID={NativeTestMethod[i].name}
onLongPress={() => { onLongPress={() => {
NativeTestMethod[i].invoke(); NativeTestMethod[i].invoke();
}} }}>
>
<Text>{NativeTestMethod[i].name}</Text> <Text>{NativeTestMethod[i].name}</Text>
</TouchableOpacity>, </TouchableOpacity>,
); );
@@ -164,8 +158,14 @@ export default function TestConsole({visible}) {
/> />
{running && <ActivityIndicator />} {running && <ActivityIndicator />}
<TouchableOpacity <TouchableOpacity
style={{backgroundColor:'rgb(0,140,237)', justifyContent: 'center', style={{
alignItems: 'center',paddingTop:10,paddingBottom:10,marginBottom:5}} backgroundColor: 'rgb(0,140,237)',
justifyContent: 'center',
alignItems: 'center',
paddingTop: 10,
paddingBottom: 10,
marginBottom: 5,
}}
testID="submit" testID="submit"
onLongPress={async () => { onLongPress={async () => {
setRunning(true); setRunning(true);
@@ -195,16 +195,17 @@ export default function TestConsole({visible}) {
setAlertMsg(e.message); setAlertMsg(e.message);
} }
setRunning(false); setRunning(false);
}} }}>
> <Text style={{color: 'white'}}>执行</Text>
<Text style={{color:'white'}}>执行</Text>
</TouchableOpacity> </TouchableOpacity>
<Button title="重置" onPress={() => setText('')} /> <Button title="重置" onPress={() => setText('')} />
{renderTestView()} {renderTestView()}
<CustomDialog <CustomDialog
title={alertMsg} title={alertMsg}
visible={alertVisible} visible={alertVisible}
onConfirm={()=>{setAlertVisible(false)}} onConfirm={() => {
setAlertVisible(false);
}}
/> />
</SafeAreaView> </SafeAreaView>
</Modal> </Modal>

View File

@@ -1,3 +1,5 @@
/* eslint-disable react/no-unstable-nested-components */
/* eslint-disable react-native/no-inline-styles */
import React, {useState} from 'react'; import React, {useState} from 'react';
import { import {
StyleSheet, StyleSheet,
@@ -47,7 +49,7 @@ function App() {
onValueChange={v => { onValueChange={v => {
setUseDefaultAlert(v); setUseDefaultAlert(v);
client?.setOptions({ client?.setOptions({
useAlert: v, updateStrategy: v ? null : 'alwaysAlert',
}); });
setShowUpdateSnackbar(!v); setShowUpdateSnackbar(!v);
}} }}

View File

@@ -6231,10 +6231,10 @@ react-native-safe-area-context@^4.8.2:
resolved "https://registry.yarnpkg.com/react-native-safe-area-context/-/react-native-safe-area-context-4.8.2.tgz#e6b3d8acf3c6afcb4b5db03a97f9c37df7668f65" resolved "https://registry.yarnpkg.com/react-native-safe-area-context/-/react-native-safe-area-context-4.8.2.tgz#e6b3d8acf3c6afcb4b5db03a97f9c37df7668f65"
integrity sha512-ffUOv8BJQ6RqO3nLml5gxJ6ab3EestPiyWekxdzO/1MQ7NF8fW1Mzh1C5QE9yq573Xefnc7FuzGXjtesZGv7cQ== integrity sha512-ffUOv8BJQ6RqO3nLml5gxJ6ab3EestPiyWekxdzO/1MQ7NF8fW1Mzh1C5QE9yq573Xefnc7FuzGXjtesZGv7cQ==
react-native-update@^10.0.2: react-native-update@^10.7.1:
version "10.0.2" version "10.7.1"
resolved "https://registry.yarnpkg.com/react-native-update/-/react-native-update-10.0.2.tgz#2bb01ab6e41e72bbbb535cebd34083b1fed69eb0" resolved "https://registry.yarnpkg.com/react-native-update/-/react-native-update-10.7.1.tgz#f89075b69b4a397ce6d3457837018fb6cfabe0ab"
integrity sha512-XkEPmTC3X6FV1eXq6uDyjfhXpAaug0HI48Mm+PkbMlXcgFjTrOmtuq7yuvemS2nPG2pwnrYQuGs0A6tE2aoRBA== integrity sha512-Lru/8qunNjggvjzfe6uzWi4HWsFmNjtwdLXC3lD+1hWQpJ8ln5bwQlYoXyz0n8GwNJiS8Z/w8oPXVxs323ls3g==
dependencies: dependencies:
nanoid "^3.3.3" nanoid "^3.3.3"

View File

@@ -69,13 +69,6 @@ public class UpdateContext {
return context.getString(R.string.pushy_build_time); return context.getString(R.string.pushy_build_time);
} }
public Map getBlockUpdate() {
return new HashMap<String, Object>() {{
put("until", sp.getInt("blockUntil", 0));
put("reason", sp.getString("blockReason", null));
}};
}
public boolean getIsUsingBundleUrl() { public boolean getIsUsingBundleUrl() {
return isUsingBundleUrl; return isUsingBundleUrl;
} }
@@ -166,13 +159,6 @@ public class UpdateContext {
return sp.getString(key, null); return sp.getString(key, null);
} }
public void setBlockUpdate(int until, String reason) {
SharedPreferences.Editor editor = sp.edit();
editor.putInt("blockUntil", until);
editor.putString("blockReason", reason);
editor.apply();
}
public String getCurrentVersion() { public String getCurrentVersion() {
return sp.getString("currentVersion", null); return sp.getString("currentVersion", null);
} }

View File

@@ -192,23 +192,6 @@ public class UpdateModuleImpl {
} }
} }
public static void setBlockUpdate(UpdateContext updateContext, ReadableMap options,Promise promise) {
try {
final int until = options.getInt("until");
final String reason = options.getString("reason");
UiThreadUtil.runOnUiThread(new Runnable() {
@Override
public void run() {
updateContext.setBlockUpdate(until, reason);
}
});
promise.resolve(true);
}catch (Exception e){
promise.reject("执行报错:"+e.getMessage());
}
}
public static void setUuid(UpdateContext updateContext, String uuid, Promise promise) { public static void setUuid(UpdateContext updateContext, String uuid, Promise promise) {
try { try {
UiThreadUtil.runOnUiThread(new Runnable() { UiThreadUtil.runOnUiThread(new Runnable() {

View File

@@ -14,7 +14,7 @@ import java.io.File;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
public class UpdateModule extends NativeUpdateSpec { public class UpdateModule extends NativePushySpec {
UpdateContext updateContext; UpdateContext updateContext;
public static ReactApplicationContext mContext; public static ReactApplicationContext mContext;
public UpdateModule(ReactApplicationContext reactContext, UpdateContext updateContext) { public UpdateModule(ReactApplicationContext reactContext, UpdateContext updateContext) {
@@ -45,7 +45,6 @@ public class UpdateModule extends NativeUpdateSpec {
if (rolledBackVersion != null) { if (rolledBackVersion != null) {
updateContext.clearRollbackMark(); updateContext.clearRollbackMark();
} }
constants.put("blockUpdate", updateContext.getBlockUpdate());
constants.put("uuid", updateContext.getKv("uuid")); constants.put("uuid", updateContext.getKv("uuid"));
return constants; return constants;
} }
@@ -108,11 +107,6 @@ public class UpdateModule extends NativeUpdateSpec {
UpdateModuleImpl.markSuccess(updateContext,promise); UpdateModuleImpl.markSuccess(updateContext,promise);
} }
@Override
public void setBlockUpdate(ReadableMap options,Promise promise) {
UpdateModuleImpl.setBlockUpdate(updateContext,options,promise);
}
@Override @Override
public void setUuid(final String uuid, Promise promise) { public void setUuid(final String uuid, Promise promise) {
UpdateModuleImpl.setUuid(updateContext,uuid,promise); UpdateModuleImpl.setUuid(updateContext,uuid,promise);

View File

@@ -59,7 +59,6 @@ public class UpdateModule extends ReactContextBaseJavaModule {
if (rolledBackVersion != null) { if (rolledBackVersion != null) {
updateContext.clearRollbackMark(); updateContext.clearRollbackMark();
} }
constants.put("blockUpdate", updateContext.getBlockUpdate());
constants.put("uuid", updateContext.getKv("uuid")); constants.put("uuid", updateContext.getKv("uuid"));
return constants; return constants;
} }
@@ -239,18 +238,6 @@ public class UpdateModule extends ReactContextBaseJavaModule {
}); });
} }
@ReactMethod
public void setBlockUpdate(ReadableMap options) {
final int until = options.getInt("until");
final String reason = options.getString("reason");
UiThreadUtil.runOnUiThread(new Runnable() {
@Override
public void run() {
updateContext.setBlockUpdate(until, reason);
}
});
}
@ReactMethod @ReactMethod
public void setUuid(final String uuid) { public void setUuid(final String uuid) {
UiThreadUtil.runOnUiThread(new Runnable() { UiThreadUtil.runOnUiThread(new Runnable() {

3
babel.config.js Normal file
View File

@@ -0,0 +1,3 @@
module.exports = {
presets: ['module:@react-native/babel-preset'],
};

View File

@@ -1 +1 @@
["update.react-native.cn", "update.reactnative.cn"] ["update.react-native.cn", "update.reactnative.cn", "p.reactnative.cn"]

View File

@@ -1 +1 @@
["https://update.react-native.cn/api", "https://update.reactnative.cn/api"] ["https://update.react-native.cn/api", "https://update.reactnative.cn/api", "https://p.reactnative.cn/api"]

View File

@@ -14,11 +14,8 @@
249F2F64261C58C700A1E60E /* Lzma2Dec.c in Sources */ = {isa = PBXBuildFile; fileRef = 249F2F60261C58C700A1E60E /* Lzma2Dec.c */; }; 249F2F64261C58C700A1E60E /* Lzma2Dec.c in Sources */ = {isa = PBXBuildFile; fileRef = 249F2F60261C58C700A1E60E /* Lzma2Dec.c */; };
249F2F65261C58C700A1E60E /* LzmaDec.c in Sources */ = {isa = PBXBuildFile; fileRef = 249F2F62261C58C700A1E60E /* LzmaDec.c */; }; 249F2F65261C58C700A1E60E /* LzmaDec.c in Sources */ = {isa = PBXBuildFile; fileRef = 249F2F62261C58C700A1E60E /* LzmaDec.c */; };
91C5F0031C76ECA90037E727 /* RCTPushy.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 91C5F0021C76ECA90037E727 /* RCTPushy.h */; }; 91C5F0031C76ECA90037E727 /* RCTPushy.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 91C5F0021C76ECA90037E727 /* RCTPushy.h */; };
91C5F0051C76ECA90037E727 /* RCTPushy.m in Sources */ = {isa = PBXBuildFile; fileRef = 91C5F0041C76ECA90037E727 /* RCTPushy.m */; };
9F1BCB1D1CAE5937000EF2CB /* RCTPushyManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 9F1BCB1C1CAE5937000EF2CB /* RCTPushyManager.m */; };
9F1BCB461CAF6B3E000EF2CB /* bspatch.c in Sources */ = {isa = PBXBuildFile; fileRef = 9F1BCB3B1CAF6B3E000EF2CB /* bspatch.c */; }; 9F1BCB461CAF6B3E000EF2CB /* bspatch.c in Sources */ = {isa = PBXBuildFile; fileRef = 9F1BCB3B1CAF6B3E000EF2CB /* bspatch.c */; };
9F1BCB4F1CAF6B68000EF2CB /* BSDiff.m in Sources */ = {isa = PBXBuildFile; fileRef = 9F1BCB4E1CAF6B68000EF2CB /* BSDiff.m */; }; 9F1BCB4F1CAF6B68000EF2CB /* BSDiff.m in Sources */ = {isa = PBXBuildFile; fileRef = 9F1BCB4E1CAF6B68000EF2CB /* BSDiff.m */; };
9F292F7D1C7C44290095945D /* RCTPushyDownloader.m in Sources */ = {isa = PBXBuildFile; fileRef = 9F292F7C1C7C44290095945D /* RCTPushyDownloader.m */; };
9F394D7D1C7C25DC00C794C0 /* aescrypt.c in Sources */ = {isa = PBXBuildFile; fileRef = 9F394D5B1C7C25DC00C794C0 /* aescrypt.c */; }; 9F394D7D1C7C25DC00C794C0 /* aescrypt.c in Sources */ = {isa = PBXBuildFile; fileRef = 9F394D5B1C7C25DC00C794C0 /* aescrypt.c */; };
9F394D7E1C7C25DC00C794C0 /* aeskey.c in Sources */ = {isa = PBXBuildFile; fileRef = 9F394D5C1C7C25DC00C794C0 /* aeskey.c */; }; 9F394D7E1C7C25DC00C794C0 /* aeskey.c in Sources */ = {isa = PBXBuildFile; fileRef = 9F394D5C1C7C25DC00C794C0 /* aeskey.c */; };
9F394D7F1C7C25DC00C794C0 /* aestab.c in Sources */ = {isa = PBXBuildFile; fileRef = 9F394D5E1C7C25DC00C794C0 /* aestab.c */; }; 9F394D7F1C7C25DC00C794C0 /* aestab.c in Sources */ = {isa = PBXBuildFile; fileRef = 9F394D5E1C7C25DC00C794C0 /* aestab.c */; };
@@ -33,6 +30,9 @@
9F394D881C7C25DC00C794C0 /* unzip.c in Sources */ = {isa = PBXBuildFile; fileRef = 9F394D761C7C25DC00C794C0 /* unzip.c */; }; 9F394D881C7C25DC00C794C0 /* unzip.c in Sources */ = {isa = PBXBuildFile; fileRef = 9F394D761C7C25DC00C794C0 /* unzip.c */; };
9F394D891C7C25DC00C794C0 /* zip.c in Sources */ = {isa = PBXBuildFile; fileRef = 9F394D781C7C25DC00C794C0 /* zip.c */; }; 9F394D891C7C25DC00C794C0 /* zip.c in Sources */ = {isa = PBXBuildFile; fileRef = 9F394D781C7C25DC00C794C0 /* zip.c */; };
9F394D8A1C7C25DC00C794C0 /* SSZipArchive.m in Sources */ = {isa = PBXBuildFile; fileRef = 9F394D7B1C7C25DC00C794C0 /* SSZipArchive.m */; }; 9F394D8A1C7C25DC00C794C0 /* SSZipArchive.m in Sources */ = {isa = PBXBuildFile; fileRef = 9F394D7B1C7C25DC00C794C0 /* SSZipArchive.m */; };
A3FD91A62C3C01600022D27F /* RCTPushy.mm in Sources */ = {isa = PBXBuildFile; fileRef = A3FD91A52C3C01600022D27F /* RCTPushy.mm */; };
A3FD91A82C3C01640022D27F /* RCTPushyDownloader.mm in Sources */ = {isa = PBXBuildFile; fileRef = A3FD91A72C3C01640022D27F /* RCTPushyDownloader.mm */; };
A3FD91AA2C3C01680022D27F /* RCTPushyManager.mm in Sources */ = {isa = PBXBuildFile; fileRef = A3FD91A92C3C01680022D27F /* RCTPushyManager.mm */; };
/* End PBXBuildFile section */ /* End PBXBuildFile section */
/* Begin PBXCopyFilesBuildPhase section */ /* Begin PBXCopyFilesBuildPhase section */
@@ -64,15 +64,12 @@
249F2F63261C58C700A1E60E /* LzmaDec.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = LzmaDec.h; path = ../../../android/jni/lzma/C/LzmaDec.h; sourceTree = "<group>"; }; 249F2F63261C58C700A1E60E /* LzmaDec.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = LzmaDec.h; path = ../../../android/jni/lzma/C/LzmaDec.h; sourceTree = "<group>"; };
91C5EFFF1C76ECA90037E727 /* libRCTPushy.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libRCTPushy.a; sourceTree = BUILT_PRODUCTS_DIR; }; 91C5EFFF1C76ECA90037E727 /* libRCTPushy.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libRCTPushy.a; sourceTree = BUILT_PRODUCTS_DIR; };
91C5F0021C76ECA90037E727 /* RCTPushy.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RCTPushy.h; sourceTree = "<group>"; }; 91C5F0021C76ECA90037E727 /* RCTPushy.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RCTPushy.h; sourceTree = "<group>"; };
91C5F0041C76ECA90037E727 /* RCTPushy.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RCTPushy.m; sourceTree = "<group>"; };
9F1BCB1B1CAE5937000EF2CB /* RCTPushyManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTPushyManager.h; sourceTree = "<group>"; }; 9F1BCB1B1CAE5937000EF2CB /* RCTPushyManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTPushyManager.h; sourceTree = "<group>"; };
9F1BCB1C1CAE5937000EF2CB /* RCTPushyManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTPushyManager.m; sourceTree = "<group>"; };
9F1BCB3B1CAF6B3E000EF2CB /* bspatch.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bspatch.c; sourceTree = "<group>"; }; 9F1BCB3B1CAF6B3E000EF2CB /* bspatch.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bspatch.c; sourceTree = "<group>"; };
9F1BCB3C1CAF6B3E000EF2CB /* bspatch.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = bspatch.h; sourceTree = "<group>"; }; 9F1BCB3C1CAF6B3E000EF2CB /* bspatch.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = bspatch.h; sourceTree = "<group>"; };
9F1BCB4D1CAF6B68000EF2CB /* BSDiff.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BSDiff.h; sourceTree = "<group>"; }; 9F1BCB4D1CAF6B68000EF2CB /* BSDiff.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BSDiff.h; sourceTree = "<group>"; };
9F1BCB4E1CAF6B68000EF2CB /* BSDiff.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BSDiff.m; sourceTree = "<group>"; }; 9F1BCB4E1CAF6B68000EF2CB /* BSDiff.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BSDiff.m; sourceTree = "<group>"; };
9F292F7B1C7C44290095945D /* RCTPushyDownloader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTPushyDownloader.h; sourceTree = "<group>"; }; 9F292F7B1C7C44290095945D /* RCTPushyDownloader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTPushyDownloader.h; sourceTree = "<group>"; };
9F292F7C1C7C44290095945D /* RCTPushyDownloader.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTPushyDownloader.m; sourceTree = "<group>"; };
9F394D591C7C25DC00C794C0 /* aes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = aes.h; sourceTree = "<group>"; }; 9F394D591C7C25DC00C794C0 /* aes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = aes.h; sourceTree = "<group>"; };
9F394D5A1C7C25DC00C794C0 /* aes_via_ace.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = aes_via_ace.h; sourceTree = "<group>"; }; 9F394D5A1C7C25DC00C794C0 /* aes_via_ace.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = aes_via_ace.h; sourceTree = "<group>"; };
9F394D5B1C7C25DC00C794C0 /* aescrypt.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = aescrypt.c; sourceTree = "<group>"; }; 9F394D5B1C7C25DC00C794C0 /* aescrypt.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = aescrypt.c; sourceTree = "<group>"; };
@@ -108,6 +105,9 @@
9F394D7A1C7C25DC00C794C0 /* SSZipArchive.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SSZipArchive.h; sourceTree = "<group>"; }; 9F394D7A1C7C25DC00C794C0 /* SSZipArchive.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SSZipArchive.h; sourceTree = "<group>"; };
9F394D7B1C7C25DC00C794C0 /* SSZipArchive.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SSZipArchive.m; sourceTree = "<group>"; }; 9F394D7B1C7C25DC00C794C0 /* SSZipArchive.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SSZipArchive.m; sourceTree = "<group>"; };
9F394D7C1C7C25DC00C794C0 /* ZipArchive.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ZipArchive.h; sourceTree = "<group>"; }; 9F394D7C1C7C25DC00C794C0 /* ZipArchive.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ZipArchive.h; sourceTree = "<group>"; };
A3FD91A52C3C01600022D27F /* RCTPushy.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = RCTPushy.mm; sourceTree = "<group>"; };
A3FD91A72C3C01640022D27F /* RCTPushyDownloader.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = RCTPushyDownloader.mm; sourceTree = "<group>"; };
A3FD91A92C3C01680022D27F /* RCTPushyManager.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = RCTPushyManager.mm; sourceTree = "<group>"; };
/* End PBXFileReference section */ /* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */ /* Begin PBXFrameworksBuildPhase section */
@@ -172,11 +172,11 @@
9F1BCB381CAF6B3E000EF2CB /* BSDiff */, 9F1BCB381CAF6B3E000EF2CB /* BSDiff */,
9F394D571C7C25DC00C794C0 /* SSZipArchive */, 9F394D571C7C25DC00C794C0 /* SSZipArchive */,
91C5F0021C76ECA90037E727 /* RCTPushy.h */, 91C5F0021C76ECA90037E727 /* RCTPushy.h */,
91C5F0041C76ECA90037E727 /* RCTPushy.m */,
9F1BCB1B1CAE5937000EF2CB /* RCTPushyManager.h */, 9F1BCB1B1CAE5937000EF2CB /* RCTPushyManager.h */,
9F1BCB1C1CAE5937000EF2CB /* RCTPushyManager.m */,
9F292F7B1C7C44290095945D /* RCTPushyDownloader.h */, 9F292F7B1C7C44290095945D /* RCTPushyDownloader.h */,
9F292F7C1C7C44290095945D /* RCTPushyDownloader.m */, A3FD91A52C3C01600022D27F /* RCTPushy.mm */,
A3FD91A72C3C01640022D27F /* RCTPushyDownloader.mm */,
A3FD91A92C3C01680022D27F /* RCTPushyManager.mm */,
); );
path = RCTPushy; path = RCTPushy;
sourceTree = "<group>"; sourceTree = "<group>";
@@ -321,25 +321,25 @@
9F394D821C7C25DC00C794C0 /* hmac.c in Sources */, 9F394D821C7C25DC00C794C0 /* hmac.c in Sources */,
9F394D881C7C25DC00C794C0 /* unzip.c in Sources */, 9F394D881C7C25DC00C794C0 /* unzip.c in Sources */,
249F2F65261C58C700A1E60E /* LzmaDec.c in Sources */, 249F2F65261C58C700A1E60E /* LzmaDec.c in Sources */,
9F1BCB1D1CAE5937000EF2CB /* RCTPushyManager.m in Sources */,
249F2F5E261C589D00A1E60E /* patch.c in Sources */, 249F2F5E261C589D00A1E60E /* patch.c in Sources */,
9F1BCB4F1CAF6B68000EF2CB /* BSDiff.m in Sources */, 9F1BCB4F1CAF6B68000EF2CB /* BSDiff.m in Sources */,
9F394D7E1C7C25DC00C794C0 /* aeskey.c in Sources */, 9F394D7E1C7C25DC00C794C0 /* aeskey.c in Sources */,
9F394D7F1C7C25DC00C794C0 /* aestab.c in Sources */, 9F394D7F1C7C25DC00C794C0 /* aestab.c in Sources */,
9F394D7D1C7C25DC00C794C0 /* aescrypt.c in Sources */, 9F394D7D1C7C25DC00C794C0 /* aescrypt.c in Sources */,
9F394D801C7C25DC00C794C0 /* entropy.c in Sources */, 9F394D801C7C25DC00C794C0 /* entropy.c in Sources */,
9F292F7D1C7C44290095945D /* RCTPushyDownloader.m in Sources */,
249F2F64261C58C700A1E60E /* Lzma2Dec.c in Sources */, 249F2F64261C58C700A1E60E /* Lzma2Dec.c in Sources */,
249F2F55261C584900A1E60E /* hpatch.c in Sources */, 249F2F55261C584900A1E60E /* hpatch.c in Sources */,
9F394D831C7C25DC00C794C0 /* prng.c in Sources */, 9F394D831C7C25DC00C794C0 /* prng.c in Sources */,
9F394D861C7C25DC00C794C0 /* ioapi.c in Sources */, 9F394D861C7C25DC00C794C0 /* ioapi.c in Sources */,
A3FD91A82C3C01640022D27F /* RCTPushyDownloader.mm in Sources */,
9F1BCB461CAF6B3E000EF2CB /* bspatch.c in Sources */, 9F1BCB461CAF6B3E000EF2CB /* bspatch.c in Sources */,
A3FD91A62C3C01600022D27F /* RCTPushy.mm in Sources */,
9F394D8A1C7C25DC00C794C0 /* SSZipArchive.m in Sources */, 9F394D8A1C7C25DC00C794C0 /* SSZipArchive.m in Sources */,
249F2F50261C577300A1E60E /* HDiffPatch.m in Sources */, 249F2F50261C577300A1E60E /* HDiffPatch.m in Sources */,
A3FD91AA2C3C01680022D27F /* RCTPushyManager.mm in Sources */,
9F394D891C7C25DC00C794C0 /* zip.c in Sources */, 9F394D891C7C25DC00C794C0 /* zip.c in Sources */,
9F394D841C7C25DC00C794C0 /* pwd2key.c in Sources */, 9F394D841C7C25DC00C794C0 /* pwd2key.c in Sources */,
249F2F59261C586900A1E60E /* file_for_patch.c in Sources */, 249F2F59261C586900A1E60E /* file_for_patch.c in Sources */,
91C5F0051C76ECA90037E727 /* RCTPushy.m in Sources */,
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
}; };

View File

@@ -16,7 +16,6 @@ static NSString *const paramLastVersion = @"lastVersion";
static NSString *const paramCurrentVersion = @"currentVersion"; static NSString *const paramCurrentVersion = @"currentVersion";
static NSString *const paramIsFirstTime = @"isFirstTime"; static NSString *const paramIsFirstTime = @"isFirstTime";
static NSString *const paramIsFirstLoadOk = @"isFirstLoadOK"; static NSString *const paramIsFirstLoadOk = @"isFirstLoadOK";
static NSString *const keyBlockUpdate = @"REACTNATIVECN_PUSHY_BLOCKUPDATE";
static NSString *const keyUuid = @"REACTNATIVECN_PUSHY_UUID"; static NSString *const keyUuid = @"REACTNATIVECN_PUSHY_UUID";
static NSString *const keyHashInfo = @"REACTNATIVECN_PUSHY_HASH_"; static NSString *const keyHashInfo = @"REACTNATIVECN_PUSHY_HASH_";
static NSString *const keyFirstLoadMarked = @"REACTNATIVECN_PUSHY_FIRSTLOADMARKED_KEY"; static NSString *const keyFirstLoadMarked = @"REACTNATIVECN_PUSHY_FIRSTLOADMARKED_KEY";
@@ -157,7 +156,6 @@ RCT_EXPORT_MODULE(RCTPushy);
ret[@"buildTime"] = [RCTPushy buildTime]; ret[@"buildTime"] = [RCTPushy buildTime];
ret[@"rolledBackVersion"] = [defaults objectForKey:keyRolledBackMarked]; ret[@"rolledBackVersion"] = [defaults objectForKey:keyRolledBackMarked];
ret[@"isFirstTime"] = [defaults objectForKey:keyFirstLoadMarked]; ret[@"isFirstTime"] = [defaults objectForKey:keyFirstLoadMarked];
ret[@"blockUpdate"] = [defaults objectForKey:keyBlockUpdate];
ret[@"uuid"] = [defaults objectForKey:keyUuid]; ret[@"uuid"] = [defaults objectForKey:keyUuid];
NSDictionary *pushyInfo = [defaults dictionaryForKey:keyPushyInfo]; NSDictionary *pushyInfo = [defaults dictionaryForKey:keyPushyInfo];
ret[@"currentVersion"] = [pushyInfo objectForKey:paramCurrentVersion]; ret[@"currentVersion"] = [pushyInfo objectForKey:paramCurrentVersion];
@@ -192,24 +190,6 @@ RCT_EXPORT_MODULE(RCTPushy);
return self; return self;
} }
RCT_EXPORT_METHOD(setBlockUpdate:(NSDictionary *)options
resolver:(RCTPromiseResolveBlock)resolve
rejecter:(RCTPromiseRejectBlock)reject)
{
// NSMutableDictionary *blockUpdateInfo = [NSMutableDictionary new];
// blockUpdateInfo[@"reason"] = options[@"reason"];
// blockUpdateInfo[@"until"] = options[@"until"];
@try {
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
[defaults setObject:options forKey:keyBlockUpdate];
[defaults synchronize];
resolve(@true);
}
@catch (NSException *exception) {
reject(@"执行报错", nil, nil);
}
}
RCT_EXPORT_METHOD(setUuid:(NSString *)uuid resolver:(RCTPromiseResolveBlock)resolve RCT_EXPORT_METHOD(setUuid:(NSString *)uuid resolver:(RCTPromiseResolveBlock)resolve
rejecter:(RCTPromiseRejectBlock)reject) rejecter:(RCTPromiseRejectBlock)reject)
{ {

View File

@@ -1,10 +1,11 @@
{ {
"name": "react-native-update", "name": "react-native-update",
"version": "10.1.0", "version": "10.7.2",
"description": "react-native hot update", "description": "react-native hot update",
"main": "src/index.ts", "main": "src/index",
"scripts": { "scripts": {
"prepublish": "yarn submodule", "prepack": "yarn submodule && yarn lint",
"lint": "eslint \"src/*.@(ts|tsx|js|jsx)\" && tsc --noEmit",
"submodule": "git submodule update --init --recursive", "submodule": "git submodule update --init --recursive",
"test": "echo \"Error: no test specified\" && exit 1", "test": "echo \"Error: no test specified\" && exit 1",
"build-lib": "yarn submodule && $ANDROID_HOME/ndk/20.1.5948944/ndk-build NDK_PROJECT_PATH=android APP_BUILD_SCRIPT=android/jni/Android.mk NDK_APPLICATION_MK=android/jni/Application.mk NDK_LIBS_OUT=android/lib", "build-lib": "yarn submodule && $ANDROID_HOME/ndk/20.1.5948944/ndk-build NDK_PROJECT_PATH=android APP_BUILD_SCRIPT=android/jni/Android.mk NDK_APPLICATION_MK=android/jni/Application.mk NDK_LIBS_OUT=android/lib",
@@ -47,25 +48,25 @@
"nanoid": "^3.3.3" "nanoid": "^3.3.3"
}, },
"codegenConfig": { "codegenConfig": {
"libraries": [
{
"name": "RCTPushySpec", "name": "RCTPushySpec",
"type": "modules", "type": "modules",
"jsSrcsDir": "lib" "jsSrcsDir": "src"
}
]
}, },
"devDependencies": { "devDependencies": {
"@babel/core": "^7.24.0",
"@react-native/babel-preset": "^0.73.21",
"@react-native/eslint-config": "^0.73.2", "@react-native/eslint-config": "^0.73.2",
"@react-native/typescript-config": "^0.74.0",
"@types/fs-extra": "^9.0.13", "@types/fs-extra": "^9.0.13",
"@types/jest": "^29.2.1", "@types/jest": "^29.2.1",
"@types/node": "^20.8.9", "@types/node": "^20.8.9",
"@types/react": "^18.2.46", "@types/react": "^18.2.46",
"detox": "^20.5.0", "detox": "^20.5.0",
"eslint": "^8.56.0", "eslint": "^8.57.0",
"eslint-plugin-ft-flow": "^3.0.7",
"firebase-tools": "^11.24.1", "firebase-tools": "^11.24.1",
"fs-extra": "^9.1.0", "fs-extra": "^9.1.0",
"jest": "^29.2.1", "jest": "^29.7.0",
"pod-install": "^0.1.37", "pod-install": "^0.1.37",
"prettier": "^2", "prettier": "^2",
"react": "18.2.0", "react": "18.2.0",

View File

@@ -1,5 +1,4 @@
import type { TurboModule } from 'react-native/Libraries/TurboModule/RCTExport'; import { TurboModule, TurboModuleRegistry } from 'react-native';
import { TurboModuleRegistry } from 'react-native';
export interface Spec extends TurboModule { export interface Spec extends TurboModule {
getConstants: () => { getConstants: () => {

View File

@@ -1,10 +1,7 @@
import { CheckResult, PushyOptions, ProgressData, EventType } from './type'; import { CheckResult, PushyOptions, ProgressData, EventType } from './type';
import { assertRelease, log } from './utils'; import { log, testUrls } from './utils';
import { import { EmitterSubscription, Platform } from 'react-native';
EmitterSubscription, import { PermissionsAndroid } from './permissions';
PermissionsAndroid,
Platform,
} from 'react-native';
import { import {
PushyModule, PushyModule,
buildTime, buildTime,
@@ -21,42 +18,50 @@ const defaultServer = {
main: 'https://update.react-native.cn/api', main: 'https://update.react-native.cn/api',
backups: ['https://update.reactnative.cn/api'], backups: ['https://update.reactnative.cn/api'],
queryUrl: queryUrl:
'https://raw.githubusercontent.com/reactnativecn/react-native-pushy/master/endpoints.json', 'https://cdn.jsdelivr.net/gh/reactnativecn/react-native-pushy@master/endpoints.json',
}; };
const empty = {}; const empty = {};
const noop = () => {}; const noop = () => {};
if (Platform.OS === 'web') {
console.warn('react-native-update 不支持 web 端热更,不会执行操作');
}
export class Pushy { export class Pushy {
options: PushyOptions = { options: PushyOptions = {
appKey: '', appKey: '',
server: defaultServer, server: defaultServer,
autoMarkSuccess: true, autoMarkSuccess: true,
useAlert: true, updateStrategy: __DEV__ ? 'alwaysAlert' : 'alertUpdateAndIgnoreError',
strategy: 'both', checkStrategy: 'both',
logger: noop, logger: noop,
debug: false,
}; };
lastChecking: number; lastChecking?: number;
lastResult: CheckResult; lastRespJson?: Promise<any>;
progressHandlers: Record<string, EmitterSubscription> = {}; progressHandlers: Record<string, EmitterSubscription> = {};
downloadedHash: string; downloadedHash?: string;
marked = false; marked = false;
applyingUpdate = false; applyingUpdate = false;
version = cInfo.pushy; version = cInfo.pushy;
constructor(options: PushyOptions) { constructor(options: PushyOptions) {
if (Platform.OS === 'ios' || Platform.OS === 'android') {
if (!options.appKey) { if (!options.appKey) {
throw new Error('appKey is required'); throw new Error('appKey is required');
} }
}
this.setOptions(options); this.setOptions(options);
} }
setOptions = (options: Partial<PushyOptions>) => { setOptions = (options: Partial<PushyOptions>) => {
for (const [key, value] of Object.entries(options)) { for (const [key, value] of Object.entries(options)) {
if (value !== undefined) { if (value !== undefined) {
// @ts-expect-error
this.options[key] = value; this.options[key] = value;
if (key === 'logger') { if (key === 'logger') {
if (isRolledBack) { if (isRolledBack) {
@@ -111,8 +116,7 @@ export class Pushy {
return true; return true;
}; };
markSuccess = () => { markSuccess = () => {
assertRelease(); if (this.marked || __DEV__) {
if (this.marked) {
return; return;
} }
this.marked = true; this.marked = true;
@@ -120,7 +124,12 @@ export class Pushy {
this.report({ type: 'markSuccess' }); this.report({ type: 'markSuccess' });
}; };
switchVersion = (hash: string) => { switchVersion = (hash: string) => {
assertRelease(); if (__DEV__) {
console.warn(
'您调用了switchVersion方法但是当前是开发环境不会进行任何操作。',
);
return;
}
if (this.assertHash(hash) && !this.applyingUpdate) { if (this.assertHash(hash) && !this.applyingUpdate) {
log('switchVersion: ' + hash); log('switchVersion: ' + hash);
this.applyingUpdate = true; this.applyingUpdate = true;
@@ -129,41 +138,59 @@ export class Pushy {
}; };
switchVersionLater = (hash: string) => { switchVersionLater = (hash: string) => {
assertRelease(); if (__DEV__) {
console.warn(
'您调用了switchVersionLater方法但是当前是开发环境不会进行任何操作。',
);
return;
}
if (this.assertHash(hash)) { if (this.assertHash(hash)) {
log('switchVersionLater: ' + hash); log('switchVersionLater: ' + hash);
PushyModule.setNeedUpdate({ hash }); PushyModule.setNeedUpdate({ hash });
} }
}; };
checkUpdate = async () => { checkUpdate = async () => {
assertRelease(); if (__DEV__ && !this.options.debug) {
console.info(
'您当前处于开发环境且未启用 debug不会进行热更检查。如需在开发环境中调试热更请在 client 中设置 debug 为 true',
);
return;
}
if (Platform.OS === 'web') {
console.warn('web 端不支持热更新检查');
return;
}
const now = Date.now(); const now = Date.now();
if ( if (
this.lastResult && this.lastRespJson &&
this.lastChecking && this.lastChecking &&
now - this.lastChecking < 1000 * 5 now - this.lastChecking < 1000 * 5
) { ) {
return this.lastResult; return await this.lastRespJson;
} }
this.lastChecking = now; this.lastChecking = now;
this.report({ type: 'checking' }); this.report({ type: 'checking' });
const fetchBody = {
packageVersion,
hash: currentVersion,
buildTime,
cInfo,
};
if (__DEV__) {
delete fetchBody.buildTime;
}
const fetchPayload = { const fetchPayload = {
method: 'POST', method: 'POST',
headers: { headers: {
Accept: 'application/json', Accept: 'application/json',
'Content-Type': 'application/json', 'Content-Type': 'application/json',
}, },
body: JSON.stringify({ body: JSON.stringify(fetchBody),
packageVersion,
hash: currentVersion,
buildTime,
cInfo,
}),
}; };
let resp; let resp;
try { try {
resp = await fetch(this.getCheckUrl(), fetchPayload); resp = await fetch(this.getCheckUrl(), fetchPayload);
} catch (e) { } catch (e: any) {
this.report({ this.report({
type: 'errorChecking', type: 'errorChecking',
message: 'Can not connect to update server. Trying backup endpoints.', message: 'Can not connect to update server. Trying backup endpoints.',
@@ -172,7 +199,7 @@ export class Pushy {
if (backupEndpoints) { if (backupEndpoints) {
try { try {
resp = await Promise.race( resp = await Promise.race(
backupEndpoints.map((endpoint) => backupEndpoints.map(endpoint =>
fetch(this.getCheckUrl(endpoint), fetchPayload), fetch(this.getCheckUrl(endpoint), fetchPayload),
), ),
); );
@@ -184,11 +211,11 @@ export class Pushy {
type: 'errorChecking', type: 'errorChecking',
message: 'Can not connect to update server. Please check your network.', message: 'Can not connect to update server. Please check your network.',
}); });
return this.lastResult || empty; return this.lastRespJson ? await this.lastRespJson : empty;
} }
const result: CheckResult = await resp.json(); this.lastRespJson = resp.json();
this.lastResult = result; const result: CheckResult = await this.lastRespJson;
if (resp.status !== 200) { if (resp.status !== 200) {
this.report({ this.report({
@@ -214,7 +241,7 @@ export class Pushy {
new Set([...(server.backups || []), ...remoteEndpoints]), new Set([...(server.backups || []), ...remoteEndpoints]),
); );
} }
} catch (e) { } catch (e: any) {
log('failed to fetch endpoints from: ', server.queryUrl); log('failed to fetch endpoints from: ', server.queryUrl);
} }
} }
@@ -224,9 +251,18 @@ export class Pushy {
info: CheckResult, info: CheckResult,
onDownloadProgress?: (data: ProgressData) => void, onDownloadProgress?: (data: ProgressData) => void,
) => { ) => {
assertRelease(); const {
const { hash, diffUrl, pdiffUrl, updateUrl, name, description, metaInfo } = hash,
info; diffUrl: _diffUrl,
diffUrls,
pdiffUrl: _pdiffUrl,
pdiffUrls,
updateUrl: _updateUrl,
updateUrls,
name,
description,
metaInfo,
} = info;
if (!info.update || !hash) { if (!info.update || !hash) {
return; return;
} }
@@ -244,7 +280,7 @@ export class Pushy {
if (onDownloadProgress) { if (onDownloadProgress) {
this.progressHandlers[hash] = pushyNativeEventEmitter.addListener( this.progressHandlers[hash] = pushyNativeEventEmitter.addListener(
'RCTPushyDownloadProgress', 'RCTPushyDownloadProgress',
(progressData) => { progressData => {
if (progressData.hash === hash) { if (progressData.hash === hash) {
onDownloadProgress(progressData); onDownloadProgress(progressData);
} }
@@ -253,6 +289,7 @@ export class Pushy {
} }
let succeeded = false; let succeeded = false;
this.report({ type: 'downloading' }); this.report({ type: 'downloading' });
const diffUrl = (await testUrls(diffUrls)) || _diffUrl;
if (diffUrl) { if (diffUrl) {
log('downloading diff'); log('downloading diff');
try { try {
@@ -262,10 +299,15 @@ export class Pushy {
originHash: currentVersion, originHash: currentVersion,
}); });
succeeded = true; succeeded = true;
} catch (e) { } catch (e: any) {
if (__DEV__) {
succeeded = true;
} else {
log(`diff error: ${e.message}, try pdiff`); log(`diff error: ${e.message}, try pdiff`);
} }
} }
}
const pdiffUrl = (await testUrls(pdiffUrls)) || _pdiffUrl;
if (!succeeded && pdiffUrl) { if (!succeeded && pdiffUrl) {
log('downloading pdiff'); log('downloading pdiff');
try { try {
@@ -274,10 +316,15 @@ export class Pushy {
hash, hash,
}); });
succeeded = true; succeeded = true;
} catch (e) { } catch (e: any) {
if (__DEV__) {
succeeded = true;
} else {
log(`pdiff error: ${e.message}, try full patch`); log(`pdiff error: ${e.message}, try full patch`);
} }
} }
}
const updateUrl = (await testUrls(updateUrls)) || _updateUrl;
if (!succeeded && updateUrl) { if (!succeeded && updateUrl) {
log('downloading full patch'); log('downloading full patch');
try { try {
@@ -286,14 +333,21 @@ export class Pushy {
hash, hash,
}); });
succeeded = true; succeeded = true;
} catch (e) { } catch (e: any) {
if (__DEV__) {
succeeded = true;
} else {
log(`full patch error: ${e.message}`); log(`full patch error: ${e.message}`);
} }
} }
}
if (this.progressHandlers[hash]) { if (this.progressHandlers[hash]) {
this.progressHandlers[hash].remove(); this.progressHandlers[hash].remove();
delete this.progressHandlers[hash]; delete this.progressHandlers[hash];
} }
if (__DEV__) {
return hash;
}
if (!succeeded) { if (!succeeded) {
return this.report({ return this.report({
type: 'errorUpdate', type: 'errorUpdate',
@@ -325,7 +379,7 @@ export class Pushy {
if (granted !== PermissionsAndroid.RESULTS.GRANTED) { if (granted !== PermissionsAndroid.RESULTS.GRANTED) {
return this.report({ type: 'rejectStoragePermission' }); return this.report({ type: 'rejectStoragePermission' });
} }
} catch (err) { } catch (e: any) {
return this.report({ type: 'errorStoragePermission' }); return this.report({ type: 'errorStoragePermission' });
} }
} }
@@ -345,7 +399,7 @@ export class Pushy {
target: 'update.apk', target: 'update.apk',
hash: progressKey, hash: progressKey,
}).catch(() => { }).catch(() => {
this.report({ type: 'errowDownloadAndInstallApk' }); this.report({ type: 'errorDownloadAndInstallApk' });
}); });
if (this.progressHandlers[progressKey]) { if (this.progressHandlers[progressKey]) {
this.progressHandlers[progressKey].remove(); this.progressHandlers[progressKey].remove();

View File

@@ -1,13 +0,0 @@
const noop = () => {};
export class Pushy {
constructor() {
console.warn(
'react-native-update is not supported and will do nothing on web.',
);
return new Proxy(this, {
get() {
return noop;
},
});
}
}

View File

@@ -2,29 +2,35 @@ import { createContext, useContext } from 'react';
import { CheckResult, ProgressData } from './type'; import { CheckResult, ProgressData } from './type';
import { Pushy } from './client'; import { Pushy } from './client';
const empty = {};
const noop = () => {}; const noop = () => {};
const asyncNoop = () => Promise.resolve();
export const defaultContext = { export const defaultContext = {
checkUpdate: () => Promise.resolve(empty), checkUpdate: asyncNoop,
switchVersion: noop, switchVersion: noop,
switchVersionLater: noop, switchVersionLater: noop,
markSuccess: noop, markSuccess: noop,
dismissError: noop, dismissError: noop,
downloadUpdate: noop, downloadUpdate: asyncNoop,
downloadAndInstallApk: noop, downloadAndInstallApk: asyncNoop,
getCurrentVersionInfo: () => Promise.resolve({}),
currentHash: '', currentHash: '',
packageVersion: '', packageVersion: '',
}; };
export const PushyContext = createContext<{ export const PushyContext = createContext<{
checkUpdate: () => void; checkUpdate: () => Promise<void>;
switchVersion: () => void; switchVersion: () => void;
switchVersionLater: () => void; switchVersionLater: () => void;
markSuccess: () => void; markSuccess: () => void;
dismissError: () => void; dismissError: () => void;
downloadUpdate: () => void; downloadUpdate: () => Promise<void>;
downloadAndInstallApk: (url: string) => void; downloadAndInstallApk: (url: string) => Promise<void>;
getCurrentVersionInfo: () => Promise<{
name?: string;
description?: string;
metaInfo?: string;
}>;
currentHash: string; currentHash: string;
packageVersion: string; packageVersion: string;
client?: Pushy; client?: Pushy;

View File

@@ -1,13 +1,18 @@
import { NativeEventEmitter, NativeModules, Platform } from 'react-native'; import { NativeEventEmitter, NativeModules, Platform } from 'react-native';
import { log } from './utils'; import { emptyModule, log } from './utils';
const { const {
version: v, version: v,
} = require('react-native/Libraries/Core/ReactNativeVersion'); } = require('react-native/Libraries/Core/ReactNativeVersion');
const RNVersion = `${v.major}.${v.minor}.${v.patch}`; const RNVersion = `${v.major}.${v.minor}.${v.patch}`;
const isTurboModuleEnabled = global.__turboModuleProxy != null; const isTurboModuleEnabled =
// @ts-expect-error
global.__turboModuleProxy != null;
export const PushyModule = isTurboModuleEnabled export const PushyModule =
? require('./turboModuleSpec').default Platform.OS === 'web'
? emptyModule
: isTurboModuleEnabled
? require('./NativePushy').default
: NativeModules.Pushy; : NativeModules.Pushy;
if (!PushyModule) { if (!PushyModule) {

View File

@@ -0,0 +1 @@
export { PermissionsAndroid } from 'react-native';

4
src/permissions.ts Normal file
View File

@@ -0,0 +1,4 @@
import type { PermissionsAndroidStatic } from 'react-native';
import { emptyModule } from './utils';
export const PermissionsAndroid = emptyModule as PermissionsAndroidStatic;

View File

@@ -13,7 +13,12 @@ import {
Linking, Linking,
} from 'react-native'; } from 'react-native';
import { Pushy } from './client'; import { Pushy } from './client';
import { currentVersion, isFirstTime, packageVersion } from './core'; import {
currentVersion,
isFirstTime,
packageVersion,
getCurrentVersionInfo,
} from './core';
import { CheckResult, ProgressData } from './type'; import { CheckResult, ProgressData } from './type';
import { PushyContext } from './context'; import { PushyContext } from './context';
@@ -27,20 +32,34 @@ export const PushyProvider = ({
const { options } = client; const { options } = client;
const stateListener = useRef<NativeEventSubscription>(); const stateListener = useRef<NativeEventSubscription>();
const [updateInfo, setUpdateInfo] = useState<CheckResult>(); const [updateInfo, setUpdateInfo] = useState<CheckResult>();
const updateInfoRef = useRef(updateInfo);
const [progress, setProgress] = useState<ProgressData>(); const [progress, setProgress] = useState<ProgressData>();
const [lastError, setLastError] = useState<Error>(); const [lastError, setLastError] = useState<Error>();
const lastChecking = useRef(0);
const dismissError = useCallback(() => { const dismissError = useCallback(() => {
setLastError(undefined); setLastError(undefined);
}, []); }, []);
const showAlert = useCallback( const alertUpdate = useCallback(
(...args: Parameters<typeof Alert.alert>) => { (...args: Parameters<typeof Alert.alert>) => {
if (options.useAlert) { if (
options.updateStrategy === 'alwaysAlert' ||
options.updateStrategy === 'alertUpdateAndIgnoreError'
) {
Alert.alert(...args); Alert.alert(...args);
} }
}, },
[options], [options.updateStrategy],
);
const alertError = useCallback(
(...args: Parameters<typeof Alert.alert>) => {
if (options.updateStrategy === 'alwaysAlert') {
Alert.alert(...args);
}
},
[options.updateStrategy],
); );
const switchVersion = useCallback(() => { const switchVersion = useCallback(() => {
@@ -55,17 +74,23 @@ export const PushyProvider = ({
} }
}, [client, updateInfo]); }, [client, updateInfo]);
const downloadUpdate = useCallback(async () => { const downloadUpdate = useCallback(
if (!updateInfo || !updateInfo.update) { async (info: CheckResult | undefined = updateInfoRef.current) => {
if (!info || !info.update) {
return; return;
} }
try { try {
const hash = await client.downloadUpdate(updateInfo, setProgress); const hash = await client.downloadUpdate(info, setProgress);
if (!hash) { if (!hash) {
return; return;
} }
stateListener.current && stateListener.current.remove(); stateListener.current && stateListener.current.remove();
showAlert('提示', '下载完毕,是否立即更新?', [ if (options.updateStrategy === 'silentAndNow') {
return client.switchVersion(hash);
} else if (options.updateStrategy === 'silentAndLater') {
return client.switchVersionLater(hash);
}
alertUpdate('提示', '下载完毕,是否立即更新?', [
{ {
text: '下次再说', text: '下次再说',
style: 'cancel', style: 'cancel',
@@ -81,49 +106,74 @@ export const PushyProvider = ({
}, },
}, },
]); ]);
} catch (err) { } catch (e: any) {
setLastError(err); setLastError(e);
showAlert('更新失败', err.message); alertError('更新失败', e.message);
} }
}, [client, showAlert, updateInfo]); },
[alertError, client, options.updateStrategy, alertUpdate],
);
const downloadAndInstallApk = useCallback( const downloadAndInstallApk = useCallback(
(downloadUrl: string) => { async (downloadUrl: string) => {
if (Platform.OS === 'android' && downloadUrl) { if (Platform.OS === 'android' && downloadUrl) {
client.downloadAndInstallApk(downloadUrl, setProgress); await client.downloadAndInstallApk(downloadUrl, setProgress);
} }
}, },
[client], [client],
); );
const checkUpdate = useCallback(async () => { const checkUpdate = useCallback(async () => {
const now = Date.now();
if (lastChecking.current && now - lastChecking.current < 1000) {
return;
}
lastChecking.current = now;
let info: CheckResult; let info: CheckResult;
try { try {
info = await client.checkUpdate(); info = await client.checkUpdate();
} catch (err) { } catch (e: any) {
setLastError(err); setLastError(e);
showAlert('更新检查失败', err.message); alertError('更新检查失败', e.message);
return; return;
} }
if (!info) {
return;
}
updateInfoRef.current = info;
setUpdateInfo(info); setUpdateInfo(info);
if (info.expired) { if (info.expired) {
const { downloadUrl } = info; const { downloadUrl } = info;
showAlert('提示', '您的应用版本已更新,点击更新下载安装新版本', [
{
text: '更新',
onPress: () => {
if (downloadUrl) { if (downloadUrl) {
if (options.updateStrategy === 'silentAndNow') {
if (Platform.OS === 'android' && downloadUrl.endsWith('.apk')) { if (Platform.OS === 'android' && downloadUrl.endsWith('.apk')) {
downloadAndInstallApk(downloadUrl); downloadAndInstallApk(downloadUrl);
} else { } else {
Linking.openURL(downloadUrl); Linking.openURL(downloadUrl);
} }
return;
}
alertUpdate('提示', '您的应用版本已更新,点击更新下载安装新版本', [
{
text: '更新',
onPress: () => {
if (Platform.OS === 'android' && downloadUrl.endsWith('.apk')) {
downloadAndInstallApk(downloadUrl);
} else {
Linking.openURL(downloadUrl);
} }
}, },
}, },
]); ]);
}
} else if (info.update) { } else if (info.update) {
showAlert( if (
options.updateStrategy === 'silentAndNow' ||
options.updateStrategy === 'silentAndLater'
) {
return downloadUpdate(info);
}
alertUpdate(
'提示', '提示',
'检查到新的版本' + info.name + ',是否下载?\n' + info.description, '检查到新的版本' + info.name + ',是否下载?\n' + info.description,
[ [
@@ -138,26 +188,39 @@ export const PushyProvider = ({
], ],
); );
} }
}, [client, downloadAndInstallApk, downloadUpdate, showAlert]); }, [
alertError,
client,
downloadAndInstallApk,
downloadUpdate,
options.updateStrategy,
alertUpdate,
]);
const markSuccess = client.markSuccess; const markSuccess = client.markSuccess;
useEffect(() => { useEffect(() => {
const { strategy, dismissErrorAfter, autoMarkSuccess } = options; if (__DEV__ && !options.debug) {
console.info(
'您当前处于开发环境且未启用debug不会进行热更检查。如需在开发环境中调试热更请在client中设置debug为true',
);
return;
}
const { checkStrategy, dismissErrorAfter, autoMarkSuccess } = options;
if (isFirstTime && autoMarkSuccess) { if (isFirstTime && autoMarkSuccess) {
markSuccess(); markSuccess();
} }
if (strategy === 'both' || strategy === 'onAppResume') { if (checkStrategy === 'both' || checkStrategy === 'onAppResume') {
stateListener.current = AppState.addEventListener( stateListener.current = AppState.addEventListener(
'change', 'change',
(nextAppState) => { nextAppState => {
if (nextAppState === 'active') { if (nextAppState === 'active') {
checkUpdate(); checkUpdate();
} }
}, },
); );
} }
if (strategy === 'both' || strategy === 'onAppStart') { if (checkStrategy === 'both' || checkStrategy === 'onAppStart') {
checkUpdate(); checkUpdate();
} }
let dismissErrorTimer: ReturnType<typeof setTimeout>; let dismissErrorTimer: ReturnType<typeof setTimeout>;
@@ -188,8 +251,8 @@ export const PushyProvider = ({
currentHash: currentVersion, currentHash: currentVersion,
progress, progress,
downloadAndInstallApk, downloadAndInstallApk,
}} getCurrentVersionInfo,
> }}>
{children} {children}
</PushyContext.Provider> </PushyContext.Provider>
); );

View File

@@ -1,2 +0,0 @@
import { Fragment } from 'react';
export const PushyProvider = Fragment;

View File

@@ -8,8 +8,11 @@ export interface CheckResult {
description?: string; description?: string;
metaInfo?: string; metaInfo?: string;
pdiffUrl?: string; pdiffUrl?: string;
pdiffUrls?: string[];
diffUrl?: string; diffUrl?: string;
diffUrls?: string[];
updateUrl?: string; updateUrl?: string;
updateUrls?: string[];
paused?: 'app' | 'package'; paused?: 'app' | 'package';
message?: string; message?: string;
} }
@@ -30,7 +33,7 @@ export type EventType =
| 'downloadingApk' | 'downloadingApk'
| 'rejectStoragePermission' | 'rejectStoragePermission'
| 'errorStoragePermission' | 'errorStoragePermission'
| 'errowDownloadAndInstallApk'; | 'errorDownloadAndInstallApk';
export interface EventData { export interface EventData {
currentVersion: string; currentVersion: string;
@@ -66,8 +69,14 @@ export interface PushyOptions {
appKey: string; appKey: string;
server?: PushyServerConfig; server?: PushyServerConfig;
logger?: UpdateEventsLogger; logger?: UpdateEventsLogger;
useAlert?: boolean; updateStrategy?:
strategy?: 'onAppStart' | 'onAppResume' | 'both'; | 'alwaysAlert'
| 'alertUpdateAndIgnoreError'
| 'silentAndNow'
| 'silentAndLater'
| null;
checkStrategy?: 'onAppStart' | 'onAppResume' | 'both' | null;
autoMarkSuccess?: boolean; autoMarkSuccess?: boolean;
dismissErrorAfter?: number; dismissErrorAfter?: number;
debug?: boolean;
} }

View File

@@ -1,9 +1,39 @@
import { Platform } from 'react-native';
export function log(...args: any[]) { export function log(...args: any[]) {
console.log('pushy: ', ...args); console.log('pushy: ', ...args);
} }
export function assertRelease() { const noop = () => {};
if (__DEV__) { class EmptyModule {
throw new Error('react-native-update 只能在 RELEASE 版本中运行.'); constructor() {
return new Proxy(this, {
get() {
return noop;
},
});
} }
} }
export const emptyModule = new EmptyModule();
const ping =
Platform.OS === 'web'
? Promise.resolve
: async (url: string) =>
Promise.race([
fetch(url, {
method: 'HEAD',
})
.then(({ status }) => (status === 200 ? url : null))
.catch(() => null),
new Promise(r => setTimeout(() => r(null), 2000)),
]);
const canUseGoogle = ping('https://www.google.com');
export const testUrls = async (urls?: string[]) => {
if (!urls?.length || (await canUseGoogle)) {
return null;
}
return Promise.race(urls.map(ping)).catch(() => null);
};

6
tea.yaml Normal file
View File

@@ -0,0 +1,6 @@
# https://tea.xyz/what-is-this-file
---
version: 1.0.0
codeOwners:
- '0x10D90dC0034E2e82F0AC55954B3ed4EC0550ECe7'
quorum: 1

4
tsconfig.json Normal file
View File

@@ -0,0 +1,4 @@
{
"extends": "@react-native/typescript-config/tsconfig.json",
"include": ["src/**/*"]
}

924
yarn.lock

File diff suppressed because it is too large Load Diff