Skip to content

Commit

Permalink
feat: ✨ Add feature flag onchain management + manage bridge feature flag
Browse files Browse the repository at this point in the history
  • Loading branch information
redDwarf03 committed Dec 10, 2024
1 parent 8502aa2 commit d7b09da
Show file tree
Hide file tree
Showing 12 changed files with 724 additions and 4 deletions.
31 changes: 31 additions & 0 deletions lib/application/feature_flags.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import 'package:aewallet/application/api_service.dart';
import 'package:aewallet/infrastructure/repositories/feature_flags_repository.dart';
import 'package:aewallet/model/available_networks.dart';
import 'package:aewallet/util/universal_platform.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:riverpod_annotation/riverpod_annotation.dart';

part 'feature_flags.g.dart';

@riverpod
FeatureFlagsRepositoryImpl _featureFlagsRepository(
Ref ref,
) =>
FeatureFlagsRepositoryImpl();

@riverpod
Future<bool?> getFeatureFlag(
Ref ref,
AvailableNetworks network,
String applicationCode,
String featureCode,
) async {
final apiService = ref.watch(apiServiceProvider);
return ref.watch(_featureFlagsRepositoryProvider).getFeatureFlag(
network,
apiService,
applicationCode,
featureCode,
UniversalPlatform.value.name.toLowerCase(),
);
}
214 changes: 214 additions & 0 deletions lib/application/feature_flags.g.dart

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

15 changes: 15 additions & 0 deletions lib/domain/models/feature_flags.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import 'package:freezed_annotation/freezed_annotation.dart';

part 'feature_flags.freezed.dart';
part 'feature_flags.g.dart';

@freezed
class FeatureFlags with _$FeatureFlags {
const factory FeatureFlags({
required String applicationCode,
required Map<String, Map<String, bool>> features,
}) = _FeatureFlags;

factory FeatureFlags.fromJson(Map<String, dynamic> json) =>
_$FeatureFlagsFromJson(json);
}
Loading

0 comments on commit d7b09da

Please sign in to comment.