Skip to content

Commit

Permalink
Merge branch 'main' into ALTME
Browse files Browse the repository at this point in the history
  • Loading branch information
hawkbee1 committed Dec 12, 2024
2 parents 60f4489 + 9a7e59c commit 4df9f61
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 38 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,38 +39,23 @@ class RestoreCredentialCubit extends Cubit<RestoreCredentialState> {
emit(state.copyWith(backupFilePath: filePath));
}

Future<void> recoverWallet({
required bool isFromOnBoarding,
}) async {
Future<void> recoverWallet() async {
if (state.backupFilePath == null) return;
await Future<void>.delayed(const Duration(milliseconds: 500));
emit(state.loading());

late String stringForBackup;

if (Parameters.importAndRestoreAtOnboarding) {
final String? recoveryMnemonic = await secureStorageProvider
.get(SecureStorageKeys.recoverCredentialMnemonics);
final String? ssiMnemonic =
await secureStorageProvider.get(SecureStorageKeys.ssiMnemonic);

if (recoveryMnemonic == null) {
throw ResponseMessage(
message: ResponseString
.RESPONSE_STRING_SOMETHING_WENT_WRONG_TRY_AGAIN_LATER,
);
}
stringForBackup = recoveryMnemonic;
} else {
final String? ssiMnemonic =
await secureStorageProvider.get(SecureStorageKeys.ssiMnemonic);

if (ssiMnemonic == null) {
throw ResponseMessage(
message: ResponseString
.RESPONSE_STRING_SOMETHING_WENT_WRONG_TRY_AGAIN_LATER,
);
}
stringForBackup = ssiMnemonic;
if (ssiMnemonic == null) {
throw ResponseMessage(
message:
ResponseString.RESPONSE_STRING_SOMETHING_WENT_WRONG_TRY_AGAIN_LATER,
);
}
stringForBackup = ssiMnemonic;

try {
final file = File(state.backupFilePath!);
Expand Down Expand Up @@ -190,16 +175,12 @@ class RestoreCredentialCubit extends Cubit<RestoreCredentialState> {

await activityLogManager.saveLog(LogData(type: LogType.restoreWallet));

if (isFromOnBoarding) {
emit(
state.copyWith(
status: AppStatus.restoreWallet,
recoveredCredentialLength: credentialList.length,
),
);
} else {
emit(state.success(recoveredCredentialLength: credentialList.length));
}
emit(
state.copyWith(
status: AppStatus.restoreWallet,
recoveredCredentialLength: credentialList.length,
),
);
} catch (e) {
if (e is MessageHandler) {
emit(state.error(messageHandler: e));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,9 +179,7 @@ class _RestoreCredentialViewState extends State<RestoreCredentialView> {
? null
: () => context
.read<RestoreCredentialCubit>()
.recoverWallet(
isFromOnBoarding: widget.fromOnBoarding,
),
.recoverWallet(),
text: l10n.loadFile,
);
},
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: altme
description: AltMe Flutter App

version: 2.18.8+5581
version: 2.18.10+5583

publish_to: "none" # Remove this line if you wish to publish to pub.dev
environment:
Expand Down

0 comments on commit 4df9f61

Please sign in to comment.