The personal finance app for everyone (by everyone)
Ruby
Fix Flutter iOS build and add `web` support with web-safe storage (#878)
Juan José Mata4be1c39e1f4f
diff --git a/mobile/.gitignore b/mobile/.gitignoreindex 39d59563bb..c7e1da6e86 100644--- a/mobile/.gitignore+++ b/mobile/.gitignore@@ -25,6 +25,7 @@ ios/Pods/ios/.symlinks/ios/Flutter/Flutter.frameworkios/Flutter/Flutter.podspec+ios/Flutter/ephemeral/ios/Flutter/Generated.xcconfigios/Runner.xcworkspace/ios/Podfile.lockdiff --git a/mobile/android/app/src/main/java/io/flutter/plugins/GeneratedPluginRegistrant.java b/mobile/android/app/src/main/java/io/flutter/plugins/GeneratedPluginRegistrant.javanew file mode 100644index 0000000000..5c9d77fc14--- /dev/null+++ b/mobile/android/app/src/main/java/io/flutter/plugins/GeneratedPluginRegistrant.java@@ -0,0 +1,44 @@+package io.flutter.plugins;++import androidx.annotation.Keep;+import androidx.annotation.NonNull;+import io.flutter.Log;++import io.flutter.embedding.engine.FlutterEngine;++/**+ * Generated file. Do not edit.+ * This file is generated by the Flutter tool based on the+ * plugins that support the Android platform.+ */+@Keep+public final class GeneratedPluginRegistrant {+ private static final String TAG = "GeneratedPluginRegistrant";+ public static void registerWith(@NonNull FlutterEngine flutterEngine) {+ try {+ flutterEngine.getPlugins().add(new dev.fluttercommunity.plus.connectivity.ConnectivityPlugin());+ } catch (Exception e) {+ Log.e(TAG, "Error registering plugin connectivity_plus, dev.fluttercommunity.plus.connectivity.ConnectivityPlugin", e);+ }+ try {+ flutterEngine.getPlugins().add(new com.it_nomads.fluttersecurestorage.FlutterSecureStoragePlugin());+ } catch (Exception e) {+ Log.e(TAG, "Error registering plugin flutter_secure_storage, com.it_nomads.fluttersecurestorage.FlutterSecureStoragePlugin", e);+ }+ try {+ flutterEngine.getPlugins().add(new io.flutter.plugins.pathprovider.PathProviderPlugin());+ } catch (Exception e) {+ Log.e(TAG, "Error registering plugin path_provider_android, io.flutter.plugins.pathprovider.PathProviderPlugin", e);+ }+ try {+ flutterEngine.getPlugins().add(new io.flutter.plugins.sharedpreferences.SharedPreferencesPlugin());+ } catch (Exception e) {+ Log.e(TAG, "Error registering plugin shared_preferences_android, io.flutter.plugins.sharedpreferences.SharedPreferencesPlugin", e);+ }+ try {+ flutterEngine.getPlugins().add(new com.tekartik.sqflite.SqflitePlugin());+ } catch (Exception e) {+ Log.e(TAG, "Error registering plugin sqflite_android, com.tekartik.sqflite.SqflitePlugin", e);+ }+ }+}diff --git a/mobile/ios/Flutter/AppFrameworkInfo.plist b/mobile/ios/Flutter/AppFrameworkInfo.plistindex 7c56964006..1dc6cf7652 100644--- a/mobile/ios/Flutter/AppFrameworkInfo.plist+++ b/mobile/ios/Flutter/AppFrameworkInfo.plist@@ -21,6 +21,6 @@<key>CFBundleVersion</key><string>1.0</string><key>MinimumOSVersion</key>- <string>12.0</string>+ <string>13.0</string></dict></plist>diff --git a/mobile/ios/Runner.xcodeproj/project.pbxproj b/mobile/ios/Runner.xcodeproj/project.pbxprojindex 030d8a5b52..649b91cd7b 100644--- a/mobile/ios/Runner.xcodeproj/project.pbxproj+++ b/mobile/ios/Runner.xcodeproj/project.pbxproj@@ -10,6 +10,7 @@1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; };3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; };74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; };+ 8DDD6AE026E53835686F984E /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = ECA0200469BC2067F6002294 /* Pods_Runner.framework */; };97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; };97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; };97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; };@@ -31,6 +32,7 @@/* Begin PBXFileReference section */1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = "<group>"; };1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = "<group>"; };+ 1DC166D4710E23F2EDEDA52D /* 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 = "<group>"; };3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = "<group>"; };74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = "<group>"; };74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };@@ -42,6 +44,9 @@97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };+ BEEF4E3D580B721E5A0852CA /* 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 = "<group>"; };+ ECA0200469BC2067F6002294 /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; };+ FE30D351EF409EF61606DE07 /* 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 = "<group>"; };/* End PBXFileReference section *//* Begin PBXFrameworksBuildPhase section */@@ -49,12 +54,32 @@isa = PBXFrameworksBuildPhase;buildActionMask = 2147483647;files = (+ 8DDD6AE026E53835686F984E /* Pods_Runner.framework in Frameworks */,);runOnlyForDeploymentPostprocessing = 0;};/* End PBXFrameworksBuildPhase section *//* Begin PBXGroup section */+ 10A9A853ACC5019AE46A5DDA /* Pods */ = {+ isa = PBXGroup;+ children = (+ BEEF4E3D580B721E5A0852CA /* Pods-Runner.debug.xcconfig */,+ FE30D351EF409EF61606DE07 /* Pods-Runner.release.xcconfig */,+ 1DC166D4710E23F2EDEDA52D /* Pods-Runner.profile.xcconfig */,+ );+ name = Pods;+ path = Pods;+ sourceTree = "<group>";+ };+ 4D2624EB4309F79988F7AC61 /* Frameworks */ = {+ isa = PBXGroup;+ children = (+ ECA0200469BC2067F6002294 /* Pods_Runner.framework */,+ );+ name = Frameworks;+ sourceTree = "<group>";+ };9740EEB11CF90186004384FC /* Flutter */ = {isa = PBXGroup;children = (@@ -72,6 +97,8 @@9740EEB11CF90186004384FC /* Flutter */,97C146F01CF9000F007C117D /* Runner */,97C146EF1CF9000F007C117D /* Products */,+ 10A9A853ACC5019AE46A5DDA /* Pods */,+ 4D2624EB4309F79988F7AC61 /* Frameworks */,);sourceTree = "<group>";};@@ -105,12 +132,14 @@isa = PBXNativeTarget;buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */;buildPhases = (+ 17EEDD344E8596DDA68B7B10 /* [CP] Check Pods Manifest.lock */,9740EEB61CF901F6004384FC /* Run Script */,97C146EA1CF9000F007C117D /* Sources */,97C146EB1CF9000F007C117D /* Frameworks */,97C146EC1CF9000F007C117D /* Resources */,9705A1C41CF9048500538489 /* Embed Frameworks */,3B06AD1E1E4923F5004D2608 /* Thin Binary */,+ 0C5310326ADD4D85F74E6637 /* [CP] Embed Pods Frameworks */,);buildRules = ();@@ -170,6 +199,45 @@/* End PBXResourcesBuildPhase section *//* Begin PBXShellScriptBuildPhase section */+ 0C5310326ADD4D85F74E6637 /* [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;+ };+ 17EEDD344E8596DDA68B7B10 /* [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;+ };3B06AD1E1E4923F5004D2608 /* Thin Binary */ = {isa = PBXShellScriptBuildPhase;alwaysOutOfDate = 1;@@ -278,7 +346,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;@@ -357,7 +425,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;@@ -408,7 +476,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/mobile/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/mobile/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcschemenew file mode 100644index 0000000000..9c12df59c6--- /dev/null+++ b/mobile/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme@@ -0,0 +1,90 @@+<?xml version="1.0" encoding="UTF-8"?>+<Scheme+ LastUpgradeVersion = "1510"+ version = "1.3">+ <BuildAction+ parallelizeBuildables = "YES"+ buildImplicitDependencies = "YES">+ <BuildActionEntries>+ <BuildActionEntry+ buildForTesting = "YES"+ buildForRunning = "YES"+ buildForProfiling = "YES"+ buildForArchiving = "YES"+ buildForAnalyzing = "YES">+ <BuildableReference+ BuildableIdentifier = "primary"+ BlueprintIdentifier = "97C146ED1CF9000F007C117D"+ BuildableName = "Runner.app"+ BlueprintName = "Runner"+ ReferencedContainer = "container:Runner.xcodeproj">+ </BuildableReference>+ </BuildActionEntry>+ </BuildActionEntries>+ </BuildAction>+ <TestAction+ buildConfiguration = "Debug"+ selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"+ selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"+ customLLDBInitFile = "$(SRCROOT)/Flutter/ephemeral/flutter_lldbinit"+ shouldUseLaunchSchemeArgsEnv = "YES">+ <MacroExpansion>+ <BuildableReference+ BuildableIdentifier = "primary"+ BlueprintIdentifier = "97C146ED1CF9000F007C117D"+ BuildableName = "Runner.app"+ BlueprintName = "Runner"+ ReferencedContainer = "container:Runner.xcodeproj">+ </BuildableReference>+ </MacroExpansion>+ <Testables>+ </Testables>+ </TestAction>+ <LaunchAction+ buildConfiguration = "Debug"+ selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"+ selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"+ customLLDBInitFile = "$(SRCROOT)/Flutter/ephemeral/flutter_lldbinit"+ launchStyle = "0"+ useCustomWorkingDirectory = "NO"+ ignoresPersistentStateOnLaunch = "NO"+ debugDocumentVersioning = "YES"+ debugServiceExtension = "internal"+ enableGPUValidationMode = "1"+ allowLocationSimulation = "YES">+ <BuildableProductRunnable+ runnableDebuggingMode = "0">+ <BuildableReference+ BuildableIdentifier = "primary"+ BlueprintIdentifier = "97C146ED1CF9000F007C117D"+ BuildableName = "Runner.app"+ BlueprintName = "Runner"+ ReferencedContainer = "container:Runner.xcodeproj">+ </BuildableReference>+ </BuildableProductRunnable>+ </LaunchAction>+ <ProfileAction+ buildConfiguration = "Profile"+ shouldUseLaunchSchemeArgsEnv = "YES"+ savedToolIdentifier = ""+ useCustomWorkingDirectory = "NO"+ debugDocumentVersioning = "YES">+ <BuildableProductRunnable+ runnableDebuggingMode = "0">+ <BuildableReference+ BuildableIdentifier = "primary"+ BlueprintIdentifier = "97C146ED1CF9000F007C117D"+ BuildableName = "Runner.app"+ BlueprintName = "Runner"+ ReferencedContainer = "container:Runner.xcodeproj">+ </BuildableReference>+ </BuildableProductRunnable>+ </ProfileAction>+ <AnalyzeAction+ buildConfiguration = "Debug">+ </AnalyzeAction>+ <ArchiveAction+ buildConfiguration = "Release"+ revealArchiveInOrganizer = "YES">+ </ArchiveAction>+</Scheme>diff --git a/mobile/ios/Runner/GeneratedPluginRegistrant.h b/mobile/ios/Runner/GeneratedPluginRegistrant.hindex 3ab55947f3..7a89092719 100644--- a/mobile/ios/Runner/GeneratedPluginRegistrant.h+++ b/mobile/ios/Runner/GeneratedPluginRegistrant.h@@ -1,5 +1,19 @@+//+// Generated file. Do not edit.+//++// clang-format off++#ifndef GeneratedPluginRegistrant_h+#define GeneratedPluginRegistrant_h+#import <Flutter/Flutter.h>+NS_ASSUME_NONNULL_BEGIN+@interface GeneratedPluginRegistrant : NSObject+ (void)registerWithRegistry:(NSObject<FlutterPluginRegistry>*)registry;@end++NS_ASSUME_NONNULL_END+#endif /* GeneratedPluginRegistrant_h */diff --git a/mobile/ios/Runner/GeneratedPluginRegistrant.m b/mobile/ios/Runner/GeneratedPluginRegistrant.mindex efe65ecccf..f59edcc75f 100644--- a/mobile/ios/Runner/GeneratedPluginRegistrant.m+++ b/mobile/ios/Runner/GeneratedPluginRegistrant.m@@ -6,9 +6,44 @@#import "GeneratedPluginRegistrant.h"+#if __has_include(<connectivity_plus/ConnectivityPlusPlugin.h>)+#import <connectivity_plus/ConnectivityPlusPlugin.h>+#else+@import connectivity_plus;+#endif++#if __has_include(<flutter_secure_storage_darwin/FlutterSecureStorageDarwinPlugin.h>)+#import <flutter_secure_storage_darwin/FlutterSecureStorageDarwinPlugin.h>+#else+@import flutter_secure_storage_darwin;+#endif++#if __has_include(<path_provider_foundation/PathProviderPlugin.h>)+#import <path_provider_foundation/PathProviderPlugin.h>+#else+@import path_provider_foundation;+#endif++#if __has_include(<shared_preferences_foundation/SharedPreferencesPlugin.h>)+#import <shared_preferences_foundation/SharedPreferencesPlugin.h>+#else+@import shared_preferences_foundation;+#endif++#if __has_include(<sqflite_darwin/SqflitePlugin.h>)+#import <sqflite_darwin/SqflitePlugin.h>+#else+@import sqflite_darwin;+#endif+@implementation GeneratedPluginRegistrant+ (void)registerWithRegistry:(NSObject<FlutterPluginRegistry>*)registry {+ [ConnectivityPlusPlugin registerWithRegistrar:[registry registrarForPlugin:@"ConnectivityPlusPlugin"]];+ [FlutterSecureStorageDarwinPlugin registerWithRegistrar:[registry registrarForPlugin:@"FlutterSecureStorageDarwinPlugin"]];+ [PathProviderPlugin registerWithRegistrar:[registry registrarForPlugin:@"PathProviderPlugin"]];+ [SharedPreferencesPlugin registerWithRegistrar:[registry registrarForPlugin:@"SharedPreferencesPlugin"]];+ [SqflitePlugin registerWithRegistrar:[registry registrarForPlugin:@"SqflitePlugin"]];}@enddiff --git a/mobile/lib/services/api_config.dart b/mobile/lib/services/api_config.dartindex a51c50219c..bb5f353b09 100644--- a/mobile/lib/services/api_config.dart+++ b/mobile/lib/services/api_config.dart@@ -5,7 +5,7 @@ class ApiConfig {// For local development, use: http://10.0.2.2:3000 (Android emulator)// For iOS simulator, use: http://localhost:3000// For production, use your actual server URL- static String _baseUrl = 'http://10.0.2.2:3000';+ static String _baseUrl = 'https://app.sure.am';static String get baseUrl => _baseUrl;diff --git a/mobile/lib/services/database_helper.dart b/mobile/lib/services/database_helper.dartindex d483a034b9..0ec4efc0fd 100644--- a/mobile/lib/services/database_helper.dart+++ b/mobile/lib/services/database_helper.dart@@ -6,11 +6,37 @@ import 'log_service.dart';class DatabaseHelper {static final DatabaseHelper instance = DatabaseHelper._init();static Database? _database;+ static final Map<String, Map<String, dynamic>> _memoryTransactions = {};+ static final Map<String, Map<String, dynamic>> _memoryAccounts = {};+ static bool _webStorageLogged = false;final LogService _log = LogService.instance;DatabaseHelper._init();+ bool get _useInMemoryStore => kIsWeb;++ void _ensureWebStoreReady() {+ if (!_useInMemoryStore || _webStorageLogged) return;+ _webStorageLogged = true;+ _log.info(+ 'DatabaseHelper',+ 'Using in-memory storage on web (sqflite is not supported in browser builds).',+ );+ }++ int _compareDesc(String? left, String? right) {+ return (right ?? '').compareTo(left ?? '');+ }++ int _compareAsc(String? left, String? right) {+ return (left ?? '').compareTo(right ?? '');+ }+Future<Database> get database async {+ if (_useInMemoryStore) {+ _ensureWebStoreReady();+ throw StateError('sqflite database is not available on web.');+ }if (_database != null) return _database!;try {@@ -124,6 +150,12 @@ class DatabaseHelper {// Transaction CRUD operationsFuture<String> insertTransaction(Map<String, dynamic> transaction) async {+ if (_useInMemoryStore) {+ _ensureWebStoreReady();+ final localId = transaction['local_id'] as String;+ _memoryTransactions[localId] = Map<String, dynamic>.from(transaction);+ return localId;+ }final db = await database;_log.debug('DatabaseHelper', 'Inserting transaction: local_id=${transaction['local_id']}, account_id="${transaction['account_id']}", server_id=${transaction['server_id']}');await db.insert(@@ -136,6 +168,22 @@ class DatabaseHelper {}Future<List<Map<String, dynamic>>> getTransactions({String? accountId}) async {+ if (_useInMemoryStore) {+ _ensureWebStoreReady();+ final results = _memoryTransactions.values+ .where((transaction) {+ final storedAccountId = transaction['account_id'] as String?;+ return accountId == null || storedAccountId == accountId;+ })+ .map((transaction) => Map<String, dynamic>.from(transaction))+ .toList();+ results.sort((a, b) {+ final dateCompare = _compareDesc(a['date'] as String?, b['date'] as String?);+ if (dateCompare != 0) return dateCompare;+ return _compareDesc(a['created_at'] as String?, b['created_at'] as String?);+ });+ return results;+ }final db = await database;if (accountId != null) {@@ -160,6 +208,11 @@ class DatabaseHelper {}Future<Map<String, dynamic>?> getTransactionByLocalId(String localId) async {+ if (_useInMemoryStore) {+ _ensureWebStoreReady();+ final transaction = _memoryTransactions[localId];+ return transaction != null ? Map<String, dynamic>.from(transaction) : null;+ }final db = await database;final results = await db.query('transactions',@@ -172,6 +225,15 @@ class DatabaseHelper {}Future<Map<String, dynamic>?> getTransactionByServerId(String serverId) async {+ if (_useInMemoryStore) {+ _ensureWebStoreReady();+ for (final transaction in _memoryTransactions.values) {+ if (transaction['server_id'] == serverId) {+ return Map<String, dynamic>.from(transaction);+ }+ }+ return null;+ }final db = await database;final results = await db.query('transactions',@@ -184,6 +246,17 @@ class DatabaseHelper {}Future<List<Map<String, dynamic>>> getPendingTransactions() async {+ if (_useInMemoryStore) {+ _ensureWebStoreReady();+ final results = _memoryTransactions.values+ .where((transaction) => transaction['sync_status'] == 'pending')+ .map((transaction) => Map<String, dynamic>.from(transaction))+ .toList();+ results.sort(+ (a, b) => _compareAsc(a['created_at'] as String?, b['created_at'] as String?),+ );+ return results;+ }final db = await database;return await db.query('transactions',@@ -194,6 +267,17 @@ class DatabaseHelper {}Future<List<Map<String, dynamic>>> getPendingDeletes() async {+ if (_useInMemoryStore) {+ _ensureWebStoreReady();+ final results = _memoryTransactions.values+ .where((transaction) => transaction['sync_status'] == 'pending_delete')+ .map((transaction) => Map<String, dynamic>.from(transaction))+ .toList();+ results.sort(+ (a, b) => _compareAsc(a['updated_at'] as String?, b['updated_at'] as String?),+ );+ return results;+ }final db = await database;return await db.query('transactions',@@ -204,6 +288,16 @@ class DatabaseHelper {}Future<int> updateTransaction(String localId, Map<String, dynamic> transaction) async {+ if (_useInMemoryStore) {+ _ensureWebStoreReady();+ if (!_memoryTransactions.containsKey(localId)) {+ return 0;+ }+ final updated = Map<String, dynamic>.from(transaction);+ updated['local_id'] = localId;+ _memoryTransactions[localId] = updated;+ return 1;+ }final db = await database;return await db.update('transactions',@@ -214,6 +308,10 @@ class DatabaseHelper {}Future<int> deleteTransaction(String localId) async {+ if (_useInMemoryStore) {+ _ensureWebStoreReady();+ return _memoryTransactions.remove(localId) != null ? 1 : 0;+ }final db = await database;return await db.delete('transactions',@@ -223,6 +321,19 @@ class DatabaseHelper {}Future<int> deleteTransactionByServerId(String serverId) async {+ if (_useInMemoryStore) {+ _ensureWebStoreReady();+ String? localIdToRemove;+ for (final entry in _memoryTransactions.entries) {+ if (entry.value['server_id'] == serverId) {+ localIdToRemove = entry.key;+ break;+ }+ }+ if (localIdToRemove == null) return 0;+ _memoryTransactions.remove(localIdToRemove);+ return 1;+ }final db = await database;return await db.delete('transactions',@@ -232,11 +343,27 @@ class DatabaseHelper {}Future<void> clearTransactions() async {+ if (_useInMemoryStore) {+ _ensureWebStoreReady();+ _memoryTransactions.clear();+ return;+ }final db = await database;await db.delete('transactions');}Future<void> clearSyncedTransactions() async {+ if (_useInMemoryStore) {+ _ensureWebStoreReady();+ final keysToRemove = _memoryTransactions.entries+ .where((entry) => entry.value['sync_status'] == 'synced')+ .map((entry) => entry.key)+ .toList();+ for (final key in keysToRemove) {+ _memoryTransactions.remove(key);+ }+ return;+ }final db = await database;_log.debug('DatabaseHelper', 'Clearing only synced transactions, keeping pending/failed');await db.delete(@@ -248,6 +375,12 @@ class DatabaseHelper {// Account CRUD operations (for caching)Future<void> insertAccount(Map<String, dynamic> account) async {+ if (_useInMemoryStore) {+ _ensureWebStoreReady();+ final id = account['id'] as String;+ _memoryAccounts[id] = Map<String, dynamic>.from(account);+ return;+ }final db = await database;await db.insert('accounts',@@ -257,6 +390,14 @@ class DatabaseHelper {}Future<void> insertAccounts(List<Map<String, dynamic>> accounts) async {+ if (_useInMemoryStore) {+ _ensureWebStoreReady();+ for (final account in accounts) {+ final id = account['id'] as String;+ _memoryAccounts[id] = Map<String, dynamic>.from(account);+ }+ return;+ }final db = await database;final batch = db.batch();@@ -272,11 +413,26 @@ class DatabaseHelper {}Future<List<Map<String, dynamic>>> getAccounts() async {+ if (_useInMemoryStore) {+ _ensureWebStoreReady();+ final results = _memoryAccounts.values+ .map((account) => Map<String, dynamic>.from(account))+ .toList();+ results.sort(+ (a, b) => _compareAsc(a['name'] as String?, b['name'] as String?),+ );+ return results;+ }final db = await database;return await db.query('accounts', orderBy: 'name ASC');}Future<Map<String, dynamic>?> getAccountById(String id) async {+ if (_useInMemoryStore) {+ _ensureWebStoreReady();+ final account = _memoryAccounts[id];+ return account != null ? Map<String, dynamic>.from(account) : null;+ }final db = await database;final results = await db.query('accounts',@@ -289,18 +445,35 @@ class DatabaseHelper {}Future<void> clearAccounts() async {+ if (_useInMemoryStore) {+ _ensureWebStoreReady();+ _memoryAccounts.clear();+ return;+ }final db = await database;await db.delete('accounts');}// Utility methodsFuture<void> clearAllData() async {+ if (_useInMemoryStore) {+ _ensureWebStoreReady();+ _memoryTransactions.clear();+ _memoryAccounts.clear();+ return;+ }final db = await database;await db.delete('transactions');await db.delete('accounts');}Future<void> close() async {+ if (_useInMemoryStore) {+ _ensureWebStoreReady();+ _memoryTransactions.clear();+ _memoryAccounts.clear();+ return;+ }if (_database != null) {await _database!.close();_database = null;diff --git a/mobile/pubspec.lock b/mobile/pubspec.lockindex 27fe57ab62..f1820a9dec 100644--- a/mobile/pubspec.lock+++ b/mobile/pubspec.lock@@ -73,6 +73,22 @@ packages:url: "https://pub.dev"source: hostedversion: "1.19.1"+ connectivity_plus:+ dependency: "direct main"+ description:+ name: connectivity_plus+ sha256: "33bae12a398f841c6cda09d1064212957265869104c478e5ad51e2fb26c3973c"+ url: "https://pub.dev"+ source: hosted+ version: "7.0.0"+ connectivity_plus_platform_interface:+ dependency: transitive+ description:+ name: connectivity_plus_platform_interface+ sha256: "42657c1715d48b167930d5f34d00222ac100475f73d10162ddf43e714932f204"+ url: "https://pub.dev"+ source: hosted+ version: "2.0.1"crypto:dependency: transitivedescription:@@ -89,6 +105,14 @@ packages:url: "https://pub.dev"source: hostedversion: "1.0.8"+ dbus:+ dependency: transitive+ description:+ name: dbus+ sha256: "79e0c23480ff85dc68de79e2cd6334add97e48f7f4865d17686dd6ea81a47e8c"+ url: "https://pub.dev"+ source: hosted+ version: "0.7.11"fake_async:dependency: transitivedescription:@@ -113,6 +137,14 @@ packages:url: "https://pub.dev"source: hostedversion: "7.0.1"+ fixnum:+ dependency: transitive+ description:+ name: fixnum+ sha256: b6dc7065e46c974bc7c5f143080a6764ec7a4be6da1285ececdc37be96de53be+ url: "https://pub.dev"+ source: hosted+ version: "1.1.1"flutter:dependency: "direct main"description: flutter@@ -122,66 +154,66 @@ packages:dependency: "direct dev"description:name: flutter_launcher_icons- sha256: "526faf84284b86a4cb36d20a5e45147747b7563d921373d4ee0559c54fcdbcea"+ sha256: "10f13781741a2e3972126fae08393d3c4e01fa4cd7473326b94b72cf594195e7"url: "https://pub.dev"source: hosted- version: "0.13.1"+ version: "0.14.4"flutter_lints:dependency: "direct dev"description:name: flutter_lints- sha256: "9e8c3858111da373efc5aa341de011d9bd23e2c5c5e0c62bccf32438e192d7b1"+ sha256: "3105dc8492f6183fb076ccf1f351ac3d60564bff92e20bfc4af9cc1651f4e7e1"url: "https://pub.dev"source: hosted- version: "3.0.2"+ version: "6.0.0"flutter_secure_storage:dependency: "direct main"description:name: flutter_secure_storage- sha256: "9cad52d75ebc511adfae3d447d5d13da15a55a92c9410e50f67335b6d21d16ea"+ sha256: da922f2aab2d733db7e011a6bcc4a825b844892d4edd6df83ff156b09a9b2e40url: "https://pub.dev"source: hosted- version: "9.2.4"- flutter_secure_storage_linux:+ version: "10.0.0"+ flutter_secure_storage_darwin:dependency: transitivedescription:- name: flutter_secure_storage_linux- sha256: be76c1d24a97d0b98f8b54bce6b481a380a6590df992d0098f868ad54dc8f688+ name: flutter_secure_storage_darwin+ sha256: "8878c25136a79def1668c75985e8e193d9d7d095453ec28730da0315dc69aee3"url: "https://pub.dev"source: hosted- version: "1.2.3"- flutter_secure_storage_macos:+ version: "0.2.0"+ flutter_secure_storage_linux:dependency: transitivedescription:- name: flutter_secure_storage_macos- sha256: "6c0a2795a2d1de26ae202a0d78527d163f4acbb11cde4c75c670f3a0fc064247"+ name: flutter_secure_storage_linux+ sha256: "2b5c76dce569ab752d55a1cee6a2242bcc11fdba927078fb88c503f150767cda"url: "https://pub.dev"source: hosted- version: "3.1.3"+ version: "3.0.0"flutter_secure_storage_platform_interface:dependency: transitivedescription:name: flutter_secure_storage_platform_interface- sha256: cf91ad32ce5adef6fba4d736a542baca9daf3beac4db2d04be350b87f69ac4a8+ sha256: "8ceea1223bee3c6ac1a22dabd8feefc550e4729b3675de4b5900f55afcb435d6"url: "https://pub.dev"source: hosted- version: "1.1.2"+ version: "2.0.1"flutter_secure_storage_web:dependency: transitivedescription:name: flutter_secure_storage_web- sha256: f4ebff989b4f07b2656fb16b47852c0aab9fed9b4ec1c70103368337bc1886a9+ sha256: "6a1137df62b84b54261dca582c1c09ea72f4f9a4b2fcee21b025964132d5d0c3"url: "https://pub.dev"source: hosted- version: "1.2.1"+ version: "2.1.0"flutter_secure_storage_windows:dependency: transitivedescription:name: flutter_secure_storage_windows- sha256: b20b07cb5ed4ed74fc567b78a72936203f587eba460af1df11281c9326cd3709+ sha256: "3b7c8e068875dfd46719ff57c90d8c459c87f2302ed6b00ff006b3c9fcad1613"url: "https://pub.dev"source: hosted- version: "3.1.2"+ version: "4.1.0"flutter_test:dependency: "direct dev"description: flutter@@ -224,14 +256,6 @@ packages:url: "https://pub.dev"source: hostedversion: "0.18.1"- js:- dependency: transitive- description:- name: js- sha256: f2c445dce49627136094980615a031419f7f3eb393237e4ecd97ac15dea343f3- url: "https://pub.dev"- source: hosted- version: "0.6.7"json_annotation:dependency: transitivedescription:@@ -244,34 +268,34 @@ packages:dependency: transitivedescription:name: leak_tracker- sha256: "6bb818ecbdffe216e81182c2f0714a2e62b593f4a4f13098713ff1685dfb6ab0"+ sha256: "33e2e26bdd85a0112ec15400c8cbffea70d0f9c3407491f672a2fad47915e2de"url: "https://pub.dev"source: hosted- version: "10.0.9"+ version: "11.0.2"leak_tracker_flutter_testing:dependency: transitivedescription:name: leak_tracker_flutter_testing- sha256: f8b613e7e6a13ec79cfdc0e97638fddb3ab848452eff057653abd3edba760573+ sha256: "1dbc140bb5a23c75ea9c4811222756104fbcd1a27173f0c34ca01e16bea473c1"url: "https://pub.dev"source: hosted- version: "3.0.9"+ version: "3.0.10"leak_tracker_testing:dependency: transitivedescription:name: leak_tracker_testing- sha256: "6ba465d5d76e67ddf503e1161d1f4a6bc42306f9d66ca1e8f079a47290fb06d3"+ sha256: "8d5a2d49f4a66b49744b23b018848400d23e54caf9463f4eb20df3eb8acb2eb1"url: "https://pub.dev"source: hosted- version: "3.0.1"+ version: "3.0.2"lints:dependency: transitivedescription:name: lints- sha256: cbf8d4b858bb0134ef3ef87841abdf8d63bfc255c266b7bf6b39daa1085c4290+ sha256: "12f842a479589fea194fe5c5a3095abc7be0c1f2ddfa9a0e76aed1dbd26a87df"url: "https://pub.dev"source: hosted- version: "3.0.0"+ version: "6.1.0"matcher:dependency: transitivedescription:@@ -292,10 +316,10 @@ packages:dependency: transitivedescription:name: meta- sha256: e3641ec5d63ebf0d9b41bd43201a66e3fc79a65db5f61fc181f04cd27aab950c+ sha256: "23f08335362185a5ea2ad3a4e597f1375e78bce8a040df5c600c8d3552ef2394"url: "https://pub.dev"source: hosted- version: "1.16.0"+ version: "1.17.0"nested:dependency: transitivedescription:@@ -304,8 +328,16 @@ packages:url: "https://pub.dev"source: hostedversion: "1.0.0"- path:+ nm:dependency: transitive+ description:+ name: nm+ sha256: "2c9aae4127bdc8993206464fcc063611e0e36e72018696cd9631023a31b24254"+ url: "https://pub.dev"+ source: hosted+ version: "0.5.0"+ path:+ dependency: "direct main"description:name: pathsha256: "75cca69d1490965be98c73ceaea117e8a04dd21217b37b292c9ddbec0d955bc5"@@ -469,6 +501,46 @@ packages:url: "https://pub.dev"source: hostedversion: "1.10.1"+ sqflite:+ dependency: "direct main"+ description:+ name: sqflite+ sha256: e2297b1da52f127bc7a3da11439985d9b536f75070f3325e62ada69a5c585d03+ url: "https://pub.dev"+ source: hosted+ version: "2.4.2"+ sqflite_android:+ dependency: transitive+ description:+ name: sqflite_android+ sha256: ecd684501ebc2ae9a83536e8b15731642b9570dc8623e0073d227d0ee2bfea88+ url: "https://pub.dev"+ source: hosted+ version: "2.4.2+2"+ sqflite_common:+ dependency: transitive+ description:+ name: sqflite_common+ sha256: "6ef422a4525ecc601db6c0a2233ff448c731307906e92cabc9ba292afaae16a6"+ url: "https://pub.dev"+ source: hosted+ version: "2.5.6"+ sqflite_darwin:+ dependency: transitive+ description:+ name: sqflite_darwin+ sha256: "279832e5cde3fe99e8571879498c9211f3ca6391b0d818df4e17d9fff5c6ccb3"+ url: "https://pub.dev"+ source: hosted+ version: "2.4.2"+ sqflite_platform_interface:+ dependency: transitive+ description:+ name: sqflite_platform_interface+ sha256: "8dd4515c7bdcae0a785b0062859336de775e8c65db81ae33dd5445f35be61920"+ url: "https://pub.dev"+ source: hosted+ version: "2.4.0"stack_trace:dependency: transitivedescription:@@ -493,6 +565,14 @@ packages:url: "https://pub.dev"source: hostedversion: "1.4.1"+ synchronized:+ dependency: transitive+ description:+ name: synchronized+ sha256: c254ade258ec8282947a0acbbc90b9575b4f19673533ee46f2f6e9b3aeefd7c0+ url: "https://pub.dev"+ source: hosted+ version: "3.4.0"term_glyph:dependency: transitivedescription:@@ -505,10 +585,10 @@ packages:dependency: transitivedescription:name: test_api- sha256: fb31f383e2ee25fbbfe06b40fe21e1e458d14080e3c67e7ba0acfde4df4e0bbd+ sha256: ab2726c1a94d3176a45960b6234466ec367179b87dd74f1611adb1f3b5fb9d55url: "https://pub.dev"source: hosted- version: "0.7.4"+ version: "0.7.7"typed_data:dependency: transitivedescription:@@ -517,14 +597,22 @@ packages:url: "https://pub.dev"source: hostedversion: "1.4.0"+ uuid:+ dependency: "direct main"+ description:+ name: uuid+ sha256: a11b666489b1954e01d992f3d601b1804a33937b5a8fe677bd26b8a9f96f96e8+ url: "https://pub.dev"+ source: hosted+ version: "4.5.2"vector_math:dependency: transitivedescription:name: vector_math- sha256: "80b3257d1492ce4d091729e3a67a60407d227c27241d6927be0130c98e741803"+ sha256: d530bd74fea330e6e364cda7a85019c434070188383e1cd8d9777ee586914c5burl: "https://pub.dev"source: hosted- version: "2.1.4"+ version: "2.2.0"vm_service:dependency: transitivedescription:@@ -574,5 +662,5 @@ packages:source: hostedversion: "3.1.3"sdks:- dart: ">=3.8.0 <4.0.0"+ dart: ">=3.9.0 <4.0.0"flutter: ">=3.29.0"diff --git a/mobile/web/favicon.png b/mobile/web/favicon.pngnew file mode 100644index 0000000000..8aaa46ac1aBinary files /dev/null and b/mobile/web/favicon.png differdiff --git a/mobile/web/icons/Icon-192.png b/mobile/web/icons/Icon-192.pngnew file mode 100644index 0000000000..b749bfef07Binary files /dev/null and b/mobile/web/icons/Icon-192.png differdiff --git a/mobile/web/icons/Icon-512.png b/mobile/web/icons/Icon-512.pngnew file mode 100644index 0000000000..88cfd48dffBinary files /dev/null and b/mobile/web/icons/Icon-512.png differdiff --git a/mobile/web/icons/Icon-maskable-192.png b/mobile/web/icons/Icon-maskable-192.pngnew file mode 100644index 0000000000..eb9b4d76e5Binary files /dev/null and b/mobile/web/icons/Icon-maskable-192.png differdiff --git a/mobile/web/icons/Icon-maskable-512.png b/mobile/web/icons/Icon-maskable-512.pngnew file mode 100644index 0000000000..d69c56691fBinary files /dev/null and b/mobile/web/icons/Icon-maskable-512.png differdiff --git a/mobile/web/index.html b/mobile/web/index.htmlnew file mode 100644index 0000000000..35a153e452--- /dev/null+++ b/mobile/web/index.html@@ -0,0 +1,39 @@+<!DOCTYPE html>+<html>+<head>+ <!--+ If you are serving your web app in a path other than the root, change the+ href value below to reflect the base path you are serving from.++ The path provided below has to start and end with a slash "/" in order for+ it to work correctly.++ For more details:+ * https://developer.mozilla.org/en-US/docs/Web/HTML/Element/base++ This is a placeholder for base href that will be replaced by the value of+ the `--base-href` argument provided to `flutter build`.+ -->+ <base href="$FLUTTER_BASE_HREF">++ <meta charset="UTF-8">+ <meta content="IE=Edge" http-equiv="X-UA-Compatible">+ <meta name="description" content="A new Flutter project.">++ <!-- iOS meta tags & icons -->+ <meta name="mobile-web-app-capable" content="yes">+ <meta name="apple-mobile-web-app-capable" content="yes">+ <meta name="apple-mobile-web-app-status-bar-style" content="black">+ <meta name="apple-mobile-web-app-title" content="sure_mobile">+ <link rel="apple-touch-icon" href="icons/Icon-192.png">++ <!-- Favicon -->+ <link rel="icon" type="image/png" href="favicon.png"/>++ <title>sure_mobile</title>+ <link rel="manifest" href="manifest.json">+</head>+<body>+ <script src="flutter_bootstrap.js" async></script>+</body>+</html>diff --git a/mobile/web/manifest.json b/mobile/web/manifest.jsonnew file mode 100644index 0000000000..d2b3ca97e9--- /dev/null+++ b/mobile/web/manifest.json@@ -0,0 +1,35 @@+{+ "name": "Sure",+ "short_name": "Sure",+ "start_url": ".",+ "display": "standalone",+ "background_color": "#0175C2",+ "theme_color": "#0175C2",+ "description": "Your personal finances, your way.",+ "orientation": "portrait-primary",+ "prefer_related_applications": false,+ "icons": [+ {+ "src": "icons/Icon-192.png",+ "sizes": "192x192",+ "type": "image/png"+ },+ {+ "src": "icons/Icon-512.png",+ "sizes": "512x512",+ "type": "image/png"+ },+ {+ "src": "icons/Icon-maskable-192.png",+ "sizes": "192x192",+ "type": "image/png",+ "purpose": "maskable"+ },+ {+ "src": "icons/Icon-maskable-512.png",+ "sizes": "512x512",+ "type": "image/png",+ "purpose": "maskable"+ }+ ]+}