-
Notifications
You must be signed in to change notification settings - Fork 102
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
hotfix: Migrate remaining chrysalis profiles (#7555)
* fix: error WIP * fix: Attempt * fix: Attempt 2 * fix: Fixes * fix: Fixes * fix: Fixes * fix: Fixes * fix: Fixes * fix: Fixes * fix: Fixes * fix: Fixes * fix: Fixes * fix: Fixes * fix: Fixes * fix: Fixes * fix: Fixes * clean up * fmt and lint * clean up * clean up * clean up * tweak * fix: corrupted profiles * fix: persistedProfileMigrationToV11 * feat: Fixed `no chrysalis data to migrate` (#7565) * fix: Fixed 'migration failed no chrysalis data to migrate' * update comment * tweak * feat: add missing onSuccess * fix: success condition --------- Co-authored-by: Begoña Alvarez <balvarez@boxfish.studio> * feat: rename old profile folder names from name to id * fix: add full profile path --------- Co-authored-by: cpl121 <cpeon@boxfish.studio> Co-authored-by: Begoña Alvarez <balvarez@boxfish.studio>
- Loading branch information
1 parent
194ee93
commit a150caf
Showing
10 changed files
with
112 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
packages/shared/lib/core/profile/actions/profiles/renameOldProfileFoldersToId.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { Platform } from '@core/app' | ||
import { profiles } from '@core/profile/stores' | ||
import { getStorageDirectoryOfProfile, getStorageDirectoryOfProfiles } from '@core/profile/utils' | ||
import { get } from 'svelte/store' | ||
|
||
export async function renameOldProfileFoldersToId(): Promise<void> { | ||
const walletPath = await getStorageDirectoryOfProfiles() | ||
const profileFolders = await Platform.listProfileFolders(walletPath) | ||
const oldProfiles = get(profiles).filter((profile) => | ||
profileFolders.find((p) => p === profile.name && profile.name !== profile.id) | ||
) | ||
if (oldProfiles.length > 0) { | ||
await Promise.all( | ||
oldProfiles.map(async (profile) => { | ||
await renameProfileFolder(profile.name, profile.id) | ||
}) | ||
) | ||
} | ||
} | ||
|
||
async function renameProfileFolder(oldName: string, newName: string): Promise<void> { | ||
const oldPath = await getStorageDirectoryOfProfile(oldName) | ||
const newPath = await getStorageDirectoryOfProfile(newName) | ||
await Platform.renameProfileFolder(oldPath, newPath) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
packages/shared/lib/core/profile/stores/current-profile-version.store.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
import { persistent } from '@core/utils/store' | ||
|
||
export const currentProfileVersion = persistent<number>('currentProfileVersion', -1) | ||
export const currentProfileVersion = persistent<number>('currentProfileVersion', 13) |