Update Readme
This commit is contained in:
parent
6d14b57fc9
commit
504b6354f1
4 changed files with 33 additions and 27 deletions
18
README.md
18
README.md
|
@ -28,17 +28,13 @@ This project is under heavy development, there will be continous functions, feat
|
|||
|
||||
# Features
|
||||
|
||||
[x] Upload assets(videos/images)
|
||||
|
||||
[x] View assets
|
||||
|
||||
[x] Quick navigation with drag scroll bar
|
||||
|
||||
[x] Auto Backup
|
||||
|
||||
[x] Support HEIC/HEIF Backup
|
||||
|
||||
[x] Extract and display EXIF info
|
||||
- Upload assets(videos/images).
|
||||
- View assets.
|
||||
- Quick navigation with drag scroll bar.
|
||||
- Auto Backup.
|
||||
- Support HEIC/HEIF Backup.
|
||||
- Extract and display EXIF info.
|
||||
- Real-time render from multi-device upload event.
|
||||
|
||||
# Development
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
|
|||
import 'package:flutter/services.dart';
|
||||
import 'package:hive_flutter/hive_flutter.dart';
|
||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||
import 'package:immich_mobile/modules/home/providers/asset.provider.dart';
|
||||
import 'package:immich_mobile/routing/router.dart';
|
||||
import 'package:immich_mobile/shared/providers/app_state.provider.dart';
|
||||
import 'package:immich_mobile/shared/providers/backup.provider.dart';
|
||||
|
@ -37,22 +38,23 @@ class _ImmichAppState extends ConsumerState<ImmichApp> with WidgetsBindingObserv
|
|||
switch (state) {
|
||||
case AppLifecycleState.resumed:
|
||||
debugPrint("[APP STATE] resumed");
|
||||
ref.read(appStateProvider.notifier).state = AppStateEnum.resumed;
|
||||
ref.read(backupProvider.notifier).resumeBackup();
|
||||
ref.read(websocketProvider.notifier).connect();
|
||||
ref.watch(appStateProvider.notifier).state = AppStateEnum.resumed;
|
||||
ref.watch(backupProvider.notifier).resumeBackup();
|
||||
ref.watch(websocketProvider.notifier).connect();
|
||||
ref.watch(assetProvider.notifier).getAllAsset();
|
||||
break;
|
||||
case AppLifecycleState.inactive:
|
||||
debugPrint("[APP STATE] inactive");
|
||||
ref.read(appStateProvider.notifier).state = AppStateEnum.inactive;
|
||||
ref.read(websocketProvider.notifier).disconnect();
|
||||
ref.watch(appStateProvider.notifier).state = AppStateEnum.inactive;
|
||||
ref.watch(websocketProvider.notifier).disconnect();
|
||||
break;
|
||||
case AppLifecycleState.paused:
|
||||
debugPrint("[APP STATE] paused");
|
||||
ref.read(appStateProvider.notifier).state = AppStateEnum.paused;
|
||||
ref.watch(appStateProvider.notifier).state = AppStateEnum.paused;
|
||||
break;
|
||||
case AppLifecycleState.detached:
|
||||
debugPrint("[APP STATE] detached");
|
||||
ref.read(appStateProvider.notifier).state = AppStateEnum.detached;
|
||||
ref.watch(appStateProvider.notifier).state = AppStateEnum.detached;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -59,9 +59,9 @@ class ProfileDrawer extends ConsumerWidget {
|
|||
bool res = await ref.read(authenticationProvider.notifier).logout();
|
||||
|
||||
if (res) {
|
||||
ref.watch(websocketProvider.notifier).disconnect();
|
||||
ref.watch(backupProvider.notifier).cancelBackup();
|
||||
ref.watch(assetProvider.notifier).clearAllAsset();
|
||||
ref.watch(websocketProvider.notifier).disconnect();
|
||||
AutoRouter.of(context).popUntilRoot();
|
||||
}
|
||||
},
|
||||
|
|
|
@ -44,7 +44,9 @@ class WebscoketState {
|
|||
}
|
||||
|
||||
class WebsocketNotifier extends StateNotifier<WebscoketState> {
|
||||
WebsocketNotifier(this.ref) : super(WebscoketState(socket: null, isConnected: false));
|
||||
WebsocketNotifier(this.ref) : super(WebscoketState(socket: null, isConnected: false)) {
|
||||
debugPrint("Init websocket instance");
|
||||
}
|
||||
|
||||
final Ref ref;
|
||||
|
||||
|
@ -53,12 +55,12 @@ class WebsocketNotifier extends StateNotifier<WebscoketState> {
|
|||
|
||||
if (authenticationState.isAuthenticated) {
|
||||
var accessToken = Hive.box(userInfoBox).get(accessTokenKey);
|
||||
|
||||
var endpoint = Hive.box(userInfoBox).get(serverEndpointKey);
|
||||
try {
|
||||
debugPrint("Attempting to connect to ws");
|
||||
debugPrint("[WEBSOCKET] Attempting to connect to ws");
|
||||
// Configure socket transports must be sepecified
|
||||
Socket socket = io(
|
||||
'http://192.168.1.103:2283',
|
||||
endpoint,
|
||||
OptionBuilder()
|
||||
.setTransports(['websocket'])
|
||||
.enableReconnection()
|
||||
|
@ -70,12 +72,12 @@ class WebsocketNotifier extends StateNotifier<WebscoketState> {
|
|||
);
|
||||
|
||||
socket.onConnect((_) {
|
||||
debugPrint("Established Websocket Connection");
|
||||
debugPrint("[WEBSOCKET] Established Websocket Connection");
|
||||
state = WebscoketState(isConnected: true, socket: socket);
|
||||
});
|
||||
|
||||
socket.onDisconnect((_) {
|
||||
debugPrint("Disconnect to Websocket Connection");
|
||||
debugPrint("[WEBSOCKET] Disconnect to Websocket Connection");
|
||||
state = WebscoketState(isConnected: false, socket: null);
|
||||
});
|
||||
|
||||
|
@ -90,13 +92,19 @@ class WebsocketNotifier extends StateNotifier<WebscoketState> {
|
|||
ref.watch(assetProvider.notifier).onNewAssetUploaded(newAsset);
|
||||
});
|
||||
} catch (e) {
|
||||
debugPrint("Catch Webcoket Error - ${e.toString()}");
|
||||
debugPrint("[WEBSOCKET] Catch Websocket Error - ${e.toString()}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
disconnect() {
|
||||
state.socket?.disconnect();
|
||||
debugPrint("[WEBSOCKET] Attempting to disconnect");
|
||||
var socket = state.socket?.disconnect();
|
||||
if (socket != null) {
|
||||
if (socket.disconnected) {
|
||||
state = WebscoketState(isConnected: false, socket: null);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue