update fetch fcm on login

This commit is contained in:
BDA MacMini 2025-09-23 18:07:43 +07:00
parent 9f7f2cebb8
commit 238e7a98ea
5 changed files with 35 additions and 17 deletions

View File

@ -462,6 +462,8 @@ PODS:
- React-Core - React-Core
- react-native-pager-view (5.4.25): - react-native-pager-view (5.4.25):
- React-Core - React-Core
- react-native-safe-area-context (4.7.4):
- React-Core
- react-native-splash-screen (3.3.0): - react-native-splash-screen (3.3.0):
- React-Core - React-Core
- react-native-view-shot (3.8.0): - react-native-view-shot (3.8.0):
@ -655,6 +657,7 @@ DEPENDENCIES:
- "react-native-cameraroll (from `../node_modules/@react-native-camera-roll/camera-roll`)" - "react-native-cameraroll (from `../node_modules/@react-native-camera-roll/camera-roll`)"
- react-native-fbsdk-next (from `../node_modules/react-native-fbsdk-next`) - react-native-fbsdk-next (from `../node_modules/react-native-fbsdk-next`)
- react-native-pager-view (from `../node_modules/react-native-pager-view`) - react-native-pager-view (from `../node_modules/react-native-pager-view`)
- react-native-safe-area-context (from `../node_modules/react-native-safe-area-context`)
- react-native-splash-screen (from `../node_modules/react-native-splash-screen`) - react-native-splash-screen (from `../node_modules/react-native-splash-screen`)
- react-native-view-shot (from `../node_modules/react-native-view-shot`) - react-native-view-shot (from `../node_modules/react-native-view-shot`)
- react-native-webview (from `../node_modules/react-native-webview`) - react-native-webview (from `../node_modules/react-native-webview`)
@ -769,6 +772,8 @@ EXTERNAL SOURCES:
:path: "../node_modules/react-native-fbsdk-next" :path: "../node_modules/react-native-fbsdk-next"
react-native-pager-view: react-native-pager-view:
:path: "../node_modules/react-native-pager-view" :path: "../node_modules/react-native-pager-view"
react-native-safe-area-context:
:path: "../node_modules/react-native-safe-area-context"
react-native-splash-screen: react-native-splash-screen:
:path: "../node_modules/react-native-splash-screen" :path: "../node_modules/react-native-splash-screen"
react-native-view-shot: react-native-view-shot:
@ -886,6 +891,7 @@ SPEC CHECKSUMS:
react-native-cameraroll: 43049a467518f86545d6aba4caf8e373b03e7bbf react-native-cameraroll: 43049a467518f86545d6aba4caf8e373b03e7bbf
react-native-fbsdk-next: 52f81e60eb3e8e0e06cf9728b4572d3509ca9d01 react-native-fbsdk-next: 52f81e60eb3e8e0e06cf9728b4572d3509ca9d01
react-native-pager-view: 873aef831fb4fe6e1a2e1ba7a79857e240dea380 react-native-pager-view: 873aef831fb4fe6e1a2e1ba7a79857e240dea380
react-native-safe-area-context: 8dba469126c1d5fb9502bfb49996026593292cf4
react-native-splash-screen: 95994222cc95c236bd3cdc59fe45ed5f27969594 react-native-splash-screen: 95994222cc95c236bd3cdc59fe45ed5f27969594
react-native-view-shot: d1a701eb0719c6dccbd20b4bb43b1069f304cb70 react-native-view-shot: d1a701eb0719c6dccbd20b4bb43b1069f304cb70
react-native-webview: 5bb1454f1eb43e0bad229bb428a378d6b865a0ad react-native-webview: 5bb1454f1eb43e0bad229bb428a378d6b865a0ad

View File

@ -689,14 +689,14 @@
CODE_SIGN_ENTITLEMENTS = csareactrn60/csareactrn60.entitlements; CODE_SIGN_ENTITLEMENTS = csareactrn60/csareactrn60.entitlements;
CODE_SIGN_IDENTITY = "iPhone Developer"; CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Distribution"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Distribution";
CURRENT_PROJECT_VERSION = 166; CURRENT_PROJECT_VERSION = 2;
DEAD_CODE_STRIPPING = NO; DEAD_CODE_STRIPPING = NO;
DEVELOPMENT_TEAM = 84F3R56BUC; DEVELOPMENT_TEAM = 84F3R56BUC;
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = 84F3R56BUC; "DEVELOPMENT_TEAM[sdk=iphoneos*]" = 84F3R56BUC;
INFOPLIST_FILE = csareactrn60/Info.plist; INFOPLIST_FILE = csareactrn60/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 13.0; IPHONEOS_DEPLOYMENT_TARGET = 13.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
MARKETING_VERSION = 2.108; MARKETING_VERSION = 2.111;
OTHER_LDFLAGS = ( OTHER_LDFLAGS = (
"$(inherited)", "$(inherited)",
"-ObjC", "-ObjC",
@ -720,13 +720,13 @@
CODE_SIGN_IDENTITY = "iPhone Distribution"; CODE_SIGN_IDENTITY = "iPhone Distribution";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Distribution"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Distribution";
CODE_SIGN_STYLE = Manual; CODE_SIGN_STYLE = Manual;
CURRENT_PROJECT_VERSION = 166; CURRENT_PROJECT_VERSION = 2;
DEVELOPMENT_TEAM = 84F3R56BUC; DEVELOPMENT_TEAM = 84F3R56BUC;
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = 84F3R56BUC; "DEVELOPMENT_TEAM[sdk=iphoneos*]" = 84F3R56BUC;
INFOPLIST_FILE = csareactrn60/Info.plist; INFOPLIST_FILE = csareactrn60/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 13.0; IPHONEOS_DEPLOYMENT_TARGET = 13.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
MARKETING_VERSION = 2.108; MARKETING_VERSION = 2.111;
OTHER_LDFLAGS = ( OTHER_LDFLAGS = (
"$(inherited)", "$(inherited)",
"-ObjC", "-ObjC",

View File

@ -363,7 +363,7 @@ const MainHeader = ({ navigation }) => {
}, []) }, [])
return <View style={[{ flex: 1, alignItems: 'center', flexDirection: 'row', marginTop: 0, paddingLeft: 10, backgroundColor: server_mode === 'develop' ? '#ff0000' : 'transparent' }]}> return <View style={[{ flex: 1, alignItems: 'center', flexDirection: 'row', marginTop: 0, paddingLeft: 10, backgroundColor: server_mode === 'develop' ? '#ff0000' : 'transparent' }]}>
<TouchableOpacity <TouchableOpacity
onPress={openSecretChamber} // onPress={openSecretChamber}
activeOpacity={1}> activeOpacity={1}>
<Image <Image
style={{ width: 35, height: 35, }} style={{ width: 35, height: 35, }}

View File

@ -4,7 +4,7 @@ import AppStack from './AppStack'
import React from 'react' import React from 'react'
import AppLoading from '../screens/app/AppLoading' import AppLoading from '../screens/app/AppLoading'
import LanguageSelect from '../screens/app/LanguageSelect' import LanguageSelect from '../screens/app/LanguageSelect'
import { View } from 'react-native' import { Platform, View } from 'react-native'
import NavigationService from '../utils/NavigationService' import NavigationService from '../utils/NavigationService'
import {SafeAreaProvider, SafeAreaView} from "react-native-safe-area-context"; import {SafeAreaProvider, SafeAreaView} from "react-native-safe-area-context";
@ -20,11 +20,21 @@ export class AppNavContainer extends React.Component {
} }
render () { render () {
return <SafeAreaProvider> if(Platform.OS === 'android') {
<SafeAreaView style={{flex: 1}} edges={['top', 'bottom']}> return (
<MainNav ref={navigatorRef => {NavigationService.setTopLevelNavigator(navigatorRef)}}/> <SafeAreaProvider>
</SafeAreaView> <SafeAreaView style={{flex: 1}} edges={['top', 'bottom']}>
</SafeAreaProvider> <MainNav ref={navigatorRef => {NavigationService.setTopLevelNavigator(navigatorRef)}}/>
</SafeAreaView>
</SafeAreaProvider>
)
}else {
return (
<View style={{flex: 1}}>
<MainNav ref={navigatorRef => {NavigationService.setTopLevelNavigator(navigatorRef)}}/>
</View>
)
}
} }
} }

View File

@ -33,6 +33,12 @@ class LoginScreen extends Component {
this._login = this._login.bind(this) this._login = this._login.bind(this)
} }
async componentDidMount() {
await messaging().deleteToken()
console.log('deletetoken');
}
async _login () { async _login () {
this.setState({ this.setState({
isLoading: true isLoading: true
@ -40,7 +46,7 @@ class LoginScreen extends Component {
if (this.state.username && this.state.password) { if (this.state.username && this.state.password) {
var regex = /^\d+$/; var regex = /^\d+$/;
const fcmToken = null; let fcmToken = null;
if (regex.test(this.state.username) === true) { if (regex.test(this.state.username) === true) {
console.log('true') console.log('true')
try { try {
@ -57,11 +63,7 @@ class LoginScreen extends Component {
if (enabled) { if (enabled) {
console.log('Notification permission granted.'); console.log('Notification permission granted.');
if(Platform.OS === 'android') { fcmToken = await messaging().getToken();
fcmToken = await messaging().getToken();
}else {
fcmToken = await messaging().getAPNSToken();
}
console.log('fcmToken >>>> ', fcmToken) console.log('fcmToken >>>> ', fcmToken)
} else { } else {
console.log('Notification permission denied.'); console.log('Notification permission denied.');