Commit 4e40f5e7 authored by Wahyu Adjie Prasetyo's avatar Wahyu Adjie Prasetyo

alert permission

parent 19de3b69
......@@ -154,7 +154,9 @@
"sendtoken": "Send Token",
"itemnotfound": "There are no menu for this category",
"copyToClipboard": "Copied To Clipboard",
"accessNotPermitted": "Access Not Permitted!",
"accessNotPermitted": "Click grant permission> allow all the time to grant location access",
"selectOpenSetting":"Allow",
"titleAlertLocationNotPermitted":"Location access is not permitted",
"tryItRealDevice": "Please use real device instead of emulator",
"makeSureClaimCredit": "Claiming your old balance. Are you sure?",
"notPremiumYet": "Your account is not yet a Premium Account",
......
......@@ -154,7 +154,9 @@
"sendtoken": "Kirim Token",
"itemnotfound": "Tidak ada menu untuk kategori ini !",
"copyToClipboard": "Disalin ke clipboard",
"accessNotPermitted": "Akses tidak dizinkan!",
"accessNotPermitted": "Klik Berikan izin > izinkan sepanjang waktu untuk memberikan akses lokasi",
"titleAlertLocationNotPermitted":"Permintaan izin lokasi tidak diberikan",
"selectOpenSetting":"Berikan izin",
"tryItRealDevice": "Mohon menggunakan device, bukan emulator",
"makeSureClaimCredit": "Yakin akan mengambil saldo lama Anda?",
"notPremiumYet": "Akun Anda belum menjadi Akun Premium",
......
......@@ -5,7 +5,7 @@ import * as Location from 'expo-location';
import * as Permissions from 'expo-permissions';
import i18n from 'i18n-js';
import * as React from 'react';
import { ActivityIndicator, Alert, Dimensions, Platform, ScrollView, StatusBar, StyleSheet, Text, TouchableOpacity, View } from 'react-native';
import { ActivityIndicator, Alert, Dimensions, Platform, ScrollView, StatusBar, StyleSheet, Text, TouchableOpacity, View, PermissionStatus } from 'react-native';
import { Badge } from 'react-native-elements';
import { SliderBox } from "react-native-image-slider-box";
import { Card } from 'react-native-shadow-cards';
......@@ -19,6 +19,7 @@ import CustomIosStatusBar from './CustomIosStatusBar';
import Spinner from 'react-native-loading-spinner-overlay';
class Home extends React.Component {
......@@ -126,19 +127,33 @@ class Home extends React.Component {
this._unsubscribe();
}
settings() {
this._getPermissions()
}
_getPermissions = async () => {
let { status } = await Permissions.askAsync(Permissions.LOCATION);
if (status !== 'granted') {
// Alert.alert('Akses tidak dizinkan!')
Toast.show(i18n.t('accessNotPermitted'))
Alert.alert(
i18n.t('titleAlertLocationNotPermitted'),
i18n.t('accessNotPermitted'),
[
{
text: i18n.t('selectOpenSetting'),
onPress: () => this.settings()
}
],
{ cancelable: false }
)
} else if (Platform.OS === 'android' && !Device.isDevice) {
// Alert.alert('Silahkan anda coba di real Device')
Toast.show(i18n.t('tryItRealDevice'))
} else {
this._getCurrentPosisition()
}
}
_getCurrentPosisition = async () => {
let location = await Location.getCurrentPositionAsync({
accuracy: Location.Accuracy.Highest
......
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