option to restore from backup during onboarding
This commit is contained in:
@@ -202,7 +202,7 @@ class UserBackupService extends _$UserBackupService {
|
||||
}
|
||||
}
|
||||
|
||||
Future<bool> restoreAndCreateNew(
|
||||
Future<Profile> restoreAndCreateNew(
|
||||
Uri backupFileUri, {
|
||||
required String profileName,
|
||||
required String password,
|
||||
@@ -222,17 +222,18 @@ class UserBackupService extends _$UserBackupService {
|
||||
outputDirectory: outputDirectory,
|
||||
argon2Params: Argon2Params.memoryConstrained(),
|
||||
);
|
||||
await backup.unpack(password).then((_) async {
|
||||
final newProfile = await backup.unpack(password).then((_) async {
|
||||
final newProfile = Profile.create(name: profileName);
|
||||
final newPath = filesystem.getProfileDir(newProfile.uuidValue);
|
||||
|
||||
await outputDirectory.rename(newPath.path);
|
||||
await filesystem.updateProfileMetadata(newProfile);
|
||||
await filesystem.healProfile(newPath);
|
||||
return newProfile;
|
||||
});
|
||||
|
||||
ref.invalidate(profileRepositoryProvider);
|
||||
return true;
|
||||
return newProfile;
|
||||
} finally {
|
||||
try {
|
||||
if (await tempFile.exists()) {
|
||||
|
||||
@@ -41,7 +41,7 @@ final class UserBackupServiceProvider
|
||||
}
|
||||
}
|
||||
|
||||
String _$userBackupServiceHash() => r'3746ae59d490e25a44815c125f30cd0981de555d';
|
||||
String _$userBackupServiceHash() => r'52c7d3df3ce2d603692a035c77987727b840a359';
|
||||
|
||||
abstract class _$UserBackupService extends $Notifier<void> {
|
||||
void build();
|
||||
|
||||
Reference in New Issue
Block a user