mirror of
				https://github.com/immich-app/immich.git
				synced 2025-10-30 18:22:37 -04:00 
			
		
		
		
	* chore: bump dart sdk to 3.8 * chore: make build * make pigeon * chore: format files --------- Co-authored-by: shenlong-tanwen <139912620+shalong-tanwen@users.noreply.github.com>
		
			
				
	
	
		
			44 lines
		
	
	
		
			1.3 KiB
		
	
	
	
		
			Dart
		
	
	
	
	
	
			
		
		
	
	
			44 lines
		
	
	
		
			1.3 KiB
		
	
	
	
		
			Dart
		
	
	
	
	
	
| 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();
 | |
|   }
 | |
| }
 |