refactor: application dependency management (#2363)
This commit is contained in:
@@ -88,7 +88,7 @@ const DataBackups = ({ application, viewControllerManager }: Props) => {
|
||||
|
||||
const readFile = async (file: File): Promise<any> => {
|
||||
if (file.type === 'application/zip') {
|
||||
application.alertService.alert(STRING_IMPORTING_ZIP_FILE).catch(console.error)
|
||||
application.alerts.alert(STRING_IMPORTING_ZIP_FILE).catch(console.error)
|
||||
return
|
||||
}
|
||||
|
||||
@@ -99,7 +99,7 @@ const DataBackups = ({ application, viewControllerManager }: Props) => {
|
||||
const data = JSON.parse(e.target?.result as string)
|
||||
resolve(data)
|
||||
} catch (e) {
|
||||
application.alertService.alert(STRING_INVALID_IMPORT_FILE).catch(console.error)
|
||||
application.alerts.alert(STRING_INVALID_IMPORT_FILE).catch(console.error)
|
||||
}
|
||||
}
|
||||
reader.readAsText(file)
|
||||
@@ -146,7 +146,7 @@ const DataBackups = ({ application, viewControllerManager }: Props) => {
|
||||
return
|
||||
}
|
||||
|
||||
if (application.encryptionService.supportedVersions().includes(version)) {
|
||||
if (application.encryption.supportedVersions().includes(version)) {
|
||||
await performImport(data)
|
||||
} else {
|
||||
setIsImportDataLoading(false)
|
||||
|
||||
@@ -72,7 +72,7 @@ const EmailBackups = ({ application }: Props) => {
|
||||
await application.settings.updateSetting(settingName, payload, false)
|
||||
return true
|
||||
} catch (e) {
|
||||
application.alertService.alert(STRING_FAILED_TO_UPDATE_USER_SETTING).catch(console.error)
|
||||
application.alerts.alert(STRING_FAILED_TO_UPDATE_USER_SETTING).catch(console.error)
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,14 +50,14 @@ const BackupsDropZone: FunctionComponent<Props> = ({ application }) => {
|
||||
const result = await application.files.readBackupFileAndSaveDecrypted(binaryFile, decryptedFileItem, fileSystem)
|
||||
|
||||
if (result === 'success') {
|
||||
void application.alertService.alert(
|
||||
void application.alerts.alert(
|
||||
`<strong>${decryptedFileItem.name}</strong> has been successfully decrypted and saved to your chosen directory.`,
|
||||
)
|
||||
setBinaryFile(undefined)
|
||||
setDecryptedFileItem(undefined)
|
||||
setDroppedFile(undefined)
|
||||
} else if (result === 'failed') {
|
||||
void application.alertService.alert(
|
||||
void application.alerts.alert(
|
||||
'Unable to save file to local directory. This may be caused by failure to decrypt, or failure to save the file locally.',
|
||||
)
|
||||
}
|
||||
@@ -74,7 +74,7 @@ const BackupsDropZone: FunctionComponent<Props> = ({ application }) => {
|
||||
}
|
||||
|
||||
if (type === 'binary') {
|
||||
void application.alertService.alert('Please drag the metadata file instead of the encrypted data file.')
|
||||
void application.alerts.alert('Please drag the metadata file instead of the encrypted data file.')
|
||||
return
|
||||
}
|
||||
|
||||
@@ -85,7 +85,7 @@ const BackupsDropZone: FunctionComponent<Props> = ({ application }) => {
|
||||
console.error(error)
|
||||
}
|
||||
},
|
||||
[application.alertService, application.files],
|
||||
[application.alerts, application.files],
|
||||
)
|
||||
|
||||
const handleDragOver = useCallback((event: DragEvent) => {
|
||||
|
||||
Reference in New Issue
Block a user