fix get fcm token from firebase messaging
This commit is contained in:
parent
ebb96bdbb8
commit
43865f075c
@ -689,7 +689,7 @@
|
||||
CODE_SIGN_ENTITLEMENTS = csareactrn60/csareactrn60.entitlements;
|
||||
CODE_SIGN_IDENTITY = "iPhone Developer";
|
||||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Distribution";
|
||||
CURRENT_PROJECT_VERSION = 162;
|
||||
CURRENT_PROJECT_VERSION = 164;
|
||||
DEAD_CODE_STRIPPING = NO;
|
||||
DEVELOPMENT_TEAM = 84F3R56BUC;
|
||||
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = 84F3R56BUC;
|
||||
@ -720,7 +720,7 @@
|
||||
CODE_SIGN_IDENTITY = "iPhone Distribution";
|
||||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Distribution";
|
||||
CODE_SIGN_STYLE = Manual;
|
||||
CURRENT_PROJECT_VERSION = 162;
|
||||
CURRENT_PROJECT_VERSION = 164;
|
||||
DEVELOPMENT_TEAM = 84F3R56BUC;
|
||||
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = 84F3R56BUC;
|
||||
INFOPLIST_FILE = csareactrn60/Info.plist;
|
||||
|
@ -59,29 +59,29 @@
|
||||
</dict>
|
||||
</dict>
|
||||
</dict>
|
||||
<key>NSAppleMusicUsageDescription</key>
|
||||
<string>no use</string>
|
||||
<key>NSBluetoothAlwaysUsageDescription</key>
|
||||
<string>no use</string>
|
||||
<key>NSCalendarsUsageDescription</key>
|
||||
<string>no use</string>
|
||||
<key>NSCameraUsageDescription</key>
|
||||
<string>This app needs access to the camera to take photos to upload profile picture and create support ticket.</string>
|
||||
<key>NSContactsUsageDescription</key>
|
||||
<string>no use</string>
|
||||
<key>NSLocationWhenInUseUsageDescription</key>
|
||||
<string>Access current location.</string>
|
||||
<key>NSMicrophoneUsageDescription</key>
|
||||
<string>Access audio from camera.</string>
|
||||
<key>NSMotionUsageDescription</key>
|
||||
<string>no use</string>
|
||||
<key>NSPhotoLibraryAddUsageDescription</key>
|
||||
<string>Choose a picture for user profile image or save image.</string>
|
||||
<key>NSPhotoLibraryUsageDescription</key>
|
||||
<string>This app needs access to choose photos to upload profile picture and create support ticket.</string>
|
||||
<key>NSContactsUsageDescription</key>
|
||||
<string>no use</string>
|
||||
<key>NSCalendarsUsageDescription</key>
|
||||
<string>no use</string>
|
||||
<key>NSAppleMusicUsageDescription</key>
|
||||
<string>no use</string>
|
||||
<key>NSMotionUsageDescription</key>
|
||||
<string>no use</string>
|
||||
<key>NSSpeechRecognitionUsageDescription</key>
|
||||
<string>no use</string>
|
||||
<key>NSSiriUsageDescription</key>
|
||||
<string>no use</string>
|
||||
<key>NSBluetoothAlwaysUsageDescription</key>
|
||||
<key>NSSpeechRecognitionUsageDescription</key>
|
||||
<string>no use</string>
|
||||
<key>UIAppFonts</key>
|
||||
<array>
|
||||
@ -164,6 +164,10 @@
|
||||
<string>Octicons.ttf</string>
|
||||
<string>Zocial.ttf</string>
|
||||
</array>
|
||||
<key>UIBackgroundModes</key>
|
||||
<array>
|
||||
<string>remote-notification</string>
|
||||
</array>
|
||||
<key>UILaunchStoryboardName</key>
|
||||
<string>LaunchScreen</string>
|
||||
<key>UIRequiredDeviceCapabilities</key>
|
||||
|
@ -40,20 +40,38 @@ class LoginScreen extends Component {
|
||||
if (this.state.username && this.state.password) {
|
||||
var regex = /^\d+$/;
|
||||
|
||||
const fcmToken = null;
|
||||
if (regex.test(this.state.username) === true) {
|
||||
console.log('true')
|
||||
const fcm = messaging()
|
||||
if (!await fcm.hasPermission()) {
|
||||
try {
|
||||
await messaging().requestPermission()
|
||||
} catch (error) {
|
||||
this.setState({
|
||||
isLoading: false
|
||||
})
|
||||
const authStatus = await messaging().requestPermission({
|
||||
alert: true,
|
||||
sound: true,
|
||||
badge: true,
|
||||
});
|
||||
|
||||
console.log('authStatus >>> ', authStatus)
|
||||
const enabled =
|
||||
authStatus === messaging.AuthorizationStatus.AUTHORIZED ||
|
||||
authStatus === messaging.AuthorizationStatus.PROVISIONAL;
|
||||
|
||||
if (enabled) {
|
||||
console.log('Notification permission granted.');
|
||||
if(Platform.OS === 'android') {
|
||||
fcmToken = await messaging().getToken();
|
||||
}else {
|
||||
fcmToken = await messaging().getAPNSToken();
|
||||
}
|
||||
console.log('fcmToken >>>> ', fcmToken)
|
||||
} else {
|
||||
console.log('Notification permission denied.');
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Failed to request notification permission:', error);
|
||||
}
|
||||
|
||||
const fcmToken = await messaging().getAPNSToken()
|
||||
// const fcmToken = await messaging().getAPNSToken()
|
||||
console.log('await messaging().getAPNSToken() <<<<<< ', fcmToken)
|
||||
|
||||
|
||||
let params = {
|
||||
|
Loading…
Reference in New Issue
Block a user