upd: setting

Deskripsi:
- buat halaman setting
- isinya edit profile, ganti tema aplikasi, nonaktifkan notifikasi, sign out

No Issues
This commit is contained in:
2026-02-18 15:45:45 +08:00
parent 42cb7c8f8e
commit 64aaafa2be
6 changed files with 294 additions and 104 deletions

View File

@@ -6,8 +6,7 @@ import {
} from '@react-native-firebase/messaging';
import * as Notifications from 'expo-notifications';
import { useEffect } from 'react';
import { PermissionsAndroid, Platform } from 'react-native';
import { Linking, PermissionsAndroid, Platform } from 'react-native';
import { ConstEnv } from '@/constants/ConstEnv';
const RNfirebaseConfig = {
@@ -38,6 +37,30 @@ const initializeFirebase = async () => {
}
};
export const checkPermission = async () => {
try {
if (Platform.OS === 'android') {
return await PermissionsAndroid.check(
PermissionsAndroid.PERMISSIONS.POST_NOTIFICATIONS
);
} else if (Platform.OS === 'ios') {
const { status } = await Notifications.getPermissionsAsync();
return status === 'granted';
}
} catch (err) {
console.warn('Error checking notification permissions:', err);
return false;
}
};
export const openSettings = () => {
if (Platform.OS === 'ios') {
Linking.openURL('app-settings:');
} else {
Linking.openSettings();
}
};
export const requestPermission = async () => {
try {
if (Platform.OS === 'android') {