Commit 7e20a7a1 authored by Fred's avatar Fred

fix permission notification ios

parent 5a64c156
......@@ -39,15 +39,18 @@ class Login extends React.Component {
}
_getDeviceInfo = async () => {
let { status } = await Permissions.getAsync(Permissions.NOTIFICATIONS);
if (status !== 'granted') {
// Alert.alert('Akses tidak dizinkan!')
Toast.show("Failed to get push token for push notification!", ToastAndroid.SHORT)
} else if (Device.osName == 'Android' && !Device.isDevice) {
// Alert.alert('Silahkan anda coba di real Device')
Toast.show("Silahkan anda coba di real Device", ToastAndroid.SHORT)
d } else {
if (Constants.isDevice) {
const { status: existingStatus } = await Permissions.getAsync(Permissions.NOTIFICATIONS);
let finalStatus = existingStatus;
if (existingStatus !== 'granted') {
const { status } = await Permissions.askAsync(Permissions.NOTIFICATIONS);
finalStatus = status;
}
if (finalStatus !== 'granted') {
Toast.show('Failed to get push token for push notification!');
return;
}
let fb_token = await Notifications.getExpoPushTokenAsync();
let device_id = Constants.deviceId
let os_name = Device.osName
......@@ -63,7 +66,8 @@ d } else {
}
// console.log(deviceInfoProps);
this.props.setDeviceInfo(deviceInfoProps)
} else {
Toast.show('Must use physical device for Push Notifications');
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment