Commit 7e20a7a1 authored by Fred's avatar Fred

fix permission notification ios

parent 5a64c156
...@@ -39,15 +39,18 @@ class Login extends React.Component { ...@@ -39,15 +39,18 @@ class Login extends React.Component {
} }
_getDeviceInfo = async () => { _getDeviceInfo = async () => {
let { status } = await Permissions.getAsync(Permissions.NOTIFICATIONS); if (Constants.isDevice) {
if (status !== 'granted') { const { status: existingStatus } = await Permissions.getAsync(Permissions.NOTIFICATIONS);
// Alert.alert('Akses tidak dizinkan!') let finalStatus = existingStatus;
Toast.show("Failed to get push token for push notification!", ToastAndroid.SHORT) if (existingStatus !== 'granted') {
} else if (Device.osName == 'Android' && !Device.isDevice) { const { status } = await Permissions.askAsync(Permissions.NOTIFICATIONS);
finalStatus = status;
// Alert.alert('Silahkan anda coba di real Device') }
Toast.show("Silahkan anda coba di real Device", ToastAndroid.SHORT) if (finalStatus !== 'granted') {
d } else { Toast.show('Failed to get push token for push notification!');
return;
}
let fb_token = await Notifications.getExpoPushTokenAsync(); let fb_token = await Notifications.getExpoPushTokenAsync();
let device_id = Constants.deviceId let device_id = Constants.deviceId
let os_name = Device.osName let os_name = Device.osName
...@@ -63,7 +66,8 @@ d } else { ...@@ -63,7 +66,8 @@ d } else {
} }
// console.log(deviceInfoProps); // console.log(deviceInfoProps);
this.props.setDeviceInfo(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