From 3316ad9169ed2b29a2755405589213f824aec9d1 Mon Sep 17 00:00:00 2001 From: Rainer Killinger Date: Fri, 30 Sep 2022 08:25:00 +0000 Subject: [PATCH] fix: background fetch crashing android app --- android/app/proguard-rules.pro | 3 +- ios/App/App/Info.plist | 6 +- ios/App/Podfile | 1 + package-lock.json | 102 +++++++++--------- src/app/app.component.ts | 1 + .../about/about-page/about-page.component.ts | 4 +- .../modules/about/about-page/about-page.html | 2 +- .../schedule/schedule-sync.service.ts | 3 +- src/app/modules/calendar/calendar.service.ts | 21 ++-- .../settings/page/calendar-sync-settings.html | 7 ++ 10 files changed, 83 insertions(+), 67 deletions(-) diff --git a/android/app/proguard-rules.pro b/android/app/proguard-rules.pro index 4ccff43f..0b773970 100644 --- a/android/app/proguard-rules.pro +++ b/android/app/proguard-rules.pro @@ -20,5 +20,6 @@ # hide the original source file name. #-renamesourcefileattribute SourceFile +# Class for seperated android headless background task # [capacitor-background-fetch] --keep class **BackgroundFetchHeadlessTask { *; } +#-keep class **BackgroundFetchHeadlessTask { *; } diff --git a/ios/App/App/Info.plist b/ios/App/App/Info.plist index 39d92a38..a2313763 100644 --- a/ios/App/App/Info.plist +++ b/ios/App/App/Info.plist @@ -61,15 +61,13 @@ UISupportedInterfaceOrientations UIInterfaceOrientationPortrait - UIInterfaceOrientationLandscapeLeft - UIInterfaceOrientationLandscapeRight UISupportedInterfaceOrientations~ipad - UIInterfaceOrientationPortrait - UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight + UIInterfaceOrientationPortrait + UIInterfaceOrientationPortraitUpsideDown UIViewControllerBasedStatusBarAppearance diff --git a/ios/App/Podfile b/ios/App/Podfile index 9169fe4f..0447ff27 100644 --- a/ios/App/Podfile +++ b/ios/App/Podfile @@ -26,6 +26,7 @@ def capacitor_pods pod 'CapacitorShare', :path => '../../node_modules/@capacitor/share' pod 'CapacitorSplashScreen', :path => '../../node_modules/@capacitor/splash-screen' pod 'CapacitorStatusBar', :path => '../../node_modules/@capacitor/status-bar' + pod 'HugotomaziCapacitorNavigationBar', :path => '../../node_modules/@hugotomazi/capacitor-navigation-bar' pod 'TransistorsoftCapacitorBackgroundFetch', :path => '../../node_modules/@transistorsoft/capacitor-background-fetch' pod 'CapacitorSecureStoragePlugin', :path => '../../node_modules/capacitor-secure-storage-plugin' pod 'CordovaPlugins', :path => '../capacitor-cordova-ios-plugins' diff --git a/package-lock.json b/package-lock.json index ea706632..671d16fb 100644 --- a/package-lock.json +++ b/package-lock.json @@ -562,21 +562,21 @@ }, "dependencies": { "@babel/core": { - "version": "7.19.1", - "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.19.1.tgz", - "integrity": "sha512-1H8VgqXme4UXCRv7/Wa1bq7RVymKOzC7znjyFM8KiEzwFqcKUKYNoQef4GhdklgNvoBXyW4gYhuBNCM5o1zImw==", + "version": "7.19.3", + "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.19.3.tgz", + "integrity": "sha512-WneDJxdsjEvyKtXKsaBGbDeiyOjR5vYq4HcShxnIbG0qixpoHjI3MqeZM9NDvsojNCEBItQE4juOo/bU6e72gQ==", "dev": true, "requires": { "@ampproject/remapping": "^2.1.0", "@babel/code-frame": "^7.18.6", - "@babel/generator": "^7.19.0", - "@babel/helper-compilation-targets": "^7.19.1", + "@babel/generator": "^7.19.3", + "@babel/helper-compilation-targets": "^7.19.3", "@babel/helper-module-transforms": "^7.19.0", "@babel/helpers": "^7.19.0", - "@babel/parser": "^7.19.1", + "@babel/parser": "^7.19.3", "@babel/template": "^7.18.10", - "@babel/traverse": "^7.19.1", - "@babel/types": "^7.19.0", + "@babel/traverse": "^7.19.3", + "@babel/types": "^7.19.3", "convert-source-map": "^1.7.0", "debug": "^4.1.0", "gensync": "^1.0.0-beta.2", @@ -593,12 +593,12 @@ } }, "@babel/generator": { - "version": "7.19.0", - "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.19.0.tgz", - "integrity": "sha512-S1ahxf1gZ2dpoiFgA+ohK9DIpz50bJ0CWs7Zlzb54Z4sG8qmdIrGrVqmy1sAtTVRb+9CU6U8VqT9L0Zj7hxHVg==", + "version": "7.19.3", + "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.19.3.tgz", + "integrity": "sha512-fqVZnmp1ncvZU757UzDheKZpfPgatqY59XtW2/j/18H7u76akb8xqvjw82f+i2UKd/ksYsSick/BCLQUUtJ/qQ==", "dev": true, "requires": { - "@babel/types": "^7.19.0", + "@babel/types": "^7.19.3", "@jridgewell/gen-mapping": "^0.3.2", "jsesc": "^2.5.1" } @@ -729,9 +729,9 @@ } }, "@babel/compat-data": { - "version": "7.19.1", - "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.19.1.tgz", - "integrity": "sha512-72a9ghR0gnESIa7jBN53U32FOVCEoztyIlKaNoU05zRhEecduGK9L9c3ww7Mp06JiR+0ls0GBPFJQwwtjn9ksg==", + "version": "7.19.3", + "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.19.3.tgz", + "integrity": "sha512-prBHMK4JYYK+wDjJF1q99KK4JLL+egWS4nmNqdlMUgCExMZ+iZW0hGhyC3VEbsPjvaN0TBhW//VIFwBrk8sEiw==", "dev": true }, "@babel/core": { @@ -810,12 +810,12 @@ } }, "@babel/helper-compilation-targets": { - "version": "7.19.1", - "resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.19.1.tgz", - "integrity": "sha512-LlLkkqhCMyz2lkQPvJNdIYU7O5YjWRgC2R4omjCTpZd8u8KMQzZvX4qce+/BluN1rcQiV7BoGUpmQ0LeHerbhg==", + "version": "7.19.3", + "resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.19.3.tgz", + "integrity": "sha512-65ESqLGyGmLvgR0mst5AdW1FkNlj9rQsCKduzEoEPhBCDFGXvz2jW6bXFG6i0/MrV2s7hhXjjb2yAzcPuQlLwg==", "dev": true, "requires": { - "@babel/compat-data": "^7.19.1", + "@babel/compat-data": "^7.19.3", "@babel/helper-validator-option": "^7.18.6", "browserslist": "^4.21.3", "semver": "^6.3.0" @@ -1193,9 +1193,9 @@ } }, "@babel/parser": { - "version": "7.19.1", - "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.19.1.tgz", - "integrity": "sha512-h7RCSorm1DdTVGJf3P2Mhj3kdnkmF/EiysUkzS2TdgAYqyjFdMQJbVuXOBej2SBJaXan/lIVtT6KkGbyyq753A==", + "version": "7.19.3", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.19.3.tgz", + "integrity": "sha512-pJ9xOlNWHiy9+FuFP09DEAFbAn4JskgRsVcc169w2xRBC3FRGuQEwjeIMMND9L2zc0iEhO/tGv4Zq+km+hxNpQ==", "dev": true }, "@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression": { @@ -2002,30 +2002,30 @@ } }, "@babel/traverse": { - "version": "7.19.1", - "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.19.1.tgz", - "integrity": "sha512-0j/ZfZMxKukDaag2PtOPDbwuELqIar6lLskVPPJDjXMXjfLb1Obo/1yjxIGqqAJrmfaTIY3z2wFLAQ7qSkLsuA==", + "version": "7.19.3", + "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.19.3.tgz", + "integrity": "sha512-qh5yf6149zhq2sgIXmwjnsvmnNQC2iw70UFjp4olxucKrWd/dvlUsBI88VSLUsnMNF7/vnOiA+nk1+yLoCqROQ==", "dev": true, "requires": { "@babel/code-frame": "^7.18.6", - "@babel/generator": "^7.19.0", + "@babel/generator": "^7.19.3", "@babel/helper-environment-visitor": "^7.18.9", "@babel/helper-function-name": "^7.19.0", "@babel/helper-hoist-variables": "^7.18.6", "@babel/helper-split-export-declaration": "^7.18.6", - "@babel/parser": "^7.19.1", - "@babel/types": "^7.19.0", + "@babel/parser": "^7.19.3", + "@babel/types": "^7.19.3", "debug": "^4.1.0", "globals": "^11.1.0" }, "dependencies": { "@babel/generator": { - "version": "7.19.0", - "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.19.0.tgz", - "integrity": "sha512-S1ahxf1gZ2dpoiFgA+ohK9DIpz50bJ0CWs7Zlzb54Z4sG8qmdIrGrVqmy1sAtTVRb+9CU6U8VqT9L0Zj7hxHVg==", + "version": "7.19.3", + "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.19.3.tgz", + "integrity": "sha512-fqVZnmp1ncvZU757UzDheKZpfPgatqY59XtW2/j/18H7u76akb8xqvjw82f+i2UKd/ksYsSick/BCLQUUtJ/qQ==", "dev": true, "requires": { - "@babel/types": "^7.19.0", + "@babel/types": "^7.19.3", "@jridgewell/gen-mapping": "^0.3.2", "jsesc": "^2.5.1" } @@ -2050,13 +2050,13 @@ } }, "@babel/types": { - "version": "7.19.0", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.19.0.tgz", - "integrity": "sha512-YuGopBq3ke25BVSiS6fgF49Ul9gH1x70Bcr6bqRLjWCkcX8Hre1/5+z+IiWOIerRMSSEfGZVB9z9kyq7wVs9YA==", + "version": "7.19.3", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.19.3.tgz", + "integrity": "sha512-hGCaQzIY22DJlDh9CH7NOxgKkFjBk0Cw9xDO1Xmh2151ti7wiGfQ3LauXzL4HP1fmFlTX6XjpRETTpUcv7wQLw==", "dev": true, "requires": { "@babel/helper-string-parser": "^7.18.10", - "@babel/helper-validator-identifier": "^7.18.6", + "@babel/helper-validator-identifier": "^7.19.1", "to-fast-properties": "^2.0.0" } }, @@ -2267,21 +2267,21 @@ }, "dependencies": { "@babel/core": { - "version": "7.19.1", - "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.19.1.tgz", - "integrity": "sha512-1H8VgqXme4UXCRv7/Wa1bq7RVymKOzC7znjyFM8KiEzwFqcKUKYNoQef4GhdklgNvoBXyW4gYhuBNCM5o1zImw==", + "version": "7.19.3", + "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.19.3.tgz", + "integrity": "sha512-WneDJxdsjEvyKtXKsaBGbDeiyOjR5vYq4HcShxnIbG0qixpoHjI3MqeZM9NDvsojNCEBItQE4juOo/bU6e72gQ==", "dev": true, "requires": { "@ampproject/remapping": "^2.1.0", "@babel/code-frame": "^7.18.6", - "@babel/generator": "^7.19.0", - "@babel/helper-compilation-targets": "^7.19.1", + "@babel/generator": "^7.19.3", + "@babel/helper-compilation-targets": "^7.19.3", "@babel/helper-module-transforms": "^7.19.0", "@babel/helpers": "^7.19.0", - "@babel/parser": "^7.19.1", + "@babel/parser": "^7.19.3", "@babel/template": "^7.18.10", - "@babel/traverse": "^7.19.1", - "@babel/types": "^7.19.0", + "@babel/traverse": "^7.19.3", + "@babel/types": "^7.19.3", "convert-source-map": "^1.7.0", "debug": "^4.1.0", "gensync": "^1.0.0-beta.2", @@ -2298,12 +2298,12 @@ } }, "@babel/generator": { - "version": "7.19.0", - "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.19.0.tgz", - "integrity": "sha512-S1ahxf1gZ2dpoiFgA+ohK9DIpz50bJ0CWs7Zlzb54Z4sG8qmdIrGrVqmy1sAtTVRb+9CU6U8VqT9L0Zj7hxHVg==", + "version": "7.19.3", + "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.19.3.tgz", + "integrity": "sha512-fqVZnmp1ncvZU757UzDheKZpfPgatqY59XtW2/j/18H7u76akb8xqvjw82f+i2UKd/ksYsSick/BCLQUUtJ/qQ==", "dev": true, "requires": { - "@babel/types": "^7.19.0", + "@babel/types": "^7.19.3", "@jridgewell/gen-mapping": "^0.3.2", "jsesc": "^2.5.1" } @@ -8041,9 +8041,9 @@ } }, "electron-to-chromium": { - "version": "1.4.264", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.264.tgz", - "integrity": "sha512-AZ6ZRkucHOQT8wke50MktxtmcWZr67kE17X/nAXFf62NIdMdgY6xfsaJD5Szoy84lnkuPWH+4tTNE3s2+bPCiw==", + "version": "1.4.265", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.265.tgz", + "integrity": "sha512-38KaYBNs0oCzWCpr6j7fY/W9vF0vSp4tKFIshQTgdZMhUpkxgotkQgjJP6iGMdmlsgMs3i0/Hkko4UXLTrkYVQ==", "dev": true }, "elementtree": { diff --git a/src/app/app.component.ts b/src/app/app.component.ts index 08f61fdd..7a00c1ec 100644 --- a/src/app/app.component.ts +++ b/src/app/app.component.ts @@ -104,6 +104,7 @@ export class AppComponent implements AfterContentInit { color: getComputedStyle(document.documentElement) .getPropertyValue('--ion-background-color') .trim(), + darkButtons: true, }); } await this.authNotificationsInit(); diff --git a/src/app/modules/about/about-page/about-page.component.ts b/src/app/modules/about/about-page/about-page.component.ts index 4f7003b4..2e0675c7 100644 --- a/src/app/modules/about/about-page/about-page.component.ts +++ b/src/app/modules/about/about-page/about-page.component.ts @@ -28,6 +28,8 @@ export class AboutPageComponent implements OnInit { version = packageJson.version; + appName: string; + constructor( private readonly route: ActivatedRoute, private readonly configProvider: ConfigProvider, @@ -35,7 +37,7 @@ export class AboutPageComponent implements OnInit { async ngOnInit() { const route = this.route.snapshot.url.map(it => it.path).join('/'); - + this.appName = (this.configProvider.getValue('name') as string) ?? 'StApps'; this.content = ( this.configProvider.getValue( diff --git a/src/app/modules/about/about-page/about-page.html b/src/app/modules/about/about-page/about-page.html index e1007119..456b1f24 100644 --- a/src/app/modules/about/about-page/about-page.html +++ b/src/app/modules/about/about-page/about-page.html @@ -29,7 +29,7 @@ -
StApps v{{ version }}
+
{{ appName }} v{{ version }}
{ await Promise.all([ diff --git a/src/app/modules/calendar/calendar.service.ts b/src/app/modules/calendar/calendar.service.ts index 5c76c764..05cf713c 100644 --- a/src/app/modules/calendar/calendar.service.ts +++ b/src/app/modules/calendar/calendar.service.ts @@ -20,8 +20,7 @@ import moment, {duration, Moment, unitOfTime} from 'moment'; import {Dialog} from '@capacitor/dialog'; import {CalendarInfo} from './calendar-info'; import {Subject} from 'rxjs'; - -const CALENDAR_NAME = 'StApps'; +import {ConfigProvider} from '../config/config.provider'; const RECURRENCE_PATTERNS: Partial< Record @@ -38,15 +37,23 @@ export class CalendarService { goToDateClicked = this.goToDate.asObservable(); + calendarName = 'StApps'; + // eslint-disable-next-line @typescript-eslint/no-empty-function - constructor(readonly calendar: Calendar) {} + constructor( + readonly calendar: Calendar, + private readonly configProvider: ConfigProvider, + ) { + this.calendarName = + (this.configProvider.getValue('name') as string) ?? 'StApps'; + } async createCalendar(): Promise { await this.calendar.createCalendar({ - calendarName: CALENDAR_NAME, + calendarName: this.calendarName, calendarColor: '#ff8740', }); - return this.findCalendar(CALENDAR_NAME); + return this.findCalendar(this.calendarName); } async listCalendars(): Promise { @@ -60,8 +67,8 @@ export class CalendarService { } async purge(): Promise { - if (await this.findCalendar(CALENDAR_NAME)) { - await this.calendar.deleteCalendar(CALENDAR_NAME); + if (await this.findCalendar(this.calendarName)) { + await this.calendar.deleteCalendar(this.calendarName); } return await this.createCalendar(); } diff --git a/src/app/modules/settings/page/calendar-sync-settings.html b/src/app/modules/settings/page/calendar-sync-settings.html index ecf4fab7..2346dd19 100644 --- a/src/app/modules/settings/page/calendar-sync-settings.html +++ b/src/app/modules/settings/page/calendar-sync-settings.html @@ -44,6 +44,12 @@ 'settings.calendar.sync.syncWithCalendar' | translate }} +