mirror of
https://github.com/immich-app/immich.git
synced 2025-07-08 18:54:18 -04:00
refactor(mobile): network.interface.dart (#19341)
* refactor(mobile): network.interface.dart * refactor(mobile): network.interface.dart
This commit is contained in:
parent
ecc99bfd16
commit
5c74f634b7
@ -1,4 +0,0 @@
|
||||
abstract interface class INetworkRepository {
|
||||
Future<String?> getWifiName();
|
||||
Future<String?> getWifiIp();
|
||||
}
|
@ -1,7 +1,6 @@
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||
import 'package:immich_mobile/interfaces/network.interface.dart';
|
||||
import 'package:network_info_plus/network_info_plus.dart';
|
||||
|
||||
final networkRepositoryProvider = Provider((_) {
|
||||
@ -10,12 +9,11 @@ final networkRepositoryProvider = Provider((_) {
|
||||
return NetworkRepository(networkInfo);
|
||||
});
|
||||
|
||||
class NetworkRepository implements INetworkRepository {
|
||||
class NetworkRepository {
|
||||
final NetworkInfo _networkInfo;
|
||||
|
||||
NetworkRepository(this._networkInfo);
|
||||
|
||||
@override
|
||||
Future<String?> getWifiName() {
|
||||
if (Platform.isAndroid) {
|
||||
// remove quote around the return value on Android
|
||||
@ -30,7 +28,6 @@ class NetworkRepository implements INetworkRepository {
|
||||
return _networkInfo.getWifiName();
|
||||
}
|
||||
|
||||
@override
|
||||
Future<String?> getWifiIp() {
|
||||
return _networkInfo.getWifiIP();
|
||||
}
|
||||
|
@ -1,5 +1,4 @@
|
||||
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';
|
||||
|
||||
@ -11,7 +10,7 @@ final networkServiceProvider = Provider((ref) {
|
||||
});
|
||||
|
||||
class NetworkService {
|
||||
final INetworkRepository _repository;
|
||||
final NetworkRepository _repository;
|
||||
final IPermissionRepository _permissionRepository;
|
||||
|
||||
NetworkService(this._repository, this._permissionRepository);
|
||||
|
Loading…
x
Reference in New Issue
Block a user