feat(app): 更新版本号并添加设备信息相关功能
- 将版本号从"1.0"修改为"1.0.0" - 在主界面添加退出登录功能 - 使用 react-native-device-info 获取设备信息 - 更新 API 请求头中的设备信息获取方式 - 移除 User 类中冗余的 deviceInfo 字段
这个提交包含在:
父节点
2634ead007
当前提交
e575e9deb5
@ -9,10 +9,11 @@
|
||||
>
|
||||
|
||||
# 2. 说明
|
||||
> 1. 下证等逻辑放在`common`里面
|
||||
> 2. 方法类工具类放在`common`里面
|
||||
> 3. 小程序共有的功能点,复用点放在`common`里面
|
||||
> 4. 避免`common`引用子级(app、miniapp),造成循环依赖
|
||||
> 1. 使用`jdk17`
|
||||
> 2. 下证等逻辑放在`common`里面
|
||||
> 3. 方法类工具类放在`common`里面
|
||||
> 4. 小程序共有的功能点,复用点放在`common`里面
|
||||
> 5. 避免`common`引用子级(app、miniapp),造成循环依赖
|
||||
>
|
||||
|
||||
# 3. 分包说明
|
||||
|
||||
@ -83,7 +83,7 @@ android {
|
||||
minSdkVersion rootProject.ext.minSdkVersion
|
||||
targetSdkVersion rootProject.ext.targetSdkVersion
|
||||
versionCode 1
|
||||
versionName "1.0"
|
||||
versionName "1.0.0"
|
||||
}
|
||||
signingConfigs {
|
||||
debug {
|
||||
|
||||
@ -16,12 +16,20 @@ import { downloadToFile } from '@common/UpdateHelper.ts';
|
||||
import UpdateManager from '../../../../specs/NativeUpdateManager.ts';
|
||||
import Spinner from '@common/components/Spinner.tsx';
|
||||
import RNFS from 'react-native-fs';
|
||||
import { useAuth } from '@common/contexts/useAuth.ts';
|
||||
import DeviceInfo from 'react-native-device-info';
|
||||
|
||||
export default function MainViewScreen() {
|
||||
const [progress, setProgress] = useState('');
|
||||
const [progressH, setProgressH] = useState('');
|
||||
const [isLoading, setLoading] = useState(false);
|
||||
|
||||
const {
|
||||
actions: { logout },
|
||||
} = useAuth();
|
||||
|
||||
console.log('>>>>', DeviceInfo.getVersion());
|
||||
|
||||
return (
|
||||
<View style={styles.container}>
|
||||
<ScrollView>
|
||||
@ -157,6 +165,13 @@ export default function MainViewScreen() {
|
||||
/>
|
||||
<View style={{ height: 45 }} />
|
||||
<Text>{`${RNFS.ExternalDirectoryPath}/bundles/`}</Text>
|
||||
<View style={{ height: 55 }} />
|
||||
<Button
|
||||
title={'退出登录'}
|
||||
onPress={() => {
|
||||
logout();
|
||||
}}
|
||||
/>
|
||||
</>
|
||||
</ScrollView>
|
||||
{isLoading && <Spinner />}
|
||||
|
||||
@ -20,6 +20,7 @@ import { getEnvUrl } from '@common/env/envUtils.ts';
|
||||
import { md5_hex } from '@common/utils/md5';
|
||||
import { CLIENT_ID, MD5_KEY } from '@common/constants';
|
||||
import { showErrorMessage } from '@common/ToastHelper.ts';
|
||||
import DeviceInfo from 'react-native-device-info';
|
||||
|
||||
const SUCCESS_STATUS = /^0$/; // 请求成功的状态码
|
||||
|
||||
@ -69,20 +70,14 @@ const useApi = <
|
||||
// 【这里添加额外的 headers】
|
||||
const commonHeaders = useMemo(() => {
|
||||
try {
|
||||
const deviceInfo = JSON.parse(info.deviceInfo ?? '{}') as Record<
|
||||
string,
|
||||
string
|
||||
>;
|
||||
|
||||
return {
|
||||
clientId: CLIENT_ID, // 厂商唯一标识,这个值是为医网信app分配的
|
||||
deviceType: Platform.select({ android: '0', ios: '1' }),
|
||||
version: deviceInfo.versionName,
|
||||
deviceId: deviceInfo.deviceId,
|
||||
phoneModel: deviceInfo.phoneModel,
|
||||
phoneBrand: deviceInfo.phoneBrand,
|
||||
phoneVersion: deviceInfo.phoneVersion,
|
||||
|
||||
version: DeviceInfo.getVersion(),
|
||||
deviceId: DeviceInfo.getDeviceId(),
|
||||
phoneModel: DeviceInfo.getModel(),
|
||||
phoneBrand: DeviceInfo.getBrand(),
|
||||
phoneVersion: DeviceInfo.getSystemVersion(),
|
||||
userId: userInfo?.userId ?? '',
|
||||
sessionId: token ?? '',
|
||||
currentClientId: '',
|
||||
@ -91,7 +86,7 @@ const useApi = <
|
||||
} catch {
|
||||
return {};
|
||||
}
|
||||
}, [info.deviceInfo, token, userInfo?.userId]);
|
||||
}, [token, userInfo?.userId]);
|
||||
|
||||
// 【这里定义 Response 的 schema】
|
||||
const responseSchema = useMemo(() => {
|
||||
@ -180,7 +175,10 @@ const useApi = <
|
||||
),
|
||||
);
|
||||
// 退出登录逻辑
|
||||
if (e.response.data?.status === '017x025'||e.response.data?.status === '017x013') {
|
||||
if (
|
||||
e.response.data?.status === '017x025' ||
|
||||
e.response.data?.status === '017x013'
|
||||
) {
|
||||
showErrorMessage(
|
||||
e.response.data?.message ??
|
||||
'该账号已在其他设备登录,请重新登录!',
|
||||
|
||||
@ -5,8 +5,6 @@ export type CommonInfo = {
|
||||
policyAccepted: boolean; // 是否已经接受用户协议与隐私政策
|
||||
appTourVersion: string; // 版本引导版本号
|
||||
lastLoginPhoneNumber: string; // 最近一次登录使用的手机号
|
||||
deviceInfo: string; // 根据 innerModule 中的 initNativeInfo() 获取到的一些设备信息,使用时需要JSON.parse()进行解析
|
||||
// ...
|
||||
};
|
||||
|
||||
// 登录用户信息
|
||||
|
||||
正在加载...
在新工单中引用
屏蔽一个用户