fix: Fixed issue on Android where only one selected file would be uploaded instead of all

This commit is contained in:
Aman Harwara
2023-11-12 00:00:28 +05:30
parent 7d9dabb818
commit e0d48afbe2

View File

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