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

Update version to 10.31.1, enhance iOS Info.plist with camera and photo library usage descriptions, and refactor code for improved readability in index.tsx. Adjust currentVersionInfo retrieval in RCTPushy.mm for better data handling.

This commit is contained in:
sunnylqm
2025-09-19 14:31:07 +08:00
parent a6e9ece559
commit 6f2314d3c9
5 changed files with 1470 additions and 827 deletions

View File

@@ -37,8 +37,14 @@
</dict> </dict>
</dict> </dict>
</dict> </dict>
<key>NSCameraUsageDescription</key>
<string>For taking photos</string>
<key>NSLocationWhenInUseUsageDescription</key> <key>NSLocationWhenInUseUsageDescription</key>
<string></string> <string></string>
<key>NSPhotoLibraryUsageDescription</key>
<string>For saving photos</string>
<key>RCTNewArchEnabled</key>
<true/>
<key>UILaunchStoryboardName</key> <key>UILaunchStoryboardName</key>
<string>LaunchScreen</string> <string>LaunchScreen</string>
<key>UIRequiredDeviceCapabilities</key> <key>UIRequiredDeviceCapabilities</key>
@@ -53,10 +59,5 @@
</array> </array>
<key>UIViewControllerBasedStatusBarAppearance</key> <key>UIViewControllerBasedStatusBarAppearance</key>
<false/> <false/>
<key>NSCameraUsageDescription</key>
<string>For taking photos</string>
<key>NSPhotoLibraryUsageDescription</key>
<string>For saving photos</string>
</dict> </dict>
</plist> </plist>

File diff suppressed because it is too large Load Diff

View File

@@ -1,6 +1,6 @@
/* eslint-disable react/no-unstable-nested-components */ /* eslint-disable react/no-unstable-nested-components */
/* eslint-disable react-native/no-inline-styles */ /* eslint-disable react-native/no-inline-styles */
import React, {useRef, useState} from 'react'; import React, { useRef, useState } from 'react';
import { import {
StyleSheet, StyleSheet,
Platform, Platform,
@@ -19,15 +19,14 @@ import {
Modal, Modal,
Portal, Portal,
} from 'react-native-paper'; } from 'react-native-paper';
import {Camera} from 'react-native-camera-kit'; import { Camera } from 'react-native-camera-kit';
import {LocalSvg} from 'react-native-svg/css'; import { LocalSvg } from 'react-native-svg/css';
import TestConsole from './TestConsole'; import TestConsole from './TestConsole';
import _updateConfig from '../update.json'; import _updateConfig from '../update.json';
import {UpdateProvider, Pushy, Cresc, useUpdate} from 'react-native-update'; import { UpdateProvider, Pushy, Cresc, useUpdate } from 'react-native-update';
const {appKey} = _updateConfig[Platform.OS]; const { appKey } = _updateConfig[Platform.OS];
function App() { function App() {
const { const {
@@ -54,8 +53,8 @@ function App() {
return ( return (
<View style={styles.container}> <View style={styles.container}>
<Text style={styles.welcome}>使Pushy热更新服务</Text> <Text style={styles.welcome}>22使Pushy热更新服务</Text>
<View style={{flexDirection: 'row'}}> <View style={{ flexDirection: 'row' }}>
<Text> <Text>
{useDefaultAlert ? '当前使用' : '当前不使用'}alert更新提示 {useDefaultAlert ? '当前使用' : '当前不使用'}alert更新提示
</Text> </Text>
@@ -74,9 +73,9 @@ function App() {
<Portal> <Portal>
<Modal visible={showCamera} onDismiss={() => setShowCamera(false)}> <Modal visible={showCamera} onDismiss={() => setShowCamera(false)}>
<Camera <Camera
style={{minHeight: 320}} style={{ minHeight: 320 }}
scanBarcode={true} scanBarcode={true}
onReadCode={({nativeEvent: {codeStringValue}}) => { onReadCode={({ nativeEvent: { codeStringValue } }) => {
// 防止重复扫码 // 防止重复扫码
if (lastParsedCode.current === codeStringValue) { if (lastParsedCode.current === codeStringValue) {
return; return;
@@ -94,7 +93,7 @@ function App() {
/> />
</Modal> </Modal>
</Portal> </Portal>
<View style={{flexDirection: 'row', alignItems: 'center', gap: 10}}> <View style={{ flexDirection: 'row', alignItems: 'center', gap: 10 }}>
<Text>png:</Text> <Text>png:</Text>
<Image <Image
resizeMode={'contain'} resizeMode={'contain'}
@@ -102,11 +101,11 @@ function App() {
style={styles.image} style={styles.image}
/> />
</View> </View>
<View style={{flexDirection: 'row', alignItems: 'center', gap: 10}}> <View style={{ flexDirection: 'row', alignItems: 'center', gap: 10 }}>
<Text>svg:</Text> <Text>svg:</Text>
<LocalSvg <LocalSvg
asset={require('./assets/react-logo.svg')} asset={require('./assets/react-logo.svg')}
style={{width: 30, height: 30}} style={{ width: 30, height: 30 }}
/> />
</View> </View>
<Text style={styles.instructions}> <Text style={styles.instructions}>
@@ -124,16 +123,18 @@ function App() {
onPress={() => { onPress={() => {
checkUpdate(); checkUpdate();
setShowUpdateSnackbar(true); setShowUpdateSnackbar(true);
}}> }}
>
<Text style={styles.instructions}></Text> <Text style={styles.instructions}></Text>
</TouchableOpacity> </TouchableOpacity>
<TouchableOpacity <TouchableOpacity
testID="testcase" testID="testcase"
style={{marginTop: 15}} style={{ marginTop: 15 }}
onLongPress={() => { onLongPress={() => {
setShowTestConsole(true); setShowTestConsole(true);
}}> }}
>
<Text style={styles.instructions}> <Text style={styles.instructions}>
react-native-update版本{client?.version} react-native-update版本{client?.version}
</Text> </Text>
@@ -155,14 +156,15 @@ function App() {
await downloadUpdate(); await downloadUpdate();
setShowUpdateBanner(true); setShowUpdateBanner(true);
}, },
}}> }}
<Text style={{color: 'white'}}> >
<Text style={{ color: 'white' }}>
({updateInfo.name}) ({updateInfo.name})
</Text> </Text>
</Snackbar> </Snackbar>
)} )}
<Banner <Banner
style={{width: '100%', position: 'absolute', top: 0}} style={{ width: '100%', position: 'absolute', top: 0 }}
visible={showUpdateBanner} visible={showUpdateBanner}
actions={[ actions={[
{ {
@@ -177,9 +179,10 @@ function App() {
}, },
}, },
]} ]}
icon={({size}) => ( icon={({ size }) => (
<Icon name="checkcircleo" size={size} color="#00f" /> <Icon name="checkcircleo" size={size} color="#00f" />
)}> )}
>
</Banner> </Banner>
</View> </View>
@@ -227,4 +230,4 @@ export default function Root() {
</PaperProvider> </PaperProvider>
</UpdateProvider> </UpdateProvider>
); );
} }

View File

@@ -178,7 +178,7 @@ RCT_EXPORT_MODULE(RCTPushy);
NSDictionary *pushyInfo = [defaults dictionaryForKey:keyPushyInfo]; NSDictionary *pushyInfo = [defaults dictionaryForKey:keyPushyInfo];
NSString *currentVersion = [pushyInfo objectForKey:paramCurrentVersion]; NSString *currentVersion = [pushyInfo objectForKey:paramCurrentVersion];
ret[@"currentVersion"] = currentVersion; ret[@"currentVersion"] = currentVersion;
ret[@"currentVersionInfo"] = [pushyInfo objectForKey:[keyHashInfo stringByAppendingString:currentVersion]]; ret[@"currentVersionInfo"] = [defaults objectForKey:[keyHashInfo stringByAppendingString:currentVersion]];
// clear isFirstTimemarked // clear isFirstTimemarked
if (ret[@"isFirstTime"]) { if (ret[@"isFirstTime"]) {

View File

@@ -1,6 +1,6 @@
{ {
"name": "react-native-update", "name": "react-native-update",
"version": "10.31.0", "version": "10.31.1",
"description": "react-native hot update", "description": "react-native hot update",
"main": "src/index", "main": "src/index",
"scripts": { "scripts": {