Skip to content

Commit

Permalink
Merge pull request #1760 from bitmark-inc/display_device_internet
Browse files Browse the repository at this point in the history
display device via internet
  • Loading branch information
phuocbitmark authored Jun 24, 2024
2 parents 6e334f2 + ca14c6b commit 13bce80
Show file tree
Hide file tree
Showing 47 changed files with 1,058 additions and 1,826 deletions.
4 changes: 4 additions & 0 deletions lib/common/environment.dart
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ class Environment {

static String get auClaimSecretKey => dotenv.env['AU_CLAIM_SECRET_KEY'] ?? '';

static String get tvKey => dotenv.env['TV_API_KEY'] ?? '';

static String get tvCastApiUrl => dotenv.env['TV_CAST_API_URL'] ?? '';

static String get tokenWebviewPrefix =>
dotenv.env['TOKEN_WEBVIEW_PREFIX'] ?? '';

Expand Down
27 changes: 14 additions & 13 deletions lib/common/injector.dart
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import 'package:autonomy_flutter/gateway/merchandise_api.dart';
import 'package:autonomy_flutter/gateway/postcard_api.dart';
import 'package:autonomy_flutter/gateway/pubdoc_api.dart';
import 'package:autonomy_flutter/gateway/source_exhibition_api.dart';
import 'package:autonomy_flutter/gateway/tv_cast_api.dart';
import 'package:autonomy_flutter/gateway/tzkt_api.dart';
import 'package:autonomy_flutter/screen/bloc/identity/identity_bloc.dart';
import 'package:autonomy_flutter/screen/bloc/subscription/subscription_bloc.dart';
Expand All @@ -41,8 +42,6 @@ import 'package:autonomy_flutter/service/audit_service.dart';
import 'package:autonomy_flutter/service/auth_service.dart';
import 'package:autonomy_flutter/service/autonomy_service.dart';
import 'package:autonomy_flutter/service/backup_service.dart';
import 'package:autonomy_flutter/service/canvas_channel_service.dart';
import 'package:autonomy_flutter/service/canvas_client_service.dart';
import 'package:autonomy_flutter/service/canvas_client_service_v2.dart';
import 'package:autonomy_flutter/service/chat_auth_service.dart';
import 'package:autonomy_flutter/service/chat_service.dart';
Expand All @@ -57,8 +56,8 @@ import 'package:autonomy_flutter/service/domain_service.dart';
import 'package:autonomy_flutter/service/ethereum_service.dart';
import 'package:autonomy_flutter/service/feralfile_service.dart';
import 'package:autonomy_flutter/service/hive_service.dart';
import 'package:autonomy_flutter/service/hive_store_service.dart';
import 'package:autonomy_flutter/service/iap_service.dart';
import 'package:autonomy_flutter/service/mdns_service.dart';
import 'package:autonomy_flutter/service/merchandise_service.dart';
import 'package:autonomy_flutter/service/metric_client_service.dart';
import 'package:autonomy_flutter/service/mix_panel_client_service.dart';
Expand All @@ -80,9 +79,10 @@ 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:dio/dio.dart';
import 'package:feralfile_app_tv_proto/feralfile_app_tv_proto.dart';
import 'package:flutter_cache_manager/flutter_cache_manager.dart';
import 'package:get_it/get_it.dart';
import 'package:http/http.dart';
import 'package:http/http.dart' as http;
import 'package:logging/logging.dart';
import 'package:nft_collection/data/api/indexer_api.dart';
import 'package:nft_collection/graphql/clients/indexer_client.dart';
Expand Down Expand Up @@ -126,6 +126,7 @@ Future<void> setup() async {
migrateV15ToV16,
migrateV16ToV17,
migrateV17ToV18,
migrateV18ToV19,
]).build();

final cloudDB = await $FloorCloudDatabase
Expand Down Expand Up @@ -179,8 +180,7 @@ Future<void> setup() async {

injector.registerSingleton<ConfigurationService>(
ConfigurationServiceImpl(sharedPreferences));

injector.registerLazySingleton(() => Client());
injector.registerLazySingleton(() => http.Client());
injector.registerLazySingleton<AutonomyService>(
() => AutonomyServiceImpl(injector(), injector()));
injector
Expand Down Expand Up @@ -247,6 +247,8 @@ Future<void> setup() async {
injector.registerLazySingleton<IAPService>(
() => IAPServiceImpl(injector(), injector()));

injector.registerLazySingleton(() =>
TvCastApi(tvCastDio(dioOptions), baseUrl: Environment.tvCastApiUrl));
injector.registerLazySingleton(() => Wc2Service(
injector(),
injector(),
Expand Down Expand Up @@ -321,13 +323,12 @@ Future<void> setup() async {
injector.registerLazySingleton<AppDatabase>(() => mainnetDB);
injector.registerLazySingleton<PlaylistService>(
() => PlayListServiceImp(injector(), injector(), injector(), injector()));

injector.registerLazySingleton<CanvasChannelService>(
() => CanvasChannelService(injector()));
injector.registerLazySingleton<DeviceInfoService>(() => DeviceInfoService());
injector.registerLazySingleton<CanvasClientService>(
() => CanvasClientService(injector(), injector(), injector()));
injector.registerLazySingleton<MDnsService>(() => MDnsService(injector()));

injector.registerLazySingleton<HiveStoreObjectService<CanvasDevice>>(
() => HiveStoreObjectServiceImpl());
await injector<HiveStoreObjectService<CanvasDevice>>()
.init('local.canvas_device');
injector.registerLazySingleton<CanvasClientServiceV2>(() =>
CanvasClientServiceV2(injector(), injector(), injector(), injector()));

Expand Down Expand Up @@ -388,7 +389,7 @@ Future<void> setup() async {
() => IdentityBloc(injector(), injector()));
injector.registerFactory<AuChatBloc>(() => AuChatBloc(injector()));
injector.registerLazySingleton<CanvasDeviceBloc>(
() => CanvasDeviceBloc(injector(), injector(), injector()));
() => CanvasDeviceBloc(injector()));
injector
.registerLazySingleton<ExhibitionBloc>(() => ExhibitionBloc(injector()));
injector.registerLazySingleton<SubscriptionBloc>(
Expand Down
17 changes: 6 additions & 11 deletions lib/database/app_database.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,12 @@
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/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/identity.dart';
import 'package:autonomy_flutter/util/log.dart';
import 'package:feralfile_app_tv_proto/feralfile_app_tv_proto.dart';
import 'package:floor/floor.dart';
import 'package:nft_collection/models/token.dart';
import 'package:sqflite/sqflite.dart' as sqflite;
Expand All @@ -25,12 +23,10 @@ import 'package:sqflite/sqflite.dart' as sqflite;
part 'app_database.g.dart'; // the generated code will be there

@TypeConverters([DateTimeConverter, TokenOwnersConverter])
@Database(version: 17, entities: [
@Database(version: 19, entities: [
Identity,
DraftCustomerSupport,
AnnouncementLocal,
CanvasDevice,
Scene,
])
abstract class AppDatabase extends FloorDatabase {
IdentityDao get identityDao;
Expand All @@ -39,16 +35,10 @@ abstract class AppDatabase extends FloorDatabase {

AnnouncementLocalDao get announcementDao;

CanvasDeviceDao get canvasDeviceDao;

SceneDao get sceneDao;

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

Expand Down Expand Up @@ -164,3 +154,8 @@ final migrateV17ToV18 = Migration(17, 18, (database) async {
await database.execute('DROP TABLE IF EXISTS Followee;');
log.info('Migrated App database from version 17 to 18');
});

final migrateV18ToV19 = Migration(18, 19, (database) async {
await database.execute('DROP TABLE IF EXISTS CanvasDevice;');
await database.execute('DROP TABLE IF EXISTS Scene;');
});
Loading

0 comments on commit 13bce80

Please sign in to comment.