diff --git a/android/app/src/main/java/com/kano/MainActivity.java b/android/app/src/main/java/com/kano/MainActivity.java index b822f93..1c9d454 100644 --- a/android/app/src/main/java/com/kano/MainActivity.java +++ b/android/app/src/main/java/com/kano/MainActivity.java @@ -6,6 +6,7 @@ import com.facebook.react.ReactActivityDelegate; import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint; import com.facebook.react.defaults.DefaultReactActivityDelegate; +import com.proyecto26.inappbrowser.RNInAppBrowserModule; import com.zoontek.rnbootsplash.RNBootSplash; public class MainActivity extends ReactActivity { @@ -38,4 +39,11 @@ protected void onCreate(Bundle savedInstanceState) { RNBootSplash.init(this); // ⬅️ initialize the splash screen super.onCreate(null); // or super.onCreate(null) with react-native-screens } + + @Override + protected void onStart() { + super.onStart(); + RNInAppBrowserModule.onStart(this); + } + } diff --git a/app/components/AboutFeedbackDialog.tsx b/app/components/AboutFeedbackDialog.tsx index 6491956..50d2c0e 100644 --- a/app/components/AboutFeedbackDialog.tsx +++ b/app/components/AboutFeedbackDialog.tsx @@ -12,7 +12,7 @@ import useLargeScreenMode from 'app/hooks/useLargeScreenMode'; //Interface interface IAboutFeedbackDialogProps { visible: boolean; - onPressTelegram: () => void; + onPressGithub: () => void; onPressEmail: () => void; onPressHideDialog: () => void; } @@ -35,9 +35,9 @@ function AboutFeedbackDialog(props: IAboutFeedbackDialogProps) { - + o.item.id === n.item.id); +export default memo(CharCellItem, (p, n) => { + return ( + p.sectionIndex === n.sectionIndex && + p.item.id === n.item.id && + p.parentWidth === n.parentWidth + ); +}); diff --git a/app/config/app-constant.ts b/app/config/app-constant.ts index 0f0602f..a151a6f 100644 --- a/app/config/app-constant.ts +++ b/app/config/app-constant.ts @@ -11,6 +11,7 @@ const Constant = { REPO_URL: GITHUB_PROJECT_LINK, + ABOUT_NEW_GITHUB_ISSUE: `${GITHUB_PROJECT_LINK}/issues`, ABOUT_TELEGRAM_LINK: 'https://t.me/appstejas', ABOUT_SUPPORT_EMAIL: 'gajjartejas26@gmail.com', @@ -27,7 +28,7 @@ const Constant = { TERMS_OF_SERVICE: `${GITHUB_PROJECT_LINK}/blob/main/docs/terms.md`, ABOUT_HELP: `${GITHUB_PROJECT_LINK}/blob/main/docs/help.md`, - ABOUT_PORTFOLIO: 'https://www.gajjartejas.me', + ABOUT_PORTFOLIO: 'https://gajjartejas.me', ABOUT_INSTAGRAM: 'https://www.instagram.com/gajjartejas', ABOUT_JOIN_TELEGRAM: 'https://t.me/appstejas', ABOUT_GITHUB: GITHUB_PROFILE, diff --git a/app/models/viewModels/settingItem.ts b/app/models/viewModels/settingItem.ts index 41ae171..276cb6a 100644 --- a/app/models/viewModels/settingItem.ts +++ b/app/models/viewModels/settingItem.ts @@ -9,6 +9,7 @@ export interface ISettingItem { title: string; description?: string; route?: any; + touchable?: boolean; } export interface ISettingSection { diff --git a/app/screens/Home/HomeTabs/MoreTab/index.tsx b/app/screens/Home/HomeTabs/MoreTab/index.tsx index 2603376..e90b4ce 100644 --- a/app/screens/Home/HomeTabs/MoreTab/index.tsx +++ b/app/screens/Home/HomeTabs/MoreTab/index.tsx @@ -86,7 +86,7 @@ const MoreTab = ({ navigation }: Props) => { const onPressHideDialog = useCallback(() => setVisible(false), []); const onPressRateApp = useCallback(async () => { - await Utils.openInAppBrowser( + await Utils.openBrowser( Platform.OS === 'android' ? Config.Constants.PLAY_STORE_URL : Config.Constants.APP_STORE_URL, ); }, []); @@ -133,8 +133,8 @@ const MoreTab = ({ navigation }: Props) => { [onPressAbout, onPressContribute, onPressMoreApps, onPressRateApp, onPressSettings, onPressShowDialog], ); - const onPressTelegram = useCallback(async () => { - await Utils.openInAppBrowser(Config.Constants.ABOUT_TELEGRAM_LINK); + const onPressGithub = useCallback(async () => { + await Utils.openInAppBrowser(Config.Constants.ABOUT_NEW_GITHUB_ISSUE); }, []); const onPressEmail = useCallback(async () => { @@ -146,7 +146,7 @@ const MoreTab = ({ navigation }: Props) => { const model = DeviceInfo.getModel(); const readableVersion = DeviceInfo.getReadableVersion(); const body = `OS: ${osType} (${systemVersion})\nBrand: ${brand} (${model})\nApp Version: ${readableVersion}`; - await Linking.openURL(`mailto:${email}?subject=${subject}&body=${body}`); + await Utils.openBrowser(`mailto:${email}?subject=${subject}&body=${body}`); }, [t]); return ( @@ -193,7 +193,7 @@ const MoreTab = ({ navigation }: Props) => { diff --git a/app/screens/Settings/About/index.tsx b/app/screens/Settings/About/index.tsx index b605f5d..fe1906b 100644 --- a/app/screens/Settings/About/index.tsx +++ b/app/screens/Settings/About/index.tsx @@ -42,6 +42,7 @@ const About = ({ navigation }: Props) => { title: t('aboutScreen.infoDescTitle'), description: '', route: '', + touchable: false, }, { id: 1, @@ -50,6 +51,7 @@ const About = ({ navigation }: Props) => { title: t('aboutScreen.infoAuthorNameTitle'), description: '', route: '', + touchable: false, }, ], }, @@ -64,6 +66,7 @@ const About = ({ navigation }: Props) => { title: t('aboutScreen.portfolioTitle'), description: t('aboutScreen.portfolioSubTitle')!, route: '', + touchable: true, }, { id: 1, @@ -72,6 +75,7 @@ const About = ({ navigation }: Props) => { title: t('aboutScreen.instagramTitle'), description: t('aboutScreen.instagramSubTitle')!, route: '', + touchable: true, }, { id: 3, @@ -80,6 +84,7 @@ const About = ({ navigation }: Props) => { title: t('aboutScreen.telegramTitle'), description: t('aboutScreen.telegramSubTitle')!, route: '', + touchable: true, }, { id: 4, @@ -88,6 +93,7 @@ const About = ({ navigation }: Props) => { title: t('aboutScreen.githubTitle'), description: t('aboutScreen.githubSubTitle')!, route: '', + touchable: true, }, { id: 5, @@ -96,6 +102,7 @@ const About = ({ navigation }: Props) => { title: t('aboutScreen.twitterTitle'), description: t('aboutScreen.twitterSubTitle')!, route: '', + touchable: true, }, ], }, @@ -107,22 +114,22 @@ const About = ({ navigation }: Props) => { // const onPressAboutOption = useCallback( - (item: ISettingSection, index: number, subItem: ISettingItem, subIndex: number) => { + async (item: ISettingSection, index: number, subItem: ISettingItem, subIndex: number) => { switch (true) { case index === 1 && subIndex === 0: - Utils.openInAppBrowser(Config.Constants.ABOUT_PORTFOLIO); + await Utils.openInAppBrowser(Config.Constants.ABOUT_PORTFOLIO); break; case index === 1 && subIndex === 1: - Linking.openURL(Config.Constants.ABOUT_INSTAGRAM); + await Utils.openBrowser(Config.Constants.ABOUT_INSTAGRAM); break; case index === 1 && subIndex === 2: - Linking.openURL(Config.Constants.ABOUT_TELEGRAM_LINK); + await Utils.openBrowser(Config.Constants.ABOUT_TELEGRAM_LINK); break; case index === 1 && subIndex === 3: - Utils.openInAppBrowser(Config.Constants.ABOUT_GITHUB); + await Utils.openInAppBrowser(Config.Constants.ABOUT_GITHUB); break; case index === 1 && subIndex === 4: - Linking.openURL(Config.Constants.ABOUT_TWITTER); + await Utils.openBrowser(Config.Constants.ABOUT_TWITTER); break; default: } @@ -166,6 +173,7 @@ const About = ({ navigation }: Props) => { onPress={() => onPressAboutOption(item, index, subItem, subIndex)} title={subItem.title} description={subItem.description} + disabled={!subItem.touchable} left={() => ( { ); }; - const onPressItem = useCallback((item: IFinalLicense, _index: number) => { - Utils.openInAppBrowser(item.licenseSpecs.licenseUrl); + const onPressItem = useCallback(async (item: IFinalLicense, _index: number) => { + await Utils.openInAppBrowser(item.licenseSpecs.licenseUrl); }, []); return ( diff --git a/app/screens/Settings/MoreApps/index.tsx b/app/screens/Settings/MoreApps/index.tsx index 7926169..6037ed3 100644 --- a/app/screens/Settings/MoreApps/index.tsx +++ b/app/screens/Settings/MoreApps/index.tsx @@ -72,15 +72,15 @@ const MoreApps = ({ navigation }: Props) => { navigation.pop(); }, [navigation]); - const onPressGithub = useCallback((item: IMoreAppItem, _index: number) => { + const onPressGithub = useCallback(async (item: IMoreAppItem, _index: number) => { if (item.github != null) { - Utils.openInAppBrowser(item.github); + await Utils.openInAppBrowser(item.github); } }, []); - const onPressPlayStore = useCallback((item: IMoreAppItem, _index: number) => { + const onPressPlayStore = useCallback(async (item: IMoreAppItem, _index: number) => { if (item.playStore != null) { - Linking.openURL(item.playStore); + await Utils.openBrowser(item.playStore); } }, []); diff --git a/app/screens/Settings/Settings/index.tsx b/app/screens/Settings/Settings/index.tsx index 4dd781e..ae4a10f 100644 --- a/app/screens/Settings/Settings/index.tsx +++ b/app/screens/Settings/Settings/index.tsx @@ -113,22 +113,22 @@ const Settings = ({ navigation }: Props) => { }, [navigation]); const onPress = useCallback( - (item: ISettingItem, _index: number) => { + async (item: ISettingItem, _index: number) => { switch (item.route) { case 'Changelog': - Utils.openInAppBrowser(Config.Constants.CHANGE_LOG); + await Utils.openInAppBrowser(Config.Constants.CHANGE_LOG); break; case 'Translate': - Utils.openInAppBrowser(Config.Constants.TRANSLATE_APP); + await Utils.openInAppBrowser(Config.Constants.TRANSLATE_APP); break; case 'FAQ': - Utils.openInAppBrowser(Config.Constants.FAQ); + await Utils.openInAppBrowser(Config.Constants.FAQ); break; case 'PrivacyPolicy': - Utils.openInAppBrowser(Config.Constants.PRIVACY_POLICY); + await Utils.openInAppBrowser(Config.Constants.PRIVACY_POLICY); break; default: diff --git a/app/screens/Settings/Translators/index.tsx b/app/screens/Settings/Translators/index.tsx index 8e7903c..1cfda66 100644 --- a/app/screens/Settings/Translators/index.tsx +++ b/app/screens/Settings/Translators/index.tsx @@ -89,8 +89,8 @@ const Translators = ({ navigation }: Props) => { const onPressItem = (_item: ITranslator, _index: number) => {}; - const onPressContribute = () => { - Utils.openInAppBrowser(Config.Constants.TRANSLATE_APP); + const onPressContribute = async () => { + await Utils.openInAppBrowser(Config.Constants.TRANSLATE_APP); }; const EmptyListComponent = ( diff --git a/app/utils/index.ts b/app/utils/index.ts index d3b9c0e..f32257d 100644 --- a/app/utils/index.ts +++ b/app/utils/index.ts @@ -1,7 +1,8 @@ -import openInAppBrowser from './openInAppBrowser'; +import openInAppBrowser, { openBrowser } from './openInAppBrowser'; import rateApp from './rateApp'; export default { openInAppBrowser, rateApp, + openBrowser, }; diff --git a/app/utils/openInAppBrowser.ts b/app/utils/openInAppBrowser.ts index c235512..d9a2507 100644 --- a/app/utils/openInAppBrowser.ts +++ b/app/utils/openInAppBrowser.ts @@ -4,13 +4,21 @@ import { Alert, Linking } from 'react-native'; const openInAppBrowser = async (url: string) => { try { if (await InAppBrowser.isAvailable()) { - InAppBrowser.open(url); + await InAppBrowser.open(url); } else { - Linking.openURL(url); + await Linking.openURL(url); } } catch (e) { Alert.alert(JSON.stringify(e)); } }; +export const openBrowser = async (url: string) => { + try { + await Linking.openURL(url); + } catch (e: any) { + Alert.alert(e.message); + } +}; + export default openInAppBrowser;