mirror of
https://github.com/immich-app/immich
synced 2025-11-07 17:27:20 +00:00
feat(mobile): Removed stay logged in checkbox and made it enabled by default (#1550)
* removed stay logged in checkbox and made it enabled by default * adds padding to login button * removed all isSaveLogin * fix: logout would re-login with previous credential upon app restart --------- Co-authored-by: Alex <alex.tran1502@gmail.com>
This commit is contained in:
parent
f38c7a4b7e
commit
16183791f3
5 changed files with 14 additions and 77 deletions
|
|
@ -55,7 +55,6 @@ class AuthenticationNotifier extends StateNotifier<AuthenticationState> {
|
|||
String email,
|
||||
String password,
|
||||
String serverUrl,
|
||||
bool isSavedLoginInfo,
|
||||
) async {
|
||||
try {
|
||||
// Resolve API server endpoint from user provided serverUrl
|
||||
|
|
@ -83,7 +82,6 @@ class AuthenticationNotifier extends StateNotifier<AuthenticationState> {
|
|||
return setSuccessLoginInfo(
|
||||
accessToken: loginResponse.accessToken,
|
||||
serverUrl: serverUrl,
|
||||
isSavedLoginInfo: isSavedLoginInfo,
|
||||
);
|
||||
} catch (e) {
|
||||
HapticFeedback.vibrate();
|
||||
|
|
@ -100,21 +98,9 @@ class AuthenticationNotifier extends StateNotifier<AuthenticationState> {
|
|||
_assetCacheService.invalidate(),
|
||||
_albumCacheService.invalidate(),
|
||||
_sharedAlbumCacheService.invalidate(),
|
||||
Hive.box<HiveSavedLoginInfo>(hiveLoginInfoBox).delete(savedLoginInfoKey)
|
||||
]);
|
||||
|
||||
// Remove login info from local storage
|
||||
var loginInfo =
|
||||
Hive.box<HiveSavedLoginInfo>(hiveLoginInfoBox).get(savedLoginInfoKey);
|
||||
if (loginInfo != null) {
|
||||
loginInfo.email = "";
|
||||
loginInfo.password = "";
|
||||
loginInfo.isSaveLogin = false;
|
||||
|
||||
await Hive.box<HiveSavedLoginInfo>(hiveLoginInfoBox).put(
|
||||
savedLoginInfoKey,
|
||||
loginInfo,
|
||||
);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -156,7 +142,6 @@ class AuthenticationNotifier extends StateNotifier<AuthenticationState> {
|
|||
Future<bool> setSuccessLoginInfo({
|
||||
required String accessToken,
|
||||
required String serverUrl,
|
||||
required bool isSavedLoginInfo,
|
||||
}) async {
|
||||
_apiService.setAccessToken(accessToken);
|
||||
var userResponseDto = await _apiService.userApi.getMyUserInfo();
|
||||
|
|
@ -181,22 +166,16 @@ class AuthenticationNotifier extends StateNotifier<AuthenticationState> {
|
|||
deviceType: deviceInfo["deviceType"],
|
||||
);
|
||||
|
||||
if (isSavedLoginInfo) {
|
||||
// Save login info to local storage
|
||||
Hive.box<HiveSavedLoginInfo>(hiveLoginInfoBox).put(
|
||||
savedLoginInfoKey,
|
||||
HiveSavedLoginInfo(
|
||||
email: "",
|
||||
password: "",
|
||||
isSaveLogin: true,
|
||||
serverUrl: serverUrl,
|
||||
accessToken: accessToken,
|
||||
),
|
||||
);
|
||||
} else {
|
||||
Hive.box<HiveSavedLoginInfo>(hiveLoginInfoBox)
|
||||
.delete(savedLoginInfoKey);
|
||||
}
|
||||
// Save login info to local storage
|
||||
Hive.box<HiveSavedLoginInfo>(hiveLoginInfoBox).put(
|
||||
savedLoginInfoKey,
|
||||
HiveSavedLoginInfo(
|
||||
email: "",
|
||||
password: "",
|
||||
serverUrl: serverUrl,
|
||||
accessToken: accessToken,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
// Register device info
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue