From ddcd9899b34d41caaa832e365464b7db7fba8065 Mon Sep 17 00:00:00 2001 From: Loewy Date: Mon, 12 Feb 2024 13:47:50 -0800 Subject: [PATCH] add type to consts + remove if block --- src/lib/alert-messages/constants.ts | 13 ++++++++++++- src/lib/alert-messages/index.ts | 4 ---- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/src/lib/alert-messages/constants.ts b/src/lib/alert-messages/constants.ts index 7cca47a..02e5d94 100644 --- a/src/lib/alert-messages/constants.ts +++ b/src/lib/alert-messages/constants.ts @@ -1,4 +1,15 @@ -export const CAMERA_PERMISSION_DENIED = { +interface PermissionMessage { + android: { + title: string; + message: string; + }; + ios: { + title: string; + message: string; + }; +} + +export const CAMERA_PERMISSION_DENIED: PermissionMessage = { android: { title: "In order to use the camera, you need to grant app permissions.", message: "Please go to Railbird > App Info and grant permissions. ", diff --git a/src/lib/alert-messages/index.ts b/src/lib/alert-messages/index.ts index 3de5bd0..4c76604 100644 --- a/src/lib/alert-messages/index.ts +++ b/src/lib/alert-messages/index.ts @@ -7,10 +7,6 @@ const ALERT_TYPE = { export const showAlert = (alertType: string) => { const alert = ALERT_TYPE[alertType]; - if (!alert) { - console.error("No alert matches this alert type:", alertType); - return; - } const { title, message } = alert[Platform.OS]; Alert.alert(title, message); };