refactor(web): dependency management (#2386)

This commit is contained in:
Mo
2023-08-05 12:48:39 -05:00
committed by GitHub
parent b07da5b663
commit d8d4052a52
274 changed files with 4065 additions and 3873 deletions

View File

@@ -1,19 +1,15 @@
import { WebApplication } from '@/Application/WebApplication'
import { getBase64FromBlob } from '@/Utils'
import { parseFileName } from '@standardnotes/filepicker'
import { Platform } from '@standardnotes/snjs'
import { MobileDeviceInterface } from '@standardnotes/snjs'
import { addToast, ToastType, dismissToast } from '@standardnotes/toast'
import { sanitizeFileName } from '@standardnotes/ui-services'
export const downloadBlobOnAndroid = async (
application: WebApplication,
mobileDevice: MobileDeviceInterface,
blob: Blob,
filename: string,
showToast = true,
) => {
if (!application.isNativeMobileWeb() || application.platform !== Platform.Android) {
throw new Error('Download function being used on non-android platform')
}
let loadingToastId: string | undefined
if (showToast) {
loadingToastId = addToast({
@@ -25,7 +21,7 @@ export const downloadBlobOnAndroid = async (
const { name, ext } = parseFileName(filename)
const sanitizedName = sanitizeFileName(name)
filename = `${sanitizedName}.${ext}`
const downloaded = await application.mobileDevice().downloadBase64AsFile(base64, filename)
const downloaded = await mobileDevice.downloadBase64AsFile(base64, filename)
if (loadingToastId) {
dismissToast(loadingToastId)
}