import 'package:hooks_riverpod/hooks_riverpod.dart'; import 'package:immich_mobile/interfaces/network.interface.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 INetworkRepository _repository; final IPermissionRepository _permissionRepository; NetworkService(this._repository, this._permissionRepository); Future getLocationWhenInUserPermission() { return _permissionRepository.hasLocationWhenInUsePermission(); } Future requestLocationWhenInUsePermission() { return _permissionRepository.requestLocationWhenInUsePermission(); } Future getLocationAlwaysPermission() { return _permissionRepository.hasLocationAlwaysPermission(); } Future requestLocationAlwaysPermission() { return _permissionRepository.requestLocationAlwaysPermission(); } Future getWifiName() async { final canRead = await getLocationWhenInUserPermission(); if (!canRead) { return null; } return await _repository.getWifiName(); } Future openSettings() { return _permissionRepository.openSettings(); } }