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]Backup: use firestore #1396

Closed
wants to merge 31 commits into from
Closed
Show file tree
Hide file tree
Changes from 7 commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
e69a8cb
Backup Firestore
ppupha Nov 23, 2023
18504d7
Firestore config
ppupha Nov 23, 2023
695554b
Replace Cloud Database
ppupha Nov 24, 2023
444c7b8
Replace CloudFirestoreDatabase
ppupha Nov 27, 2023
0b639ea
Update
ppupha Nov 28, 2023
d092cb5
Revert Migration Util
ppupha Nov 28, 2023
5288a3c
Merge branch 'develop' into Sang/backup/use_fireStore
ppupha Nov 28, 2023
77a8e4e
Fix lint
ppupha Nov 28, 2023
196535b
Check if backup from sqlite
ppupha Nov 29, 2023
ecf9fd2
Update Path
ppupha Nov 29, 2023
a8a7d3d
Forget i exist
ppupha Nov 29, 2023
6837d41
Remove unuse code
ppupha Nov 29, 2023
35be763
integrate JWT
ppupha Dec 18, 2023
0bd26e3
Merge branch 'develop' into Sang/backup/auth_firebase
ppupha Dec 19, 2023
1b822f8
Merge branch 'develop' into Sang/backup/use_fireStore
ppupha Dec 19, 2023
31b0b1b
Auth User
ppupha Dec 27, 2023
08935a9
Fix: getDefaultAccount
ppupha Jan 4, 2024
b9effbd
Fix lint
ppupha Jan 4, 2024
64525e5
Mixpanel: Fix identify user
ppupha Jan 4, 2024
52da9a0
Merge branch 'develop' into Sang/backup/auth_firebase
ppupha Jan 4, 2024
3d75bd0
Merge branch 'develop' into Sang/backup/use_fireStore
ppupha Jan 17, 2024
1671701
Merge branch 'Sang/backup/use_fireStore' into Sang/backup/auth_firebase
ppupha Jan 17, 2024
6f64b1a
Merge branch 'develop' into Sang/backup/use_fireStore
ppupha Jan 23, 2024
cf0d1aa
Merge branch 'Sang/backup/use_fireStore' into Sang/backup/auth_firebase
ppupha Jan 23, 2024
7a9d39c
Merge branch 'Sang/backup/auth_firebase' into Sang/backup/use_fireStore
ppupha Jan 23, 2024
3177a94
Fix lint
ppupha Jan 23, 2024
ca87b74
User env for apiKey
ppupha Jan 23, 2024
8e10495
Update CI and git ignore
ppupha Jan 23, 2024
14a17a5
Merge branch 'develop' into Sang/backup/use_fireStore
ppupha Jan 26, 2024
fa0f12e
Update Project
ppupha Jan 26, 2024
39e7511
Merge branch 'develop' into Sang/backup/use_fireStore
ppupha Feb 22, 2024
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
43 changes: 11 additions & 32 deletions android/app/google-services.json
Original file line number Diff line number Diff line change
@@ -1,66 +1,45 @@
{
"project_info": {
"project_number": "1049339402213",
"firebase_url": "https://bitmark-autonomy.firebaseio.com",
"project_id": "bitmark-autonomy",
"storage_bucket": "bitmark-autonomy.appspot.com"
"project_number": "887245084469",
"project_id": "my-first-project-sang",
"storage_bucket": "my-first-project-sang.appspot.com"
},
"client": [
{
"client_info": {
"mobilesdk_app_id": "1:1049339402213:android:7265dc65bcc4e82715c10c",
"mobilesdk_app_id": "1:887245084469:android:1884bfad977da157e1de7c",
"android_client_info": {
"package_name": "com.bitmark.autonomy_client"
}
},
"oauth_client": [
{
"client_id": "1049339402213-4p8ded0ahoujss4hq73mlk46d4kmg3vo.apps.googleusercontent.com",
"client_type": 3
}
],
"oauth_client": [],
"api_key": [
{
"current_key": "AIzaSyD9pZXBE637fqM-Qz8mxhqMGpaWyENrm2w"
"current_key": "AIzaSyCZpjsOErKaHDsb_IefvZPJogyVEwicEzQ"
ppupha marked this conversation as resolved.
Show resolved Hide resolved
}
],
"services": {
"appinvite_service": {
"other_platform_oauth_client": [
{
"client_id": "1049339402213-4p8ded0ahoujss4hq73mlk46d4kmg3vo.apps.googleusercontent.com",
"client_type": 3
}
]
"other_platform_oauth_client": []
}
}
},
{
"client_info": {
"mobilesdk_app_id": "1:1049339402213:android:ac2e79b3a7b8853215c10c",
"mobilesdk_app_id": "1:887245084469:android:9a5750f1a53e5368e1de7c",
"android_client_info": {
"package_name": "com.bitmark.autonomy_client.inhouse"
}
},
"oauth_client": [
{
"client_id": "1049339402213-4p8ded0ahoujss4hq73mlk46d4kmg3vo.apps.googleusercontent.com",
"client_type": 3
}
],
"oauth_client": [],
"api_key": [
{
"current_key": "AIzaSyD9pZXBE637fqM-Qz8mxhqMGpaWyENrm2w"
"current_key": "AIzaSyCZpjsOErKaHDsb_IefvZPJogyVEwicEzQ"
ppupha marked this conversation as resolved.
Show resolved Hide resolved
}
],
"services": {
"appinvite_service": {
"other_platform_oauth_client": [
{
"client_id": "1049339402213-4p8ded0ahoujss4hq73mlk46d4kmg3vo.apps.googleusercontent.com",
"client_type": 3
}
]
"other_platform_oauth_client": []
}
}
}
Expand Down
5 changes: 4 additions & 1 deletion android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ buildscript {

dependencies {
classpath 'com.android.tools.build:gradle:7.4.2'
// START: FlutterFire Configuration
classpath 'com.google.gms:google-services:4.3.15'
// END: FlutterFire Configuration
classpath "org.jetbrains.kotlin:kotlin-serialization:$kotlin_version"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
Expand All @@ -26,7 +29,7 @@ allprojects {
}
}
maven { url 'https://jitpack.io' }
maven { url "${project(':background_fetch').projectDir}/libs"}
maven { url "${project(':background_fetch').projectDir}/libs" }
}
}

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 @@ -95,6 +95,7 @@
97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; };
97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; };
C577A25E2C1FF997DB2CF183 /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A451CD8AF50E41359BCF628F /* Pods_Runner.framework */; };
D8B1C74AF3D36CCED934471C /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = F0D0B016630ED1C607052172 /* GoogleService-Info.plist */; };
E990C0ED2A26F412007CAE7A /* LocaleHandler.swift in Sources */ = {isa = PBXBuildFile; fileRef = E990C0EC2A26F412007CAE7A /* LocaleHandler.swift */; };
E990C0EE2A26F412007CAE7A /* LocaleHandler.swift in Sources */ = {isa = PBXBuildFile; fileRef = E990C0EC2A26F412007CAE7A /* LocaleHandler.swift */; };
/* End PBXBuildFile section */
Expand Down Expand Up @@ -253,6 +254,7 @@
E16387878DC7F0174C63CE7E /* Pods-Runner Notification.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner Notification.profile.xcconfig"; path = "Target Support Files/Pods-Runner Notification/Pods-Runner Notification.profile.xcconfig"; sourceTree = "<group>"; };
E990C0EC2A26F412007CAE7A /* LocaleHandler.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LocaleHandler.swift; sourceTree = "<group>"; };
EE8CDE6C03F3F785748BF040 /* Pods-Runner-Runner Notification.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner-Runner Notification.debug.xcconfig"; path = "Target Support Files/Pods-Runner-Runner Notification/Pods-Runner-Runner Notification.debug.xcconfig"; sourceTree = "<group>"; };
F0D0B016630ED1C607052172 /* GoogleService-Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; name = "GoogleService-Info.plist"; path = "Runner/GoogleService-Info.plist"; sourceTree = "<group>"; };
F4998FB76BED087D5F59212F /* Pods-Runner Inhouse Notification.profile-prd.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner Inhouse Notification.profile-prd.xcconfig"; path = "Target Support Files/Pods-Runner Inhouse Notification/Pods-Runner Inhouse Notification.profile-prd.xcconfig"; sourceTree = "<group>"; };
FAF8CE1D5921CF3A07F21D56 /* Pods-Runner Notification.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner Notification.debug.xcconfig"; path = "Target Support Files/Pods-Runner Notification/Pods-Runner Notification.debug.xcconfig"; sourceTree = "<group>"; };
/* End PBXFileReference section */
Expand Down Expand Up @@ -440,6 +442,7 @@
97C146EF1CF9000F007C117D /* Products */,
3BBCC0A3C0034FEB1A0111DB /* Pods */,
48A495939161E7A3DB3133FE /* Frameworks */,
F0D0B016630ED1C607052172 /* 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 */,
D8B1C74AF3D36CCED934471C /* 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
7 changes: 7 additions & 0 deletions ios/firebase_app_id_file.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"file_generated_by": "FlutterFire CLI",
"purpose": "FirebaseAppID & ProjectID for this Firebase app in this directory",
"GOOGLE_APP_ID": "1:887245084469:ios:875669b063548a75e1de7c",
"FIREBASE_PROJECT_ID": "my-first-project-sang",
"GCM_SENDER_ID": "887245084469"
}
30 changes: 26 additions & 4 deletions lib/common/injector.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ import 'dart:math';
import 'package:autonomy_flutter/common/environment.dart';
import 'package:autonomy_flutter/database/app_database.dart';
import 'package:autonomy_flutter/database/cloud_database.dart';
import 'package:autonomy_flutter/database/dao/firestore_address_dao.dart';
import 'package:autonomy_flutter/database/dao/firestore_audit_dao.dart';
import 'package:autonomy_flutter/database/dao/firestore_connection_dao.dart';
import 'package:autonomy_flutter/database/dao/firestore_persona_dao.dart';
import 'package:autonomy_flutter/database/sqlite_cloud_database.dart';
import 'package:autonomy_flutter/gateway/activation_api.dart';
import 'package:autonomy_flutter/gateway/airdrop_api.dart';
import 'package:autonomy_flutter/gateway/announcement_api.dart';
Expand Down Expand Up @@ -39,6 +44,7 @@ import 'package:autonomy_flutter/service/canvas_client_service.dart';
import 'package:autonomy_flutter/service/chat_auth_service.dart';
import 'package:autonomy_flutter/service/chat_service.dart';
import 'package:autonomy_flutter/service/client_token_service.dart';
import 'package:autonomy_flutter/service/cloud_firestore_service.dart';
import 'package:autonomy_flutter/service/cloud_service.dart';
import 'package:autonomy_flutter/service/configuration_service.dart';
import 'package:autonomy_flutter/service/currency_service.dart';
Expand All @@ -65,6 +71,7 @@ import 'package:autonomy_flutter/util/constants.dart';
import 'package:autonomy_flutter/util/dio_interceptors.dart';
import 'package:autonomy_flutter/util/dio_util.dart';
import 'package:autonomy_flutter/util/log.dart';
import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:dio/dio.dart';
import 'package:dio_smart_retry/dio_smart_retry.dart';
import 'package:flutter_cache_manager/flutter_cache_manager.dart';
Expand Down Expand Up @@ -116,7 +123,7 @@ Future<void> setup() async {
migrateV17ToV18,
]).build();

final cloudDB = await $FloorCloudDatabase
final cloudDB = await $FloorSqliteCloudDatabase
.databaseBuilder('cloud_database.db')
.addMigrations([
migrateCloudV1ToV2,
Expand Down Expand Up @@ -152,6 +159,20 @@ Future<void> setup() async {
injector.registerLazySingleton(() => NftCollection.database.provenanceDao);
injector.registerLazySingleton(() => cloudDB);

injector.registerLazySingleton<CloudFirestoreService>(
ppupha marked this conversation as resolved.
Show resolved Hide resolved
() => CloudFirestoreService(FirebaseFirestore.instance));

injector.registerLazySingleton<FirestorePersonaDao>(
ppupha marked this conversation as resolved.
Show resolved Hide resolved
() => FirestorePersonaDaoImp(injector()));
injector.registerLazySingleton<FirestoreConnectionDao>(
ppupha marked this conversation as resolved.
Show resolved Hide resolved
() => FirestoreConnectionDaoImp(injector()));
injector.registerLazySingleton<FirestoreAuditDao>(
ppupha marked this conversation as resolved.
Show resolved Hide resolved
() => FirestoreAuditDaoImp(injector()));
injector.registerLazySingleton<FirestoreWalletAddressDao>(
ppupha marked this conversation as resolved.
Show resolved Hide resolved
() => FirestoreWalletAddressDaoImp(injector()));
injector.registerLazySingleton(
ppupha marked this conversation as resolved.
Show resolved Hide resolved
() => CloudDatabase(injector(), injector(), injector(), injector()));

final authenticatedDio = Dio(); // Authenticated dio instance for AU servers
authenticatedDio.interceptors.add(AutonomyAuthInterceptor());
authenticatedDio.interceptors.add(LoggingInterceptor());
Expand All @@ -173,7 +194,7 @@ Future<void> setup() async {
authenticatedDio.options = dioOptions;

// Services
final auditService = AuditServiceImpl(cloudDB);
final auditService = AuditServiceImpl(injector());

injector.registerSingleton<ConfigurationService>(
ConfigurationServiceImpl(sharedPreferences));
Expand All @@ -188,7 +209,7 @@ Future<void> setup() async {
() => MixPanelClientService(injector(), injector(), injector()));
injector.registerLazySingleton<CacheManager>(() => AUImageCacheManage());
injector.registerLazySingleton<AccountService>(() => AccountServiceImpl(
cloudDB,
injector(),
injector(),
injector(),
auditService,
Expand Down Expand Up @@ -217,7 +238,7 @@ Future<void> setup() async {
() => RemoteConfigServiceImpl(injector()));
injector.registerLazySingleton(
() => AuthService(injector(), injector(), injector()));
injector.registerLazySingleton(() => BackupService(injector()));
injector.registerLazySingleton(() => BackupService(injector(), injector()));
ppupha marked this conversation as resolved.
Show resolved Hide resolved
injector
.registerLazySingleton(() => TezosBeaconService(injector(), injector()));

Expand All @@ -239,6 +260,7 @@ Future<void> setup() async {
injector(),
injector(),
injector(),
injector(),
));

injector.registerLazySingleton<IAPService>(
Expand Down
Loading
Loading