fix: Fixed issue on Android where only one selected file would be uploaded instead of all
This commit is contained in:
@@ -50,7 +50,7 @@ import { Database } from './Database/Database'
|
||||
import { isLegacyIdentifier } from './Database/LegacyIdentifier'
|
||||
import { LegacyKeyValueStore } from './Database/LegacyKeyValueStore'
|
||||
import Keychain from './Keychain'
|
||||
import notifee, { AuthorizationStatus, Notification } from '@notifee/react-native'
|
||||
import notifee, { AuthorizationStatus, Notification, NotificationSettings } from '@notifee/react-native'
|
||||
|
||||
export type BiometricsType = 'Fingerprint' | 'Face ID' | 'Biometrics' | 'Touch ID'
|
||||
|
||||
@@ -72,6 +72,8 @@ export class MobileDevice implements MobileDeviceInterface {
|
||||
private keyValueStore = new LegacyKeyValueStore()
|
||||
private databases = new Map<string, Database>()
|
||||
|
||||
private notificationSettings: NotificationSettings | undefined
|
||||
|
||||
constructor(
|
||||
private stateObserverService?: AppStateObserverService,
|
||||
private androidBackHandlerService?: AndroidBackHandlerService,
|
||||
@@ -89,12 +91,23 @@ export class MobileDevice implements MobileDeviceInterface {
|
||||
id: 'files',
|
||||
name: 'File Upload/Download',
|
||||
})
|
||||
|
||||
const didAskForPermission = await this.keyValueStore.getValue<boolean>('didAskForNotificationPermission')
|
||||
|
||||
if (!didAskForPermission) {
|
||||
this.notificationSettings = await notifee.requestPermission()
|
||||
await this.keyValueStore.set('didAskForNotificationPermission', 'true')
|
||||
}
|
||||
|
||||
this.notificationSettings = await notifee.getNotificationSettings()
|
||||
}
|
||||
|
||||
async canDisplayNotifications(): Promise<boolean> {
|
||||
const settings = await notifee.requestPermission()
|
||||
if (!this.notificationSettings) {
|
||||
return false
|
||||
}
|
||||
|
||||
return settings.authorizationStatus >= AuthorizationStatus.AUTHORIZED
|
||||
return this.notificationSettings.authorizationStatus >= AuthorizationStatus.AUTHORIZED
|
||||
}
|
||||
|
||||
async displayNotification(options: Notification): Promise<string> {
|
||||
|
||||
Reference in New Issue
Block a user