refactor: application dependency management (#2363)

This commit is contained in:
Mo
2023-07-23 15:54:31 -05:00
committed by GitHub
parent e698b1c990
commit a77535456c
299 changed files with 7415 additions and 4890 deletions

View File

@@ -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)

View File

@@ -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
}
}

View File

@@ -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) => {