Source Code added
This commit is contained in:
parent
800376eafd
commit
9efa9bc6dd
3912 changed files with 754770 additions and 2 deletions
43
mobile/lib/services/network.service.dart
Normal file
43
mobile/lib/services/network.service.dart
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||
import 'package:immich_mobile/repositories/network.repository.dart';
|
||||
import 'package:immich_mobile/repositories/permission.repository.dart';
|
||||
|
||||
final networkServiceProvider = Provider((ref) {
|
||||
return NetworkService(ref.watch(networkRepositoryProvider), ref.watch(permissionRepositoryProvider));
|
||||
});
|
||||
|
||||
class NetworkService {
|
||||
final NetworkRepository _repository;
|
||||
final IPermissionRepository _permissionRepository;
|
||||
|
||||
const NetworkService(this._repository, this._permissionRepository);
|
||||
|
||||
Future<bool> getLocationWhenInUserPermission() {
|
||||
return _permissionRepository.hasLocationWhenInUsePermission();
|
||||
}
|
||||
|
||||
Future<bool> requestLocationWhenInUsePermission() {
|
||||
return _permissionRepository.requestLocationWhenInUsePermission();
|
||||
}
|
||||
|
||||
Future<bool> getLocationAlwaysPermission() {
|
||||
return _permissionRepository.hasLocationAlwaysPermission();
|
||||
}
|
||||
|
||||
Future<bool> requestLocationAlwaysPermission() {
|
||||
return _permissionRepository.requestLocationAlwaysPermission();
|
||||
}
|
||||
|
||||
Future<String?> getWifiName() async {
|
||||
final canRead = await getLocationWhenInUserPermission();
|
||||
if (!canRead) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return await _repository.getWifiName();
|
||||
}
|
||||
|
||||
Future<bool> openSettings() {
|
||||
return _permissionRepository.openSettings();
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue