Skip to content

Commit 9389bb0

Browse files
fix: migrate log for software profiles (#72)
Co-authored-by: Begoña Álvarez de la Cruz <[email protected]>
1 parent 1d5c685 commit 9389bb0

File tree

4 files changed

+4
-45
lines changed

4 files changed

+4
-45
lines changed

packages/desktop/electron/electronApi.js

Lines changed: 1 addition & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -118,45 +118,12 @@ const ElectronApi = {
118118
*
119119
* @method exportMigrationLog
120120
*
121-
* @param {string} sourcePath
122-
* @param {string} defaultFileName
123-
*
124-
* @returns {Promise<boolean>}
125-
*/
126-
exportMigrationLog: (sourcePath, defaultFileName) =>
127-
ipcRenderer
128-
.invoke('show-save-dialog', {
129-
properties: ['createDirectory', 'showOverwriteConfirmation'],
130-
defaultPath: defaultFileName,
131-
filters: [{ name: 'Log Files', extensions: ['log'] }],
132-
})
133-
.then((result) => {
134-
if (result.canceled) {
135-
return null
136-
}
137-
138-
return new Promise((resolve, reject) => {
139-
fs.copyFile(sourcePath, result.filePath, (err) => {
140-
if (err) {
141-
reject(err)
142-
} else {
143-
resolve(true)
144-
}
145-
})
146-
})
147-
}),
148-
149-
/**
150-
* Exports ledger migration log
151-
*
152-
* @method exportLedgerMigrationLog
153-
*
154121
* @param {string} content
155122
* @param {string} defaultFileName
156123
*
157124
* @returns {Promise}
158125
*/
159-
exportLedgerMigrationLog: (content, defaultFileName) =>
126+
exportMigrationLog: (content, defaultFileName) =>
160127
ipcRenderer
161128
.invoke('show-save-dialog', {
162129
properties: ['createDirectory', 'showOverwriteConfirmation'],

packages/shared/lib/tests/mocks/platform.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,7 @@ const Platform: IPlatform = {
99
PincodeManager: undefined,
1010
ledger: undefined,
1111
close(): void {},
12-
exportLedgerMigrationLog(content: unknown, defaultFileName: string): Promise<boolean | null> {
13-
return Promise.resolve(undefined)
14-
},
15-
exportMigrationLog(sourcePath: string, defaultFileName: string): Promise<boolean | null> {
12+
exportMigrationLog(content: unknown, defaultFileName: string): Promise<boolean | null> {
1613
return Promise.resolve(undefined)
1714
},
1815
exportTransactionHistory(defaultPath: string, contents: string): Promise<string | null> {

packages/shared/lib/typings/platform.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,7 @@ export interface IPlatform {
1515
getStrongholdBackupDestination(defaultPath: string): Promise<string | null>
1616
saveStrongholdBackup({ allowAccess }: { allowAccess: boolean }): Promise<void>
1717
exportTransactionHistory(defaultPath: string, contents: string): Promise<string | null>
18-
exportMigrationLog(sourcePath: string, defaultFileName: string): Promise<boolean | null>
19-
exportLedgerMigrationLog(content: unknown, defaultFileName: string): Promise<boolean | null>
18+
exportMigrationLog(content: unknown, defaultFileName: string): Promise<boolean | null>
2019
getUserDataPath(): Promise<string>
2120
getDiagnostics(): Promise<{ label: string; value: string }[]>
2221
getOS(): Promise<string> | string

packages/shared/routes/setup/Congratulations.svelte

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,7 @@
5656
function exportMigrationLog(): void {
5757
exportMigrationLogBusy = true
5858
getProfileDataPath($activeProfile.id)
59-
.then((source) =>
60-
$walletSetupType === SetupType.TrinityLedger
61-
? Platform.exportLedgerMigrationLog($migrationLog, `${$activeProfile.id}-${LOG_FILE_NAME}`)
62-
: Platform.exportMigrationLog(`${source}/${LOG_FILE_NAME}`, `${$activeProfile.id}-${LOG_FILE_NAME}`)
63-
)
59+
.then(() => Platform.exportMigrationLog($migrationLog, `${$activeProfile.id}-${LOG_FILE_NAME}`))
6460
.catch((error) => {
6561
console.error(error)
6662
showAppNotification({

0 commit comments

Comments
 (0)