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_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 = 162;
|
CURRENT_PROJECT_VERSION = 164;
|
||||||
DEAD_CODE_STRIPPING = NO;
|
DEAD_CODE_STRIPPING = NO;
|
||||||
DEVELOPMENT_TEAM = 84F3R56BUC;
|
DEVELOPMENT_TEAM = 84F3R56BUC;
|
||||||
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = 84F3R56BUC;
|
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = 84F3R56BUC;
|
||||||
@ -720,7 +720,7 @@
|
|||||||
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 = 162;
|
CURRENT_PROJECT_VERSION = 164;
|
||||||
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;
|
||||||
|
@ -59,29 +59,29 @@
|
|||||||
</dict>
|
</dict>
|
||||||
</dict>
|
</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>
|
<key>NSCameraUsageDescription</key>
|
||||||
<string>This app needs access to the camera to take photos to upload profile picture and create support ticket.</string>
|
<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>
|
<key>NSLocationWhenInUseUsageDescription</key>
|
||||||
<string>Access current location.</string>
|
<string>Access current location.</string>
|
||||||
<key>NSMicrophoneUsageDescription</key>
|
<key>NSMicrophoneUsageDescription</key>
|
||||||
<string>Access audio from camera.</string>
|
<string>Access audio from camera.</string>
|
||||||
|
<key>NSMotionUsageDescription</key>
|
||||||
|
<string>no use</string>
|
||||||
<key>NSPhotoLibraryAddUsageDescription</key>
|
<key>NSPhotoLibraryAddUsageDescription</key>
|
||||||
<string>Choose a picture for user profile image or save image.</string>
|
<string>Choose a picture for user profile image or save image.</string>
|
||||||
<key>NSPhotoLibraryUsageDescription</key>
|
<key>NSPhotoLibraryUsageDescription</key>
|
||||||
<string>This app needs access to choose photos to upload profile picture and create support ticket.</string>
|
<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>
|
<key>NSSiriUsageDescription</key>
|
||||||
<string>no use</string>
|
<string>no use</string>
|
||||||
<key>NSBluetoothAlwaysUsageDescription</key>
|
<key>NSSpeechRecognitionUsageDescription</key>
|
||||||
<string>no use</string>
|
<string>no use</string>
|
||||||
<key>UIAppFonts</key>
|
<key>UIAppFonts</key>
|
||||||
<array>
|
<array>
|
||||||
@ -164,6 +164,10 @@
|
|||||||
<string>Octicons.ttf</string>
|
<string>Octicons.ttf</string>
|
||||||
<string>Zocial.ttf</string>
|
<string>Zocial.ttf</string>
|
||||||
</array>
|
</array>
|
||||||
|
<key>UIBackgroundModes</key>
|
||||||
|
<array>
|
||||||
|
<string>remote-notification</string>
|
||||||
|
</array>
|
||||||
<key>UILaunchStoryboardName</key>
|
<key>UILaunchStoryboardName</key>
|
||||||
<string>LaunchScreen</string>
|
<string>LaunchScreen</string>
|
||||||
<key>UIRequiredDeviceCapabilities</key>
|
<key>UIRequiredDeviceCapabilities</key>
|
||||||
|
@ -40,20 +40,38 @@ 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;
|
||||||
if (regex.test(this.state.username) === true) {
|
if (regex.test(this.state.username) === true) {
|
||||||
console.log('true')
|
console.log('true')
|
||||||
const fcm = messaging()
|
try {
|
||||||
if (!await fcm.hasPermission()) {
|
const authStatus = await messaging().requestPermission({
|
||||||
try {
|
alert: true,
|
||||||
await messaging().requestPermission()
|
sound: true,
|
||||||
} catch (error) {
|
badge: true,
|
||||||
this.setState({
|
});
|
||||||
isLoading: false
|
|
||||||
})
|
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 = {
|
let params = {
|
||||||
|
Loading…
Reference in New Issue
Block a user