Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] set up remote config #1360

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions analysis_options.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
30 changes: 17 additions & 13 deletions ios/Runner.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -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 */; };
Expand Down Expand Up @@ -223,6 +224,7 @@
76F328B627D1F17D00C3B9FA /* Runner-Inhouse.entitlements */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.entitlements; path = "Runner-Inhouse.entitlements"; sourceTree = "<group>"; };
7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = "<group>"; };
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 = "<group>"; };
87460CF1292F786D00A23EB6 /* CustomCodable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CustomCodable.swift; sourceTree = "<group>"; };
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 = "<group>"; };
9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = "<group>"; };
Expand Down Expand Up @@ -440,6 +442,7 @@
97C146EF1CF9000F007C117D /* Products */,
3BBCC0A3C0034FEB1A0111DB /* Pods */,
48A495939161E7A3DB3133FE /* Frameworks */,
7FDDBC61B02048F5A227BA40 /* GoogleService-Info.plist */,
);
sourceTree = "<group>";
};
Expand Down Expand Up @@ -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 = "";
Expand Down Expand Up @@ -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;
};
Expand Down Expand Up @@ -2062,15 +2066,15 @@
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 = {
kind = revision;
revision = ce7375515c0c9f316e6261be1868a6122d65275a;
};
};
63D4B0F628B7180C0014B2C0 /* XCRemoteSwiftPackageReference "Starscream" */ = {
63D4B0F628B7180C0014B2C0 /* XCRemoteSwiftPackageReference "Starscream.git" */ = {
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/daltoniam/Starscream.git";
requirement = {
Expand All @@ -2086,15 +2090,15 @@
revision = 986a2962d5e9bd3bc02d259b696dcd0ffb78d9b8;
};
};
766DF4602849FCD700731ADE /* XCRemoteSwiftPackageReference "swift-log" */ = {
766DF4602849FCD700731ADE /* XCRemoteSwiftPackageReference "swift-log.git" */ = {
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/apple/swift-log.git";
requirement = {
branch = main;
kind = branch;
};
};
76F3288B27D1EC1C00C3B9FA /* XCRemoteSwiftPackageReference "libauk-swift" */ = {
76F3288B27D1EC1C00C3B9FA /* XCRemoteSwiftPackageReference "libauk-swift.git" */ = {
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/bitmark-inc/libauk-swift.git";
requirement = {
Expand Down Expand Up @@ -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 */ = {
Expand All @@ -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 */ = {
Expand All @@ -2200,7 +2204,7 @@
};
76F3288A27D1EC1C00C3B9FA /* LibAuk */ = {
isa = XCSwiftPackageProductDependency;
package = 76F3288B27D1EC1C00C3B9FA /* XCRemoteSwiftPackageReference "libauk-swift" */;
package = 76F3288B27D1EC1C00C3B9FA /* XCRemoteSwiftPackageReference "libauk-swift.git" */;
productName = LibAuk;
};
76F3288C27D1EC1C00C3B9FA /* BeaconBlockchainTezos */ = {
Expand Down
30 changes: 30 additions & 0 deletions ios/Runner/GoogleService-Info.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>API_KEY</key>
<string>AIzaSyC513ZRGMjj7Wclx20buBANDkhAMVb8g6k</string>
<key>GCM_SENDER_ID</key>
<string>274291020120</string>
<key>PLIST_VERSION</key>
<string>1</string>
<key>BUNDLE_ID</key>
<string>com.bitmark.autonomywallet</string>
<key>PROJECT_ID</key>
<string>autonomy-firebase-inhouse</string>
<key>STORAGE_BUCKET</key>
<string>autonomy-firebase-inhouse.appspot.com</string>
<key>IS_ADS_ENABLED</key>
<false></false>
<key>IS_ANALYTICS_ENABLED</key>
<false></false>
<key>IS_APPINVITE_ENABLED</key>
<true></true>
<key>IS_GCM_ENABLED</key>
<true></true>
<key>IS_SIGNIN_ENABLED</key>
<true></true>
<key>GOOGLE_APP_ID</key>
<string>1:274291020120:ios:9259d45e91978cce55d52d</string>
</dict>
</plist>
68 changes: 68 additions & 0 deletions lib/firebase_options.dart
Original file line number Diff line number Diff line change
@@ -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',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[gitleaks] reported by reviewdog 🐶
Generic API Key

appId: '1:274291020120:android:290061cbf00b291755d52d',
messagingSenderId: '274291020120',
projectId: 'autonomy-firebase-inhouse',
storageBucket: 'autonomy-firebase-inhouse.appspot.com',
);

static const FirebaseOptions ios = FirebaseOptions(
apiKey: 'AIzaSyC513ZRGMjj7Wclx20buBANDkhAMVb8g6k',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[gitleaks] reported by reviewdog 🐶
GCP API key

appId: '1:274291020120:ios:9259d45e91978cce55d52d',
messagingSenderId: '274291020120',
projectId: 'autonomy-firebase-inhouse',
storageBucket: 'autonomy-firebase-inhouse.appspot.com',
iosBundleId: 'com.bitmark.autonomywallet',
);
}
25 changes: 25 additions & 0 deletions lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -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';
Expand Down Expand Up @@ -90,6 +93,8 @@ void main() async {
_setupApp() async {
await setup();

await _firebaseSetUp();

await DeviceInfo.instance.init();

final metricClient = injector.get<MetricClientService>();
Expand Down Expand Up @@ -141,6 +146,26 @@ Future<void> _deleteLocalDatabase() async {
await sqfliteDatabaseFactory.deleteDatabase(appDatabaseTestnet);
}

Future<void> _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;
Expand Down
80 changes: 80 additions & 0 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down
3 changes: 3 additions & 0 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Loading