1
0
Code Issues Pull Requests Packages Projects Releases Wiki Activity GitHub Gitee

feat: new version

This commit is contained in:
sunnylqm 2024-01-21 22:23:51 +08:00
parent 36533d43c4
commit 1afc896306
No known key found for this signature in database
5 changed files with 4302 additions and 3135 deletions

View File

@ -8,15 +8,12 @@ import {
Image,
Switch,
} from 'react-native';
import {Icon, PaperProvider} from 'react-native-paper';
import {Snackbar, Banner} from 'react-native-paper';
import {Icon, PaperProvider, Snackbar, Banner} from 'react-native-paper';
import TestConsole from './TestConsole';
import _updateConfig from '../update.json';
import {PushyProvider} from '../../../src/provider';
import {Pushy} from '../../../src/client';
import {usePushy} from '../../../src/context';
import {PushyProvider, Pushy, usePushy} from 'react-native-update';
const {appKey} = _updateConfig[Platform.OS];
function App() {

File diff suppressed because it is too large Load Diff

View File

@ -2,7 +2,7 @@
"name": "react-native-update",
"version": "9.1.6",
"description": "react-native hot update",
"main": "lib/index.ts",
"main": "src/index.ts",
"scripts": {
"prepublish": "yarn submodule",
"submodule": "git submodule update --init --recursive",
@ -39,6 +39,7 @@
"url": "https://github.com/reactnativecn/react-native-pushy/issues"
},
"peerDependencies": {
"react": ">=16.8.0",
"react-native": ">=0.57.0"
},
"homepage": "https://github.com/reactnativecn/react-native-pushy#readme",
@ -59,8 +60,8 @@
"@types/react": "^18.2.46",
"eslint": "^8.56.0",
"prettier": "^2",
"react": "18.2.0",
"react-native": "0.73",
"react": "18.0.0",
"react-native": "0.69.8",
"typescript": "^5.3.3",
"@types/fs-extra": "^9.0.13",
"@types/jest": "^29.2.1",

View File

@ -66,7 +66,7 @@ export const PushyProvider = ({
return;
}
stateListener.current && stateListener.current.remove();
showAlert('Download complete', 'Do you want to apply the update now?', [
showAlert('提示', '下载完毕,是否立即更新?', [
{
text: '下次再说',
style: 'cancel',
@ -84,7 +84,7 @@ export const PushyProvider = ({
]);
} catch (err) {
setLastError(err);
showAlert('Failed to update', err.message);
showAlert('更新失败', err.message);
}
}, [client, showAlert, updateInfo]);
@ -94,30 +94,26 @@ export const PushyProvider = ({
info = await client.checkUpdate();
} catch (err) {
setLastError(err);
showAlert('Failed to check update', err.message);
showAlert('更新检查失败', err.message);
return;
}
setUpdateInfo(info);
if ('expired' in info) {
const { downloadUrl } = info;
showAlert(
'Major update',
'A full update is required to download and install to continue.',
[
{
text: '更新',
onPress: () => {
if (downloadUrl) {
if (Platform.OS === 'android' && downloadUrl.endsWith('.apk')) {
client.downloadAndInstallApk(downloadUrl);
} else {
Linking.openURL(downloadUrl);
}
showAlert('提示', '您的应用版本已更新,点击更新下载安装新版本', [
{
text: '更新',
onPress: () => {
if (downloadUrl) {
if (Platform.OS === 'android' && downloadUrl.endsWith('.apk')) {
client.downloadAndInstallApk(downloadUrl);
} else {
Linking.openURL(downloadUrl);
}
},
}
},
],
);
},
]);
} else if ('update' in info) {
showAlert(
'提示',

2494
yarn.lock

File diff suppressed because it is too large Load Diff