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

Compare commits

..

17 Commits

Author SHA1 Message Date
sunnylqm
84381e5ed7 Increment version in package.json to 10.34.7 and update podspec to simplify public header files for Expo dependency. 2025-10-22 16:03:54 +08:00
sunnylqm
8970fd406d bump 2025-10-22 14:53:59 +08:00
sunnylqm
34d6fef493 revert react header 2025-10-22 14:19:40 +08:00
sunnylqm
84b71e33a8 support expo 54 2025-10-21 22:23:49 +08:00
sunnylqm
6cd99dece0 Increment version in package.json to 10.34.5, remove obsolete ImportReact.h file, and update podspec to eliminate unnecessary public header files for Expo dependency. 2025-10-21 11:57:09 +08:00
sunnylqm
d726f3602b Update app.json to include package name, modify index.js to use expo-router, and upgrade dependencies in package.json for improved compatibility and features. 2025-10-19 17:40:18 +08:00
sunnylqm
da21c99bcc Update react-native-update dependency to version 10.34.4 in package.json, bun.lock, and Podfile.lock. Add additional flags for Folly configuration in Xcode project settings. 2025-10-18 23:18:23 +08:00
sunnylqm
1f8748375c Enhance Pushy class to support locale configuration in i18n initialization by adding optional locale property to ClientOptions interface. 2025-10-17 16:03:54 +08:00
sunnylqm
fa731cd583 Increment version in package.json to 10.34.4. 2025-10-16 12:56:53 +08:00
sunnylqm
d077dcb6d3 Update submodule references for HDiffPatch and lzma to v3.1.1 commits. 2025-10-16 12:49:59 +08:00
sunnylqm
59b60fdc6d Update .gitmodules to reflect new submodule paths for HDiffPatch and lzma, and increment version in package.json to 10.34.3. 2025-10-16 11:35:39 +08:00
sunnylqm
c768705221 Update .gitmodules to add new submodules for HDiffPatch and lzma, and increment version in package.json to 10.34.2. 2025-10-16 11:13:22 +08:00
sunnylqm
57206dd2f1 Update .gitignore to exclude new harmony package files, remove submodule entries from .gitmodules, and increment version in package.json to 10.34.1. Refactor build-profile.json5 for consistency and update PushyFileJSBundleProvider to handle optional chaining. Remove obsolete pushy.har file and adjust dependencies in oh-package.json5 for clarity. 2025-10-16 00:48:17 +08:00
sunnylqm
4e27d906c3 Reorder properties in CheckResult object for consistency in UpdateProvider component. 2025-09-28 23:23:16 +08:00
sunnylqm
c24f469475 Refactor Pushy class to replace getCurrentVersionInfo with currentVersionInfo for improved clarity and consistency. 2025-09-28 21:57:56 +08:00
sunnylqm
8f8a29eda8 Update version in package.json from 10.34.0-beta.0 to 10.34.0 for stable release. 2025-09-24 16:56:28 +08:00
sunnylqm
a78542b214 Update version to 10.34.0-beta.0 in package.json and modify NDK version for build-lib script; update package manager to yarn@1.22.21. 2025-09-24 15:29:57 +08:00
31 changed files with 817 additions and 568 deletions

5
.gitignore vendored
View File

@@ -52,3 +52,8 @@ Example/testHotUpdate/harmony
Example/testHotUpdate/android/app/.cxx Example/testHotUpdate/android/app/.cxx
Example/harmony_use_pushy/libs Example/harmony_use_pushy/libs
**/mcp.json **/mcp.json
harmony/package
**/oh_modules
harmony/pushy/.preview

8
.gitmodules vendored
View File

@@ -4,9 +4,9 @@
[submodule "android/jni/HDiffPatch"] [submodule "android/jni/HDiffPatch"]
path = android/jni/HDiffPatch path = android/jni/HDiffPatch
url = https://github.com/sisong/HDiffPatch.git url = https://github.com/sisong/HDiffPatch.git
[submodule "harmony/src/main/cpp/HDiffPatch"] [submodule "harmony/pushy/src/main/cpp/HDiffPatch"]
path = harmony/src/main/cpp/HDiffPatch path = harmony/pushy/src/main/cpp/HDiffPatch
url = https://github.com/sisong/HDiffPatch.git url = https://github.com/sisong/HDiffPatch.git
[submodule "harmony/src/main/cpp/lzma"] [submodule "harmony/pushy/src/main/cpp/lzma"]
path = harmony/src/main/cpp/lzma path = harmony/pushy/src/main/cpp/lzma
url = https://github.com/sisong/lzma.git url = https://github.com/sisong/lzma.git

View File

@@ -20,7 +20,8 @@
"adaptiveIcon": { "adaptiveIcon": {
"foregroundImage": "./assets/adaptive-icon.png", "foregroundImage": "./assets/adaptive-icon.png",
"backgroundColor": "#ffffff" "backgroundColor": "#ffffff"
} },
"package": "com.anonymous.expoUsePushy"
}, },
"web": { "web": {
"favicon": "./assets/favicon.png" "favicon": "./assets/favicon.png"

File diff suppressed because it is too large Load Diff

View File

@@ -1,8 +1 @@
import { registerRootComponent } from 'expo'; import 'expo-router/entry';
import App from './App';
// registerRootComponent calls AppRegistry.registerComponent('main', () => App);
// It also ensures that whether you load the app in Expo Go or in a native build,
// the environment is set up appropriately
registerRootComponent(App);

View File

@@ -1,27 +1,50 @@
{ {
"name": "expousepushy", "name": "expousepushy",
"version": "1.0.0",
"main": "index.js", "main": "index.js",
"version": "1.0.0",
"scripts": { "scripts": {
"start": "expo start", "start": "expo start",
"reset-project": "node ./scripts/reset-project.js",
"android": "expo run:android", "android": "expo run:android",
"ios": "expo run:ios", "ios": "expo run:ios",
"web": "expo start --web" "web": "expo start --web",
"lint": "expo lint"
}, },
"dependencies": { "dependencies": {
"@expo/metro-runtime": "~4.0.1", "@expo/vector-icons": "^14.1.0",
"expo": "~52.0.46", "@react-navigation/bottom-tabs": "^7.3.10",
"expo-status-bar": "~2.0.1", "@react-navigation/elements": "^2.3.8",
"react": "18.3.1", "@react-navigation/native": "^7.1.6",
"react-dom": "18.3.1", "expo": "~53.0.22",
"react-native": "0.76.9", "expo-blur": "~14.1.5",
"react-native-update": "^10.30.3", "expo-constants": "~17.1.7",
"react-native-web": "~0.19.13" "expo-font": "~13.3.2",
"expo-haptics": "~14.1.4",
"expo-image": "~2.4.0",
"expo-linking": "~7.1.7",
"expo-router": "~5.1.5",
"expo-splash-screen": "~0.30.10",
"expo-status-bar": "~2.2.3",
"expo-symbols": "~0.4.5",
"expo-system-ui": "~5.0.11",
"expo-web-browser": "~14.2.0",
"react": "19.0.0",
"react-dom": "19.0.0",
"react-native": "0.79.6",
"react-native-gesture-handler": "~2.24.0",
"react-native-reanimated": "~3.17.4",
"react-native-safe-area-context": "5.4.0",
"react-native-screens": "~4.11.1",
"react-native-update": "^10.34.4",
"react-native-web": "~0.20.0",
"react-native-webview": "13.13.5"
}, },
"devDependencies": { "devDependencies": {
"@babel/core": "^7.25.2", "@babel/core": "^7.25.2",
"@types/react": "~18.3.12", "@types/react": "~19.0.10",
"typescript": "^5.3.3" "typescript": "~5.8.3",
"eslint": "^9.25.0",
"eslint-config-expo": "~9.2.0"
}, },
"private": true "private": true
} }

View File

@@ -1,41 +1,49 @@
{ {
"app": { app: {
"signingConfigs": [], signingConfigs: [],
"products": [ products: [
{ {
"name": "default", name: 'default',
"signingConfig": "default", signingConfig: 'default',
"compatibleSdkVersion": "5.0.0(12)", compatibleSdkVersion: '5.0.0(12)',
"runtimeOS": "HarmonyOS", runtimeOS: 'HarmonyOS',
"buildOption": { buildOption: {
"strictMode": { strictMode: {
"caseSensitiveCheck": true, caseSensitiveCheck: true,
"useNormalizedOHMUrl": true useNormalizedOHMUrl: true,
} },
} },
} },
], ],
"buildModeSet": [ buildModeSet: [
{ {
"name": "debug", name: 'debug',
}, },
{ {
"name": "release" name: 'release',
} },
] ],
}, },
"modules": [ modules: [
{ {
"name": "entry", name: 'entry',
"srcPath": "./entry", srcPath: './entry',
"targets": [ targets: [
{ {
"name": "default", name: 'default',
"applyToProducts": [ applyToProducts: ['default'],
"default" },
] ],
} },
] {
} name: 'pushy',
] srcPath: '../../../harmony/pushy',
targets: [
{
name: 'default',
applyToProducts: ['default'],
},
],
},
],
} }

View File

@@ -1,25 +1,26 @@
{ {
"meta": { "meta": {
"stableOrder": true "stableOrder": true,
"enableUnifiedLockfile": false
}, },
"lockfileVersion": 3, "lockfileVersion": 3,
"ATTENTION": "THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.", "ATTENTION": "THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.",
"specifiers": { "specifiers": {
"@rnoh/react-native-openharmony@0.72.38": "@rnoh/react-native-openharmony@0.72.38", "@rnoh/react-native-openharmony@0.72.38": "@rnoh/react-native-openharmony@0.72.38",
"pushy@../../node_modules/react-native-update/harmony": "pushy@../../node_modules/react-native-update/harmony" "pushy@../../node_modules/react-native-update/harmony/pushy": "pushy@../../node_modules/react-native-update/harmony/pushy"
}, },
"packages": { "packages": {
"@rnoh/react-native-openharmony@0.72.38": { "@rnoh/react-native-openharmony@0.72.38": {
"name": "@rnoh/react-native-openharmony", "name": "",
"version": "0.72.38", "version": "0.72.38",
"integrity": "sha512-br5SIrbB0OarSLirenleE7eTOX1lNccMJ7nb/G7qWTyJ7kW4DalmTXVKYpoT2qaOLls1uEE7McD1OjbZZM9jug==", "integrity": "sha512-br5SIrbB0OarSLirenleE7eTOX1lNccMJ7nb/G7qWTyJ7kW4DalmTXVKYpoT2qaOLls1uEE7McD1OjbZZM9jug==",
"resolved": "https://ohpm.openharmony.cn/ohpm/@rnoh/react-native-openharmony/-/react-native-openharmony-0.72.38.har", "resolved": "https://ohpm.openharmony.cn/ohpm/@rnoh/react-native-openharmony/-/react-native-openharmony-0.72.38.har",
"registryType": "ohpm" "registryType": "ohpm"
}, },
"pushy@../../node_modules/react-native-update/harmony": { "pushy@../../node_modules/react-native-update/harmony/pushy": {
"name": "pushy", "name": "pushy",
"version": "3.1.0-0.0.7", "version": "3.1.0-0.0.7",
"resolved": "../../node_modules/react-native-update/harmony", "resolved": "",
"registryType": "local", "registryType": "local",
"dependencies": { "dependencies": {
"@rnoh/react-native-openharmony": "^0.72.38" "@rnoh/react-native-openharmony": "^0.72.38"

View File

@@ -1,13 +1,12 @@
{ {
"name": "entry", name: 'entry',
"version": "1.0.0", version: '1.0.0',
"description": "Please describe the basic information.", description: 'Please describe the basic information.',
"main": "", main: '',
"author": "", author: '',
"license": "", license: '',
"dependencies": { dependencies: {
"@rnoh/react-native-openharmony": "0.72.38", '@rnoh/react-native-openharmony': '0.72.38',
"pushy": "file:../../node_modules/react-native-update/harmony/pushy.har", pushy: 'file:../../node_modules/react-native-update/harmony/pushy',
} },
} }

View File

@@ -1,6 +1,6 @@
import { appTasks } from '@ohos/hvigor-ohos-plugin'; import {appTasks} from '@ohos/hvigor-ohos-plugin';
export default { export default {
system: appTasks, /* Built-in plugin of Hvigor. It cannot be modified. */ system: appTasks /* Built-in plugin of Hvigor. It cannot be modified. */,
plugins:[] /* Custom plugin to extend the functionality of Hvigor. */ plugins: [] /* Custom plugin to extend the functionality of Hvigor. */,
} };

View File

@@ -12,7 +12,7 @@
"react-native-paper": "^5.14.5", "react-native-paper": "^5.14.5",
"react-native-safe-area-context": "^5.6.1", "react-native-safe-area-context": "^5.6.1",
"react-native-svg": "^15.13.0", "react-native-svg": "^15.13.0",
"react-native-update": "^10.31.2", "react-native-update": "^10.34.4",
"react-native-vector-icons": "^10.3.0", "react-native-vector-icons": "^10.3.0",
}, },
"devDependencies": { "devDependencies": {
@@ -1430,7 +1430,7 @@
"react-native-svg": ["react-native-svg@15.13.0", "", { "dependencies": { "css-select": "^5.1.0", "css-tree": "^1.1.3", "warn-once": "0.1.1" }, "peerDependencies": { "react": "*", "react-native": "*" } }, "sha512-/YPK+PAAXg4T0x2d2vYPvqqAhOYid2bRKxUVT7STIyd1p2JxWmsGQkfZxXCkEFN7TwLfIyVlT5RimT91Pj/qXw=="], "react-native-svg": ["react-native-svg@15.13.0", "", { "dependencies": { "css-select": "^5.1.0", "css-tree": "^1.1.3", "warn-once": "0.1.1" }, "peerDependencies": { "react": "*", "react-native": "*" } }, "sha512-/YPK+PAAXg4T0x2d2vYPvqqAhOYid2bRKxUVT7STIyd1p2JxWmsGQkfZxXCkEFN7TwLfIyVlT5RimT91Pj/qXw=="],
"react-native-update": ["react-native-update@10.31.2", "", { "dependencies": { "nanoid": "^3.3.3", "react-native-url-polyfill": "^2.0.0" }, "peerDependencies": { "react": ">=16.8.0", "react-native": ">=0.59.0" } }, "sha512-doKTDyU/+6eN1jDswSh1HxnM9/XuxYFM65dLadsYVR+JvdLJ0PtbceSauthv4HYI3QXoeGaStkrRCaQAVKvp+w=="], "react-native-update": ["react-native-update@10.34.4", "", { "dependencies": { "nanoid": "^3.3.3", "react-native-url-polyfill": "^2.0.0" }, "peerDependencies": { "react": ">=16.8.0", "react-native": ">=0.59.0" } }, "sha512-yuXlff7EMUDyp1js2NylOw9jT0sVXoc5rpaRhzoYYcwfQTQq1Qp53qpyupDuUj43MEv5ikfJ6xBd/iRpXuanNg=="],
"react-native-url-polyfill": ["react-native-url-polyfill@2.0.0", "", { "dependencies": { "whatwg-url-without-unicode": "8.0.0-3" }, "peerDependencies": { "react-native": "*" } }, "sha512-My330Do7/DvKnEvwQc0WdcBnFPploYKp9CYlefDXzIdEaA+PAhDYllkvGeEroEzvc4Kzzj2O4yVdz8v6fjRvhA=="], "react-native-url-polyfill": ["react-native-url-polyfill@2.0.0", "", { "dependencies": { "whatwg-url-without-unicode": "8.0.0-3" }, "peerDependencies": { "react-native": "*" } }, "sha512-My330Do7/DvKnEvwQc0WdcBnFPploYKp9CYlefDXzIdEaA+PAhDYllkvGeEroEzvc4Kzzj2O4yVdz8v6fjRvhA=="],

View File

@@ -403,6 +403,8 @@
"-DFOLLY_NO_CONFIG", "-DFOLLY_NO_CONFIG",
"-DFOLLY_MOBILE=1", "-DFOLLY_MOBILE=1",
"-DFOLLY_USE_LIBCPP=1", "-DFOLLY_USE_LIBCPP=1",
"-DFOLLY_CFG_NO_COROUTINES=1",
"-DFOLLY_HAVE_CLOCK_GETTIME=1",
); );
OTHER_LDFLAGS = "$(inherited)"; OTHER_LDFLAGS = "$(inherited)";
REACT_NATIVE_PATH = "${PODS_ROOT}/../../node_modules/react-native"; REACT_NATIVE_PATH = "${PODS_ROOT}/../../node_modules/react-native";
@@ -475,6 +477,8 @@
"-DFOLLY_NO_CONFIG", "-DFOLLY_NO_CONFIG",
"-DFOLLY_MOBILE=1", "-DFOLLY_MOBILE=1",
"-DFOLLY_USE_LIBCPP=1", "-DFOLLY_USE_LIBCPP=1",
"-DFOLLY_CFG_NO_COROUTINES=1",
"-DFOLLY_HAVE_CLOCK_GETTIME=1",
); );
OTHER_LDFLAGS = "$(inherited)"; OTHER_LDFLAGS = "$(inherited)";
REACT_NATIVE_PATH = "${PODS_ROOT}/../../node_modules/react-native"; REACT_NATIVE_PATH = "${PODS_ROOT}/../../node_modules/react-native";

View File

@@ -1835,7 +1835,7 @@ PODS:
- ReactCommon/turbomodule/core - ReactCommon/turbomodule/core
- SocketRocket - SocketRocket
- Yoga - Yoga
- react-native-update (10.31.2): - react-native-update (10.34.4):
- boost - boost
- DoubleConversion - DoubleConversion
- fast_float - fast_float
@@ -1854,7 +1854,7 @@ PODS:
- React-graphics - React-graphics
- React-ImageManager - React-ImageManager
- React-jsi - React-jsi
- react-native-update/RCTPushy (= 10.31.2) - react-native-update/RCTPushy (= 10.34.4)
- React-NativeModulesApple - React-NativeModulesApple
- React-RCTFabric - React-RCTFabric
- React-renderercss - React-renderercss
@@ -1866,7 +1866,7 @@ PODS:
- SocketRocket - SocketRocket
- SSZipArchive - SSZipArchive
- Yoga - Yoga
- react-native-update/RCTPushy (10.31.2): - react-native-update/RCTPushy (10.34.4):
- boost - boost
- DoubleConversion - DoubleConversion
- fast_float - fast_float
@@ -2800,7 +2800,7 @@ SPEC CHECKSUMS:
React-Mapbuffer: 9d2434a42701d6144ca18f0ca1c4507808ca7696 React-Mapbuffer: 9d2434a42701d6144ca18f0ca1c4507808ca7696
React-microtasksnativemodule: 75b6604b667d297292345302cc5bfb6b6aeccc1b React-microtasksnativemodule: 75b6604b667d297292345302cc5bfb6b6aeccc1b
react-native-safe-area-context: c6e2edd1c1da07bdce287fa9d9e60c5f7b514616 react-native-safe-area-context: c6e2edd1c1da07bdce287fa9d9e60c5f7b514616
react-native-update: 7a05a78c6da651c1961b8407859f44bd0aa9b03a react-native-update: 822780a6d3c8482d47ba50b5801ed295c0dfcaff
React-NativeModulesApple: 879fbdc5dcff7136abceb7880fe8a2022a1bd7c3 React-NativeModulesApple: 879fbdc5dcff7136abceb7880fe8a2022a1bd7c3
React-oscompat: 93b5535ea7f7dff46aaee4f78309a70979bdde9d React-oscompat: 93b5535ea7f7dff46aaee4f78309a70979bdde9d
React-perflogger: 5536d2df3d18fe0920263466f7b46a56351c0510 React-perflogger: 5536d2df3d18fe0920263466f7b46a56351c0510

View File

@@ -10,8 +10,7 @@
"test:e2e": "detox test --configuration android.emu.debug", "test:e2e": "detox test --configuration android.emu.debug",
"lint": "eslint .", "lint": "eslint .",
"postinstall": "patch-package", "postinstall": "patch-package",
"apk": "cd android && ./gradlew assembleRelease", "apk": "cd android && ./gradlew assembleRelease"
"dev:harmony": "react-native bundle-harmony --dev"
}, },
"dependencies": { "dependencies": {
"form-data": "^4.0.4", "form-data": "^4.0.4",
@@ -22,7 +21,7 @@
"react-native-paper": "^5.14.5", "react-native-paper": "^5.14.5",
"react-native-safe-area-context": "^5.6.1", "react-native-safe-area-context": "^5.6.1",
"react-native-svg": "^15.13.0", "react-native-svg": "^15.13.0",
"react-native-update": "^10.31.2", "react-native-update": "^10.34.4",
"react-native-vector-icons": "^10.3.0" "react-native-vector-icons": "^10.3.0"
}, },
"devDependencies": { "devDependencies": {

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -1,6 +1,7 @@
{ {
"meta": { "meta": {
"stableOrder": true "stableOrder": true,
"enableUnifiedLockfile": false
}, },
"lockfileVersion": 3, "lockfileVersion": 3,
"ATTENTION": "THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.", "ATTENTION": "THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.",
@@ -9,7 +10,7 @@
}, },
"packages": { "packages": {
"@rnoh/react-native-openharmony@0.72.38": { "@rnoh/react-native-openharmony@0.72.38": {
"name": "@rnoh/react-native-openharmony", "name": "",
"version": "0.72.38", "version": "0.72.38",
"integrity": "sha512-br5SIrbB0OarSLirenleE7eTOX1lNccMJ7nb/G7qWTyJ7kW4DalmTXVKYpoT2qaOLls1uEE7McD1OjbZZM9jug==", "integrity": "sha512-br5SIrbB0OarSLirenleE7eTOX1lNccMJ7nb/G7qWTyJ7kW4DalmTXVKYpoT2qaOLls1uEE7McD1OjbZZM9jug==",
"resolved": "https://ohpm.openharmony.cn/ohpm/@rnoh/react-native-openharmony/-/react-native-openharmony-0.72.38.har", "resolved": "https://ohpm.openharmony.cn/ohpm/@rnoh/react-native-openharmony/-/react-native-openharmony-0.72.38.har",

View File

@@ -1,5 +1,5 @@
{ {
"license": "ISC", "license": "MIT",
"types": "", "types": "",
"devDependencies": {}, "devDependencies": {},
"name": "pushy", "name": "pushy",
@@ -8,5 +8,6 @@
"version": "3.1.0-0.0.7", "version": "3.1.0-0.0.7",
"dependencies": { "dependencies": {
"@rnoh/react-native-openharmony":"^0.72.38" "@rnoh/react-native-openharmony":"^0.72.38"
} },
"modelVersion": "5.0.0"
} }

View File

@@ -12,7 +12,7 @@ export class PushyFileJSBundleProvider extends JSBundleProvider {
this.updateContext = new UpdateContext(context); this.updateContext = new UpdateContext(context);
} }
getURL(): string { getURL(): string {
return this.updateContext.getBundleUrl().substring(1); return this.updateContext.getBundleUrl()?.substring(1);
} }
async getBundle(): Promise<ArrayBuffer> { async getBundle(): Promise<ArrayBuffer> {

View File

@@ -9,47 +9,47 @@ import { UpdateModuleImpl } from './UpdateModuleImpl';
import { UpdateContext } from './UpdateContext'; import { UpdateContext } from './UpdateContext';
import { EventHub } from './EventHub'; import { EventHub } from './EventHub';
const TAG = "PushyTurboModule" const TAG = 'PushyTurboModule';
export class PushyTurboModule extends TurboModule { export class PushyTurboModule extends TurboModule {
mUiCtx: common.UIAbilityContext mUiCtx: common.UIAbilityContext;
context: UpdateContext context: UpdateContext;
constructor(protected ctx: TurboModuleContext) { constructor(protected ctx: TurboModuleContext) {
super(ctx); super(ctx);
logger.debug(TAG, ",PushyTurboModule constructor"); logger.debug(TAG, ',PushyTurboModule constructor');
this.mUiCtx = ctx.uiAbilityContext this.mUiCtx = ctx.uiAbilityContext;
this.context = new UpdateContext(this.mUiCtx) this.context = new UpdateContext(this.mUiCtx);
EventHub.getInstance().setRNInstance(ctx.rnInstance) EventHub.getInstance().setRNInstance(ctx.rnInstance);
} }
getConstants(): Object { getConstants(): Object {
logger.debug(TAG, ",call getConstants"); logger.debug(TAG, ',call getConstants');
const context = this.mUiCtx; const context = this.mUiCtx;
const preferencesManager = dataPreferences.getPreferencesSync(context,{ name: 'update' }); const preferencesManager = dataPreferences.getPreferencesSync(context,{ name: 'update' });
const isFirstTime = preferencesManager.getSync("isFirstTime", false) as boolean; const isFirstTime = preferencesManager.getSync('isFirstTime', false) as boolean;
const rolledBackVersion = preferencesManager.getSync("rolledBackVersion", "") as string; const rolledBackVersion = preferencesManager.getSync('rolledBackVersion', '') as string;
const uuid = preferencesManager.getSync("uuid", "") as string; const uuid = preferencesManager.getSync('uuid', '') as string;
const currentVersion = preferencesManager.getSync("currentVersion", "") as string; const currentVersion = preferencesManager.getSync('currentVersion', '') as string;
const currentVersionInfo = this.context.getKv(`hash_${currentVersion}`); const currentVersionInfo = this.context.getKv(`hash_${currentVersion}`);
const buildTime = preferencesManager.getSync("buildTime", "") as string; const buildTime = preferencesManager.getSync('buildTime', '') as string;
const isUsingBundleUrl = this.context.getIsUsingBundleUrl(); const isUsingBundleUrl = this.context.getIsUsingBundleUrl();
let bundleFlags = bundleManager.BundleFlag.GET_BUNDLE_INFO_WITH_REQUESTED_PERMISSION; let bundleFlags = bundleManager.BundleFlag.GET_BUNDLE_INFO_WITH_REQUESTED_PERMISSION;
let packageVersion = ''; let packageVersion = '';
try { try {
const bundleInfo = bundleManager.getBundleInfoForSelfSync(bundleFlags); const bundleInfo = bundleManager.getBundleInfoForSelfSync(bundleFlags);
packageVersion = bundleInfo?.versionName || "Unknown" packageVersion = bundleInfo?.versionName || 'Unknown';
} catch (error) { } catch (error) {
console.error("Failed to get bundle info:", error); console.error('Failed to get bundle info:', error);
} }
if (isFirstTime) { if (isFirstTime) {
preferencesManager.deleteSync("isFirstTime"); preferencesManager.deleteSync('isFirstTime');
} }
if (rolledBackVersion) { if (rolledBackVersion) {
preferencesManager.deleteSync("rolledBackVersion"); preferencesManager.deleteSync('rolledBackVersion');
} }
return { return {
@@ -62,12 +62,12 @@ getConstants(): Object {
isFirstTime, isFirstTime,
rolledBackVersion, rolledBackVersion,
uuid, uuid,
} };
} }
setLocalHashInfo(hash: string, info: string): boolean { setLocalHashInfo(hash: string, info: string): boolean {
logger.debug(TAG, ",call setLocalHashInfo"); logger.debug(TAG, ',call setLocalHashInfo');
return UpdateModuleImpl.setLocalHashInfo(this.context, hash, info); return UpdateModuleImpl.setLocalHashInfo(this.context, hash, info);
} }
@@ -76,50 +76,50 @@ getConstants(): Object {
} }
async setUuid(uuid: string): Promise<boolean> { async setUuid(uuid: string): Promise<boolean> {
logger.debug(TAG, `,call setUuid`); logger.debug(TAG, ',call setUuid');
return UpdateModuleImpl.setUuid(this.context,uuid); return UpdateModuleImpl.setUuid(this.context,uuid);
} }
async reloadUpdate(options: { hash: string }): Promise<void> { async reloadUpdate(options: { hash: string }): Promise<void> {
logger.debug(TAG, `,call reloadUpdate`); logger.debug(TAG, ',call reloadUpdate');
return UpdateModuleImpl.reloadUpdate(this.context, this.mUiCtx, options); return UpdateModuleImpl.reloadUpdate(this.context, this.mUiCtx, options);
} }
async setNeedUpdate(options: { hash: string }): Promise<boolean> { async setNeedUpdate(options: { hash: string }): Promise<boolean> {
logger.debug(TAG, `,call setNeedUpdate`); logger.debug(TAG, ',call setNeedUpdate');
return UpdateModuleImpl.setNeedUpdate(this.context, options); return UpdateModuleImpl.setNeedUpdate(this.context, options);
} }
async markSuccess(): Promise<boolean> { async markSuccess(): Promise<boolean> {
logger.debug(TAG, `,call markSuccess`); logger.debug(TAG, ',call markSuccess');
return UpdateModuleImpl.markSuccess(this.context); return UpdateModuleImpl.markSuccess(this.context);
} }
async downloadPatchFromPpk(options: { updateUrl: string; hash: string; originHash: string }): Promise<void> { async downloadPatchFromPpk(options: { updateUrl: string; hash: string; originHash: string }): Promise<void> {
logger.debug(TAG, `,call downloadPatchFromPpk`); logger.debug(TAG, ',call downloadPatchFromPpk');
return UpdateModuleImpl.downloadPatchFromPpk(this.context, options); return UpdateModuleImpl.downloadPatchFromPpk(this.context, options);
} }
async downloadPatchFromPackage(options: { updateUrl: string; hash: string }): Promise<void> { async downloadPatchFromPackage(options: { updateUrl: string; hash: string }): Promise<void> {
logger.debug(TAG, `,call downloadPatchFromPackage`); logger.debug(TAG, ',call downloadPatchFromPackage');
return UpdateModuleImpl.downloadPatchFromPackage(this.context, options); return UpdateModuleImpl.downloadPatchFromPackage(this.context, options);
} }
async downloadFullUpdate(options: { updateUrl: string; hash: string }): Promise<void> { async downloadFullUpdate(options: { updateUrl: string; hash: string }): Promise<void> {
logger.debug(TAG, `,call downloadFullUpdate`); logger.debug(TAG, ',call downloadFullUpdate');
return UpdateModuleImpl.downloadFullUpdate(this.context, options); return UpdateModuleImpl.downloadFullUpdate(this.context, options);
} }
async downloadAndInstallApk(options: { url: string; target: string; hash: string }): Promise<void> { async downloadAndInstallApk(options: { url: string; target: string; hash: string }): Promise<void> {
logger.debug(TAG, `,call downloadAndInstallApk`); logger.debug(TAG, ',call downloadAndInstallApk');
return UpdateModuleImpl.downloadAndInstallApk(this.mUiCtx, options); return UpdateModuleImpl.downloadAndInstallApk(this.mUiCtx, options);
} }
addListener(eventName: string): void { addListener(eventName: string): void {
logger.debug(TAG, `,call addListener`); logger.debug(TAG, ',call addListener');
} }
removeListeners(count: number): void { removeListeners(count: number): void {
logger.debug(TAG, `,call removeListeners`); logger.debug(TAG, ',call removeListeners');
} }
} }

View File

@@ -1,6 +1,6 @@
{ {
"name": "react-native-update", "name": "react-native-update",
"version": "10.33.0", "version": "10.34.7",
"description": "react-native hot update", "description": "react-native hot update",
"main": "src/index", "main": "src/index",
"scripts": { "scripts": {
@@ -9,7 +9,7 @@
"lint": "eslint \"src/*.@(ts|tsx|js|jsx)\" && tsc --noEmit", "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": "bun 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:so": "bun submodule && $ANDROID_HOME/ndk/28.2.13676358/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:ios-debug": "cd Example/testHotUpdate && bun && detox build --configuration ios.sim.debug", "build:ios-debug": "cd Example/testHotUpdate && bun && detox build --configuration ios.sim.debug",
"build:ios-release": "cd Example/testHotUpdate && bun && detox build --configuration ios.sim.release", "build:ios-release": "cd Example/testHotUpdate && bun && detox build --configuration ios.sim.release",
"test:ios-debug": "cd Example/testHotUpdate && detox test --configuration ios.sim.debug", "test:ios-debug": "cd Example/testHotUpdate && detox test --configuration ios.sim.debug",

View File

@@ -105,18 +105,17 @@ Pod::Spec.new do |s|
# Conditionally add Expo dependency # Conditionally add Expo dependency
if valid_expo_project if valid_expo_project
s.public_header_files = ['ios/ImportReact.h']
s.dependency 'ExpoModulesCore' s.dependency 'ExpoModulesCore'
end end
s.subspec 'RCTPushy' do |ss| s.subspec 'RCTPushy' do |ss|
ss.source_files = ['ios/RCTPushy/**/*.{h,m,mm,c}', ss.source_files = ['ios/**/*.{h,m,mm,c}',
'android/jni/hpatch.{h,c}', 'android/jni/hpatch.{h,c}',
'android/jni/HDiffPatch/libHDiffPatch/HPatch/*.{h,c}', 'android/jni/HDiffPatch/libHDiffPatch/HPatch/*.{h,c}',
'android/jni/HDiffPatch/file_for_patch.{h,c}', 'android/jni/HDiffPatch/file_for_patch.{h,c}',
'android/jni/lzma/C/LzmaDec.{h,c}', 'android/jni/lzma/C/LzmaDec.{h,c}',
'android/jni/lzma/C/Lzma2Dec.{h,c}'] 'android/jni/lzma/C/Lzma2Dec.{h,c}']
ss.public_header_files = ['ios/RCTPushy/**/*.h'] ss.public_header_files = ['ios/**/*.h']
end end
# Conditionally add Expo subspec and check ExpoModulesCore version # Conditionally add Expo subspec and check ExpoModulesCore version

1
react-native.config.js Normal file
View File

@@ -0,0 +1 @@
module.exports = {};

View File

@@ -8,7 +8,7 @@ import {
buildTime, buildTime,
cInfo, cInfo,
currentVersion, currentVersion,
getCurrentVersionInfo, currentVersionInfo,
isFirstTime, isFirstTime,
isRolledBack, isRolledBack,
packageVersion, packageVersion,
@@ -110,8 +110,7 @@ export class Pushy {
this.clientType = clientType || 'Pushy'; this.clientType = clientType || 'Pushy';
this.options.server = SERVER_PRESETS[this.clientType]; this.options.server = SERVER_PRESETS[this.clientType];
// Initialize i18n based on clientType i18n.setLocale(options.locale ?? this.clientType === 'Pushy' ? 'zh' : 'en');
i18n.setLocale(this.clientType === 'Pushy' ? 'zh' : 'en');
if (Platform.OS === 'ios' || Platform.OS === 'android') { if (Platform.OS === 'ios' || Platform.OS === 'android') {
if (!options.appKey) { if (!options.appKey) {
@@ -163,7 +162,6 @@ export class Pushy {
log(type + ' ' + message); log(type + ' ' + message);
await this.loggerPromise.promise; await this.loggerPromise.promise;
const { logger = noop, appKey } = this.options; const { logger = noop, appKey } = this.options;
const info = await getCurrentVersionInfo();
const overridePackageVersion = this.options.overridePackageVersion; const overridePackageVersion = this.options.overridePackageVersion;
logger({ logger({
type, type,
@@ -175,7 +173,7 @@ export class Pushy {
overridePackageVersion, overridePackageVersion,
buildTime, buildTime,
message, message,
...info, ...currentVersionInfo,
...data, ...data,
}, },
}); });

View File

@@ -179,8 +179,8 @@ export const UpdateProvider = ({
delete rootInfo.expVersion; delete rootInfo.expVersion;
for (const versionInfo of versions) { for (const versionInfo of versions) {
const info: CheckResult = { const info: CheckResult = {
...versionInfo,
...rootInfo, ...rootInfo,
...versionInfo,
}; };
const rollout = info.config?.rollout?.[packageVersion]; const rollout = info.config?.rollout?.[packageVersion];
if (info.update && rollout) { if (info.update && rollout) {

View File

@@ -86,6 +86,7 @@ export interface ClientOptions {
appKey: string; appKey: string;
server?: UpdateServerConfig; server?: UpdateServerConfig;
logger?: UpdateEventsLogger; logger?: UpdateEventsLogger;
locale?: 'zh' | 'en';
updateStrategy?: updateStrategy?:
| 'alwaysAlert' | 'alwaysAlert'
| 'alertUpdateAndIgnoreError' | 'alertUpdateAndIgnoreError'