Skip to content

Commit

Permalink
chore: ♻️ Replace network management with environment management (dou…
Browse files Browse the repository at this point in the history
…blon)
  • Loading branch information
redDwarf03 committed Dec 30, 2024
1 parent f5b642d commit acce5cc
Show file tree
Hide file tree
Showing 38 changed files with 376 additions and 1,139 deletions.
15 changes: 6 additions & 9 deletions lib/application/dapps.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import 'package:aewallet/application/api_service.dart';
import 'package:aewallet/application/settings/settings.dart';
import 'package:aewallet/domain/models/dapp.dart';
import 'package:aewallet/infrastructure/repositories/dapps_repository.dart';
import 'package:aewallet/modules/aeswap/application/session/provider.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:riverpod_annotation/riverpod_annotation.dart';

Expand All @@ -19,24 +19,21 @@ Future<DApp?> getDApp(
String code,
) async {
final apiService = ref.watch(apiServiceProvider);
final networkSettings = ref.watch(
SettingsProviders.settings.select((settings) => settings.network),
);
final environment = ref.watch(environmentProvider);

return ref
.watch(dAppsRepositoryProvider)
.getDApp(networkSettings.network, code, apiService);
.getDApp(environment, code, apiService);
}

@riverpod
Future<List<DApp>> getDAppsFromNetwork(
Ref ref,
) async {
final apiService = ref.watch(apiServiceProvider);
final networkSettings = ref.watch(
SettingsProviders.settings.select((settings) => settings.network),
);
final environment = ref.watch(environmentProvider);
final dAppsFromNetwork = await ref
.read(dAppsRepositoryProvider)
.getDAppsFromNetwork(networkSettings.network, apiService);
.getDAppsFromNetwork(environment, apiService);
return dAppsFromNetwork;
}
4 changes: 2 additions & 2 deletions lib/application/dapps.g.dart

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

8 changes: 3 additions & 5 deletions lib/application/feature_flags.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import 'package:aewallet/application/api_service.dart';
import 'package:aewallet/application/settings/settings.dart';
import 'package:aewallet/infrastructure/repositories/feature_flags_repository.dart';
import 'package:aewallet/modules/aeswap/application/session/provider.dart';
import 'package:aewallet/util/universal_platform.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:riverpod_annotation/riverpod_annotation.dart';
Expand All @@ -20,11 +20,9 @@ Future<bool?> getFeatureFlag(
String featureCode,
) async {
final apiService = ref.watch(apiServiceProvider);
final networkSettings = ref.watch(
SettingsProviders.settings.select((settings) => settings.network),
);
final environment = ref.watch(environmentProvider);
return ref.watch(_featureFlagsRepositoryProvider).getFeatureFlag(
networkSettings.network,
environment,
apiService,
applicationCode,
featureCode,
Expand Down
2 changes: 1 addition & 1 deletion lib/application/feature_flags.g.dart

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

82 changes: 0 additions & 82 deletions lib/application/network/provider.dart

This file was deleted.

Loading

0 comments on commit acce5cc

Please sign in to comment.