diff --git a/compass_app/app/ios/Flutter/AppFrameworkInfo.plist b/compass_app/app/ios/Flutter/AppFrameworkInfo.plist
index 7c569640062..391a902b2be 100644
--- a/compass_app/app/ios/Flutter/AppFrameworkInfo.plist
+++ b/compass_app/app/ios/Flutter/AppFrameworkInfo.plist
@@ -20,7 +20,5 @@
????
CFBundleVersion
1.0
- MinimumOSVersion
- 12.0
diff --git a/compass_app/app/ios/Podfile b/compass_app/app/ios/Podfile
index d97f17e223f..e51a31d9ca9 100644
--- a/compass_app/app/ios/Podfile
+++ b/compass_app/app/ios/Podfile
@@ -1,5 +1,5 @@
# Uncomment this line to define a global platform for your project
-# platform :ios, '12.0'
+# platform :ios, '13.0'
# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true'
diff --git a/compass_app/app/ios/Runner.xcodeproj/project.pbxproj b/compass_app/app/ios/Runner.xcodeproj/project.pbxproj
index 9a72577f690..41da184eeca 100644
--- a/compass_app/app/ios/Runner.xcodeproj/project.pbxproj
+++ b/compass_app/app/ios/Runner.xcodeproj/project.pbxproj
@@ -7,6 +7,8 @@
objects = {
/* Begin PBXBuildFile section */
+ 000D6155430573541296A669 /* Pods_RunnerTests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 65C6980E1C978E48E2CAAF9E /* Pods_RunnerTests.framework */; };
+ 095C39CAC25FFF2F7EEF3F6A /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 979D91CF8ECF74C07F941F26 /* Pods_Runner.framework */; };
1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; };
331C808B294A63AB00263BE5 /* RunnerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 331C807B294A618700263BE5 /* RunnerTests.swift */; };
3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; };
@@ -42,26 +44,43 @@
/* Begin PBXFileReference section */
1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; };
1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; };
+ 2D08EBED17F8EB3E71066100 /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = ""; };
331C807B294A618700263BE5 /* RunnerTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RunnerTests.swift; sourceTree = ""; };
331C8081294A63A400263BE5 /* RunnerTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = RunnerTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; };
+ 533C3FD951D5AE1E277F97EA /* Pods-RunnerTests.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.profile.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.profile.xcconfig"; sourceTree = ""; };
+ 65C6980E1C978E48E2CAAF9E /* Pods_RunnerTests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_RunnerTests.framework; sourceTree = BUILT_PRODUCTS_DIR; };
+ 73D680D850EE7547967548AF /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = ""; };
74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = ""; };
74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; };
7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; };
+ 7CE0B42F28AB4499FBFFCA2B /* Pods-RunnerTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.release.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.release.xcconfig"; sourceTree = ""; };
9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = ""; };
9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = ""; };
+ 979D91CF8ECF74C07F941F26 /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; };
97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; };
97C146FB1CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; };
97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; };
97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; };
97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; };
+ A92DF2C27B508203F7C6C31E /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = ""; };
+ F0B5CFB1023F506DCA60BD86 /* Pods-RunnerTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.debug.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.debug.xcconfig"; sourceTree = ""; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
+ 7643B12B470921837C5584E9 /* Frameworks */ = {
+ isa = PBXFrameworksBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 000D6155430573541296A669 /* Pods_RunnerTests.framework in Frameworks */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
97C146EB1CF9000F007C117D /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
+ 095C39CAC25FFF2F7EEF3F6A /* Pods_Runner.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -76,6 +95,15 @@
path = RunnerTests;
sourceTree = "";
};
+ 364DA2461A3585E181B377B7 /* Frameworks */ = {
+ isa = PBXGroup;
+ children = (
+ 979D91CF8ECF74C07F941F26 /* Pods_Runner.framework */,
+ 65C6980E1C978E48E2CAAF9E /* Pods_RunnerTests.framework */,
+ );
+ name = Frameworks;
+ sourceTree = "";
+ };
9740EEB11CF90186004384FC /* Flutter */ = {
isa = PBXGroup;
children = (
@@ -94,6 +122,8 @@
97C146F01CF9000F007C117D /* Runner */,
97C146EF1CF9000F007C117D /* Products */,
331C8082294A63A400263BE5 /* RunnerTests */,
+ CB700A2D2D14FBAC8C22DD21 /* Pods */,
+ 364DA2461A3585E181B377B7 /* Frameworks */,
);
sourceTree = "";
};
@@ -121,6 +151,20 @@
path = Runner;
sourceTree = "";
};
+ CB700A2D2D14FBAC8C22DD21 /* Pods */ = {
+ isa = PBXGroup;
+ children = (
+ A92DF2C27B508203F7C6C31E /* Pods-Runner.debug.xcconfig */,
+ 2D08EBED17F8EB3E71066100 /* Pods-Runner.release.xcconfig */,
+ 73D680D850EE7547967548AF /* Pods-Runner.profile.xcconfig */,
+ F0B5CFB1023F506DCA60BD86 /* Pods-RunnerTests.debug.xcconfig */,
+ 7CE0B42F28AB4499FBFFCA2B /* Pods-RunnerTests.release.xcconfig */,
+ 533C3FD951D5AE1E277F97EA /* Pods-RunnerTests.profile.xcconfig */,
+ );
+ name = Pods;
+ path = Pods;
+ sourceTree = "";
+ };
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
@@ -128,8 +172,10 @@
isa = PBXNativeTarget;
buildConfigurationList = 331C8087294A63A400263BE5 /* Build configuration list for PBXNativeTarget "RunnerTests" */;
buildPhases = (
+ D59C8769D5938D37E15DAADE /* [CP] Check Pods Manifest.lock */,
331C807D294A63A400263BE5 /* Sources */,
331C807F294A63A400263BE5 /* Resources */,
+ 7643B12B470921837C5584E9 /* Frameworks */,
);
buildRules = (
);
@@ -145,12 +191,14 @@
isa = PBXNativeTarget;
buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */;
buildPhases = (
+ 3D573ADF58588C56399F3A51 /* [CP] Check Pods Manifest.lock */,
9740EEB61CF901F6004384FC /* Run Script */,
97C146EA1CF9000F007C117D /* Sources */,
97C146EB1CF9000F007C117D /* Frameworks */,
97C146EC1CF9000F007C117D /* Resources */,
9705A1C41CF9048500538489 /* Embed Frameworks */,
3B06AD1E1E4923F5004D2608 /* Thin Binary */,
+ 55555ACDFAA12F10D6FEF6B7 /* [CP] Embed Pods Frameworks */,
);
buildRules = (
);
@@ -238,6 +286,45 @@
shellPath = /bin/sh;
shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin";
};
+ 3D573ADF58588C56399F3A51 /* [CP] Check Pods Manifest.lock */ = {
+ isa = PBXShellScriptBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ );
+ inputFileListPaths = (
+ );
+ inputPaths = (
+ "${PODS_PODFILE_DIR_PATH}/Podfile.lock",
+ "${PODS_ROOT}/Manifest.lock",
+ );
+ name = "[CP] Check Pods Manifest.lock";
+ outputFileListPaths = (
+ );
+ outputPaths = (
+ "$(DERIVED_FILE_DIR)/Pods-Runner-checkManifestLockResult.txt",
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ shellPath = /bin/sh;
+ 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;
+ };
+ 55555ACDFAA12F10D6FEF6B7 /* [CP] Embed Pods Frameworks */ = {
+ isa = PBXShellScriptBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ );
+ inputFileListPaths = (
+ "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-input-files.xcfilelist",
+ );
+ name = "[CP] Embed Pods Frameworks";
+ outputFileListPaths = (
+ "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-output-files.xcfilelist",
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ shellPath = /bin/sh;
+ shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n";
+ showEnvVarsInLog = 0;
+ };
9740EEB61CF901F6004384FC /* Run Script */ = {
isa = PBXShellScriptBuildPhase;
alwaysOutOfDate = 1;
@@ -253,6 +340,28 @@
shellPath = /bin/sh;
shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build";
};
+ D59C8769D5938D37E15DAADE /* [CP] Check Pods Manifest.lock */ = {
+ isa = PBXShellScriptBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ );
+ inputFileListPaths = (
+ );
+ inputPaths = (
+ "${PODS_PODFILE_DIR_PATH}/Podfile.lock",
+ "${PODS_ROOT}/Manifest.lock",
+ );
+ name = "[CP] Check Pods Manifest.lock";
+ outputFileListPaths = (
+ );
+ outputPaths = (
+ "$(DERIVED_FILE_DIR)/Pods-RunnerTests-checkManifestLockResult.txt",
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ shellPath = /bin/sh;
+ 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;
+ };
/* End PBXShellScriptBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
@@ -346,7 +455,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
- IPHONEOS_DEPLOYMENT_TARGET = 12.0;
+ IPHONEOS_DEPLOYMENT_TARGET = 13.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SUPPORTED_PLATFORMS = iphoneos;
@@ -378,6 +487,7 @@
};
331C8088294A63A400263BE5 /* Debug */ = {
isa = XCBuildConfiguration;
+ baseConfigurationReference = F0B5CFB1023F506DCA60BD86 /* Pods-RunnerTests.debug.xcconfig */;
buildSettings = {
BUNDLE_LOADER = "$(TEST_HOST)";
CODE_SIGN_STYLE = Automatic;
@@ -395,6 +505,7 @@
};
331C8089294A63A400263BE5 /* Release */ = {
isa = XCBuildConfiguration;
+ baseConfigurationReference = 7CE0B42F28AB4499FBFFCA2B /* Pods-RunnerTests.release.xcconfig */;
buildSettings = {
BUNDLE_LOADER = "$(TEST_HOST)";
CODE_SIGN_STYLE = Automatic;
@@ -410,6 +521,7 @@
};
331C808A294A63A400263BE5 /* Profile */ = {
isa = XCBuildConfiguration;
+ baseConfigurationReference = 533C3FD951D5AE1E277F97EA /* Pods-RunnerTests.profile.xcconfig */;
buildSettings = {
BUNDLE_LOADER = "$(TEST_HOST)";
CODE_SIGN_STYLE = Automatic;
@@ -472,7 +584,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
- IPHONEOS_DEPLOYMENT_TARGET = 12.0;
+ IPHONEOS_DEPLOYMENT_TARGET = 13.0;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
@@ -523,7 +635,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
- IPHONEOS_DEPLOYMENT_TARGET = 12.0;
+ IPHONEOS_DEPLOYMENT_TARGET = 13.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SUPPORTED_PLATFORMS = iphoneos;
diff --git a/compass_app/app/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/compass_app/app/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme
index 8e3ca5dfe19..e3773d42e24 100644
--- a/compass_app/app/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme
+++ b/compass_app/app/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme
@@ -26,6 +26,7 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
+ customLLDBInitFile = "$(SRCROOT)/Flutter/ephemeral/flutter_lldbinit"
shouldUseLaunchSchemeArgsEnv = "YES">
diff --git a/compass_app/app/ios/Runner.xcworkspace/contents.xcworkspacedata b/compass_app/app/ios/Runner.xcworkspace/contents.xcworkspacedata
index 1d526a16ed0..21a3cc14c74 100644
--- a/compass_app/app/ios/Runner.xcworkspace/contents.xcworkspacedata
+++ b/compass_app/app/ios/Runner.xcworkspace/contents.xcworkspacedata
@@ -4,4 +4,7 @@
+
+
diff --git a/compass_app/app/ios/Runner/AppDelegate.swift b/compass_app/app/ios/Runner/AppDelegate.swift
index 9074fee9290..c30b367ec0a 100644
--- a/compass_app/app/ios/Runner/AppDelegate.swift
+++ b/compass_app/app/ios/Runner/AppDelegate.swift
@@ -1,13 +1,16 @@
import Flutter
import UIKit
-@UIApplicationMain
-@objc class AppDelegate: FlutterAppDelegate {
+@main
+@objc class AppDelegate: FlutterAppDelegate, FlutterImplicitEngineDelegate {
override func application(
_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
) -> Bool {
- GeneratedPluginRegistrant.register(with: self)
return super.application(application, didFinishLaunchingWithOptions: launchOptions)
}
+
+ func didInitializeImplicitFlutterEngine(_ engineBridge: FlutterImplicitEngineBridge) {
+ GeneratedPluginRegistrant.register(with: engineBridge.pluginRegistry)
+ }
}
diff --git a/compass_app/app/ios/Runner/Info.plist b/compass_app/app/ios/Runner/Info.plist
index e8a8df16df5..7ffb103a5b5 100644
--- a/compass_app/app/ios/Runner/Info.plist
+++ b/compass_app/app/ios/Runner/Info.plist
@@ -2,6 +2,8 @@
+ CADisableMinimumFrameDurationOnPhone
+
CFBundleDevelopmentRegion
$(DEVELOPMENT_LANGUAGE)
CFBundleDisplayName
@@ -24,6 +26,29 @@
$(FLUTTER_BUILD_NUMBER)
LSRequiresIPhoneOS
+ UIApplicationSceneManifest
+
+ UIApplicationSupportsMultipleScenes
+
+ UISceneConfigurations
+
+ UIWindowSceneSessionRoleApplication
+
+
+ UISceneClassName
+ UIWindowScene
+ UISceneConfigurationName
+ flutter
+ UISceneDelegateClassName
+ FlutterSceneDelegate
+ UISceneStoryboardFile
+ Main
+
+
+
+
+ UIApplicationSupportsIndirectInputEvents
+
UILaunchStoryboardName
LaunchScreen
UIMainStoryboardFile
@@ -41,9 +66,5 @@
UIInterfaceOrientationLandscapeLeft
UIInterfaceOrientationLandscapeRight
- CADisableMinimumFrameDurationOnPhone
-
- UIApplicationSupportsIndirectInputEvents
-
diff --git a/compass_app/app/lib/config/dependencies.dart b/compass_app/app/lib/config/dependencies.dart
index 29e3543ebce..acb50e24f94 100644
--- a/compass_app/app/lib/config/dependencies.dart
+++ b/compass_app/app/lib/config/dependencies.dart
@@ -28,7 +28,6 @@ import '../data/repositories/user/user_repository_remote.dart';
import '../data/services/api/api_client.dart';
import '../data/services/api/auth_api_client.dart';
import '../data/services/local/local_data_service.dart';
-import '../data/services/shared_preferences_service.dart';
import '../domain/use_cases/booking/booking_create_use_case.dart';
import '../domain/use_cases/booking/booking_share_use_case.dart';
@@ -54,7 +53,6 @@ List get providersRemote {
return [
Provider(create: (context) => AuthApiClient()),
Provider(create: (context) => ApiClient()),
- Provider(create: (context) => SharedPreferencesService()),
ChangeNotifierProvider(
create: (context) =>
AuthRepositoryRemote(
diff --git a/compass_app/app/lib/data/services/shared_preferences_service.dart b/compass_app/app/lib/data/services/shared_preferences_service.dart
index 24a67a9b55a..75f296574bf 100644
--- a/compass_app/app/lib/data/services/shared_preferences_service.dart
+++ b/compass_app/app/lib/data/services/shared_preferences_service.dart
@@ -1,3 +1,4 @@
+// ignore_for_file: public_member_api_docs, sort_constructors_first
// Copyright 2024 The Flutter team. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -10,12 +11,20 @@ import '../../utils/result.dart';
class SharedPreferencesService {
static const _tokenKey = 'TOKEN';
final _log = Logger('SharedPreferencesService');
+ final SharedPreferencesWithCache _prefs;
+ SharedPreferencesService(this._prefs);
+
+ static Future create() async {
+ final prefs = await SharedPreferencesWithCache.create(
+ cacheOptions: SharedPreferencesWithCacheOptions(allowList: {_tokenKey}),
+ );
+ return SharedPreferencesService(prefs);
+ }
Future> fetchToken() async {
try {
- final sharedPreferences = await SharedPreferences.getInstance();
_log.finer('Got token from SharedPreferences');
- return Result.ok(sharedPreferences.getString(_tokenKey));
+ return Result.ok(_prefs.getString(_tokenKey));
} on Exception catch (e) {
_log.warning('Failed to get token', e);
return Result.error(e);
@@ -24,13 +33,12 @@ class SharedPreferencesService {
Future> saveToken(String? token) async {
try {
- final sharedPreferences = await SharedPreferences.getInstance();
if (token == null) {
_log.finer('Removed token');
- await sharedPreferences.remove(_tokenKey);
+ _prefs.remove(_tokenKey);
} else {
_log.finer('Replaced token');
- await sharedPreferences.setString(_tokenKey, token);
+ _prefs.setString(_tokenKey, token);
}
return const Result.ok(null);
} on Exception catch (e) {
diff --git a/compass_app/app/lib/main.dart b/compass_app/app/lib/main.dart
index 880d91d3101..8149e562fa6 100644
--- a/compass_app/app/lib/main.dart
+++ b/compass_app/app/lib/main.dart
@@ -14,6 +14,8 @@ import 'ui/core/ui/scroll_behavior.dart';
/// Default main method
void main() {
+ // print('main_staging');
+
// Launch development config by default
development.main();
}
diff --git a/compass_app/app/lib/main_development.dart b/compass_app/app/lib/main_development.dart
index 163f2f472d5..b72466e3752 100644
--- a/compass_app/app/lib/main_development.dart
+++ b/compass_app/app/lib/main_development.dart
@@ -7,13 +7,25 @@ import 'package:logging/logging.dart';
import 'package:provider/provider.dart';
import 'config/dependencies.dart';
+import 'data/services/shared_preferences_service.dart';
import 'main.dart';
/// Development config entry point.
/// Launch with `flutter run --target lib/main_development.dart`.
/// Uses local data.
-void main() {
+Future main() async {
+ WidgetsFlutterBinding.ensureInitialized();
+
Logger.root.level = Level.ALL;
+ final sharedPrefsService = await SharedPreferencesService.create();
- runApp(MultiProvider(providers: providersLocal, child: const MainApp()));
-}
+ runApp(
+ MultiProvider(
+ providers: [
+ Provider.value(value: sharedPrefsService),
+ ...providersRemote,
+ ],
+ child: const MainApp(),
+ ),
+ );
+}
\ No newline at end of file
diff --git a/compass_app/app/lib/main_staging.dart b/compass_app/app/lib/main_staging.dart
index 4f4e51cdc3e..f1425fc332a 100644
--- a/compass_app/app/lib/main_staging.dart
+++ b/compass_app/app/lib/main_staging.dart
@@ -7,13 +7,32 @@ import 'package:logging/logging.dart';
import 'package:provider/provider.dart';
import 'config/dependencies.dart';
+import 'data/services/shared_preferences_service.dart';
import 'main.dart';
/// Staging config entry point.
/// Launch with `flutter run --target lib/main_staging.dart`.
/// Uses remote data from a server.
-void main() {
+Future main() async {
+ WidgetsFlutterBinding.ensureInitialized();
+
Logger.root.level = Level.ALL;
+ Logger.root.onRecord.listen((record) {
+ // ignore: avoid_print
+ print(
+ '${record.time}: [${record.level.name}] ${record.loggerName}: ${record.message}',
+ );
+ });
+
+ final sharedPrefsService = await SharedPreferencesService.create();
- runApp(MultiProvider(providers: providersRemote, child: const MainApp()));
+ runApp(
+ MultiProvider(
+ providers: [
+ Provider.value(value: sharedPrefsService),
+ ...providersRemote,
+ ],
+ child: const MainApp(),
+ ),
+ );
}
diff --git a/compass_app/app/macos/Flutter/GeneratedPluginRegistrant.swift b/compass_app/app/macos/Flutter/GeneratedPluginRegistrant.swift
index 8c02029d1e4..8255a0b9913 100644
--- a/compass_app/app/macos/Flutter/GeneratedPluginRegistrant.swift
+++ b/compass_app/app/macos/Flutter/GeneratedPluginRegistrant.swift
@@ -5,13 +5,11 @@
import FlutterMacOS
import Foundation
-import path_provider_foundation
import share_plus
import shared_preferences_foundation
import sqflite_darwin
func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
- PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin"))
SharePlusMacosPlugin.register(with: registry.registrar(forPlugin: "SharePlusMacosPlugin"))
SharedPreferencesPlugin.register(with: registry.registrar(forPlugin: "SharedPreferencesPlugin"))
SqflitePlugin.register(with: registry.registrar(forPlugin: "SqflitePlugin"))
diff --git a/compass_app/app/pubspec.yaml b/compass_app/app/pubspec.yaml
index cbdd3ff056f..4e31adb2e0f 100644
--- a/compass_app/app/pubspec.yaml
+++ b/compass_app/app/pubspec.yaml
@@ -23,7 +23,7 @@ dependencies:
logging: ^1.3.0
provider: ^6.1.2
share_plus: ^10.1.3
- shared_preferences: ^2.3.5
+ shared_preferences: ^2.5.5
dev_dependencies:
analysis_defaults:
diff --git a/compass_app/app/test/data/services/shared_preferences_service_test.dart b/compass_app/app/test/data/services/shared_preferences_service_test.dart
new file mode 100644
index 00000000000..3e42e91a26c
--- /dev/null
+++ b/compass_app/app/test/data/services/shared_preferences_service_test.dart
@@ -0,0 +1,89 @@
+import 'package:compass_app/data/services/shared_preferences_service.dart';
+import 'package:compass_app/utils/result.dart';
+import 'package:flutter_test/flutter_test.dart';
+import 'package:mocktail/mocktail.dart';
+import 'package:shared_preferences/shared_preferences.dart';
+
+// --- Mock ---
+class MockSharedPreferencesWithCache extends Mock
+ implements SharedPreferencesWithCache {}
+
+void main() {
+ late MockSharedPreferencesWithCache mockPrefs;
+ late SharedPreferencesService sut;
+
+ setUp(() {
+ mockPrefs = MockSharedPreferencesWithCache();
+ sut = SharedPreferencesService(mockPrefs);
+ });
+
+ group('fetchToken', () {
+ test('returns ok with token when prefs has a stored value', () async {
+ when(() => mockPrefs.getString('TOKEN')).thenReturn('my-token');
+
+ final result = await sut.fetchToken();
+
+ expect(result, isA>());
+ expect((result as Ok).value, 'my-token');
+ });
+
+ test('returns ok with null when no token is stored', () async {
+ when(() => mockPrefs.getString('TOKEN')).thenReturn(null);
+
+ final result = await sut.fetchToken();
+
+ expect(result, isA>());
+ expect((result as Ok).value, isNull);
+ });
+
+ test('returns error when getString throws an Exception', () async {
+ when(() => mockPrefs.getString('TOKEN'))
+ .thenThrow(Exception('read error'));
+
+ final result = await sut.fetchToken();
+
+ expect(result, isA>());
+ });
+ });
+
+ group('saveToken', () {
+ test('calls setString and returns ok when token is not null', () async {
+ when(() => mockPrefs.setString('TOKEN', 'new-token'))
+ .thenAnswer((_) async {});
+
+ final result = await sut.saveToken('new-token');
+
+ expect(result, isA>());
+ verify(() => mockPrefs.setString('TOKEN', 'new-token')).called(1);
+ verifyNever(() => mockPrefs.remove(any()));
+ });
+
+ test('calls remove and returns ok when token is null', () async {
+ when(() => mockPrefs.remove('TOKEN')).thenAnswer((_) async {});
+
+ final result = await sut.saveToken(null);
+
+ expect(result, isA>());
+ verify(() => mockPrefs.remove('TOKEN')).called(1);
+ verifyNever(() => mockPrefs.setString(any(), any()));
+ });
+
+ test('returns error when setString throws an Exception', () async {
+ when(() => mockPrefs.setString('TOKEN', any()))
+ .thenThrow(Exception('write error'));
+
+ final result = await sut.saveToken('bad-token');
+
+ expect(result, isA>());
+ });
+
+ test('returns error when remove throws an Exception', () async {
+ when(() => mockPrefs.remove('TOKEN'))
+ .thenThrow(Exception('remove error'));
+
+ final result = await sut.saveToken(null);
+
+ expect(result, isA>());
+ });
+ });
+}
\ No newline at end of file