Skip to content

Commit

Permalink
Merge branch 'develop' into Sang/backup/use_fireStore
Browse files Browse the repository at this point in the history
  • Loading branch information
ppupha committed Nov 28, 2023
2 parents d092cb5 + 66be6e0 commit 5288a3c
Show file tree
Hide file tree
Showing 62 changed files with 2,081 additions and 5,953 deletions.
3 changes: 1 addition & 2 deletions analysis_options.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -151,5 +151,4 @@ linter:
analyzer:
exclude:
- '**/*.g.dart'
- 'auto-test/**'
- 'test/**'
- 'auto-test/**'
18 changes: 5 additions & 13 deletions lib/common/injector.dart
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ import 'package:autonomy_flutter/gateway/chat_api.dart';
import 'package:autonomy_flutter/gateway/currency_exchange_api.dart';
import 'package:autonomy_flutter/gateway/customer_support_api.dart';
import 'package:autonomy_flutter/gateway/etherchain_api.dart';
import 'package:autonomy_flutter/gateway/feed_api.dart';
import 'package:autonomy_flutter/gateway/feralfile_api.dart';
import 'package:autonomy_flutter/gateway/iap_api.dart';
import 'package:autonomy_flutter/gateway/postcard_api.dart';
Expand Down Expand Up @@ -52,9 +51,7 @@ import 'package:autonomy_flutter/service/currency_service.dart';
import 'package:autonomy_flutter/service/customer_support_service.dart';
import 'package:autonomy_flutter/service/deeplink_service.dart';
import 'package:autonomy_flutter/service/ethereum_service.dart';
import 'package:autonomy_flutter/service/feed_service.dart';
import 'package:autonomy_flutter/service/feralfile_service.dart';
import 'package:autonomy_flutter/service/followee_service.dart';
import 'package:autonomy_flutter/service/iap_service.dart';
import 'package:autonomy_flutter/service/metric_client_service.dart';
import 'package:autonomy_flutter/service/mix_panel_client_service.dart';
Expand Down Expand Up @@ -122,7 +119,8 @@ Future<void> setup() async {
migrateV13ToV14,
migrateV14ToV15,
migrateV15ToV16,
migrateV16ToV17
migrateV16ToV17,
migrateV17ToV18,
]).build();

final cloudDB = await $FloorSqliteCloudDatabase
Expand Down Expand Up @@ -183,7 +181,7 @@ Future<void> setup() async {
dio.interceptors.add(RetryInterceptor(
dio: dio,
logPrint: (message) {
log.warning("[request retry] $message");
log.warning('[request retry] $message');
},
retryDelays: const [
// set delays between retries
Expand Down Expand Up @@ -221,7 +219,7 @@ Future<void> setup() async {
));

injector.registerLazySingleton(() => ChatApi(dio,
baseUrl: Environment.postcardChatServerUrl.replaceFirst("ws", "http")));
baseUrl: Environment.postcardChatServerUrl.replaceFirst('ws', 'http')));
injector.registerLazySingleton(() => ChatAuthService(injector()));
injector.registerLazySingleton(
() => IAPApi(authenticatedDio, baseUrl: Environment.autonomyAuthURL));
Expand All @@ -239,9 +237,7 @@ Future<void> setup() async {
injector.registerLazySingleton<RemoteConfigService>(
() => RemoteConfigServiceImpl(injector()));
injector.registerLazySingleton(
() => FeedApi(authenticatedDio, baseUrl: Environment.feedURL));
injector.registerLazySingleton(
() => AuthService(injector(), injector(), injector(), injector()));
() => AuthService(injector(), injector(), injector()));
injector.registerLazySingleton(() => BackupService(injector(), injector()));
injector
.registerLazySingleton(() => TezosBeaconService(injector(), injector()));
Expand Down Expand Up @@ -304,7 +300,6 @@ Future<void> setup() async {
injector.registerLazySingleton<ClientTokenService>(() => ClientTokenService(
injector(), injector(), injector(), injector(), injector()));

injector.registerLazySingleton(() => FolloweeService(injector(), injector()));
final tezosNodeClientURL = Environment.appTestnetConfig
? Environment.tezosNodeClientTestnetURL
: publicTezosNodes[Random().nextInt(publicTezosNodes.length)];
Expand All @@ -330,9 +325,6 @@ Future<void> setup() async {
injector
.registerLazySingleton<TezosService>(() => TezosServiceImpl(injector()));
injector.registerLazySingleton<AppDatabase>(() => mainnetDB);

injector
.registerLazySingleton<FeedService>(() => FeedServiceImpl(injector()));
injector.registerLazySingleton<PlaylistService>(
() => PlayListServiceImp(injector(), injector(), injector()));

Expand Down
51 changes: 25 additions & 26 deletions lib/database/app_database.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,18 @@
import 'dart:async';

import 'package:autonomy_flutter/database/dao/announcement_dao.dart';
import 'package:autonomy_flutter/database/dao/canvas_device_dao.dart';
import 'package:autonomy_flutter/database/dao/draft_customer_support_dao.dart';
import 'package:autonomy_flutter/database/dao/followee_dao.dart';
import 'package:autonomy_flutter/database/dao/identity_dao.dart';
import 'package:autonomy_flutter/database/entity/announcement_local.dart';
import 'package:autonomy_flutter/database/entity/draft_customer_support.dart';
import 'package:autonomy_flutter/database/entity/followee.dart';
import 'package:autonomy_flutter/database/entity/identity.dart';
import 'package:autonomy_tv_proto/models/canvas_device.dart';
import 'package:floor/floor.dart';
import 'package:nft_collection/models/token.dart';
import 'package:sqflite/sqflite.dart' as sqflite;

import 'dao/canvas_device_dao.dart';
//ignore_for_file: lines_longer_than_80_chars

part 'app_database.g.dart'; // the generated code will be there

Expand All @@ -31,7 +30,6 @@ part 'app_database.g.dart'; // the generated code will be there
AnnouncementLocal,
CanvasDevice,
Scene,
Followee
])
abstract class AppDatabase extends FloorDatabase {
IdentityDao get identityDao;
Expand All @@ -44,15 +42,12 @@ abstract class AppDatabase extends FloorDatabase {

SceneDao get sceneDao;

FolloweeDao get followeeDao;

Future<dynamic> removeAll() async {
await identityDao.removeAll();
await draftCustomerSupportDao.removeAll();
await announcementDao.removeAll();
await canvasDeviceDao.removeAll();
await sceneDao.removeAll();
await followeeDao.removeAll();
}
}

Expand All @@ -69,13 +64,13 @@ final migrateV2ToV3 = Migration(2, 3, (database) async {
// For unknown reason, execute DROP then CREATE in same migration execution doesn't work.
// So I have to separate 2 versions
final migrateV3ToV4 = Migration(3, 4, (database) async {
await database.execute("DROP TABLE IF EXISTS Provenance;");
await database.execute('DROP TABLE IF EXISTS Provenance;');
});

final migrateV4ToV5 = Migration(4, 5, (database) async {
await database.execute("""
await database.execute('''
CREATE TABLE IF NOT EXISTS `Provenance` (`txID` TEXT NOT NULL, `type` TEXT NOT NULL, `blockchain` TEXT NOT NULL, `owner` TEXT NOT NULL, `timestamp` INTEGER NOT NULL, `txURL` TEXT NOT NULL, `tokenID` TEXT NOT NULL, FOREIGN KEY (`tokenID`) REFERENCES `AssetToken` (`id`) ON UPDATE NO ACTION ON DELETE NO ACTION, PRIMARY KEY (`txID`));
CREATE INDEX `index_Provenance_tokenID` ON `Provenance` (`tokenID`);""");
CREATE INDEX `index_Provenance_tokenID` ON `Provenance` (`tokenID`);''');
});

final migrateV5ToV6 = Migration(5, 6, (database) async {
Expand All @@ -84,51 +79,51 @@ final migrateV5ToV6 = Migration(5, 6, (database) async {
});

final migrateV6ToV7 = Migration(6, 7, (database) async {
await database.execute("""
await database.execute('''
DROP TABLE IF EXISTS Provenance;
""");
''');
});

final migrateV7ToV8 = Migration(7, 8, (database) async {
await database.execute("""
await database.execute('''
CREATE TABLE IF NOT EXISTS `Provenance` (`txID` TEXT NOT NULL, `type` TEXT NOT NULL, `blockchain` TEXT NOT NULL, `owner` TEXT NOT NULL, `timestamp` INTEGER NOT NULL, `txURL` TEXT NOT NULL, `tokenID` TEXT NOT NULL, FOREIGN KEY (`tokenID`) REFERENCES `AssetToken` (`id`) ON UPDATE NO ACTION ON DELETE CASCADE, PRIMARY KEY (`txID`));
CREATE INDEX `index_Provenance_tokenID` ON `Provenance` (`tokenID`);
""");
''');
});

final migrateV8ToV9 = Migration(8, 9, (database) async {
await database.execute("""
await database.execute('''
ALTER TABLE AssetToken ADD COLUMN blockchainURL TEXT;
""");
''');
});

final migrateV9ToV10 = Migration(9, 10, (database) async {
await database.execute("""
await database.execute('''
CREATE TABLE IF NOT EXISTS `DraftCustomerSupport` (`uuid` TEXT NOT NULL, `issueID` TEXT NOT NULL, `type` TEXT NOT NULL, `data` TEXT NOT NULL, `createdAt` INTEGER NOT NULL, `reportIssueType` TEXT NOT NULL, `mutedMessages` TEXT NOT NULL, PRIMARY KEY (`uuid`));
""");
''');
});

final migrateV10ToV11 = Migration(10, 11, (database) async {
await database.execute("""
await database.execute('''
ALTER TABLE AssetToken ADD COLUMN mimeType TEXT;
""");
''');
});

final migrateV11ToV12 = Migration(11, 12, (database) async {
await database.execute("""
await database.execute('''
ALTER TABLE AssetToken ADD COLUMN artistID TEXT;
""");
''');
});

final migrateV12ToV13 = Migration(12, 13, (database) async {
await database.execute("""
await database.execute('''
ALTER TABLE AssetToken ADD COLUMN contractAddress TEXT, tokenId TEXT;
""");
''');
});

final migrateV13ToV14 = Migration(13, 14, (database) async {
await database.execute("DROP TABLE IF EXISTS AssetToken;");
await database.execute("DROP TABLE IF EXISTS Provenance;");
await database.execute('DROP TABLE IF EXISTS AssetToken;');
await database.execute('DROP TABLE IF EXISTS Provenance;');
});

final migrateV14ToV15 = Migration(14, 15, (database) async {
Expand All @@ -147,3 +142,7 @@ final migrateV16ToV17 = Migration(16, 17, (database) async {
await database.execute(
'CREATE TABLE IF NOT EXISTS `Followee` (`address` TEXT NOT NULL, `type` INTEGER NOT NULL, `isFollowed` INTEGER NOT NULL, `createdAt` INTEGER NOT NULL, `name` TEXT NOT NULL, PRIMARY KEY (`address`))');
});

final migrateV17ToV18 = Migration(17, 18, (database) async {
await database.execute('DROP TABLE IF EXISTS Followee;');
});
113 changes: 0 additions & 113 deletions lib/database/app_database.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 0 additions & 23 deletions lib/database/dao/followee_dao.dart

This file was deleted.

Loading

0 comments on commit 5288a3c

Please sign in to comment.