chore: fix android
This commit is contained in:
@@ -80,13 +80,13 @@ export class ReceivedSharedItemsHandler {
|
|||||||
Linking.getInitialURL()
|
Linking.getInitialURL()
|
||||||
.then((url) => {
|
.then((url) => {
|
||||||
if (url && url.startsWith(IosUrlToCheckFor)) {
|
if (url && url.startsWith(IosUrlToCheckFor)) {
|
||||||
this.addSharedItemsToQueue(url)
|
this.addSharedItemsToQueue(url).catch(console.error)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch(console.error)
|
.catch(console.error)
|
||||||
this.eventSub = Linking.addEventListener('url', ({ url }) => {
|
this.eventSub = Linking.addEventListener('url', ({ url }) => {
|
||||||
if (url && url.startsWith(IosUrlToCheckFor)) {
|
if (url && url.startsWith(IosUrlToCheckFor)) {
|
||||||
this.addSharedItemsToQueue(url)
|
this.addSharedItemsToQueue(url).catch(console.error)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
return
|
return
|
||||||
@@ -94,7 +94,7 @@ export class ReceivedSharedItemsHandler {
|
|||||||
|
|
||||||
this.eventSub = AppState.addEventListener('change', (state) => {
|
this.eventSub = AppState.addEventListener('change', (state) => {
|
||||||
if (state === 'active') {
|
if (state === 'active') {
|
||||||
this.addSharedItemsToQueue()
|
this.addSharedItemsToQueue().catch(console.error)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@@ -163,9 +163,11 @@ export class ReceivedSharedItemsHandler {
|
|||||||
this.handleItemsQueue().catch(console.error)
|
this.handleItemsQueue().catch(console.error)
|
||||||
}
|
}
|
||||||
|
|
||||||
private addSharedItemsToQueue = (url?: string) => {
|
private addSharedItemsToQueue = async (url?: string) => {
|
||||||
ReceiveSharingIntent.getFileNames(url)
|
const received =
|
||||||
.then(async (received: unknown) => {
|
Platform.OS === 'ios' ? await ReceiveSharingIntent.getFileNames(url) : await ReceiveSharingIntent.getFileNames()
|
||||||
|
ReceiveSharingIntent.clearFileNames()
|
||||||
|
|
||||||
if (!received) {
|
if (!received) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -203,8 +205,5 @@ export class ReceivedSharedItemsHandler {
|
|||||||
if (this.isApplicationLaunched) {
|
if (this.isApplicationLaunched) {
|
||||||
this.handleItemsQueue().catch(console.error)
|
this.handleItemsQueue().catch(console.error)
|
||||||
}
|
}
|
||||||
})
|
|
||||||
.then(() => ReceiveSharingIntent.clearFileNames())
|
|
||||||
.catch(console.error)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user