1
0
mirror of https://github.com/tooot-app/app synced 2025-06-05 22:19:13 +02:00
Turns out to be much more complicated than expected. Finally got the app running through Browser Stack (thanks for their sponsoring!), realised the issue was related to an early attempt to create a build for F-Droid #50 which removed the Google Service. However for Android push, Google service is still required.
This commit is contained in:
xmflsct
2023-01-09 00:55:29 +01:00
parent cfa637b23d
commit 215534d0c8
9 changed files with 188 additions and 35 deletions

View File

@ -46,14 +46,21 @@ export const PUSH_ADMIN = () =>
export const setChannels = async (reset: boolean | undefined = false, specificAccount?: string) => {
const account = specificAccount || getGlobalStorage.string('account.active')
const accountDetails = getAccountDetails(['version', 'push'])
const accountDetails = getAccountDetails([
'version',
'push',
'auth.account.acct',
'auth.account.domain'
])
if (!account || !accountDetails) return null
const readableAccount = `@${accountDetails['auth.account.acct']}@${accountDetails['auth.account.domain']}`
const deleteChannel = async (type: string) =>
Notifications.deleteNotificationChannelAsync(`${account}_${type}`)
Notifications.deleteNotificationChannelAsync(`${readableAccount}_${type}`)
const setChannel = async (type: string) =>
Notifications.setNotificationChannelAsync(`${account}_${type}`, {
groupId: account,
Notifications.setNotificationChannelAsync(`${readableAccount}_${type}`, {
groupId: readableAccount,
name: i18n.t(`screenTabs:me.push.${type}.heading` as any),
importance: Notifications.AndroidImportance.DEFAULT,
bypassDnd: false,
@ -62,12 +69,12 @@ export const setChannels = async (reset: boolean | undefined = false, specificAc
enableVibrate: true
})
const channelGroup = await Notifications.getNotificationChannelGroupAsync(account)
const channelGroup = await Notifications.getNotificationChannelGroupAsync(readableAccount)
if (channelGroup && !reset) {
return
}
if (!channelGroup) {
await Notifications.setNotificationChannelGroupAsync(account, { name: account })
await Notifications.setNotificationChannelGroupAsync(readableAccount, { name: readableAccount })
}
if (!accountDetails.push.decode) {