mirror of
https://gitlab.com/openstapps/openstapps.git
synced 2026-01-05 21:12:52 +00:00
feat: migrate app to AOT compilation
refactor: temporarily replace @ionic/storage-angular with custom file until upgrade to Angular 14+
This commit is contained in:
@@ -56,7 +56,6 @@
|
||||
"@angular/core": "13.3.11",
|
||||
"@angular/forms": "13.3.11",
|
||||
"@angular/platform-browser": "13.3.11",
|
||||
"@angular/platform-browser-dynamic": "13.3.11",
|
||||
"@angular/router": "13.3.11",
|
||||
"@asymmetrik/ngx-leaflet": "13.0.2",
|
||||
"@asymmetrik/ngx-leaflet-markercluster": "13.0.1",
|
||||
@@ -80,7 +79,7 @@
|
||||
"@hugotomazi/capacitor-navigation-bar": "2.0.0",
|
||||
"@ionic-native/core": "5.36.0",
|
||||
"@ionic/angular": "6.3.9",
|
||||
"@ionic/storage-angular": "3.0.6",
|
||||
"@ionic/storage": "4.0.0",
|
||||
"@ngx-translate/core": "14.0.0",
|
||||
"@ngx-translate/http-loader": "7.0.0",
|
||||
"@openid/appauth": "1.3.1",
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {NgModule} from '@angular/core';
|
||||
import {IonicStorageModule} from '@ionic/storage-angular';
|
||||
import {IonicStorageModule} from '../../util/ionic-storage.module';
|
||||
import {StorageProvider} from './storage.provider';
|
||||
|
||||
/**
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
*/
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
import {TestBed} from '@angular/core/testing';
|
||||
import {Storage} from '@ionic/storage-angular';
|
||||
import {Storage} from '@ionic/storage';
|
||||
import {StorageModule} from './storage.module';
|
||||
import {StorageProvider} from './storage.provider';
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {Injectable} from '@angular/core';
|
||||
import {Storage} from '@ionic/storage-angular';
|
||||
import {Storage} from '@ionic/storage';
|
||||
|
||||
/**
|
||||
* Provides interaction with the (ionic) storage on the device (in the browser)
|
||||
|
||||
105
frontend/app/src/app/util/ionic-storage.module.ts
Normal file
105
frontend/app/src/app/util/ionic-storage.module.ts
Normal file
@@ -0,0 +1,105 @@
|
||||
/* eslint-disable @typescript-eslint/no-empty-function,@typescript-eslint/no-unused-vars,unicorn/no-null,jsdoc/require-jsdoc,@typescript-eslint/no-explicit-any,@typescript-eslint/ban-types */
|
||||
/**
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2021 Drifty, co.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
// This is based on the Ionic Storage 4.0.0 implementation until we can
|
||||
// upgrade to Angular 14+ and use the new update.
|
||||
// https://github.com/ionic-team/ionic-storage/blob/main/angular/src/index.ts
|
||||
import {isPlatformServer} from '@angular/common';
|
||||
import type {ModuleWithProviders} from '@angular/core';
|
||||
import {InjectionToken, NgModule, PLATFORM_ID} from '@angular/core';
|
||||
import {Storage, StorageConfig} from '@ionic/storage';
|
||||
|
||||
const StorageConfigToken = new InjectionToken<any>('STORAGE_CONFIG_TOKEN');
|
||||
|
||||
export {StorageConfigToken};
|
||||
|
||||
class NoopStorage extends Storage {
|
||||
constructor() {
|
||||
super();
|
||||
}
|
||||
|
||||
async create() {
|
||||
return this;
|
||||
}
|
||||
|
||||
async defineDriver() {}
|
||||
|
||||
get driver(): string | null {
|
||||
return 'noop';
|
||||
}
|
||||
|
||||
// @ts-expect-error unused
|
||||
async get(key: string) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// @ts-expect-error unused
|
||||
async set(key: string, value: any) {}
|
||||
|
||||
// @ts-expect-error unused
|
||||
async remove(key: string): Promise<any> {}
|
||||
|
||||
async clear(): Promise<void> {}
|
||||
|
||||
async length(): Promise<number> {
|
||||
return 0;
|
||||
}
|
||||
|
||||
async keys() {
|
||||
return [];
|
||||
}
|
||||
|
||||
// @ts-expect-error unused
|
||||
async forEach(iteratorCallback: (value: any, key: string, iterationNumber: Number) => any): Promise<void> {}
|
||||
|
||||
// @ts-expect-error unused
|
||||
setEncryptionKey(key: string) {}
|
||||
}
|
||||
|
||||
export function provideStorage(platformId: any, storageConfig: StorageConfig): Storage {
|
||||
if (isPlatformServer(platformId)) {
|
||||
// When running in a server context return the NoopStorage
|
||||
return new NoopStorage();
|
||||
}
|
||||
|
||||
return new Storage(storageConfig);
|
||||
}
|
||||
|
||||
@NgModule()
|
||||
export class IonicStorageModule {
|
||||
// @ts-expect-error unused
|
||||
static forRoot(storageConfig: StorageConfig = null): ModuleWithProviders<IonicStorageModule> {
|
||||
return {
|
||||
ngModule: IonicStorageModule,
|
||||
providers: [
|
||||
{provide: StorageConfigToken, useValue: storageConfig},
|
||||
{
|
||||
provide: Storage,
|
||||
useFactory: provideStorage,
|
||||
deps: [PLATFORM_ID, StorageConfigToken],
|
||||
},
|
||||
],
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -13,7 +13,7 @@
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {enableProdMode} from '@angular/core';
|
||||
import {platformBrowserDynamic} from '@angular/platform-browser-dynamic';
|
||||
import {platformBrowser} from '@angular/platform-browser';
|
||||
import {AppModule} from './app/app.module';
|
||||
import {environment} from './environments/environment';
|
||||
|
||||
@@ -21,7 +21,7 @@ if (environment.production) {
|
||||
enableProdMode();
|
||||
}
|
||||
|
||||
platformBrowserDynamic()
|
||||
platformBrowser()
|
||||
.bootstrapModule(AppModule)
|
||||
// eslint-disable-next-line unicorn/prefer-top-level-await
|
||||
.catch(async error => console.error(error));
|
||||
|
||||
45
pnpm-lock.yaml
generated
45
pnpm-lock.yaml
generated
@@ -735,9 +735,6 @@ importers:
|
||||
'@angular/platform-browser':
|
||||
specifier: 13.3.11
|
||||
version: 13.3.11(@angular/animations@13.3.11)(@angular/common@13.3.11)(@angular/core@13.3.11)
|
||||
'@angular/platform-browser-dynamic':
|
||||
specifier: 13.3.11
|
||||
version: 13.3.11(@angular/common@13.3.11)(@angular/compiler@13.3.11)(@angular/core@13.3.11)(@angular/platform-browser@13.3.11)
|
||||
'@angular/router':
|
||||
specifier: 13.3.11
|
||||
version: 13.3.11(@angular/common@13.3.11)(@angular/core@13.3.11)(@angular/platform-browser@13.3.11)(rxjs@7.8.0)
|
||||
@@ -807,9 +804,9 @@ importers:
|
||||
'@ionic/angular':
|
||||
specifier: 6.3.9
|
||||
version: 6.3.9(@angular/core@13.3.11)(@angular/forms@13.3.11)(@angular/router@13.3.11)(rxjs@7.8.0)(zone.js@0.12.0)
|
||||
'@ionic/storage-angular':
|
||||
specifier: 3.0.6
|
||||
version: 3.0.6(@angular/core@13.3.11)(rxjs@7.8.0)
|
||||
'@ionic/storage':
|
||||
specifier: 4.0.0
|
||||
version: 4.0.0
|
||||
'@ngx-translate/core':
|
||||
specifier: 14.0.0
|
||||
version: 14.0.0(@angular/core@13.3.11)(rxjs@7.8.0)
|
||||
@@ -2481,6 +2478,7 @@ packages:
|
||||
engines: {node: ^12.20.0 || ^14.15.0 || >=16.10.0}
|
||||
dependencies:
|
||||
tslib: 2.4.1
|
||||
dev: true
|
||||
|
||||
/@angular/core@13.3.11(rxjs@7.8.0)(zone.js@0.12.0):
|
||||
resolution: {integrity: sha512-9BmE2CxyV0g+AkBeuc8IwjSOiJ8Y+kptXnqD/J8EAFT3B0/fLGVnjFdZC6Sev9L0SNZb6qdzebpfIOLqbUjReQ==}
|
||||
@@ -2514,22 +2512,6 @@ packages:
|
||||
engines: {node: ^12.20.0 || ^14.15.0 || >=16.10.0}
|
||||
dev: true
|
||||
|
||||
/@angular/platform-browser-dynamic@13.3.11(@angular/common@13.3.11)(@angular/compiler@13.3.11)(@angular/core@13.3.11)(@angular/platform-browser@13.3.11):
|
||||
resolution: {integrity: sha512-xM0VRC1Nw//SHO3gkghUHyjCaaQbk1UYMq4vIu3iKVq9KLqOSZgccv0NcOKHzXXN3S5RgX2auuyOUOCD6ny1Pg==}
|
||||
engines: {node: ^12.20.0 || ^14.15.0 || >=16.10.0}
|
||||
peerDependencies:
|
||||
'@angular/common': 13.3.11
|
||||
'@angular/compiler': 13.3.11
|
||||
'@angular/core': 13.3.11
|
||||
'@angular/platform-browser': 13.3.11
|
||||
dependencies:
|
||||
'@angular/common': 13.3.11(@angular/core@13.3.11)(rxjs@7.8.0)
|
||||
'@angular/compiler': 13.3.11
|
||||
'@angular/core': 13.3.11(rxjs@7.8.0)(zone.js@0.12.0)
|
||||
'@angular/platform-browser': 13.3.11(@angular/animations@13.3.11)(@angular/common@13.3.11)(@angular/core@13.3.11)
|
||||
tslib: 2.4.1
|
||||
dev: false
|
||||
|
||||
/@angular/platform-browser@13.3.11(@angular/animations@13.3.11)(@angular/common@13.3.11)(@angular/core@13.3.11):
|
||||
resolution: {integrity: sha512-PG3chCErARb6wNzkOed2NsZmgvTmbumRx/6sMXqGkDKXYQm0JULnl4X42Rn+JCgJ9DLJi5/jrd1dbcBCrKk9Vg==}
|
||||
engines: {node: ^12.20.0 || ^14.15.0 || >=16.10.0}
|
||||
@@ -5826,24 +5808,19 @@ packages:
|
||||
tslib: 2.4.1
|
||||
dev: false
|
||||
|
||||
/@ionic/storage-angular@3.0.6(@angular/core@13.3.11)(rxjs@7.8.0):
|
||||
resolution: {integrity: sha512-ZXlIFWGU27aCxVFgZb0KFJFtWwnn6+HK6v0rMGzjN8f7oV2ewXaQ2dl1gTw/A8YoozTVPOFxwfFHCjhWLFR1Fw==}
|
||||
peerDependencies:
|
||||
'@angular/core': '*'
|
||||
rxjs: '*'
|
||||
dependencies:
|
||||
'@angular/core': 13.3.11(rxjs@7.8.0)(zone.js@0.12.0)
|
||||
'@ionic/storage': 3.0.6
|
||||
rxjs: 7.8.0
|
||||
tslib: 1.14.1
|
||||
dev: false
|
||||
|
||||
/@ionic/storage@3.0.6:
|
||||
resolution: {integrity: sha512-sw+zSJINIpbQCGZR9mEtb9N0WmZLuhcMVqOZJBqLuDACAMdXqG39zmp5nSVqhGI1/9X3nd0K5gVn6icyVfUnUg==}
|
||||
requiresBuild: true
|
||||
dependencies:
|
||||
localforage: 1.10.0
|
||||
dev: false
|
||||
optional: true
|
||||
|
||||
/@ionic/storage@4.0.0:
|
||||
resolution: {integrity: sha512-3N21P19Xk6cICLnSXZ3ilRqbSXAGSFeIF3HNqz+1kARcm0UFT/vwmZreaXtFyq437vvEWOfJ2enlj3JHLKS0FA==}
|
||||
dependencies:
|
||||
localforage: 1.10.0
|
||||
dev: false
|
||||
|
||||
/@ionic/utils-array@2.1.5:
|
||||
resolution: {integrity: sha512-HD72a71IQVBmQckDwmA8RxNVMTbxnaLbgFOl+dO5tbvW9CkkSFCv41h6fUuNsSEVgngfkn0i98HDuZC8mk+lTA==}
|
||||
|
||||
Reference in New Issue
Block a user