diff --git a/analysis_options.yaml b/analysis_options.yaml index 604dfd0aa..f0aa68921 100644 --- a/analysis_options.yaml +++ b/analysis_options.yaml @@ -73,10 +73,7 @@ linter: prefer_const_literals_to_create_immutables: true prefer_contains: true prefer_expression_function_bodies: true - prefer_final_fields: true - prefer_final_in_for_each: true prefer_final_locals: true - prefer_final_parameters: true prefer_for_elements_to_map_fromIterable: true prefer_function_declarations_over_variables: true prefer_generic_function_type_aliases: true diff --git a/ios/Runner.xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj index 9e35343d3..9e5fb9ae2 100644 --- a/ios/Runner.xcodeproj/project.pbxproj +++ b/ios/Runner.xcodeproj/project.pbxproj @@ -94,6 +94,7 @@ 87460CF3292F786D00A23EB6 /* CustomCodable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 87460CF1292F786D00A23EB6 /* CustomCodable.swift */; }; 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; }; 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; }; + 9B0FCEF40BE2091C6DD2B9DD /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 7FDDBC61B02048F5A227BA40 /* GoogleService-Info.plist */; }; C577A25E2C1FF997DB2CF183 /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A451CD8AF50E41359BCF628F /* Pods_Runner.framework */; }; E990C0ED2A26F412007CAE7A /* LocaleHandler.swift in Sources */ = {isa = PBXBuildFile; fileRef = E990C0EC2A26F412007CAE7A /* LocaleHandler.swift */; }; E990C0EE2A26F412007CAE7A /* LocaleHandler.swift in Sources */ = {isa = PBXBuildFile; fileRef = E990C0EC2A26F412007CAE7A /* LocaleHandler.swift */; }; @@ -223,6 +224,7 @@ 76F328B627D1F17D00C3B9FA /* Runner-Inhouse.entitlements */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.entitlements; path = "Runner-Inhouse.entitlements"; sourceTree = ""; }; 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; }; 7B1476D4526F72964B4A0961 /* Pods_Runner_Inhouse.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner_Inhouse.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 7FDDBC61B02048F5A227BA40 /* GoogleService-Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; name = "GoogleService-Info.plist"; path = "Runner/GoogleService-Info.plist"; sourceTree = ""; }; 87460CF1292F786D00A23EB6 /* CustomCodable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CustomCodable.swift; sourceTree = ""; }; 910C600E080C4A7D48B11C56 /* Pods-Runner Inhouse Notification.release-prd.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner Inhouse Notification.release-prd.xcconfig"; path = "Target Support Files/Pods-Runner Inhouse Notification/Pods-Runner Inhouse Notification.release-prd.xcconfig"; sourceTree = ""; }; 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = ""; }; @@ -440,6 +442,7 @@ 97C146EF1CF9000F007C117D /* Products */, 3BBCC0A3C0034FEB1A0111DB /* Pods */, 48A495939161E7A3DB3133FE /* Frameworks */, + 7FDDBC61B02048F5A227BA40 /* GoogleService-Info.plist */, ); sourceTree = ""; }; @@ -637,11 +640,11 @@ ); mainGroup = 97C146E51CF9000F007C117D; packageReferences = ( - 63CED4A627AE9DFC00699ED5 /* XCRemoteSwiftPackageReference "libauk-swift" */, + 63CED4A627AE9DFC00699ED5 /* XCRemoteSwiftPackageReference "libauk-swift.git" */, 63F1664927B2509F00451AAA /* XCRemoteSwiftPackageReference "beacon-ios-sdk" */, - 766DF4602849FCD700731ADE /* XCRemoteSwiftPackageReference "swift-log" */, + 766DF4602849FCD700731ADE /* XCRemoteSwiftPackageReference "swift-log.git" */, 637862A328B48DAF00DBA925 /* XCRemoteSwiftPackageReference "WalletConnectSwiftV2" */, - 63D4B0F628B7180C0014B2C0 /* XCRemoteSwiftPackageReference "Starscream" */, + 63D4B0F628B7180C0014B2C0 /* XCRemoteSwiftPackageReference "Starscream.git" */, ); productRefGroup = 97C146EF1CF9000F007C117D /* Products */; projectDirPath = ""; @@ -693,6 +696,7 @@ 581747E427D7131D0070EB48 /* Settings.bundle in Resources */, 580C5D022840773C00112C28 /* Assets.xcassets in Resources */, 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */, + 9B0FCEF40BE2091C6DD2B9DD /* GoogleService-Info.plist in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -2062,7 +2066,7 @@ version = 1.6.10; }; }; - 63CED4A627AE9DFC00699ED5 /* XCRemoteSwiftPackageReference "libauk-swift" */ = { + 63CED4A627AE9DFC00699ED5 /* XCRemoteSwiftPackageReference "libauk-swift.git" */ = { isa = XCRemoteSwiftPackageReference; repositoryURL = "https://github.com/bitmark-inc/libauk-swift.git"; requirement = { @@ -2070,7 +2074,7 @@ revision = ce7375515c0c9f316e6261be1868a6122d65275a; }; }; - 63D4B0F628B7180C0014B2C0 /* XCRemoteSwiftPackageReference "Starscream" */ = { + 63D4B0F628B7180C0014B2C0 /* XCRemoteSwiftPackageReference "Starscream.git" */ = { isa = XCRemoteSwiftPackageReference; repositoryURL = "https://github.com/daltoniam/Starscream.git"; requirement = { @@ -2086,7 +2090,7 @@ revision = 986a2962d5e9bd3bc02d259b696dcd0ffb78d9b8; }; }; - 766DF4602849FCD700731ADE /* XCRemoteSwiftPackageReference "swift-log" */ = { + 766DF4602849FCD700731ADE /* XCRemoteSwiftPackageReference "swift-log.git" */ = { isa = XCRemoteSwiftPackageReference; repositoryURL = "https://github.com/apple/swift-log.git"; requirement = { @@ -2094,7 +2098,7 @@ kind = branch; }; }; - 76F3288B27D1EC1C00C3B9FA /* XCRemoteSwiftPackageReference "libauk-swift" */ = { + 76F3288B27D1EC1C00C3B9FA /* XCRemoteSwiftPackageReference "libauk-swift.git" */ = { isa = XCRemoteSwiftPackageReference; repositoryURL = "https://github.com/bitmark-inc/libauk-swift.git"; requirement = { @@ -2145,17 +2149,17 @@ }; 63CED4A727AE9DFC00699ED5 /* LibAuk */ = { isa = XCSwiftPackageProductDependency; - package = 63CED4A627AE9DFC00699ED5 /* XCRemoteSwiftPackageReference "libauk-swift" */; + package = 63CED4A627AE9DFC00699ED5 /* XCRemoteSwiftPackageReference "libauk-swift.git" */; productName = LibAuk; }; 63D4B0F728B7180C0014B2C0 /* Starscream */ = { isa = XCSwiftPackageProductDependency; - package = 63D4B0F628B7180C0014B2C0 /* XCRemoteSwiftPackageReference "Starscream" */; + package = 63D4B0F628B7180C0014B2C0 /* XCRemoteSwiftPackageReference "Starscream.git" */; productName = Starscream; }; 63D4B0F928B7181B0014B2C0 /* Starscream */ = { isa = XCSwiftPackageProductDependency; - package = 63D4B0F628B7180C0014B2C0 /* XCRemoteSwiftPackageReference "Starscream" */; + package = 63D4B0F628B7180C0014B2C0 /* XCRemoteSwiftPackageReference "Starscream.git" */; productName = Starscream; }; 63F1664A27B2509F00451AAA /* BeaconBlockchainTezos */ = { @@ -2180,12 +2184,12 @@ }; 766DF4612849FCD700731ADE /* Logging */ = { isa = XCSwiftPackageProductDependency; - package = 766DF4602849FCD700731ADE /* XCRemoteSwiftPackageReference "swift-log" */; + package = 766DF4602849FCD700731ADE /* XCRemoteSwiftPackageReference "swift-log.git" */; productName = Logging; }; 766DF4632849FCEF00731ADE /* Logging */ = { isa = XCSwiftPackageProductDependency; - package = 766DF4602849FCD700731ADE /* XCRemoteSwiftPackageReference "swift-log" */; + package = 766DF4602849FCD700731ADE /* XCRemoteSwiftPackageReference "swift-log.git" */; productName = Logging; }; 76AA1D4A2806E79000E21A83 /* BeaconBlockchainSubstrate */ = { @@ -2200,7 +2204,7 @@ }; 76F3288A27D1EC1C00C3B9FA /* LibAuk */ = { isa = XCSwiftPackageProductDependency; - package = 76F3288B27D1EC1C00C3B9FA /* XCRemoteSwiftPackageReference "libauk-swift" */; + package = 76F3288B27D1EC1C00C3B9FA /* XCRemoteSwiftPackageReference "libauk-swift.git" */; productName = LibAuk; }; 76F3288C27D1EC1C00C3B9FA /* BeaconBlockchainTezos */ = { diff --git a/ios/Runner/GoogleService-Info.plist b/ios/Runner/GoogleService-Info.plist new file mode 100644 index 000000000..3ff30d297 --- /dev/null +++ b/ios/Runner/GoogleService-Info.plist @@ -0,0 +1,30 @@ + + + + + API_KEY + AIzaSyC513ZRGMjj7Wclx20buBANDkhAMVb8g6k + GCM_SENDER_ID + 274291020120 + PLIST_VERSION + 1 + BUNDLE_ID + com.bitmark.autonomywallet + PROJECT_ID + autonomy-firebase-inhouse + STORAGE_BUCKET + autonomy-firebase-inhouse.appspot.com + IS_ADS_ENABLED + + IS_ANALYTICS_ENABLED + + IS_APPINVITE_ENABLED + + IS_GCM_ENABLED + + IS_SIGNIN_ENABLED + + GOOGLE_APP_ID + 1:274291020120:ios:9259d45e91978cce55d52d + + \ No newline at end of file diff --git a/lib/firebase_options.dart b/lib/firebase_options.dart new file mode 100644 index 000000000..9af40d3bf --- /dev/null +++ b/lib/firebase_options.dart @@ -0,0 +1,68 @@ +// File generated by FlutterFire CLI. +// ignore_for_file: lines_longer_than_80_chars, avoid_classes_with_only_static_members +import 'package:firebase_core/firebase_core.dart' show FirebaseOptions; +import 'package:flutter/foundation.dart' + show defaultTargetPlatform, kIsWeb, TargetPlatform; + +/// Default [FirebaseOptions] for use with your Firebase apps. +/// +/// Example: +/// ```dart +/// import 'firebase_options.dart'; +/// // ... +/// await Firebase.initializeApp( +/// options: DefaultFirebaseOptions.currentPlatform, +/// ); +/// ``` +class DefaultFirebaseOptions { + static FirebaseOptions get currentPlatform { + if (kIsWeb) { + throw UnsupportedError( + 'DefaultFirebaseOptions have not been configured for web - ' + 'you can reconfigure this by running the FlutterFire CLI again.', + ); + } + switch (defaultTargetPlatform) { + case TargetPlatform.android: + return android; + case TargetPlatform.iOS: + return ios; + case TargetPlatform.macOS: + throw UnsupportedError( + 'DefaultFirebaseOptions have not been configured for macos - ' + 'you can reconfigure this by running the FlutterFire CLI again.', + ); + case TargetPlatform.windows: + throw UnsupportedError( + 'DefaultFirebaseOptions have not been configured for windows - ' + 'you can reconfigure this by running the FlutterFire CLI again.', + ); + case TargetPlatform.linux: + throw UnsupportedError( + 'DefaultFirebaseOptions have not been configured for linux - ' + 'you can reconfigure this by running the FlutterFire CLI again.', + ); + default: + throw UnsupportedError( + 'DefaultFirebaseOptions are not supported for this platform.', + ); + } + } + + static const FirebaseOptions android = FirebaseOptions( + apiKey: 'AIzaSyBlfk5fsEgduFo9pknuPi-fhfGHpA1NltQ', + appId: '1:274291020120:android:290061cbf00b291755d52d', + messagingSenderId: '274291020120', + projectId: 'autonomy-firebase-inhouse', + storageBucket: 'autonomy-firebase-inhouse.appspot.com', + ); + + static const FirebaseOptions ios = FirebaseOptions( + apiKey: 'AIzaSyC513ZRGMjj7Wclx20buBANDkhAMVb8g6k', + appId: '1:274291020120:ios:9259d45e91978cce55d52d', + messagingSenderId: '274291020120', + projectId: 'autonomy-firebase-inhouse', + storageBucket: 'autonomy-firebase-inhouse.appspot.com', + iosBundleId: 'com.bitmark.autonomywallet', + ); +} diff --git a/lib/main.dart b/lib/main.dart index 4e0756a3b..4a57d26ef 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -11,6 +11,7 @@ import 'dart:ui'; import 'package:autonomy_flutter/common/environment.dart'; import 'package:autonomy_flutter/common/injector.dart'; +import 'package:autonomy_flutter/firebase_options.dart'; import 'package:autonomy_flutter/screen/app_router.dart'; import 'package:autonomy_flutter/service/configuration_service.dart'; import 'package:autonomy_flutter/service/deeplink_service.dart'; @@ -27,6 +28,8 @@ import 'package:autonomy_flutter/view/responsive.dart'; import 'package:autonomy_flutter/view/user_agent_utils.dart'; import 'package:autonomy_theme/autonomy_theme.dart'; import 'package:easy_localization/easy_localization.dart'; +import 'package:firebase_core/firebase_core.dart'; +import 'package:firebase_remote_config/firebase_remote_config.dart'; import 'package:floor/floor.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; @@ -90,6 +93,8 @@ void main() async { _setupApp() async { await setup(); + await _firebaseSetUp(); + await DeviceInfo.instance.init(); final metricClient = injector.get(); @@ -141,6 +146,26 @@ Future _deleteLocalDatabase() async { await sqfliteDatabaseFactory.deleteDatabase(appDatabaseTestnet); } +Future _firebaseSetUp() async { + await Firebase.initializeApp( + name: 'autonomy-firebase-inhouse', + options: DefaultFirebaseOptions.currentPlatform, + ); + final remoteConfig = FirebaseRemoteConfig.instance; + await remoteConfig.setConfigSettings(RemoteConfigSettings( + fetchTimeout: const Duration(minutes: 1), + minimumFetchInterval: const Duration(hours: 1), + )); + + await remoteConfig.fetchAndActivate(); + + remoteConfig.onConfigUpdated.listen((event) async { + await remoteConfig.activate(); + + // Use the new config values here. + }); +} + class AutonomyApp extends StatelessWidget { const AutonomyApp({Key? key}) : super(key: key); static double maxWidth = 0; diff --git a/pubspec.lock b/pubspec.lock index a5b9f5632..d0557a4d7 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -9,6 +9,14 @@ packages: url: "https://pub.dev" source: hosted version: "61.0.0" + _flutterfire_internals: + dependency: transitive + description: + name: _flutterfire_internals + sha256: "5dadadeecceac19d6a63c9d2e037bb8df58ddd4aedb94e8a056af2f39ee50f9d" + url: "https://pub.dev" + source: hosted + version: "1.3.11" after_layout: dependency: "direct main" description: @@ -612,6 +620,78 @@ packages: url: "https://pub.dev" source: hosted version: "0.9.3" + firebase_analytics: + dependency: "direct main" + description: + name: firebase_analytics + sha256: fb8c29d97d29aed258d2fd98ba0ffc04ccca2c7b830b149187679524757f5d9d + url: "https://pub.dev" + source: hosted + version: "10.6.3" + firebase_analytics_platform_interface: + dependency: transitive + description: + name: firebase_analytics_platform_interface + sha256: "85fe94377732a168896a705410441b721a49c0703679c24e3edca0c680a45bb7" + url: "https://pub.dev" + source: hosted + version: "3.7.5" + firebase_analytics_web: + dependency: transitive + description: + name: firebase_analytics_web + sha256: "99a39a97e4760011ca0f2135c68a40f65dc9b260a0c27db2fdcb1258052c588b" + url: "https://pub.dev" + source: hosted + version: "0.5.5+5" + firebase_core: + dependency: "direct main" + description: + name: firebase_core + sha256: "7706f4ade6cc2698c70074083bc262586a185047f6bfdd53938dcc35d35cbb9e" + url: "https://pub.dev" + source: hosted + version: "2.21.0" + firebase_core_platform_interface: + dependency: transitive + description: + name: firebase_core_platform_interface + sha256: c437ae5d17e6b5cc7981cf6fd458a5db4d12979905f9aafd1fea930428a9fe63 + url: "https://pub.dev" + source: hosted + version: "5.0.0" + firebase_core_web: + dependency: transitive + description: + name: firebase_core_web + sha256: "0631a2ec971dbc540275e2fa00c3a8a2676f0a7adbc3c197d6fba569db689d97" + url: "https://pub.dev" + source: hosted + version: "2.8.1" + firebase_remote_config: + dependency: "direct main" + description: + name: firebase_remote_config + sha256: fde4fcadc9f8775d39da5c6b9c05c58eb632f480ab7531c6000242ebe40b0ad2 + url: "https://pub.dev" + source: hosted + version: "4.3.3" + firebase_remote_config_platform_interface: + dependency: transitive + description: + name: firebase_remote_config_platform_interface + sha256: "247357f32b6293cb43ea950f7e4bc1d65897f056fd6519c9a45a626e7f99ac4b" + url: "https://pub.dev" + source: hosted + version: "1.4.11" + firebase_remote_config_web: + dependency: transitive + description: + name: firebase_remote_config_web + sha256: "069a8f7265527459080f4b5d509880d323e4fe1436fe49d70ae30f79679d3671" + url: "https://pub.dev" + source: hosted + version: "1.4.11" fixnum: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index b31b6a078..9e5cb7b8c 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -163,6 +163,9 @@ dependencies: card_swiper: ^3.0.1 image_gallery_saver: ^2.0.3 hand_signature: ^3.0.1 + firebase_core: ^2.21.0 + firebase_remote_config: ^4.3.3 + firebase_analytics: ^10.6.3 dependency_overrides: intl: 0.18.0