Skip to content

Commit

Permalink
usecase, provider
Browse files Browse the repository at this point in the history
  • Loading branch information
leo-lox committed Nov 22, 2024
1 parent e13d9a0 commit 91a629a
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 2 deletions.
2 changes: 0 additions & 2 deletions lib/data_layer/repositories/nostr_list_repository_impl.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,9 @@ import '../models/nostr_lists_model.dart';

class NostrListRepositoryImpl implements NostrListRepository {
final DartNdkSource dartNdkSource;
final ndk.EventVerifier eventVerifier;

NostrListRepositoryImpl({
required this.dartNdkSource,
required this.eventVerifier,
});

@override
Expand Down
20 changes: 20 additions & 0 deletions lib/domain_layer/usecases/get_nostr_lists.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import '../entities/nostr_list.dart';
import '../repositories/nostr_list_repository.dart';

class GetNostrLists {
final NostrListRepository _nostrListRepository;

GetNostrLists({
required NostrListRepository nostrListRepository,
}) : _nostrListRepository = nostrListRepository;

Future<NostrSet?> getPublicNostrFollowSet({
required String pubKey,
required String name,
}) {
return _nostrListRepository.getPublicNostrFollowSet(
pubKey: pubKey,
name: name,
);
}
}
22 changes: 22 additions & 0 deletions lib/presentation_layer/providers/nostr_list_provider.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import 'package:flutter_riverpod/flutter_riverpod.dart';

import '../../data_layer/data_sources/dart_ndk_source.dart';
import '../../data_layer/repositories/nostr_list_repository_impl.dart';
import '../../domain_layer/repositories/nostr_list_repository.dart';
import '../../domain_layer/usecases/get_nostr_lists.dart';

import 'ndk_provider.dart';

final nostrListProvider = Provider<GetNostrLists>((ref) {
final ndk = ref.watch(ndkProvider);

final DartNdkSource dartNdkSource = DartNdkSource(ndk);

final NostrListRepository listsRepo = NostrListRepositoryImpl(
dartNdkSource: dartNdkSource,
);

final GetNostrLists getLists = GetNostrLists(nostrListRepository: listsRepo);

return getLists;
});

0 comments on commit 91a629a

Please sign in to comment.