-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #83 from KosukeSaigusa/set_user_mode_host_by_default
サインイン直後、ホストドキュメントが存在するなら UserMode を Host にする
- Loading branch information
Showing
3 changed files
with
72 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,23 @@ | ||
import 'package:firebase_common/firebase_common.dart'; | ||
import 'package:hooks_riverpod/hooks_riverpod.dart'; | ||
|
||
import '../../firestore_repository.dart'; | ||
|
||
final hostServiceProvider = Provider.autoDispose<HostService>( | ||
(ref) => HostService( | ||
hostRepository: ref.watch(hostRepositoryProvider), | ||
), | ||
); | ||
|
||
class HostService { | ||
const HostService({required HostRepository hostRepository}) | ||
: _hostRepository = hostRepository; | ||
|
||
final HostRepository _hostRepository; | ||
|
||
/// 指定した [Host] が存在するかどうかを返す。 | ||
Future<bool> hostExists({required String hostId}) async { | ||
final host = await _hostRepository.fetchHost(hostId: hostId); | ||
return host != null; | ||
} | ||
} |