From 0f34596fbcf1aa6618fe0f9c2e12508e03f9a1bc Mon Sep 17 00:00:00 2001 From: Beast Date: Mon, 16 Feb 2026 15:01:05 +0800 Subject: [PATCH 1/2] feat: inject firebase api key from env --- .gitignore | 1 - mobile-app/lib/firebase_options.dart | 43 ++++++++++++++++++++++++++++ mobile-app/lib/main.dart | 2 +- mobile-app/lib/utils/env_utils.dart | 16 +++++++++++ 4 files changed, 60 insertions(+), 2 deletions(-) create mode 100644 mobile-app/lib/firebase_options.dart diff --git a/.gitignore b/.gitignore index b6da182d..82deca8a 100644 --- a/.gitignore +++ b/.gitignore @@ -32,7 +32,6 @@ analysis_benchmark.json .packages.generated # Flutter/Dart/Pub related -**/lib/firebase_options.dart **/doc/api/ .dart_tool/ .flutter-plugins diff --git a/mobile-app/lib/firebase_options.dart b/mobile-app/lib/firebase_options.dart new file mode 100644 index 00000000..139945dc --- /dev/null +++ b/mobile-app/lib/firebase_options.dart @@ -0,0 +1,43 @@ +// File generated by FlutterFire CLI. +// ignore_for_file: type=lint +import 'package:firebase_core/firebase_core.dart' show FirebaseOptions; +import 'package:flutter/foundation.dart' show defaultTargetPlatform, kIsWeb, TargetPlatform; +import 'package:resonance_network_wallet/utils/env_utils.dart'; + +/// Default [FirebaseOptions] for use with your Firebase apps. +/// +/// Example: +/// ```dart +/// import 'firebase_options.dart'; +/// // ... +/// await Firebase.initializeApp( +/// options: DefaultFirebaseOptions.currentPlatform, +/// ); +/// ``` +class DefaultFirebaseOptions { + static FirebaseOptions getOptionsForEnvironment() { + if (kIsWeb) throw UnsupportedError('Web not configured'); + + switch (defaultTargetPlatform) { + case TargetPlatform.android: + return FirebaseOptions( + apiKey: EnvUtils.androidFirebaseApiKey, + appId: '1:700047185713:android:151f32080a837021d98210', + messagingSenderId: '700047185713', + projectId: 'quantus-wallet', + storageBucket: 'quantus-wallet.firebasestorage.app', + ); + case TargetPlatform.iOS: + return FirebaseOptions( + apiKey: EnvUtils.iosFirebaseApiKey, + appId: '1:700047185713:ios:4689e532e8a4f174d98210', + messagingSenderId: '700047185713', + projectId: 'quantus-wallet', + storageBucket: 'quantus-wallet.firebasestorage.app', + iosBundleId: 'com.quantus.mobile-wallet', + ); + default: + throw UnsupportedError('Platform not supported'); + } + } +} diff --git a/mobile-app/lib/main.dart b/mobile-app/lib/main.dart index 92339e0e..c415680d 100644 --- a/mobile-app/lib/main.dart +++ b/mobile-app/lib/main.dart @@ -20,7 +20,7 @@ void main() async { await Supabase.initialize(url: EnvUtils.supabaseUrl, anonKey: EnvUtils.supabaseKey); await QuantusSdk.init(); if (FeatureFlags.enableRemoteNotifications) { - await Firebase.initializeApp(options: DefaultFirebaseOptions.currentPlatform); + await Firebase.initializeApp(options: DefaultFirebaseOptions.getOptionsForEnvironment()); } Telemetrydecksdk.start( diff --git a/mobile-app/lib/utils/env_utils.dart b/mobile-app/lib/utils/env_utils.dart index 28433e5f..036dec76 100644 --- a/mobile-app/lib/utils/env_utils.dart +++ b/mobile-app/lib/utils/env_utils.dart @@ -21,6 +21,22 @@ class EnvUtils { return key; } + static String get iosFirebaseApiKey { + final key = dotenv.env['IOS_FIREBASE_API_KEY']; + if (key == null || key.isEmpty) { + throw Exception('IOS_FIREBASE_API_KEY is not set in .env file'); + } + return key; + } + + static String get androidFirebaseApiKey { + final key = dotenv.env['ANDROID_FIREBASE_API_KEY']; + if (key == null || key.isEmpty) { + throw Exception('ANDROID_FIREBASE_API_KEY is not set in .env file'); + } + return key; + } + static String? getEnv(String key) { return dotenv.env[key]; } From fb3f21855ab9580715a5701c21b6c6d54be71444 Mon Sep 17 00:00:00 2001 From: Beast Date: Mon, 16 Feb 2026 15:07:07 +0800 Subject: [PATCH 2/2] fix: formatting --- mobile-app/lib/features/main/screens/app.dart | 2 +- mobile-app/lib/services/transaction_service.dart | 2 +- mobile-app/lib/utils/env_utils.dart | 2 +- mobile-app/lib/v2/components/glass_container.dart | 13 +++++++++++-- .../lib/v2/screens/home/activity_section.dart | 6 ++++-- .../v2/screens/settings/recovery_phrase_screen.dart | 12 +++++++++++- mobile-app/lib/v2/screens/swap/deposit_screen.dart | 3 ++- 7 files changed, 31 insertions(+), 9 deletions(-) diff --git a/mobile-app/lib/features/main/screens/app.dart b/mobile-app/lib/features/main/screens/app.dart index 58918cd0..127af5b4 100644 --- a/mobile-app/lib/features/main/screens/app.dart +++ b/mobile-app/lib/features/main/screens/app.dart @@ -38,7 +38,7 @@ class _ResonanceWalletAppState extends ConsumerState { if (FeatureFlags.enableRemoteNotifications) { ref.read(firebaseMessagingServiceProvider).setupNotificationTapHandlers(navigatorKey); } - + if (Platform.isAndroid) _referralService.checkPlayStoreReferralCode(); }); } diff --git a/mobile-app/lib/services/transaction_service.dart b/mobile-app/lib/services/transaction_service.dart index 3280ee9e..7bc3aa45 100644 --- a/mobile-app/lib/services/transaction_service.dart +++ b/mobile-app/lib/services/transaction_service.dart @@ -91,7 +91,7 @@ class TransactionService { void navigateToTransactionFromPayloadIfPossible(Map? json, GlobalKey navigatorKey) { final event = deserializeTxEventFromJsonIfPossible(json); - + if (event != null) { _ref.read(transactionIntentProvider.notifier).state = event; navigatorKey.currentState?.pushNamed('/transactions'); diff --git a/mobile-app/lib/utils/env_utils.dart b/mobile-app/lib/utils/env_utils.dart index 036dec76..fab68413 100644 --- a/mobile-app/lib/utils/env_utils.dart +++ b/mobile-app/lib/utils/env_utils.dart @@ -22,7 +22,7 @@ class EnvUtils { } static String get iosFirebaseApiKey { - final key = dotenv.env['IOS_FIREBASE_API_KEY']; + final key = dotenv.env['IOS_FIREBASE_API_KEY']; if (key == null || key.isEmpty) { throw Exception('IOS_FIREBASE_API_KEY is not set in .env file'); } diff --git a/mobile-app/lib/v2/components/glass_container.dart b/mobile-app/lib/v2/components/glass_container.dart index 9779fa48..94ef48fd 100644 --- a/mobile-app/lib/v2/components/glass_container.dart +++ b/mobile-app/lib/v2/components/glass_container.dart @@ -22,7 +22,11 @@ class GlassContainer extends StatelessWidget { wideAsset: Rect.fromLTRB(_inset, _inset, 1020 - _inset, 168 - _inset), }; - double get defaultHeight => asset == smallAsset ? 40 : asset == mediumSmallAsset ? 36 : 56; + double get defaultHeight => asset == smallAsset + ? 40 + : asset == mediumSmallAsset + ? 36 + : 56; const GlassContainer({ super.key, @@ -49,7 +53,12 @@ class GlassContainer extends StatelessWidget { ), if (filled) Positioned.fill( - child: DecoratedBox(decoration: BoxDecoration(color: Colors.white.withValues(alpha: 0.1), borderRadius: BorderRadius.circular(14))), + child: DecoratedBox( + decoration: BoxDecoration( + color: Colors.white.withValues(alpha: 0.1), + borderRadius: BorderRadius.circular(14), + ), + ), ), Positioned.fill( child: Padding( diff --git a/mobile-app/lib/v2/screens/home/activity_section.dart b/mobile-app/lib/v2/screens/home/activity_section.dart index 2d0d9943..1be9c4aa 100644 --- a/mobile-app/lib/v2/screens/home/activity_section.dart +++ b/mobile-app/lib/v2/screens/home/activity_section.dart @@ -59,7 +59,7 @@ class ActivitySection extends ConsumerWidget { const SizedBox(height: 40), _header(colors, text, context), const SizedBox(height: 24), - + ...recentTransactions.mapIndexed((index, tx) { final data = TxItemData.from(tx, activeAccount.accountId); final isLastItem = index == recentTransactions.length - 1; @@ -137,7 +137,9 @@ class ActivitySection extends ConsumerWidget { 'View All', style: text.paragraph?.copyWith( color: Colors.transparent, - shadows: [Shadow(color: colors.textSecondary, offset: const Offset(0, -2))], // Shadow trick to create gap between text and underline + shadows: [ + Shadow(color: colors.textSecondary, offset: const Offset(0, -2)), + ], // Shadow trick to create gap between text and underline decoration: TextDecoration.underline, decorationColor: colors.textSecondary, decorationStyle: TextDecorationStyle.solid, diff --git a/mobile-app/lib/v2/screens/settings/recovery_phrase_screen.dart b/mobile-app/lib/v2/screens/settings/recovery_phrase_screen.dart index cf7222db..9e4af679 100644 --- a/mobile-app/lib/v2/screens/settings/recovery_phrase_screen.dart +++ b/mobile-app/lib/v2/screens/settings/recovery_phrase_screen.dart @@ -146,7 +146,17 @@ class _RecoveryPhraseScreenState extends State { ); return SizedBox( - child: GlassContainer(asset: GlassContainer.mediumSmallAsset, filled: true, child: Row(mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center, children: [const SizedBox(width: 8), Text('$index', style: text.detail?.copyWith(color: colors.textSecondary)), const SizedBox(width: 6), Expanded( + child: GlassContainer( + asset: GlassContainer.mediumSmallAsset, + filled: true, + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + const SizedBox(width: 8), + Text('$index', style: text.detail?.copyWith(color: colors.textSecondary)), + const SizedBox(width: 6), + Expanded( child: Stack( alignment: Alignment.centerLeft, children: [ diff --git a/mobile-app/lib/v2/screens/swap/deposit_screen.dart b/mobile-app/lib/v2/screens/swap/deposit_screen.dart index 06f7979e..2bedeb58 100644 --- a/mobile-app/lib/v2/screens/swap/deposit_screen.dart +++ b/mobile-app/lib/v2/screens/swap/deposit_screen.dart @@ -155,8 +155,9 @@ class _DepositScreenState extends State { child: Container( color: Colors.white, padding: const EdgeInsets.all(8), + /// for now this QR Code is invalid so people don't transfer by accident - // child: QrImageView(data: _order.depositAddress, version: QrVersions.auto, size: 184), + // child: QrImageView(data: _order.depositAddress, version: QrVersions.auto, size: 184), child: QrImageView(data: 'quantum secure bitcoin - quantus!', version: QrVersions.auto, size: 184), ), ),