From 886052fe652558b8c140ec1f3dc2447e716f9920 Mon Sep 17 00:00:00 2001 From: Maarten Date: Tue, 13 Aug 2024 17:06:41 +0200 Subject: [PATCH] Add no internet screen --- app/index.tsx | 28 ++-- assets/languages/en.json | 8 +- assets/languages/nl.json | 8 +- ios/Kliko.xcodeproj/project.pbxproj | 242 ++++++++++++++-------------- ios/Podfile.lock | 6 + package.json | 1 + src/components/LoadingScreen.tsx | 33 ++++ src/components/NoInternet.tsx | 104 ++++++++++++ yarn.lock | 5 + 9 files changed, 296 insertions(+), 139 deletions(-) create mode 100644 src/components/LoadingScreen.tsx create mode 100644 src/components/NoInternet.tsx diff --git a/app/index.tsx b/app/index.tsx index 891ffe5..876e380 100644 --- a/app/index.tsx +++ b/app/index.tsx @@ -4,33 +4,28 @@ import { useTranslation } from 'react-i18next'; import '@/src/localization/i18n'; -import { ThemedText } from '@/src/components/themed/ThemedText'; import { ThemedView } from '@/src/components/themed/ThemedView'; import { useToken } from '@/src/context/AppProvider'; import { Request } from '@/src/services/request'; import { store } from '@/src/store/store'; import { setSession } from '@/src/store/dataStore'; +import NoInternetConnectionScreen from '@/src/components/NoInternet'; +import LoadingScreen from '@/src/components/LoadingScreen'; export default function OnboardStartScreen() { const { token, isLoading } = useToken(); - const { i18n } = useTranslation(); + const { t, i18n } = useTranslation(); const router = useRouter(); - const loadingScreen = () => ( - - Loading... - - ); - useEffect( () => { const fetchData = async () => { const response = await Request.post( 'sessions/get', { token: token } ); if (response.success) { // Save to store - store.dispatch(setSession(response.session)) + store.dispatch( setSession( response.session ) ) // Set language - i18n.changeLanguage(response.session.language); + i18n.changeLanguage( response.session.language ); // @ts-ignore router.replace( '/(tabs)' ); @@ -44,13 +39,14 @@ export default function OnboardStartScreen() { } }, [ isLoading, token, router ] ); - if (isLoading) { - return loadingScreen(); - } - - if (!token) { + if (!isLoading && !token) { return ; } - return loadingScreen(); + return ( + + + + + ) } diff --git a/assets/languages/en.json b/assets/languages/en.json index 1c41e24..1f44fc2 100644 --- a/assets/languages/en.json +++ b/assets/languages/en.json @@ -1,4 +1,5 @@ { + "loading": "Loading", "onboarding": { "missing-info": "Not all information has been filled in!", "welcome": "Welcome to", @@ -90,5 +91,10 @@ "day-before": "A day before", "same-day": "At the same day", "off": "Off", - "at": "at" + "at": "at", + "internet": { + "no-connection": "No Internet Connection", + "please-check": "Please check your internet settings and try again.", + "retry": "Retry" + } } \ No newline at end of file diff --git a/assets/languages/nl.json b/assets/languages/nl.json index fe6de5f..232ce61 100644 --- a/assets/languages/nl.json +++ b/assets/languages/nl.json @@ -1,4 +1,5 @@ { + "loading": "Laden", "onboarding": { "missing-info": "Niet alle gegevens zijn ingevuld!", "welcome": "Welkom bij", @@ -90,5 +91,10 @@ "day-before": "Dag van te voren", "same-day": "Op de ophaaldag", "off": "Uit", - "at": "Om" + "at": "Om", + "internet": { + "no-connection": "Geen internet verbinding", + "please-check": "Controleer je internet verbinding en probeer het opnieuw.", + "retry": "Opnieuw proberen" + } } \ No newline at end of file diff --git a/ios/Kliko.xcodeproj/project.pbxproj b/ios/Kliko.xcodeproj/project.pbxproj index 7d987a3..1d52807 100644 --- a/ios/Kliko.xcodeproj/project.pbxproj +++ b/ios/Kliko.xcodeproj/project.pbxproj @@ -7,37 +7,37 @@ objects = { /* Begin PBXBuildFile section */ - 11BA08BEF4FFF90D24C6F611 /* PrivacyInfo.xcprivacy in Resources */ = {isa = PBXBuildFile; fileRef = E8BA6F96F3BE8899189B78A6 /* PrivacyInfo.xcprivacy */; }; + 11F88ED125254DD1BA7167D5 /* OneSignalNotificationServiceExtension.appex in Copy Files */ = {isa = PBXBuildFile; fileRef = 41F0146C7CE54BFC83136D58 /* OneSignalNotificationServiceExtension.appex */; }; 13B07FBC1A68108700A75B9A /* AppDelegate.mm in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB01A68108700A75B9A /* AppDelegate.mm */; }; 13B07FBF1A68108700A75B9A /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 13B07FB51A68108700A75B9A /* Images.xcassets */; }; 13B07FC11A68108700A75B9A /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB71A68108700A75B9A /* main.m */; }; 3E461D99554A48A4959DE609 /* SplashScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = AA286B85B6C04FC6940260E9 /* SplashScreen.storyboard */; }; - 81CE43F87C754C24A88C5E62 /* NotificationService.m in Sources */ = {isa = PBXBuildFile; fileRef = E8602A0F69F0417F90AD1F90 /* NotificationService.m */; }; - 822BCEAAC39946FBBA362C40 /* noop-file.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74907E5D7F2947368D73D307 /* noop-file.swift */; }; + 4761096C7882447EB5D979F2 /* noop-file.swift in Sources */ = {isa = PBXBuildFile; fileRef = 27DAD56EA1E54CE88F34A6A9 /* noop-file.swift */; }; 96905EF65AED1B983A6B3ABC /* libPods-Kliko.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 58EEBF8E8E6FB1BC6CAF49B5 /* libPods-Kliko.a */; }; + 9E3B010500F333DDDD2A69ED /* PrivacyInfo.xcprivacy in Resources */ = {isa = PBXBuildFile; fileRef = 846CD92B520B9A69865A7372 /* PrivacyInfo.xcprivacy */; }; B18059E884C0ABDD17F3DC3D /* ExpoModulesProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = FAC715A2D49A985799AEE119 /* ExpoModulesProvider.swift */; }; BB2F792D24A3F905000567C9 /* Expo.plist in Resources */ = {isa = PBXBuildFile; fileRef = BB2F792C24A3F905000567C9 /* Expo.plist */; }; - C880742DF0384A348CB3511D /* OneSignalNotificationServiceExtension.appex in Copy Files */ = {isa = PBXBuildFile; fileRef = 390C21A938EC49C499EDE45A /* OneSignalNotificationServiceExtension.appex */; }; + F8386683F4CA43139737D713 /* NotificationService.m in Sources */ = {isa = PBXBuildFile; fileRef = 59DDBC4B819B43BD8344A064 /* NotificationService.m */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ - 195D8FBF0BAB47DB9920EDFF /* PBXContainerItemProxy */ = { + 6CF909F318DB4F9FA1EFDBF6 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = 83CBB9F71A601CBA00E9B192 /* Project object */; proxyType = 1; - remoteGlobalIDString = F1BE1B47B0FE49DBA94FF2D2; + remoteGlobalIDString = AAF7F21870F941D384754869; remoteInfo = OneSignalNotificationServiceExtension; }; /* End PBXContainerItemProxy section */ /* Begin PBXCopyFilesBuildPhase section */ - E5BDBC73DC3A480FA19FF842 /* Copy Files */ = { + DBF4772D34A3419DBCF489CE /* Copy Files */ = { isa = PBXCopyFilesBuildPhase; buildActionMask = 2147483647; dstPath = ""; dstSubfolderSpec = 13; files = ( - C880742DF0384A348CB3511D /* OneSignalNotificationServiceExtension.appex in Copy Files */, + 11F88ED125254DD1BA7167D5 /* OneSignalNotificationServiceExtension.appex in Copy Files */, ); name = "Copy Files"; runOnlyForDeploymentPostprocessing = 0; @@ -51,20 +51,20 @@ 13B07FB51A68108700A75B9A /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Images.xcassets; path = Kliko/Images.xcassets; sourceTree = ""; }; 13B07FB61A68108700A75B9A /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = Info.plist; path = Kliko/Info.plist; sourceTree = ""; }; 13B07FB71A68108700A75B9A /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = main.m; path = Kliko/main.m; sourceTree = ""; }; - 2ABF6CA379A34D79B96BF6ED /* OneSignalNotificationServiceExtension-Info.plist */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 4; includeInIndex = 0; lastKnownFileType = text.plist.xml; name = "OneSignalNotificationServiceExtension-Info.plist"; path = "OneSignalNotificationServiceExtension-Info.plist"; sourceTree = ""; }; - 390C21A938EC49C499EDE45A /* OneSignalNotificationServiceExtension.appex */ = {isa = PBXFileReference; explicitFileType = "wrapper.app-extension"; fileEncoding = undefined; includeInIndex = 0; lastKnownFileType = undefined; name = OneSignalNotificationServiceExtension.appex; path = OneSignalNotificationServiceExtension.appex; sourceTree = BUILT_PRODUCTS_DIR; }; - 4972FD0DD6424EE5B111C141 /* OneSignalNotificationServiceExtension.entitlements */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = undefined; includeInIndex = 0; lastKnownFileType = unknown; name = OneSignalNotificationServiceExtension.entitlements; path = OneSignalNotificationServiceExtension.entitlements; sourceTree = ""; }; - 4DC819D0299A4B2688B168E6 /* Kliko-Bridging-Header.h */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 4; includeInIndex = 0; lastKnownFileType = sourcecode.c.h; name = "Kliko-Bridging-Header.h"; path = "Kliko/Kliko-Bridging-Header.h"; sourceTree = ""; }; + 27DAD56EA1E54CE88F34A6A9 /* noop-file.swift */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 4; includeInIndex = 0; lastKnownFileType = sourcecode.swift; name = "noop-file.swift"; path = "Kliko/noop-file.swift"; sourceTree = ""; }; + 3E310E9973104212B00EFD0B /* OneSignalNotificationServiceExtension.entitlements */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = undefined; includeInIndex = 0; lastKnownFileType = unknown; name = OneSignalNotificationServiceExtension.entitlements; path = OneSignalNotificationServiceExtension.entitlements; sourceTree = ""; }; + 41F0146C7CE54BFC83136D58 /* OneSignalNotificationServiceExtension.appex */ = {isa = PBXFileReference; explicitFileType = "wrapper.app-extension"; fileEncoding = undefined; includeInIndex = 0; lastKnownFileType = undefined; name = OneSignalNotificationServiceExtension.appex; path = OneSignalNotificationServiceExtension.appex; sourceTree = BUILT_PRODUCTS_DIR; }; 58EEBF8E8E6FB1BC6CAF49B5 /* libPods-Kliko.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-Kliko.a"; sourceTree = BUILT_PRODUCTS_DIR; }; + 59DDBC4B819B43BD8344A064 /* NotificationService.m */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 4; includeInIndex = 0; lastKnownFileType = sourcecode.c.objc; name = NotificationService.m; path = NotificationService.m; sourceTree = ""; }; 6C2E3173556A471DD304B334 /* Pods-Kliko.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Kliko.debug.xcconfig"; path = "Target Support Files/Pods-Kliko/Pods-Kliko.debug.xcconfig"; sourceTree = ""; }; - 74907E5D7F2947368D73D307 /* noop-file.swift */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 4; includeInIndex = 0; lastKnownFileType = sourcecode.swift; name = "noop-file.swift"; path = "Kliko/noop-file.swift"; sourceTree = ""; }; + 6F9AD7CD5CDE49F08417D645 /* Kliko-Bridging-Header.h */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 4; includeInIndex = 0; lastKnownFileType = sourcecode.c.h; name = "Kliko-Bridging-Header.h"; path = "Kliko/Kliko-Bridging-Header.h"; sourceTree = ""; }; 7A4D352CD337FB3A3BF06240 /* Pods-Kliko.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Kliko.release.xcconfig"; path = "Target Support Files/Pods-Kliko/Pods-Kliko.release.xcconfig"; sourceTree = ""; }; + 846CD92B520B9A69865A7372 /* PrivacyInfo.xcprivacy */ = {isa = PBXFileReference; includeInIndex = 1; name = PrivacyInfo.xcprivacy; path = Kliko/PrivacyInfo.xcprivacy; sourceTree = ""; }; AA286B85B6C04FC6940260E9 /* SplashScreen.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; name = SplashScreen.storyboard; path = Kliko/SplashScreen.storyboard; sourceTree = ""; }; BB2F792C24A3F905000567C9 /* Expo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Expo.plist; sourceTree = ""; }; - E7C423693D2349B3A0CE5FD1 /* NotificationService.h */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 4; includeInIndex = 0; lastKnownFileType = sourcecode.c.h; name = NotificationService.h; path = NotificationService.h; sourceTree = ""; }; - E8602A0F69F0417F90AD1F90 /* NotificationService.m */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 4; includeInIndex = 0; lastKnownFileType = sourcecode.c.objc; name = NotificationService.m; path = NotificationService.m; sourceTree = ""; }; - E8BA6F96F3BE8899189B78A6 /* PrivacyInfo.xcprivacy */ = {isa = PBXFileReference; includeInIndex = 1; name = PrivacyInfo.xcprivacy; path = Kliko/PrivacyInfo.xcprivacy; sourceTree = ""; }; + CCAF22965677481F875CEC58 /* OneSignalNotificationServiceExtension-Info.plist */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 4; includeInIndex = 0; lastKnownFileType = text.plist.xml; name = "OneSignalNotificationServiceExtension-Info.plist"; path = "OneSignalNotificationServiceExtension-Info.plist"; sourceTree = ""; }; ED297162215061F000B7C4FE /* JavaScriptCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = JavaScriptCore.framework; path = System/Library/Frameworks/JavaScriptCore.framework; sourceTree = SDKROOT; }; + FAC5128A3282435BAD08A152 /* NotificationService.h */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 4; includeInIndex = 0; lastKnownFileType = sourcecode.c.h; name = NotificationService.h; path = NotificationService.h; sourceTree = ""; }; FAC715A2D49A985799AEE119 /* ExpoModulesProvider.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ExpoModulesProvider.swift; path = "Pods/Target Support Files/Pods-Kliko/ExpoModulesProvider.swift"; sourceTree = ""; }; /* End PBXFileReference section */ @@ -77,7 +77,7 @@ ); runOnlyForDeploymentPostprocessing = 0; }; - B1570166C0FB45C19B7F92A3 /* Frameworks */ = { + FF655E8BB874456C8C0E48D0 /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( @@ -97,9 +97,9 @@ 13B07FB61A68108700A75B9A /* Info.plist */, 13B07FB71A68108700A75B9A /* main.m */, AA286B85B6C04FC6940260E9 /* SplashScreen.storyboard */, - 74907E5D7F2947368D73D307 /* noop-file.swift */, - 4DC819D0299A4B2688B168E6 /* Kliko-Bridging-Header.h */, - E8BA6F96F3BE8899189B78A6 /* PrivacyInfo.xcprivacy */, + 27DAD56EA1E54CE88F34A6A9 /* noop-file.swift */, + 6F9AD7CD5CDE49F08417D645 /* Kliko-Bridging-Header.h */, + 846CD92B520B9A69865A7372 /* PrivacyInfo.xcprivacy */, ); name = Kliko; sourceTree = ""; @@ -113,18 +113,6 @@ name = Frameworks; sourceTree = ""; }; - 819C68B783024998AE3769F1 /* OneSignalNotificationServiceExtension */ = { - isa = PBXGroup; - children = ( - E7C423693D2349B3A0CE5FD1 /* NotificationService.h */, - 4972FD0DD6424EE5B111C141 /* OneSignalNotificationServiceExtension.entitlements */, - 2ABF6CA379A34D79B96BF6ED /* OneSignalNotificationServiceExtension-Info.plist */, - E8602A0F69F0417F90AD1F90 /* NotificationService.m */, - ); - name = OneSignalNotificationServiceExtension; - path = OneSignalNotificationServiceExtension; - sourceTree = ""; - }; 832341AE1AAA6A7D00B99B32 /* Libraries */ = { isa = PBXGroup; children = ( @@ -141,7 +129,7 @@ 2D16E6871FA4F8E400B85C8A /* Frameworks */, D65327D7A22EEC0BE12398D9 /* Pods */, D7E4C46ADA2E9064B798F356 /* ExpoModulesProviders */, - 819C68B783024998AE3769F1 /* OneSignalNotificationServiceExtension */, + B3D8DC56DBE2467C9B686635 /* OneSignalNotificationServiceExtension */, ); indentWidth = 2; sourceTree = ""; @@ -152,7 +140,7 @@ isa = PBXGroup; children = ( 13B07F961A680F5B00A75B9A /* Kliko.app */, - 390C21A938EC49C499EDE45A /* OneSignalNotificationServiceExtension.appex */, + 41F0146C7CE54BFC83136D58 /* OneSignalNotificationServiceExtension.appex */, ); name = Products; sourceTree = ""; @@ -165,6 +153,18 @@ name = Kliko; sourceTree = ""; }; + B3D8DC56DBE2467C9B686635 /* OneSignalNotificationServiceExtension */ = { + isa = PBXGroup; + children = ( + FAC5128A3282435BAD08A152 /* NotificationService.h */, + 3E310E9973104212B00EFD0B /* OneSignalNotificationServiceExtension.entitlements */, + CCAF22965677481F875CEC58 /* OneSignalNotificationServiceExtension-Info.plist */, + 59DDBC4B819B43BD8344A064 /* NotificationService.m */, + ); + name = OneSignalNotificationServiceExtension; + path = OneSignalNotificationServiceExtension; + sourceTree = ""; + }; BB2F792B24A3F905000567C9 /* Supporting */ = { isa = PBXGroup; children = ( @@ -199,32 +199,32 @@ buildConfigurationList = 13B07F931A680F5B00A75B9A /* Build configuration list for PBXNativeTarget "Kliko" */; buildPhases = ( 08A4A3CD28434E44B6B9DE2E /* [CP] Check Pods Manifest.lock */, - 1601BB34E78E87632E7FDF80 /* [Expo] Configure project */, + 1B2B29E5AE4653CC93E337E4 /* [Expo] Configure project */, 13B07F871A680F5B00A75B9A /* Sources */, 13B07F8C1A680F5B00A75B9A /* Frameworks */, 13B07F8E1A680F5B00A75B9A /* Resources */, 00DD1BFF1BD5951E006B06BC /* Bundle React Native code and images */, 800E24972A6A228C8D4807E9 /* [CP] Copy Pods Resources */, - E5BDBC73DC3A480FA19FF842 /* Copy Files */, - E8BF83328D9A2B416CFD2AD8 /* [CP] Embed Pods Frameworks */, + DBF4772D34A3419DBCF489CE /* Copy Files */, + 7CA60269AF3C1BBAC3A0325E /* [CP] Embed Pods Frameworks */, ); buildRules = ( ); dependencies = ( - 8F24380ABC06479FBEDDC50E /* PBXTargetDependency */, + FA0FE68FACB041C4BB2FC891 /* PBXTargetDependency */, ); name = Kliko; productName = Kliko; productReference = 13B07F961A680F5B00A75B9A /* Kliko.app */; productType = "com.apple.product-type.application"; }; - F1BE1B47B0FE49DBA94FF2D2 /* OneSignalNotificationServiceExtension */ = { + AAF7F21870F941D384754869 /* OneSignalNotificationServiceExtension */ = { isa = PBXNativeTarget; - buildConfigurationList = 7777515550CE4FB481B09AD4 /* Build configuration list for PBXNativeTarget "OneSignalNotificationServiceExtension" */; + buildConfigurationList = FA5ED143292D4AA4A67AC234 /* Build configuration list for PBXNativeTarget "OneSignalNotificationServiceExtension" */; buildPhases = ( - 70069E98311C4D0EAEFAED17 /* Sources */, - 854B28CBF86A4209987BEA15 /* Resources */, - B1570166C0FB45C19B7F92A3 /* Frameworks */, + AECF0061EA0C45BFA9FD25D7 /* Sources */, + DF55C288296E4619A1CD5EE3 /* Resources */, + FF655E8BB874456C8C0E48D0 /* Frameworks */, ); buildRules = ( ); @@ -232,7 +232,7 @@ ); name = OneSignalNotificationServiceExtension; productName = OneSignalNotificationServiceExtension; - productReference = 390C21A938EC49C499EDE45A /* OneSignalNotificationServiceExtension.appex */; + productReference = 41F0146C7CE54BFC83136D58 /* OneSignalNotificationServiceExtension.appex */; productType = "com.apple.product-type.app-extension"; }; /* End PBXNativeTarget section */ @@ -247,7 +247,7 @@ DevelopmentTeam = undefined; LastSwiftMigration = 1250; }; - F1BE1B47B0FE49DBA94FF2D2 = { + AAF7F21870F941D384754869 = { DevelopmentTeam = undefined; }; }; @@ -266,7 +266,7 @@ projectRoot = ""; targets = ( 13B07F861A680F5B00A75B9A /* Kliko */, - F1BE1B47B0FE49DBA94FF2D2 /* OneSignalNotificationServiceExtension */, + AAF7F21870F941D384754869 /* OneSignalNotificationServiceExtension */, ); }; /* End PBXProject section */ @@ -279,11 +279,11 @@ BB2F792D24A3F905000567C9 /* Expo.plist in Resources */, 13B07FBF1A68108700A75B9A /* Images.xcassets in Resources */, 3E461D99554A48A4959DE609 /* SplashScreen.storyboard in Resources */, - 11BA08BEF4FFF90D24C6F611 /* PrivacyInfo.xcprivacy in Resources */, + 9E3B010500F333DDDD2A69ED /* PrivacyInfo.xcprivacy in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; - 854B28CBF86A4209987BEA15 /* Resources */ = { + DF55C288296E4619A1CD5EE3 /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( @@ -330,7 +330,7 @@ shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; showEnvVarsInLog = 0; }; - 1601BB34E78E87632E7FDF80 /* [Expo] Configure project */ = { + 1B2B29E5AE4653CC93E337E4 /* [Expo] Configure project */ = { isa = PBXShellScriptBuildPhase; alwaysOutOfDate = 1; buildActionMask = 2147483647; @@ -349,41 +349,7 @@ shellPath = /bin/sh; shellScript = "# This script configures Expo modules and generates the modules provider file.\nbash -l -c \"./Pods/Target\\ Support\\ Files/Pods-Kliko/expo-configure-project.sh\"\n"; }; - 800E24972A6A228C8D4807E9 /* [CP] Copy Pods Resources */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - "${PODS_ROOT}/Target Support Files/Pods-Kliko/Pods-Kliko-resources.sh", - "${PODS_CONFIGURATION_BUILD_DIR}/EXConstants/EXConstants.bundle", - "${PODS_CONFIGURATION_BUILD_DIR}/EXConstants/ExpoConstants_privacy.bundle", - "${PODS_CONFIGURATION_BUILD_DIR}/ExpoFileSystem/ExpoFileSystem_privacy.bundle", - "${PODS_CONFIGURATION_BUILD_DIR}/ExpoSystemUI/ExpoSystemUI_privacy.bundle", - "${PODS_CONFIGURATION_BUILD_DIR}/RNCAsyncStorage/RNCAsyncStorage_resources.bundle", - "${PODS_CONFIGURATION_BUILD_DIR}/RNDeviceInfo/RNDeviceInfoPrivacyInfo.bundle", - "${PODS_CONFIGURATION_BUILD_DIR}/React-Core/RCTI18nStrings.bundle", - "${PODS_CONFIGURATION_BUILD_DIR}/expo-dev-launcher/EXDevLauncher.bundle", - "${PODS_CONFIGURATION_BUILD_DIR}/expo-dev-menu/EXDevMenu.bundle", - ); - name = "[CP] Copy Pods Resources"; - outputPaths = ( - "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/EXConstants.bundle", - "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/ExpoConstants_privacy.bundle", - "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/ExpoFileSystem_privacy.bundle", - "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/ExpoSystemUI_privacy.bundle", - "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/RNCAsyncStorage_resources.bundle", - "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/RNDeviceInfoPrivacyInfo.bundle", - "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/RCTI18nStrings.bundle", - "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/EXDevLauncher.bundle", - "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/EXDevMenu.bundle", - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Kliko/Pods-Kliko-resources.sh\"\n"; - showEnvVarsInLog = 0; - }; - E8BF83328D9A2B416CFD2AD8 /* [CP] Embed Pods Frameworks */ = { + 7CA60269AF3C1BBAC3A0325E /* [CP] Embed Pods Frameworks */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( @@ -431,6 +397,40 @@ shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Kliko/Pods-Kliko-frameworks.sh\"\n"; showEnvVarsInLog = 0; }; + 800E24972A6A228C8D4807E9 /* [CP] Copy Pods Resources */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-Kliko/Pods-Kliko-resources.sh", + "${PODS_CONFIGURATION_BUILD_DIR}/EXConstants/EXConstants.bundle", + "${PODS_CONFIGURATION_BUILD_DIR}/EXConstants/ExpoConstants_privacy.bundle", + "${PODS_CONFIGURATION_BUILD_DIR}/ExpoFileSystem/ExpoFileSystem_privacy.bundle", + "${PODS_CONFIGURATION_BUILD_DIR}/ExpoSystemUI/ExpoSystemUI_privacy.bundle", + "${PODS_CONFIGURATION_BUILD_DIR}/RNCAsyncStorage/RNCAsyncStorage_resources.bundle", + "${PODS_CONFIGURATION_BUILD_DIR}/RNDeviceInfo/RNDeviceInfoPrivacyInfo.bundle", + "${PODS_CONFIGURATION_BUILD_DIR}/React-Core/RCTI18nStrings.bundle", + "${PODS_CONFIGURATION_BUILD_DIR}/expo-dev-launcher/EXDevLauncher.bundle", + "${PODS_CONFIGURATION_BUILD_DIR}/expo-dev-menu/EXDevMenu.bundle", + ); + name = "[CP] Copy Pods Resources"; + outputPaths = ( + "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/EXConstants.bundle", + "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/ExpoConstants_privacy.bundle", + "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/ExpoFileSystem_privacy.bundle", + "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/ExpoSystemUI_privacy.bundle", + "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/RNCAsyncStorage_resources.bundle", + "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/RNDeviceInfoPrivacyInfo.bundle", + "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/RCTI18nStrings.bundle", + "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/EXDevLauncher.bundle", + "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/EXDevMenu.bundle", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Kliko/Pods-Kliko-resources.sh\"\n"; + showEnvVarsInLog = 0; + }; /* End PBXShellScriptBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ @@ -441,25 +441,25 @@ 13B07FBC1A68108700A75B9A /* AppDelegate.mm in Sources */, 13B07FC11A68108700A75B9A /* main.m in Sources */, B18059E884C0ABDD17F3DC3D /* ExpoModulesProvider.swift in Sources */, - 822BCEAAC39946FBBA362C40 /* noop-file.swift in Sources */, + 4761096C7882447EB5D979F2 /* noop-file.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; - 70069E98311C4D0EAEFAED17 /* Sources */ = { + AECF0061EA0C45BFA9FD25D7 /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - 81CE43F87C754C24A88C5E62 /* NotificationService.m in Sources */, + F8386683F4CA43139737D713 /* NotificationService.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXSourcesBuildPhase section */ /* Begin PBXTargetDependency section */ - 8F24380ABC06479FBEDDC50E /* PBXTargetDependency */ = { + FA0FE68FACB041C4BB2FC891 /* PBXTargetDependency */ = { isa = PBXTargetDependency; - target = F1BE1B47B0FE49DBA94FF2D2 /* OneSignalNotificationServiceExtension */; - targetProxy = 195D8FBF0BAB47DB9920EDFF /* PBXContainerItemProxy */; + target = AAF7F21870F941D384754869 /* OneSignalNotificationServiceExtension */; + targetProxy = 6CF909F318DB4F9FA1EFDBF6 /* PBXContainerItemProxy */; }; /* End PBXTargetDependency section */ @@ -524,7 +524,7 @@ }; name = Release; }; - 1F4FC9398E94457E8BDA20D2 /* Release */ = { + 2A7E072146D34D64A910BB64 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { CODE_SIGN_ENTITLEMENTS = OneSignalNotificationServiceExtension/OneSignalNotificationServiceExtension.entitlements; @@ -541,6 +541,27 @@ }; name = Release; }; + 49733290FF4245759D5C306B /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + CODE_SIGN_ENTITLEMENTS = OneSignalNotificationServiceExtension/OneSignalNotificationServiceExtension.entitlements; + CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_TEAM = undefined; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + INFOPLIST_FILE = "OneSignalNotificationServiceExtension/OneSignalNotificationServiceExtension-Info.plist"; + IPHONEOS_DEPLOYMENT_TARGET = 11.0; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks"; + OTHER_SWIFT_FLAGS = "$(inherited) -D EXPO_CONFIGURATION_DEBUG"; + PRODUCT_BUNDLE_IDENTIFIER = nl.maartenvr98.kliko.OneSignalNotificationServiceExtension; + PRODUCT_NAME = OneSignalNotificationServiceExtension; + SKIP_INSTALL = YES; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Debug; + }; 83CBBA201A601CBA00E9B192 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { @@ -666,27 +687,6 @@ }; name = Release; }; - F1C3254570E44E0CB5CEC2BA /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - CODE_SIGN_ENTITLEMENTS = OneSignalNotificationServiceExtension/OneSignalNotificationServiceExtension.entitlements; - CODE_SIGN_STYLE = Automatic; - DEVELOPMENT_TEAM = undefined; - GCC_PREPROCESSOR_DEFINITIONS = ( - "DEBUG=1", - "$(inherited)", - ); - INFOPLIST_FILE = "OneSignalNotificationServiceExtension/OneSignalNotificationServiceExtension-Info.plist"; - IPHONEOS_DEPLOYMENT_TARGET = 11.0; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks"; - OTHER_SWIFT_FLAGS = "$(inherited) -D EXPO_CONFIGURATION_DEBUG"; - PRODUCT_BUNDLE_IDENTIFIER = nl.maartenvr98.kliko.OneSignalNotificationServiceExtension; - PRODUCT_NAME = OneSignalNotificationServiceExtension; - SKIP_INSTALL = YES; - TARGETED_DEVICE_FAMILY = "1,2"; - }; - name = Debug; - }; /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ @@ -699,15 +699,6 @@ defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; - 7777515550CE4FB481B09AD4 /* Build configuration list for PBXNativeTarget "OneSignalNotificationServiceExtension" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - F1C3254570E44E0CB5CEC2BA /* Debug */, - 1F4FC9398E94457E8BDA20D2 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; 83CBB9FA1A601CBA00E9B192 /* Build configuration list for PBXProject "Kliko" */ = { isa = XCConfigurationList; buildConfigurations = ( @@ -717,6 +708,15 @@ defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; + FA5ED143292D4AA4A67AC234 /* Build configuration list for PBXNativeTarget "OneSignalNotificationServiceExtension" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 49733290FF4245759D5C306B /* Debug */, + 2A7E072146D34D64A910BB64 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; /* End XCConfigurationList section */ }; rootObject = 83CBB9F71A601CBA00E9B192 /* Project object */; diff --git a/ios/Podfile.lock b/ios/Podfile.lock index e1c171b..6409be9 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -1269,6 +1269,8 @@ PODS: - React-debug - react-native-leaflet (0.1.2): - React-Core + - react-native-netinfo (11.3.2): + - React-Core - react-native-onesignal (5.2.2): - OneSignalXCFramework (= 5.2.2) - React (< 1.0.0, >= 0.13.0) @@ -1666,6 +1668,7 @@ DEPENDENCIES: - React-logger (from `../node_modules/react-native/ReactCommon/logger`) - React-Mapbuffer (from `../node_modules/react-native/ReactCommon`) - react-native-leaflet (from `../node_modules/react-native-leaflet-view`) + - "react-native-netinfo (from `../node_modules/@react-native-community/netinfo`)" - react-native-onesignal (from `../node_modules/react-native-onesignal`) - react-native-render-html (from `../node_modules/react-native-render-html`) - react-native-safe-area-context (from `../node_modules/react-native-safe-area-context`) @@ -1815,6 +1818,8 @@ EXTERNAL SOURCES: :path: "../node_modules/react-native/ReactCommon" react-native-leaflet: :path: "../node_modules/react-native-leaflet-view" + react-native-netinfo: + :path: "../node_modules/@react-native-community/netinfo" react-native-onesignal: :path: "../node_modules/react-native-onesignal" react-native-render-html: @@ -1944,6 +1949,7 @@ SPEC CHECKSUMS: React-logger: fa92ba4d3a5d39ac450f59be2a3cec7b099f0304 React-Mapbuffer: 9f68550e7c6839d01411ac8896aea5c868eff63a react-native-leaflet: cead07656af59e80164379f6ec9f11a012d7725c + react-native-netinfo: 076df4f9b07f6670acf4ce9a75aac8d34c2e2ccc react-native-onesignal: 592184d34780d04ebbea2b9844d5b6088606cb30 react-native-render-html: 984dfe2294163d04bf5fe25d7c9f122e60e05ebe react-native-safe-area-context: a240ad4b683349e48b1d51fed1611138d1bdad97 diff --git a/package.json b/package.json index ada40ad..86acd13 100644 --- a/package.json +++ b/package.json @@ -18,6 +18,7 @@ "@react-native-async-storage/async-storage": "1.23.1", "@react-native-community/cli-platform-ios": "^14.0.0", "@react-native-community/datetimepicker": "^8.2.0", + "@react-native-community/netinfo": "^11.3.2", "@react-navigation/native": "^6.0.2", "@reduxjs/toolkit": "^2.2.7", "@rnmapbox/maps": "^10.1.28", diff --git a/src/components/LoadingScreen.tsx b/src/components/LoadingScreen.tsx new file mode 100644 index 0000000..e10699b --- /dev/null +++ b/src/components/LoadingScreen.tsx @@ -0,0 +1,33 @@ +import React from 'react'; +import { ActivityIndicator, StyleSheet } from 'react-native'; +import { ThemedView } from '@/src/components/themed/ThemedView'; +import { ThemedText } from '@/src/components/themed/ThemedText'; +import { Colors } from '@/src/constants/Colors'; + +interface LoadingScreenProps { + message?: string; +} + +const LoadingScreen: React.FC = ({ message = 'Loading...' }) => { + return ( + + + {message} + + ); +}; + +const styles = StyleSheet.create( { + container: { + flex: 1, + justifyContent: 'center', + alignItems: 'center', + }, + message: { + marginTop: 20, + fontSize: 18, + fontWeight: '500', + }, +} ); + +export default LoadingScreen; \ No newline at end of file diff --git a/src/components/NoInternet.tsx b/src/components/NoInternet.tsx new file mode 100644 index 0000000..76f3a79 --- /dev/null +++ b/src/components/NoInternet.tsx @@ -0,0 +1,104 @@ +import React, { useState, useEffect } from 'react'; +import { StyleSheet, Dimensions, TouchableOpacity } from 'react-native'; +import NetInfo from '@react-native-community/netinfo'; +import { ThemedText } from '@/src/components/themed/ThemedText'; +import { ThemedView } from '@/src/components/themed/ThemedView'; +import { Colors } from '@/src/constants/Colors'; +import Ionicons from '@expo/vector-icons/Ionicons'; +import { useColorScheme } from '@/src/hooks/useColorScheme'; +import { useTranslation } from 'react-i18next'; + +const { width, height } = Dimensions.get( 'window' ); + +const NoInternetConnectionScreen: React.FC = () => { + const colorScheme = useColorScheme() ?? 'light'; + const [ isConnected, setIsConnected ] = useState( null ); + const { t } = useTranslation(); + + useEffect( () => { + const unsubscribe = NetInfo.addEventListener( state => { + setIsConnected( state.isConnected ); + } ); + + // Check the initial connection status + NetInfo.fetch().then( state => { + setIsConnected( state.isConnected ); + } ); + + return () => unsubscribe(); + }, [] ); + + const retryConnection = () => { + NetInfo.fetch().then( state => { + setIsConnected( state.isConnected ); + } ); + }; + + if (isConnected !== false) { + return null; // Don't render the screen if connected + } + + return ( + + {t( "internet.no-connection" )} + + {t( "internet.please-check" )} + + + + + {t( "internet.retry" )} + + + + + ); +}; + +const styles = StyleSheet.create( { + container: { + position: 'absolute', + top: 0, + left: 0, + width: width, + height: height + 70, // Tab bar height + alignItems: 'center', + justifyContent: 'center', + padding: 20, + zIndex: 9999, // Ensure it's on top + }, + image: { + width: 120, + height: 120, + marginBottom: 20, + }, + title: { + fontSize: 24, + fontWeight: 'bold', + marginBottom: 10, + }, + message: { + fontSize: 16, + textAlign: 'center', + marginBottom: 20, + color: '#666', + }, + button: { + borderRadius: 5, + paddingTop: 10, + paddingBottom: 10, + paddingLeft: 40, + paddingRight: 40, + marginTop: 30, + display: 'flex', + flexDirection: 'row', + alignItems: 'center', + }, + buttonIcon: { + marginLeft: 15, + paddingTop: 2, + color: Colors.white + }, +} ); + +export default NoInternetConnectionScreen; \ No newline at end of file diff --git a/yarn.lock b/yarn.lock index 46f8ad1..7fe3db9 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1804,6 +1804,11 @@ dependencies: invariant "^2.2.4" +"@react-native-community/netinfo@^11.3.2": + version "11.3.2" + resolved "https://registry.yarnpkg.com/@react-native-community/netinfo/-/netinfo-11.3.2.tgz#e63201d0b87ad42d086d1003be48ae7b327f0594" + integrity sha512-YsaS3Dutnzqd1BEoeC+DEcuNJedYRkN6Ef3kftT5Sm8ExnCF94C/nl4laNxuvFli3+Jz8Df3jO25Jn8A9S0h4w== + "@react-native/assets-registry@0.74.85": version "0.74.85" resolved "https://registry.npmjs.org/@react-native/assets-registry/-/assets-registry-0.74.85.tgz"