diff --git a/.github/workflows/migration.yml b/.github/workflows/migration.yml index 32899b4a6..585b297c0 100644 --- a/.github/workflows/migration.yml +++ b/.github/workflows/migration.yml @@ -12,7 +12,7 @@ jobs: - name: Use Node.js uses: actions/setup-node@v1 with: - node-version: '12.x' + node-version: '14.x' - run: npm ci - run: result=$(find src -type f -iname '*.html' -exec sh -c 'cat {} | tr "\n" " " | grep -Eo "class=\"[^\"]+\"[^>]+class=\"" ' \; | wc -l); test $result -eq 0 - run: npm install -D @ionic/v4-migration-tslint diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index 4f326a88b..9e315c81a 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -12,7 +12,7 @@ jobs: - name: Use Node.js uses: actions/setup-node@v1 with: - node-version: '12' + node-version: '14' - name: Install npm packages run: | npm install -g npm@7 diff --git a/.nvmrc b/.nvmrc index 48082f72f..55d178216 100644 --- a/.nvmrc +++ b/.nvmrc @@ -1 +1 @@ -12 +v14.15.0 diff --git a/.travis.yml b/.travis.yml index 171b23db3..e53df5fb1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,6 @@ os: linux dist: trusty -node_js: 12 +node_js: 14 git: depth: 3 @@ -18,7 +18,7 @@ cache: - $HOME/.android/build-cache before_install: - - nvm install 12 + - nvm use - node --version - npm --version - nvm --version diff --git a/package.json b/package.json index 609746927..8331ec89d 100644 --- a/package.json +++ b/package.json @@ -173,7 +173,7 @@ "typescript": "^3.9.9" }, "engines": { - "node": ">=12.x" + "node": ">=14.15.0 <15" }, "cordova": { "platforms": [ diff --git a/src/core/classes/application-init-status.ts b/src/core/classes/application-init-status.ts index f98420f81..8cfe10e86 100644 --- a/src/core/classes/application-init-status.ts +++ b/src/core/classes/application-init-status.ts @@ -24,4 +24,9 @@ export class CoreApplicationInitStatus extends ApplicationInitStatus { super(injector.get(APP_INITIALIZER, [])); } + whenDone(callback: () => unknown): void { + // eslint-disable-next-line promise/catch-or-return, promise/no-callback-in-promise + this.donePromise.then(callback); + } + } diff --git a/src/core/services/filepool.ts b/src/core/services/filepool.ts index 275785a4a..042558991 100644 --- a/src/core/services/filepool.ts +++ b/src/core/services/filepool.ts @@ -102,17 +102,15 @@ export class CoreFilepoolProvider { /** * Initialize queue. */ - async initialize(): Promise { - // Waiting for the app to be ready to start processing the queue. - await ApplicationInit.donePromise; + initialize(): void { + // Start processing the queue once the app is ready. + ApplicationInit.whenDone(() => { + this.checkQueueProcessing(); - this.checkQueueProcessing(); - - // Start queue when device goes online. - Network.onConnect().subscribe(() => { - // Execute the callback in the Angular zone, so change detection doesn't stop working. - NgZone.run(() => { - this.checkQueueProcessing(); + // Start queue when device goes online. + Network.onConnect().subscribe(() => { + // Execute the callback in the Angular zone, so change detection doesn't stop working. + NgZone.run(() => this.checkQueueProcessing()); }); }); } diff --git a/src/core/services/lang.ts b/src/core/services/lang.ts index c14cd0054..b3eee335e 100644 --- a/src/core/services/lang.ts +++ b/src/core/services/lang.ts @@ -50,7 +50,7 @@ export class CoreLangProvider { document.documentElement.setAttribute('dir', dir); }); - await this.initializeCurrentLanguage(); + this.initializeCurrentLanguage(); } /** diff --git a/src/core/singletons/index.ts b/src/core/singletons/index.ts index deee2a2be..cb3a81e9a 100644 --- a/src/core/singletons/index.ts +++ b/src/core/singletons/index.ts @@ -57,6 +57,8 @@ import { Zip as ZipService } from '@ionic-native/zip/ngx'; import { TranslateService } from '@ngx-translate/core'; +import { CoreApplicationInitStatus } from '@classes/application-init-status'; + /** * Injector instance used to resolve singletons. */ @@ -198,7 +200,7 @@ export const ModalController = makeSingleton(ModalControllerService); export const PopoverController = makeSingleton(PopoverControllerService); export const ToastController = makeSingleton(ToastControllerService); export const GestureController = makeSingleton(GestureControllerService); -export const ApplicationInit = makeSingleton(ApplicationInitStatus); +export const ApplicationInit = makeSingleton(ApplicationInitStatus); export const Application = makeSingleton(ApplicationRef); export const NavController = makeSingleton(NavControllerService); export const Router = makeSingleton(RouterService); diff --git a/src/core/singletons/subscriptions.ts b/src/core/singletons/subscriptions.ts index 0c66c939f..3ea609a32 100644 --- a/src/core/singletons/subscriptions.ts +++ b/src/core/singletons/subscriptions.ts @@ -44,7 +44,7 @@ export class CoreSubscriptions { // Unsubscribe using a timeout because we can receive a value immediately. setTimeout(() => subscription.unsubscribe(), 0); - onError?.call(error); + onError && onError(error); }, ); }