You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

functions.ts 693B

1234567891011121314151617181920212223242526272829
  1. import { Alert, Linking, NativeModules } from 'react-native';
  2. import Platform from '../../base/react/Platform.native';
  3. /**
  4. * Opens the settings panel for the current platform.
  5. *
  6. * @private
  7. * @returns {void}
  8. */
  9. export function openSettings() {
  10. switch (Platform.OS) {
  11. case 'android':
  12. NativeModules.AndroidSettings.open().catch(() => {
  13. Alert.alert(
  14. 'Error opening settings',
  15. 'Please open settings and grant the required permissions',
  16. [
  17. { text: 'OK' }
  18. ]
  19. );
  20. });
  21. break;
  22. case 'ios':
  23. Linking.openURL('app-settings:');
  24. break;
  25. }
  26. }