From 73cb7017757b15df19e3e51a296f6faa0cf0aad3 Mon Sep 17 00:00:00 2001 From: chrismclarke Date: Sun, 22 Sep 2024 11:16:40 -0700 Subject: [PATCH 01/16] chore: analytics deps and live-reload --- maths-club-app/README.md | 19 + maths-club-app/android/.gitignore | 2 - .../android/app/capacitor.build.gradle | 2 +- .../android/capacitor.settings.gradle | 4 +- maths-club-app/package.json | 3 +- .../src/app/services/analytics.service.ts | 18 +- maths-club-app/yarn.lock | 743 +++++++++++++++++- 7 files changed, 769 insertions(+), 22 deletions(-) diff --git a/maths-club-app/README.md b/maths-club-app/README.md index 57d15e43..d0e10f0d 100644 --- a/maths-club-app/README.md +++ b/maths-club-app/README.md @@ -47,6 +47,25 @@ yarn build Finally open Android studio in the generated folder `maths-club-app/android` You should be able to build and run the app directly from android studio. +**Use Live-Reload** +Follow guide at: https://capacitorjs.com/docs/guides/live-reload#using-with-framework-clis + +Example change to `capacitor.config.ts` + +```ts +server: { + url: "http://192.168.50.67:4200", + cleartext: true, + } +``` + +Example (windows) command to serve with host binding + +```sh +cd maths-club-app +yarn ng serve --host=0.0.0.0 +``` + ## Running on IOS TODO diff --git a/maths-club-app/android/.gitignore b/maths-club-app/android/.gitignore index 48354a3d..a4f2396f 100644 --- a/maths-club-app/android/.gitignore +++ b/maths-club-app/android/.gitignore @@ -61,8 +61,6 @@ captures/ .externalNativeBuild .cxx/ -# Google Services (e.g. APIs or Firebase) -# google-services.json # Freeline freeline.py diff --git a/maths-club-app/android/app/capacitor.build.gradle b/maths-club-app/android/app/capacitor.build.gradle index 6cd6e61e..3d0f4602 100644 --- a/maths-club-app/android/app/capacitor.build.gradle +++ b/maths-club-app/android/app/capacitor.build.gradle @@ -9,7 +9,7 @@ android { apply from: "../capacitor-cordova-android-plugins/cordova.variables.gradle" dependencies { - implementation project(':capacitor-community-firebase-analytics') + implementation project(':capacitor-firebase-analytics') implementation project(':capacitor-app') implementation project(':capacitor-dialog') implementation project(':capacitor-push-notifications') diff --git a/maths-club-app/android/capacitor.settings.gradle b/maths-club-app/android/capacitor.settings.gradle index 579460f1..0a6c3403 100644 --- a/maths-club-app/android/capacitor.settings.gradle +++ b/maths-club-app/android/capacitor.settings.gradle @@ -2,8 +2,8 @@ include ':capacitor-android' project(':capacitor-android').projectDir = new File('../node_modules/@capacitor/android/capacitor') -include ':capacitor-community-firebase-analytics' -project(':capacitor-community-firebase-analytics').projectDir = new File('../node_modules/@capacitor-community/firebase-analytics/android') +include ':capacitor-firebase-analytics' +project(':capacitor-firebase-analytics').projectDir = new File('../node_modules/@capacitor-firebase/analytics/android') include ':capacitor-app' project(':capacitor-app').projectDir = new File('../node_modules/@capacitor/app/android') diff --git a/maths-club-app/package.json b/maths-club-app/package.json index 14ea302c..df70fa3b 100644 --- a/maths-club-app/package.json +++ b/maths-club-app/package.json @@ -22,7 +22,7 @@ "@angular/platform-browser": "^18.2.3", "@angular/platform-browser-dynamic": "^18.2.3", "@angular/router": "^18.2.3", - "@capacitor-community/firebase-analytics": "^6.0.0", + "@capacitor-firebase/analytics": "^6.1.0", "@capacitor/app": "^6.0.1", "@capacitor/core": "^6.1.2", "@capacitor/dialog": "^6.0.1", @@ -30,6 +30,7 @@ "@capacitor/share": "^6.0.2", "@capacitor/status-bar": "^6.0.1", "@sentry/angular": "^8.29.0", + "firebase": "^10.13.2", "katex": "^0.16.0", "marked": "^12.0.0", "ngx-markdown": "^18.0.0", diff --git a/maths-club-app/src/app/services/analytics.service.ts b/maths-club-app/src/app/services/analytics.service.ts index 37a78e15..164351e3 100644 --- a/maths-club-app/src/app/services/analytics.service.ts +++ b/maths-club-app/src/app/services/analytics.service.ts @@ -1,10 +1,11 @@ import { Injectable } from "@angular/core"; import { MatDialog } from "@angular/material/dialog"; import { NavigationEnd, Router } from "@angular/router"; -import "@capacitor-community/firebase-analytics"; -import { FirebaseAnalytics } from "@capacitor-community/firebase-analytics"; - +import { FirebaseAnalytics } from "@capacitor-firebase/analytics"; import { Capacitor } from "@capacitor/core"; +import { initializeApp } from "firebase/app"; +import { getAnalytics } from "firebase/analytics"; + import { environment } from "src/environments/environment"; import { AnalyticsConsentComponent } from "../components/analytics-consent"; @@ -18,8 +19,6 @@ export class AnalyticsService { * Initialise analytics to track route changes and share data * Note - requires installation and initialisation of analytics sdk * and google services json - * API - https://github.com/capacitor-community/firebase-analytics - * NOTE - currently only enabled for native, but could be initialised for web */ async init() { const consented = await this.verifyUserAnalyticsConsent(); @@ -27,9 +26,8 @@ export class AnalyticsService { // Only register analytics on web if production settings set if (Capacitor.getPlatform() === "web") { if (environment.FIREBASE_CONFIG) { - await FirebaseAnalytics.initializeFirebase( - environment.FIREBASE_CONFIG - ); + const app = initializeApp(environment.FIREBASE_CONFIG); + const analytics = getAnalytics(app); this._subscribeToRouteChanges(); } else { console.info("No analytics settings configured, skipping"); @@ -71,9 +69,9 @@ export class AnalyticsService { console.info("Analytics enabled"); this.router.events.subscribe(async (e) => { if (e instanceof NavigationEnd) { - FirebaseAnalytics.setScreenName({ + FirebaseAnalytics.setCurrentScreen({ screenName: e.url, - nameOverride: null, + screenClassOverride: null, }); FirebaseAnalytics.logEvent({ name: "page_view", diff --git a/maths-club-app/yarn.lock b/maths-club-app/yarn.lock index 10d5d086..caad64b9 100644 --- a/maths-club-app/yarn.lock +++ b/maths-club-app/yarn.lock @@ -1923,12 +1923,16 @@ __metadata: languageName: node linkType: hard -"@capacitor-community/firebase-analytics@npm:^6.0.0": - version: 6.0.0 - resolution: "@capacitor-community/firebase-analytics@npm:6.0.0" +"@capacitor-firebase/analytics@npm:^6.1.0": + version: 6.1.0 + resolution: "@capacitor-firebase/analytics@npm:6.1.0" peerDependencies: "@capacitor/core": ^6.0.0 - checksum: 10c0/e465740ec2a9b39bc09d0b9484ed74d2d5bd3a88874f17a5686539fc439f55abe3f8225699310becee30d020282d5331c7038c8143b587b8e9dac6d891c78405 + firebase: ^10.9.0 + peerDependenciesMeta: + firebase: + optional: true + checksum: 10c0/48c34c2fd9987a24347bad356d1d9f00ccd90980a1fc95ce1e6c8ad630358ad0d6fbd991bcbffb37fd979bb67a1dfdf14b08df8ca3928efdef44e731c70e0047 languageName: node linkType: hard @@ -2386,6 +2390,558 @@ __metadata: languageName: node linkType: hard +"@firebase/analytics-compat@npm:0.2.14": + version: 0.2.14 + resolution: "@firebase/analytics-compat@npm:0.2.14" + dependencies: + "@firebase/analytics": "npm:0.10.8" + "@firebase/analytics-types": "npm:0.8.2" + "@firebase/component": "npm:0.6.9" + "@firebase/util": "npm:1.10.0" + tslib: "npm:^2.1.0" + peerDependencies: + "@firebase/app-compat": 0.x + checksum: 10c0/d63982fb8d423968b61240f00771fd96858b269f11ccbdd05887c1d1c03356df4aff854070fad2934b49819a4a78ec0b1f81eddec1e341f0e3f78127f9d1d646 + languageName: node + linkType: hard + +"@firebase/analytics-types@npm:0.8.2": + version: 0.8.2 + resolution: "@firebase/analytics-types@npm:0.8.2" + checksum: 10c0/0345beed0e36637c3e3f5c0638478fbd0d165d197a0374dd848c4bb772298b1eb3f3bccfea1f4501e32ee9a4ae8ac1c30bf399645f60037b2b08f4b5e252ec78 + languageName: node + linkType: hard + +"@firebase/analytics@npm:0.10.8": + version: 0.10.8 + resolution: "@firebase/analytics@npm:0.10.8" + dependencies: + "@firebase/component": "npm:0.6.9" + "@firebase/installations": "npm:0.6.9" + "@firebase/logger": "npm:0.4.2" + "@firebase/util": "npm:1.10.0" + tslib: "npm:^2.1.0" + peerDependencies: + "@firebase/app": 0.x + checksum: 10c0/0ad50a59a2e8aa4f7a3a297081e0e6ec5b78b4180f7c28822d1a722ce70a8274190089104b62febae9dbfa9bd2f17e7c22e6417d5ef9b0319ce4dcc3d6f18946 + languageName: node + linkType: hard + +"@firebase/app-check-compat@npm:0.3.15": + version: 0.3.15 + resolution: "@firebase/app-check-compat@npm:0.3.15" + dependencies: + "@firebase/app-check": "npm:0.8.8" + "@firebase/app-check-types": "npm:0.5.2" + "@firebase/component": "npm:0.6.9" + "@firebase/logger": "npm:0.4.2" + "@firebase/util": "npm:1.10.0" + tslib: "npm:^2.1.0" + peerDependencies: + "@firebase/app-compat": 0.x + checksum: 10c0/590b7af980c9efd852c671a232fed666e4502e13754e85ad58a85a4651882486089cb5d8b4bb6be79bb648d3b66524b71965565a68f2757e2cbd93daf37b4bcf + languageName: node + linkType: hard + +"@firebase/app-check-interop-types@npm:0.3.2": + version: 0.3.2 + resolution: "@firebase/app-check-interop-types@npm:0.3.2" + checksum: 10c0/7f1d25bc6cef3e4a209e6db096f6088b132b80f59947026af269406bdfbf140f391aeb94e68ecb4f524b4382b7217cc500cc068eeaf834e9665b7793177cc3f8 + languageName: node + linkType: hard + +"@firebase/app-check-types@npm:0.5.2": + version: 0.5.2 + resolution: "@firebase/app-check-types@npm:0.5.2" + checksum: 10c0/0e1e3c89da6591c608647faefd49add3aed8a3d5af061c6f4d192fa52cd48a9c511df3dfda96eac5cf18fde2661361bb26a18c9c346b300f71ffa743a85aeb68 + languageName: node + linkType: hard + +"@firebase/app-check@npm:0.8.8": + version: 0.8.8 + resolution: "@firebase/app-check@npm:0.8.8" + dependencies: + "@firebase/component": "npm:0.6.9" + "@firebase/logger": "npm:0.4.2" + "@firebase/util": "npm:1.10.0" + tslib: "npm:^2.1.0" + peerDependencies: + "@firebase/app": 0.x + checksum: 10c0/1d083e4b8cefc04a068ec5996c201fa2179e4315142a832c777558e6d44fa224d67cdbd9ac90086cca2c222fa6316168fa15c720b81672bafa2d722e48e1035a + languageName: node + linkType: hard + +"@firebase/app-compat@npm:0.2.41": + version: 0.2.41 + resolution: "@firebase/app-compat@npm:0.2.41" + dependencies: + "@firebase/app": "npm:0.10.11" + "@firebase/component": "npm:0.6.9" + "@firebase/logger": "npm:0.4.2" + "@firebase/util": "npm:1.10.0" + tslib: "npm:^2.1.0" + checksum: 10c0/9873ebc40871182e2ca4948aeef99c56b592c14e3a3c242239a781ec8e5fdefe7dbc50cf73a9733ed6aed778aa8e9bbd8cd631b8f31a1493e24648fd30fdf329 + languageName: node + linkType: hard + +"@firebase/app-types@npm:0.9.2": + version: 0.9.2 + resolution: "@firebase/app-types@npm:0.9.2" + checksum: 10c0/6bc78395ecadbf4958f1300ce9eb1d80522f05531acbacd88220fb77f4b924355bc920afe7f09c29acc40f374380e36539647604e1dab2fea045622b24988441 + languageName: node + linkType: hard + +"@firebase/app@npm:0.10.11": + version: 0.10.11 + resolution: "@firebase/app@npm:0.10.11" + dependencies: + "@firebase/component": "npm:0.6.9" + "@firebase/logger": "npm:0.4.2" + "@firebase/util": "npm:1.10.0" + idb: "npm:7.1.1" + tslib: "npm:^2.1.0" + checksum: 10c0/217516e7fb5f64fd8fc4932944a6c1e7fb10bc8dbc05f93787539b25174ea75cfbd3a0b5e820ac57f5536c70f12da55ae680d98089c54ad9ba792f158a00c353 + languageName: node + linkType: hard + +"@firebase/auth-compat@npm:0.5.14": + version: 0.5.14 + resolution: "@firebase/auth-compat@npm:0.5.14" + dependencies: + "@firebase/auth": "npm:1.7.9" + "@firebase/auth-types": "npm:0.12.2" + "@firebase/component": "npm:0.6.9" + "@firebase/util": "npm:1.10.0" + tslib: "npm:^2.1.0" + undici: "npm:6.19.7" + peerDependencies: + "@firebase/app-compat": 0.x + checksum: 10c0/09fdd896fd39b34a7364ac2a75979ba99091afda9472730ff4911c84382d7b719b5ee8b26c92cca80a7b2aa60dc26fe0dfb46423c961552b5fc660a01ef1e465 + languageName: node + linkType: hard + +"@firebase/auth-interop-types@npm:0.2.3": + version: 0.2.3 + resolution: "@firebase/auth-interop-types@npm:0.2.3" + checksum: 10c0/a3e72134a5ba177c87e2a35064f88ec6e9272f582c0754664edaabf23e2dcc1e8f9b70f78521c128d20c8ed060e857f333a9c6d5b463e6612bddef01b070da06 + languageName: node + linkType: hard + +"@firebase/auth-types@npm:0.12.2": + version: 0.12.2 + resolution: "@firebase/auth-types@npm:0.12.2" + peerDependencies: + "@firebase/app-types": 0.x + "@firebase/util": 1.x + checksum: 10c0/daf3d785cf7c3bb0fde7a92781f11419f7543980e28ad24eebba61ee448ca9858cdd7cbab91d9c4dcc0b7c21708b72dca45fef49f45af715f7ddfe8d545fafbd + languageName: node + linkType: hard + +"@firebase/auth@npm:1.7.9": + version: 1.7.9 + resolution: "@firebase/auth@npm:1.7.9" + dependencies: + "@firebase/component": "npm:0.6.9" + "@firebase/logger": "npm:0.4.2" + "@firebase/util": "npm:1.10.0" + tslib: "npm:^2.1.0" + undici: "npm:6.19.7" + peerDependencies: + "@firebase/app": 0.x + "@react-native-async-storage/async-storage": ^1.18.1 + peerDependenciesMeta: + "@react-native-async-storage/async-storage": + optional: true + checksum: 10c0/dab94919c8f695b6915b509b87bd36d97a739feb905c353779a2b7798745c391e4284d856e3682f10ee9f2953b0cacefcb682b36b02cc8857debb169abae8e61 + languageName: node + linkType: hard + +"@firebase/component@npm:0.6.9": + version: 0.6.9 + resolution: "@firebase/component@npm:0.6.9" + dependencies: + "@firebase/util": "npm:1.10.0" + tslib: "npm:^2.1.0" + checksum: 10c0/609dd193000dd9bdd12d820fbf2653d693e9aa2f768aa7817573e4f349b83ae4aa3b80ccd13b5cde4fb6bdf924a283a33ba0b608896bf6112db9265607202d28 + languageName: node + linkType: hard + +"@firebase/database-compat@npm:1.0.8": + version: 1.0.8 + resolution: "@firebase/database-compat@npm:1.0.8" + dependencies: + "@firebase/component": "npm:0.6.9" + "@firebase/database": "npm:1.0.8" + "@firebase/database-types": "npm:1.0.5" + "@firebase/logger": "npm:0.4.2" + "@firebase/util": "npm:1.10.0" + tslib: "npm:^2.1.0" + checksum: 10c0/34456da205dc0376601cef43ac1eb22b9bddac0555ccde14d759e0737b041bad6b996335f824543e4d782e9440893ae9c09e28be2c26c6afc6dbbfedd2c3eb84 + languageName: node + linkType: hard + +"@firebase/database-types@npm:1.0.5": + version: 1.0.5 + resolution: "@firebase/database-types@npm:1.0.5" + dependencies: + "@firebase/app-types": "npm:0.9.2" + "@firebase/util": "npm:1.10.0" + checksum: 10c0/64067fd5f11117898ec499bd63b04e13e0a3ef08c82d10873c112ef86be503152d0848f996d6f3f178392a141f20206d7cadb8e3163fd7ffaf7221c132d0f7a2 + languageName: node + linkType: hard + +"@firebase/database@npm:1.0.8": + version: 1.0.8 + resolution: "@firebase/database@npm:1.0.8" + dependencies: + "@firebase/app-check-interop-types": "npm:0.3.2" + "@firebase/auth-interop-types": "npm:0.2.3" + "@firebase/component": "npm:0.6.9" + "@firebase/logger": "npm:0.4.2" + "@firebase/util": "npm:1.10.0" + faye-websocket: "npm:0.11.4" + tslib: "npm:^2.1.0" + checksum: 10c0/dac0f0d1836cdd1ccc4785bdf35a1cc35a00d35c5c3d21dd87afccd1873f10ed56a606c72de07dbc93600115cd5a94686fbcf169e34ee9ae19a184469c110810 + languageName: node + linkType: hard + +"@firebase/firestore-compat@npm:0.3.37": + version: 0.3.37 + resolution: "@firebase/firestore-compat@npm:0.3.37" + dependencies: + "@firebase/component": "npm:0.6.9" + "@firebase/firestore": "npm:4.7.2" + "@firebase/firestore-types": "npm:3.0.2" + "@firebase/util": "npm:1.10.0" + tslib: "npm:^2.1.0" + peerDependencies: + "@firebase/app-compat": 0.x + checksum: 10c0/3b4250074ea55080b7733597119abe1dab46e030a742915bc4f4267a3ad20309cb5445d827e0ce71d0adef2055ac0878540910e66b36b69083028190f664eb51 + languageName: node + linkType: hard + +"@firebase/firestore-types@npm:3.0.2": + version: 3.0.2 + resolution: "@firebase/firestore-types@npm:3.0.2" + peerDependencies: + "@firebase/app-types": 0.x + "@firebase/util": 1.x + checksum: 10c0/3f8d97894d6bbef7a15ec5a33b241ddbb6ee90c3316c13f2a38fe5b8333e6b842197b498ec7d597ecd52ba4d5253ee96fcc6c889e9b394156200950577bbbded + languageName: node + linkType: hard + +"@firebase/firestore@npm:4.7.2": + version: 4.7.2 + resolution: "@firebase/firestore@npm:4.7.2" + dependencies: + "@firebase/component": "npm:0.6.9" + "@firebase/logger": "npm:0.4.2" + "@firebase/util": "npm:1.10.0" + "@firebase/webchannel-wrapper": "npm:1.0.1" + "@grpc/grpc-js": "npm:~1.9.0" + "@grpc/proto-loader": "npm:^0.7.8" + tslib: "npm:^2.1.0" + undici: "npm:6.19.7" + peerDependencies: + "@firebase/app": 0.x + checksum: 10c0/59e35106cc8db1d8f2ebe61a794b3bb9c49db2b577ce72fda3595020b27167d11611c7fe28a5c8d3cf7cfb2dab8e26607194898979ae31b219e214a81fcada9c + languageName: node + linkType: hard + +"@firebase/functions-compat@npm:0.3.14": + version: 0.3.14 + resolution: "@firebase/functions-compat@npm:0.3.14" + dependencies: + "@firebase/component": "npm:0.6.9" + "@firebase/functions": "npm:0.11.8" + "@firebase/functions-types": "npm:0.6.2" + "@firebase/util": "npm:1.10.0" + tslib: "npm:^2.1.0" + peerDependencies: + "@firebase/app-compat": 0.x + checksum: 10c0/1e2626fbf7d1d79ea4e9bf6f3b29803116e10498b1fd0334da6a8d4a47fd339b7e10db83aecf6b633e4c37ed08f43c5a1645f2679a67c0906143fef68c4180bb + languageName: node + linkType: hard + +"@firebase/functions-types@npm:0.6.2": + version: 0.6.2 + resolution: "@firebase/functions-types@npm:0.6.2" + checksum: 10c0/36ea0b30f4cd8d28fc574870780439642048d25bbed289f37f2567f7d93bac80dc19d03e5e7131e879f1f354f6ad7f6cf70188edaf6dbe005b98403e50224054 + languageName: node + linkType: hard + +"@firebase/functions@npm:0.11.8": + version: 0.11.8 + resolution: "@firebase/functions@npm:0.11.8" + dependencies: + "@firebase/app-check-interop-types": "npm:0.3.2" + "@firebase/auth-interop-types": "npm:0.2.3" + "@firebase/component": "npm:0.6.9" + "@firebase/messaging-interop-types": "npm:0.2.2" + "@firebase/util": "npm:1.10.0" + tslib: "npm:^2.1.0" + undici: "npm:6.19.7" + peerDependencies: + "@firebase/app": 0.x + checksum: 10c0/4e6eadb2a94b6fd2ed208fcc8dc29810b660a8834641bb9990d8010859ac2f5cfe8ff32f6b2616ab26012d017a7a70a49bc6c1a1c4992c4f6a0f1a956ca4b8b5 + languageName: node + linkType: hard + +"@firebase/installations-compat@npm:0.2.9": + version: 0.2.9 + resolution: "@firebase/installations-compat@npm:0.2.9" + dependencies: + "@firebase/component": "npm:0.6.9" + "@firebase/installations": "npm:0.6.9" + "@firebase/installations-types": "npm:0.5.2" + "@firebase/util": "npm:1.10.0" + tslib: "npm:^2.1.0" + peerDependencies: + "@firebase/app-compat": 0.x + checksum: 10c0/c86329a04e055db3755d8ae501e7a7720c975c12aaa963083e90096901831c42bd746e4322de674d0fbf7a6e92381a314e73e85b5500083ab52cb0a8b3ff68ce + languageName: node + linkType: hard + +"@firebase/installations-types@npm:0.5.2": + version: 0.5.2 + resolution: "@firebase/installations-types@npm:0.5.2" + peerDependencies: + "@firebase/app-types": 0.x + checksum: 10c0/f0a80b57fbeea6a079bfa564a8e5490aeb4a11e0d8e6ea73e548e3ccee637554eed30abc2c7c639d4fcc13c56f440f3aac1ff1588886cbaf552da0cbbd349545 + languageName: node + linkType: hard + +"@firebase/installations@npm:0.6.9": + version: 0.6.9 + resolution: "@firebase/installations@npm:0.6.9" + dependencies: + "@firebase/component": "npm:0.6.9" + "@firebase/util": "npm:1.10.0" + idb: "npm:7.1.1" + tslib: "npm:^2.1.0" + peerDependencies: + "@firebase/app": 0.x + checksum: 10c0/fafae83f93ad697e4da18c947605edb5debe68bc80737697e15c25681a17d0be04c743fcfd18358e3e467ff3e7260b7285e6854c5e998953e881383ceb70fe22 + languageName: node + linkType: hard + +"@firebase/logger@npm:0.4.2": + version: 0.4.2 + resolution: "@firebase/logger@npm:0.4.2" + dependencies: + tslib: "npm:^2.1.0" + checksum: 10c0/bec040b451ac10fa2dbec54e262093eedab7a684d2f2c80f2549e918db6c4b2091ff7fc1f70f6cd1ec65564dc3b8f9b9d1b4dbfb9708b7ae2b9fd856ee764b3a + languageName: node + linkType: hard + +"@firebase/messaging-compat@npm:0.2.11": + version: 0.2.11 + resolution: "@firebase/messaging-compat@npm:0.2.11" + dependencies: + "@firebase/component": "npm:0.6.9" + "@firebase/messaging": "npm:0.12.11" + "@firebase/util": "npm:1.10.0" + tslib: "npm:^2.1.0" + peerDependencies: + "@firebase/app-compat": 0.x + checksum: 10c0/c78a548bfa911f391990ff0f77336094dc1259da8a6f6e839719950410739a7ff9fe541bd72ef689a8ed9f2cc595dd41c289444e0876e119741b0a3c582985e7 + languageName: node + linkType: hard + +"@firebase/messaging-interop-types@npm:0.2.2": + version: 0.2.2 + resolution: "@firebase/messaging-interop-types@npm:0.2.2" + checksum: 10c0/c2ecebd2c1762869adc5a8dffc8881cb96ed4da8532291d6d5aca5302201546a19cd9a369561de29d253deb82d53be05e3d6fbdabd66ef1ba7c2e162ac5bf0f5 + languageName: node + linkType: hard + +"@firebase/messaging@npm:0.12.11": + version: 0.12.11 + resolution: "@firebase/messaging@npm:0.12.11" + dependencies: + "@firebase/component": "npm:0.6.9" + "@firebase/installations": "npm:0.6.9" + "@firebase/messaging-interop-types": "npm:0.2.2" + "@firebase/util": "npm:1.10.0" + idb: "npm:7.1.1" + tslib: "npm:^2.1.0" + peerDependencies: + "@firebase/app": 0.x + checksum: 10c0/8e745e0ca34bd12c115755904979f18b799ffe8a6e8205c756d075c526aa5d955197d7734f9930757e6b1b8e14d60c29cc30a3d72a4d9d41acd9f35ac76301b0 + languageName: node + linkType: hard + +"@firebase/performance-compat@npm:0.2.9": + version: 0.2.9 + resolution: "@firebase/performance-compat@npm:0.2.9" + dependencies: + "@firebase/component": "npm:0.6.9" + "@firebase/logger": "npm:0.4.2" + "@firebase/performance": "npm:0.6.9" + "@firebase/performance-types": "npm:0.2.2" + "@firebase/util": "npm:1.10.0" + tslib: "npm:^2.1.0" + peerDependencies: + "@firebase/app-compat": 0.x + checksum: 10c0/4359a27fea0d5ac1da46146cad5039d8746639d5a2099810fe162c8fa05a87e78d38a64fa1d92007914ff0858b3ddf5ba3cd461d4ce9c83e5c277c208c5a03c4 + languageName: node + linkType: hard + +"@firebase/performance-types@npm:0.2.2": + version: 0.2.2 + resolution: "@firebase/performance-types@npm:0.2.2" + checksum: 10c0/4187b2d8c49fa7b51bb8811fc25b31500d7e90b43ad48977a57eb77e461be963d4c102468b81471b04c30125270ea48399a4976f1ceb2ddabfe6e1ab901541d1 + languageName: node + linkType: hard + +"@firebase/performance@npm:0.6.9": + version: 0.6.9 + resolution: "@firebase/performance@npm:0.6.9" + dependencies: + "@firebase/component": "npm:0.6.9" + "@firebase/installations": "npm:0.6.9" + "@firebase/logger": "npm:0.4.2" + "@firebase/util": "npm:1.10.0" + tslib: "npm:^2.1.0" + peerDependencies: + "@firebase/app": 0.x + checksum: 10c0/ac6d37c9cb087789bb31c4afb0a202e017214e7ec2e1226260a140cd977465743817685cb7cd37e64cb1063aaf78fb119bc48e69c5c865fd5e90df9d2c5464e1 + languageName: node + linkType: hard + +"@firebase/remote-config-compat@npm:0.2.9": + version: 0.2.9 + resolution: "@firebase/remote-config-compat@npm:0.2.9" + dependencies: + "@firebase/component": "npm:0.6.9" + "@firebase/logger": "npm:0.4.2" + "@firebase/remote-config": "npm:0.4.9" + "@firebase/remote-config-types": "npm:0.3.2" + "@firebase/util": "npm:1.10.0" + tslib: "npm:^2.1.0" + peerDependencies: + "@firebase/app-compat": 0.x + checksum: 10c0/bd5393ce8aa518262851158acaf4c2e383bd01d09a92b4f4e1d9ec7b26e463c1b0d35b843e3db375c91a8ad397fb5b51f164960ffc990ab2b51d2e5a16f7a240 + languageName: node + linkType: hard + +"@firebase/remote-config-types@npm:0.3.2": + version: 0.3.2 + resolution: "@firebase/remote-config-types@npm:0.3.2" + checksum: 10c0/eab1a2c046ed77a9072e73f9cb0a21ce8e93f79a726d6be06ff2338c608f4f3c98a10315ca151b6d88635da5c6301e2a6c8026db1828430a467259497380eb9b + languageName: node + linkType: hard + +"@firebase/remote-config@npm:0.4.9": + version: 0.4.9 + resolution: "@firebase/remote-config@npm:0.4.9" + dependencies: + "@firebase/component": "npm:0.6.9" + "@firebase/installations": "npm:0.6.9" + "@firebase/logger": "npm:0.4.2" + "@firebase/util": "npm:1.10.0" + tslib: "npm:^2.1.0" + peerDependencies: + "@firebase/app": 0.x + checksum: 10c0/48c27cc86bc92e3ffc9e22758697fa788cc46d855e3117af153bc5dbdf0d66fb7400432349d0f143b0482fdbfaddadbeaa34819574efe10f4ef100fe86b5d469 + languageName: node + linkType: hard + +"@firebase/storage-compat@npm:0.3.12": + version: 0.3.12 + resolution: "@firebase/storage-compat@npm:0.3.12" + dependencies: + "@firebase/component": "npm:0.6.9" + "@firebase/storage": "npm:0.13.2" + "@firebase/storage-types": "npm:0.8.2" + "@firebase/util": "npm:1.10.0" + tslib: "npm:^2.1.0" + peerDependencies: + "@firebase/app-compat": 0.x + checksum: 10c0/7fd4febb0e48eed42b46913b0433eb7befc6c33a97b3efe23209c0ed8add600ed8626a91722a36fbc59cdd36206fecd0043e7169fd6ca07c5c123dceb6510058 + languageName: node + linkType: hard + +"@firebase/storage-types@npm:0.8.2": + version: 0.8.2 + resolution: "@firebase/storage-types@npm:0.8.2" + peerDependencies: + "@firebase/app-types": 0.x + "@firebase/util": 1.x + checksum: 10c0/8319975f6ee1585d52670fc75eaaf668ba9d4ae75c766dd1b33e609de68b191865a7125beeca5df6232636a7fd3a1cdc412848a1fc196b5410503f096de99daf + languageName: node + linkType: hard + +"@firebase/storage@npm:0.13.2": + version: 0.13.2 + resolution: "@firebase/storage@npm:0.13.2" + dependencies: + "@firebase/component": "npm:0.6.9" + "@firebase/util": "npm:1.10.0" + tslib: "npm:^2.1.0" + undici: "npm:6.19.7" + peerDependencies: + "@firebase/app": 0.x + checksum: 10c0/12791911ef1bab345d62584fb5edfed18576a18990408ff9203bed8a04b6988946af4af515ad878fe7346d355709310c5fa05946c2701e68a27a3653ecfac83f + languageName: node + linkType: hard + +"@firebase/util@npm:1.10.0": + version: 1.10.0 + resolution: "@firebase/util@npm:1.10.0" + dependencies: + tslib: "npm:^2.1.0" + checksum: 10c0/fc152a2cbdd06323f57f66c90cd388369e48e8910d589127f2ea76ca415c43c1c59b5b7b240307ae18f7f4c9cf0f97c71cb06e5ed8cba770b70958903ec52571 + languageName: node + linkType: hard + +"@firebase/vertexai-preview@npm:0.0.4": + version: 0.0.4 + resolution: "@firebase/vertexai-preview@npm:0.0.4" + dependencies: + "@firebase/app-check-interop-types": "npm:0.3.2" + "@firebase/component": "npm:0.6.9" + "@firebase/logger": "npm:0.4.2" + "@firebase/util": "npm:1.10.0" + tslib: "npm:^2.1.0" + peerDependencies: + "@firebase/app": 0.x + "@firebase/app-types": 0.x + checksum: 10c0/863fb2a92952f0eb543cbedaad8153d61060dfc4df93492dff87ce07d74710946e6bab255f1659de629a673a7b4bb46db0c2a36bc7314de781cf28c7938431a3 + languageName: node + linkType: hard + +"@firebase/webchannel-wrapper@npm:1.0.1": + version: 1.0.1 + resolution: "@firebase/webchannel-wrapper@npm:1.0.1" + checksum: 10c0/080e9a2c2b8077877a526851a500e8d01e271fd21b44f792fe48c7b4863498b1c0d631605d64a8e08a17c726bf492d4b418b9f3ef5efb78aa46866d1d7b14a8d + languageName: node + linkType: hard + +"@grpc/grpc-js@npm:~1.9.0": + version: 1.9.15 + resolution: "@grpc/grpc-js@npm:1.9.15" + dependencies: + "@grpc/proto-loader": "npm:^0.7.8" + "@types/node": "npm:>=12.12.47" + checksum: 10c0/5bd40e1b886df238f8ffe4cab694ceb51250f94ede7da6f94233b4d9a2526a4e525aafbc8f319850c2d8126c189232be458991768877b2af441f0234fb4b4292 + languageName: node + linkType: hard + +"@grpc/proto-loader@npm:^0.7.8": + version: 0.7.13 + resolution: "@grpc/proto-loader@npm:0.7.13" + dependencies: + lodash.camelcase: "npm:^4.3.0" + long: "npm:^5.0.0" + protobufjs: "npm:^7.2.5" + yargs: "npm:^17.7.2" + bin: + proto-loader-gen-types: build/bin/proto-loader-gen-types.js + checksum: 10c0/dc8ed7aa1454c15e224707cc53d84a166b98d76f33606a9f334c7a6fb1aedd3e3614dcd2c2b02a6ffaf140587d19494f93b3a56346c6c2e26bc564f6deddbbf3 + languageName: node + linkType: hard + "@inquirer/checkbox@npm:^2.4.7": version: 2.5.0 resolution: "@inquirer/checkbox@npm:2.5.0" @@ -3076,6 +3632,79 @@ __metadata: languageName: node linkType: hard +"@protobufjs/aspromise@npm:^1.1.1, @protobufjs/aspromise@npm:^1.1.2": + version: 1.1.2 + resolution: "@protobufjs/aspromise@npm:1.1.2" + checksum: 10c0/a83343a468ff5b5ec6bff36fd788a64c839e48a07ff9f4f813564f58caf44d011cd6504ed2147bf34835bd7a7dd2107052af755961c6b098fd8902b4f6500d0f + languageName: node + linkType: hard + +"@protobufjs/base64@npm:^1.1.2": + version: 1.1.2 + resolution: "@protobufjs/base64@npm:1.1.2" + checksum: 10c0/eec925e681081af190b8ee231f9bad3101e189abbc182ff279da6b531e7dbd2a56f1f306f37a80b1be9e00aa2d271690d08dcc5f326f71c9eed8546675c8caf6 + languageName: node + linkType: hard + +"@protobufjs/codegen@npm:^2.0.4": + version: 2.0.4 + resolution: "@protobufjs/codegen@npm:2.0.4" + checksum: 10c0/26ae337c5659e41f091606d16465bbcc1df1f37cc1ed462438b1f67be0c1e28dfb2ca9f294f39100c52161aef82edf758c95d6d75650a1ddf31f7ddee1440b43 + languageName: node + linkType: hard + +"@protobufjs/eventemitter@npm:^1.1.0": + version: 1.1.0 + resolution: "@protobufjs/eventemitter@npm:1.1.0" + checksum: 10c0/1eb0a75180e5206d1033e4138212a8c7089a3d418c6dfa5a6ce42e593a4ae2e5892c4ef7421f38092badba4040ea6a45f0928869989411001d8c1018ea9a6e70 + languageName: node + linkType: hard + +"@protobufjs/fetch@npm:^1.1.0": + version: 1.1.0 + resolution: "@protobufjs/fetch@npm:1.1.0" + dependencies: + "@protobufjs/aspromise": "npm:^1.1.1" + "@protobufjs/inquire": "npm:^1.1.0" + checksum: 10c0/cda6a3dc2d50a182c5865b160f72077aac197046600091dbb005dd0a66db9cce3c5eaed6d470ac8ed49d7bcbeef6ee5f0bc288db5ff9a70cbd003e5909065233 + languageName: node + linkType: hard + +"@protobufjs/float@npm:^1.0.2": + version: 1.0.2 + resolution: "@protobufjs/float@npm:1.0.2" + checksum: 10c0/18f2bdede76ffcf0170708af15c9c9db6259b771e6b84c51b06df34a9c339dbbeec267d14ce0bddd20acc142b1d980d983d31434398df7f98eb0c94a0eb79069 + languageName: node + linkType: hard + +"@protobufjs/inquire@npm:^1.1.0": + version: 1.1.0 + resolution: "@protobufjs/inquire@npm:1.1.0" + checksum: 10c0/64372482efcba1fb4d166a2664a6395fa978b557803857c9c03500e0ac1013eb4b1aacc9ed851dd5fc22f81583670b4f4431bae186f3373fedcfde863ef5921a + languageName: node + linkType: hard + +"@protobufjs/path@npm:^1.1.2": + version: 1.1.2 + resolution: "@protobufjs/path@npm:1.1.2" + checksum: 10c0/cece0a938e7f5dfd2fa03f8c14f2f1cf8b0d6e13ac7326ff4c96ea311effd5fb7ae0bba754fbf505312af2e38500250c90e68506b97c02360a43793d88a0d8b4 + languageName: node + linkType: hard + +"@protobufjs/pool@npm:^1.1.0": + version: 1.1.0 + resolution: "@protobufjs/pool@npm:1.1.0" + checksum: 10c0/eda2718b7f222ac6e6ad36f758a92ef90d26526026a19f4f17f668f45e0306a5bd734def3f48f51f8134ae0978b6262a5c517c08b115a551756d1a3aadfcf038 + languageName: node + linkType: hard + +"@protobufjs/utf8@npm:^1.1.0": + version: 1.1.0 + resolution: "@protobufjs/utf8@npm:1.1.0" + checksum: 10c0/a3fe31fe3fa29aa3349e2e04ee13dc170cc6af7c23d92ad49e3eeaf79b9766264544d3da824dba93b7855bd6a2982fb40032ef40693da98a136d835752beb487 + languageName: node + linkType: hard + "@rollup/rollup-android-arm-eabi@npm:4.20.0": version: 4.20.0 resolution: "@rollup/rollup-android-arm-eabi@npm:4.20.0" @@ -3735,6 +4364,15 @@ __metadata: languageName: node linkType: hard +"@types/node@npm:>=12.12.47, @types/node@npm:>=13.7.0": + version: 22.5.5 + resolution: "@types/node@npm:22.5.5" + dependencies: + undici-types: "npm:~6.19.2" + checksum: 10c0/ead9495cfc6b1da5e7025856dcce2591e9bae635357410c0d2dd619fce797d2a1d402887580ca4b336cb78168b195224869967de370a23f61663cf1e4836121c + languageName: node + linkType: hard + "@types/node@npm:^22.5.2": version: 22.5.4 resolution: "@types/node@npm:22.5.4" @@ -7133,6 +7771,15 @@ __metadata: languageName: node linkType: hard +"faye-websocket@npm:0.11.4": + version: 0.11.4 + resolution: "faye-websocket@npm:0.11.4" + dependencies: + websocket-driver: "npm:>=0.5.1" + checksum: 10c0/c6052a0bb322778ce9f89af92890f6f4ce00d5ec92418a35e5f4c6864a4fe736fec0bcebd47eac7c0f0e979b01530746b1c85c83cb04bae789271abf19737420 + languageName: node + linkType: hard + "faye-websocket@npm:^0.11.3": version: 0.11.3 resolution: "faye-websocket@npm:0.11.3" @@ -7238,6 +7885,41 @@ __metadata: languageName: node linkType: hard +"firebase@npm:^10.13.2": + version: 10.13.2 + resolution: "firebase@npm:10.13.2" + dependencies: + "@firebase/analytics": "npm:0.10.8" + "@firebase/analytics-compat": "npm:0.2.14" + "@firebase/app": "npm:0.10.11" + "@firebase/app-check": "npm:0.8.8" + "@firebase/app-check-compat": "npm:0.3.15" + "@firebase/app-compat": "npm:0.2.41" + "@firebase/app-types": "npm:0.9.2" + "@firebase/auth": "npm:1.7.9" + "@firebase/auth-compat": "npm:0.5.14" + "@firebase/database": "npm:1.0.8" + "@firebase/database-compat": "npm:1.0.8" + "@firebase/firestore": "npm:4.7.2" + "@firebase/firestore-compat": "npm:0.3.37" + "@firebase/functions": "npm:0.11.8" + "@firebase/functions-compat": "npm:0.3.14" + "@firebase/installations": "npm:0.6.9" + "@firebase/installations-compat": "npm:0.2.9" + "@firebase/messaging": "npm:0.12.11" + "@firebase/messaging-compat": "npm:0.2.11" + "@firebase/performance": "npm:0.6.9" + "@firebase/performance-compat": "npm:0.2.9" + "@firebase/remote-config": "npm:0.4.9" + "@firebase/remote-config-compat": "npm:0.2.9" + "@firebase/storage": "npm:0.13.2" + "@firebase/storage-compat": "npm:0.3.12" + "@firebase/util": "npm:1.10.0" + "@firebase/vertexai-preview": "npm:0.0.4" + checksum: 10c0/3e98c729e4cea8da83b26060fc3e7d93bc86474da1a0c9dc56b22f16eb3b027c8cf2a37ab324517996934c0452825a0708edd5b651828fc96fbe69fb629e9e58 + languageName: node + linkType: hard + "flat-cache@npm:^3.0.4": version: 3.0.4 resolution: "flat-cache@npm:3.0.4" @@ -7951,6 +8633,13 @@ __metadata: languageName: node linkType: hard +"idb@npm:7.1.1": + version: 7.1.1 + resolution: "idb@npm:7.1.1" + checksum: 10c0/72418e4397638797ee2089f97b45fc29f937b830bc0eb4126f4a9889ecf10320ceacf3a177fe5d7ffaf6b4fe38b20bbd210151549bfdc881db8081eed41c870d + languageName: node + linkType: hard + "ieee754@npm:^1.1.13": version: 1.2.1 resolution: "ieee754@npm:1.2.1" @@ -9033,6 +9722,13 @@ __metadata: languageName: node linkType: hard +"lodash.camelcase@npm:^4.3.0": + version: 4.3.0 + resolution: "lodash.camelcase@npm:4.3.0" + checksum: 10c0/fcba15d21a458076dd309fce6b1b4bf611d84a0ec252cb92447c948c533ac250b95d2e00955801ebc367e5af5ed288b996d75d37d2035260a937008e14eaf432 + languageName: node + linkType: hard + "lodash.clonedeep@npm:^4.5.0": version: 4.5.0 resolution: "lodash.clonedeep@npm:4.5.0" @@ -9121,6 +9817,13 @@ __metadata: languageName: node linkType: hard +"long@npm:^5.0.0": + version: 5.2.3 + resolution: "long@npm:5.2.3" + checksum: 10c0/6a0da658f5ef683b90330b1af76f06790c623e148222da9d75b60e266bbf88f803232dd21464575681638894a84091616e7f89557aa087fd14116c0f4e0e43d9 + languageName: node + linkType: hard + "lru-cache@npm:^10.0.1, lru-cache@npm:^10.2.0": version: 10.4.3 resolution: "lru-cache@npm:10.4.3" @@ -10911,6 +11614,26 @@ __metadata: languageName: node linkType: hard +"protobufjs@npm:^7.2.5": + version: 7.4.0 + resolution: "protobufjs@npm:7.4.0" + dependencies: + "@protobufjs/aspromise": "npm:^1.1.2" + "@protobufjs/base64": "npm:^1.1.2" + "@protobufjs/codegen": "npm:^2.0.4" + "@protobufjs/eventemitter": "npm:^1.1.0" + "@protobufjs/fetch": "npm:^1.1.0" + "@protobufjs/float": "npm:^1.0.2" + "@protobufjs/inquire": "npm:^1.1.0" + "@protobufjs/path": "npm:^1.1.2" + "@protobufjs/pool": "npm:^1.1.0" + "@protobufjs/utf8": "npm:^1.1.0" + "@types/node": "npm:>=13.7.0" + long: "npm:^5.0.0" + checksum: 10c0/a5460a63fe596523b9a067cbce39a6b310d1a71750fda261f076535662aada97c24450e18c5bc98a27784f70500615904ff1227e1742183509f0db4fdede669b + languageName: node + linkType: hard + "protractor@npm:~7.0.0": version: 7.0.0 resolution: "protractor@npm:7.0.0" @@ -11629,7 +12352,7 @@ __metadata: "@angular/platform-browser": "npm:^18.2.3" "@angular/platform-browser-dynamic": "npm:^18.2.3" "@angular/router": "npm:^18.2.3" - "@capacitor-community/firebase-analytics": "npm:^6.0.0" + "@capacitor-firebase/analytics": "npm:^6.1.0" "@capacitor/android": "npm:6.1.2" "@capacitor/app": "npm:^6.0.1" "@capacitor/cli": "npm:^6.1.2" @@ -11647,6 +12370,7 @@ __metadata: eslint: "npm:^7.26.0" eslint-config-prettier: "npm:^8.3.0" eslint-plugin-prettier: "npm:^3.4.0" + firebase: "npm:^10.13.2" jasmine-core: "npm:~3.7.1" jasmine-spec-reporter: "npm:~7.0.0" karma: "npm:~6.3.2" @@ -12947,6 +13671,13 @@ __metadata: languageName: node linkType: hard +"undici@npm:6.19.7": + version: 6.19.7 + resolution: "undici@npm:6.19.7" + checksum: 10c0/801d1e66d5bccdd3fcc9ecf1c95b83a593e4867b89e21ed725e35bd4d572b3d3ce1d7feab2a4f2046f65923de70bfafb69ac148c633d1ab30a948d6fec24475a + languageName: node + linkType: hard + "unicode-canonical-property-names-ecmascript@npm:^2.0.0": version: 2.0.0 resolution: "unicode-canonical-property-names-ecmascript@npm:2.0.0" @@ -13683,7 +14414,7 @@ __metadata: languageName: node linkType: hard -"yargs@npm:17.7.2, yargs@npm:^17.2.1": +"yargs@npm:17.7.2, yargs@npm:^17.2.1, yargs@npm:^17.7.2": version: 17.7.2 resolution: "yargs@npm:17.7.2" dependencies: From f16a4731532f9bcd5259452d7ad52d8c286a5386 Mon Sep 17 00:00:00 2001 From: chrismclarke Date: Sun, 22 Sep 2024 12:15:05 -0700 Subject: [PATCH 02/16] fix: android notch --- .../android/app/capacitor.build.gradle | 1 + .../android/capacitor.settings.gradle | 3 +++ maths-club-app/capacitor.config.ts | 15 +++++++++++ maths-club-app/package.json | 1 + maths-club-app/src/app/app.component.html | 7 ++--- maths-club-app/src/app/app.component.scss | 11 +++++--- maths-club-app/src/app/app.component.ts | 26 +++++++++---------- .../src/app/services/problem.service.ts | 4 +-- maths-club-app/yarn.lock | 10 +++++++ 9 files changed, 55 insertions(+), 23 deletions(-) diff --git a/maths-club-app/android/app/capacitor.build.gradle b/maths-club-app/android/app/capacitor.build.gradle index 3d0f4602..222c52c0 100644 --- a/maths-club-app/android/app/capacitor.build.gradle +++ b/maths-club-app/android/app/capacitor.build.gradle @@ -9,6 +9,7 @@ android { apply from: "../capacitor-cordova-android-plugins/cordova.variables.gradle" dependencies { + implementation project(':capacitor-community-safe-area') implementation project(':capacitor-firebase-analytics') implementation project(':capacitor-app') implementation project(':capacitor-dialog') diff --git a/maths-club-app/android/capacitor.settings.gradle b/maths-club-app/android/capacitor.settings.gradle index 0a6c3403..cd93ebc2 100644 --- a/maths-club-app/android/capacitor.settings.gradle +++ b/maths-club-app/android/capacitor.settings.gradle @@ -2,6 +2,9 @@ include ':capacitor-android' project(':capacitor-android').projectDir = new File('../node_modules/@capacitor/android/capacitor') +include ':capacitor-community-safe-area' +project(':capacitor-community-safe-area').projectDir = new File('../node_modules/@capacitor-community/safe-area/android') + include ':capacitor-firebase-analytics' project(':capacitor-firebase-analytics').projectDir = new File('../node_modules/@capacitor-firebase/analytics/android') diff --git a/maths-club-app/capacitor.config.ts b/maths-club-app/capacitor.config.ts index 00b80a24..0551d637 100644 --- a/maths-club-app/capacitor.config.ts +++ b/maths-club-app/capacitor.config.ts @@ -1,3 +1,5 @@ +/// + import type { CapacitorConfig } from "@capacitor/cli"; const config: CapacitorConfig = { @@ -11,10 +13,23 @@ const config: CapacitorConfig = { launchFadeOutDuration: 500, backgroundColor: "#ffffffff", }, + SafeArea: { + enabled: true, + customColorsForSystemBars: true, + statusBarColor: "#03a9f4", // SAMI Theme color + statusBarContent: "light", + navigationBarColor: "#03a9f4", + navigationBarContent: "light", + offset: 0, + }, }, ios: { contentInset: "automatic", }, + // server: { + // url: "http://192.168.50.67:4200", + // cleartext: true, + // }, }; export default config; diff --git a/maths-club-app/package.json b/maths-club-app/package.json index df70fa3b..c7c8caf1 100644 --- a/maths-club-app/package.json +++ b/maths-club-app/package.json @@ -22,6 +22,7 @@ "@angular/platform-browser": "^18.2.3", "@angular/platform-browser-dynamic": "^18.2.3", "@angular/router": "^18.2.3", + "@capacitor-community/safe-area": "^6.0.0-alpha.7", "@capacitor-firebase/analytics": "^6.1.0", "@capacitor/app": "^6.0.1", "@capacitor/core": "^6.1.2", diff --git a/maths-club-app/src/app/app.component.html b/maths-club-app/src/app/app.component.html index 507911a8..515a6a09 100644 --- a/maths-club-app/src/app/app.component.html +++ b/maths-club-app/src/app/app.component.html @@ -17,10 +17,7 @@ -
+
@if (!params().slug) { - } @if (params().slug) { - - } - SAMI Maths Club - - +
+ + @if (!params().slug) { + + } @if (params().slug) { + + } + SAMI Maths Club + + +
+ *******************************************************************************/ + +/** Min android version as mapped from `minSdkVersion` (API 23, Android 6.0) */ +const minAndroidVersion = 6.0; + +/** + * Minimum version of chrome required to run app + * Min baseline 45 to support arrow functions: https://caniuse.com/arrow-functions + * Capacitor requirement 60, according to: https://capacitorjs.com/docs/android + * Codebase pdf viewer 92 (https://caniuse.com/mdn-javascript_builtins_string_at) + * Legacy chrome versions available at: https://www.chromium.org/getting-involved/download-chromium/ + * + * NOTE - whilst capacitor does have functionality to detect version and present custom error page, + * using the `capacitor.config.ts` android property `minWebViewVersion`, however this requires capacitor + * to load correctly which often does not happen + */ +const minAndroidWebviewVersion = 93; + +/** + * Check for compatibiliy issues that may arise before main app loads + * This script is designed to be called from main index.html file to detect + * + * Uses web navigator instead of native APIs as Capacitor will fail to initialise + * in some legacy browsers + */ +function checkCompatibility() { + const info = getInfo(); + if (info.operatingSystem === 'android') { + // Catch case where app may be sideloaded onto a device with sdk lower than `minSdkVersion` (API 23, Android 6.0) + // Additionally the render prompt update will fail due to use of template literals + if (info.androidVersion && info.androidVersion < minAndroidVersion) { + alert('This app is not supported on Android 5.\nPlease use a device running Android 6 or higher'); + return; + } + // Check chrome webview version up-to-date + if (info.chromeVersion && info.chromeVersion < minAndroidWebviewVersion) { + console.log('[Compatibility check]'); + console.log(JSON.stringify(info, null, 2)); + // Webview version is controlled by different apps depending on android version + // For android 7-9 this is the controlled by the preinstalled Google Chrome app + // For android 6 and 10+ this is controlled by the standalone Android Webview app + // https://chromium.googlesource.com/chromium/src/+/HEAD/android_webview/docs/faq.md#what_s-the-relationship-between-webview-and-chrome + // https://techblogs.42gears.com/webkit-provider-changes-in-various-android-versions/ + + if (info.androidVersion >= 7 && info.androidVersion <= 9) { + renderUpdatePrompt('Google Chrome', 'https://play.google.com/store/apps/details?id=com.android.chrome'); + } else { + renderUpdatePrompt( + 'Android Webview', + 'https://play.google.com/store/apps/details?id=com.google.android.webview' + ); + } + } + } +} + +checkCompatibility(); + +/** + * Attempt to get core device info by parsing the navigator user object + * Adapted from Capacitor Device api methods to support case where Capacitor itself + * fails to correctly initialise (e.g. some legacy browsers) + * https://github.com/ionic-team/capacitor-plugins/blob/main/device/src/web.ts + * @returns + */ +function getInfo() { + const uaFields = {}; + const ua = navigator.userAgent; + const start = ua.indexOf('(') + 1; + const end = ua.indexOf(') AppleWebKit'); + const fields = ua.substring(start, end); + if (ua.indexOf('Android') !== -1) { + const tmpFields = fields.replace('; wv', '').split('; ').pop(); + if (tmpFields) { + uaFields.model = tmpFields.split(' Build')[0]; + } + uaFields.osVersion = fields.split('; ')[1]; + } + if (/android/i.test(ua)) { + uaFields.operatingSystem = 'android'; + } + // Additional fields that would normally be determined using native code (adapted for web) + if (uaFields.operatingSystem === 'android') { + uaFields.androidVersion = parseFloat(uaFields.osVersion.toLowerCase().replace('android', '')); + uaFields.chromeVersion = getChromeVersion(); + } + return uaFields; +} + +function getChromeVersion() { + const ua = navigator.userAgent.toLowerCase(); + const regex = /chrome\/([0-9]*)\./; + const res = regex.exec(ua); + if (res) { + const chromeVersion = parseInt(res[1]); + return chromeVersion; + } +} + +/** Create a custom popup element that blocks the screen to force user to update before continuing */ +function renderUpdatePrompt(appName, appLink) { + const backdropEl = document.createElement('div'); + backdropEl.id = 'updatePrompt'; + const styles = ` + position:absolute; + top:0; + left:0; + height:100vh; + width:100vw; + z-index:2; + background:#000c; + display:flex; + flex-direction:column; + align-items:center; + justify-content:center + `; + backdropEl.style.cssText = styles; + + // Main content container + const contentEl = document.createElement('div'); + contentEl.style.cssText = ` + width:300px; + background:#e9e9e9; + padding: 16px; + border-radius: 8px; + `; + + // Close button + const closeButtonEl = document.createElement('button'); + closeButtonEl.style.cssText = ` + float:right; + `; + closeButtonEl.textContent = 'X'; + closeButtonEl.onclick = closePrompt; + contentEl.appendChild(closeButtonEl); + + // Heading + const headingEl = document.createElement('h2'); + (headingEl.textContent = 'Update Required'), (headingEl.style.cssText = `text-align:center`); + contentEl.appendChild(headingEl); + + // Text + const textEl = document.createElement('p'); + textEl.innerHTML = `Please update the ${appName} app from the play store and restart the app`; + contentEl.appendChild(textEl); + + // Action button + const buttonEl = document.createElement('button'); + buttonEl.textContent = 'Go To Play Store'; + buttonEl.style.cssText = ` + width: 100%; + height: 48px; + margin: 16px 0; + font-size: 16px; + padding: 8px; + background: #01875f; + color: white; + border-radius: 8px; + font-weight: bold; + border: none; + cursor: pointer; + `; + + // Action button link + const linkEl = document.createElement('a'); + linkEl.href = appLink; + linkEl.target = '_blank'; + linkEl.appendChild(buttonEl); + contentEl.appendChild(linkEl); + + // Append to main content + backdropEl.appendChild(contentEl); + const bodyEl = document.querySelector('body'); + bodyEl.appendChild(backdropEl); +} + +function closePrompt() { + document.getElementById('updatePrompt').remove(); +} diff --git a/maths-club-app/src/index.html b/maths-club-app/src/index.html index 262f21e3..f665d1c3 100644 --- a/maths-club-app/src/index.html +++ b/maths-club-app/src/index.html @@ -42,6 +42,14 @@ + + From aa799fc1655f99770e455e8c76a51c22b6d0c221 Mon Sep 17 00:00:00 2001 From: chrismclarke Date: Mon, 23 Sep 2024 15:11:01 -0700 Subject: [PATCH 09/16] chore: update todos --- TODO.md | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/TODO.md b/TODO.md index 50573b65..9e411e48 100644 --- a/TODO.md +++ b/TODO.md @@ -10,7 +10,6 @@ - [x] capacitor - [x] yarn - [x] misc deps -- [ ] nx **Content** @@ -18,7 +17,7 @@ - [x] signals - [x] mat components - [x] Weekly problem -- [ ] route subscriptions signals +- [x] route subscriptions signals **Actions** @@ -41,7 +40,7 @@ - [x] scroll restoration - [x] markdown (katex) - [x] web -- [ ] android +- [x] android - [ ] ios **Android** @@ -49,10 +48,13 @@ - [ ] Splash screen - [ ] Notch - [ ] Deep Links +- [ ] Add crashlytics **IOS** - [ ] Configure plist for status bar: https://capacitorjs.com/docs/apis/status-bar#ios-note +- [ ] Notch +- [ ] Analytics - [ ] Enable push notification https://capacitorjs.com/docs/apis/push-notifications#ios - [ ] Check all other plugin notes - [ ] Splash screen @@ -68,6 +70,8 @@ - [ ] Lint rules (enforce control-flow, ordered imports) - [ ] Run prettier (write) `yarn prettier --write "**/*.{ts}"` - [ ] problems standalone repo (?) +- [ ] Add nx +- [ ] Add esbuild **Misc** From 5612dde4f75166a887e168abc843d6d858fa5017 Mon Sep 17 00:00:00 2001 From: chrismclarke Date: Mon, 23 Sep 2024 21:41:21 -0700 Subject: [PATCH 10/16] fix: nav bar color --- maths-club-app/android/app/build.gradle | 4 ++-- maths-club-app/android/app/capacitor.build.gradle | 1 - maths-club-app/android/capacitor.settings.gradle | 3 --- maths-club-app/capacitor.config.ts | 3 +-- maths-club-app/ios/App/App/Info.plist | 2 +- maths-club-app/ios/App/Podfile | 3 ++- maths-club-app/package.json | 3 +-- maths-club-app/src/app/app.component.html | 4 ++-- maths-club-app/src/app/app.component.scss | 3 ++- maths-club-app/src/app/app.component.ts | 14 +++++--------- maths-club-app/yarn.lock | 10 ---------- package.json | 2 +- 12 files changed, 17 insertions(+), 35 deletions(-) diff --git a/maths-club-app/android/app/build.gradle b/maths-club-app/android/app/build.gradle index 5b1474b9..ad9de42e 100644 --- a/maths-club-app/android/app/build.gradle +++ b/maths-club-app/android/app/build.gradle @@ -7,8 +7,8 @@ android { applicationId "io.c2dev.samimathsclub" minSdkVersion rootProject.ext.minSdkVersion targetSdkVersion rootProject.ext.targetSdkVersion - versionCode 3000000 - versionName "3.0.0" + versionCode 3000001 + versionName "3.0.1" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" aaptOptions { // Files and dirs to omit from the packaged assets dir, modified to accommodate modern web apps. diff --git a/maths-club-app/android/app/capacitor.build.gradle b/maths-club-app/android/app/capacitor.build.gradle index 34fe633a..222c52c0 100644 --- a/maths-club-app/android/app/capacitor.build.gradle +++ b/maths-club-app/android/app/capacitor.build.gradle @@ -15,7 +15,6 @@ dependencies { implementation project(':capacitor-dialog') implementation project(':capacitor-push-notifications') implementation project(':capacitor-share') - implementation project(':capacitor-splash-screen') implementation project(':capacitor-status-bar') } diff --git a/maths-club-app/android/capacitor.settings.gradle b/maths-club-app/android/capacitor.settings.gradle index 17464a97..cd93ebc2 100644 --- a/maths-club-app/android/capacitor.settings.gradle +++ b/maths-club-app/android/capacitor.settings.gradle @@ -20,8 +20,5 @@ project(':capacitor-push-notifications').projectDir = new File('../node_modules/ include ':capacitor-share' project(':capacitor-share').projectDir = new File('../node_modules/@capacitor/share/android') -include ':capacitor-splash-screen' -project(':capacitor-splash-screen').projectDir = new File('../node_modules/@capacitor/splash-screen/android') - include ':capacitor-status-bar' project(':capacitor-status-bar').projectDir = new File('../node_modules/@capacitor/status-bar/android') diff --git a/maths-club-app/capacitor.config.ts b/maths-club-app/capacitor.config.ts index c47b9c4f..d6733446 100644 --- a/maths-club-app/capacitor.config.ts +++ b/maths-club-app/capacitor.config.ts @@ -1,5 +1,4 @@ /// -/// import type { CapacitorConfig } from "@capacitor/cli"; @@ -13,7 +12,7 @@ const config: CapacitorConfig = { customColorsForSystemBars: true, statusBarColor: "#03a9f4", // SAMI Theme color statusBarContent: "light", - navigationBarColor: "#03a9f4", + navigationBarColor: "#00FFFFFF", // transparent navigationBarContent: "light", offset: 0, }, diff --git a/maths-club-app/ios/App/App/Info.plist b/maths-club-app/ios/App/App/Info.plist index 1b6d2c9a..40a244c5 100644 --- a/maths-club-app/ios/App/App/Info.plist +++ b/maths-club-app/ios/App/App/Info.plist @@ -17,7 +17,7 @@ CFBundlePackageType APPL CFBundleShortVersionString - 3.0.0 + 3.0.1 CFBundleVersion $(CURRENT_PROJECT_VERSION) LSRequiresIPhoneOS diff --git a/maths-club-app/ios/App/Podfile b/maths-club-app/ios/App/Podfile index 101922b5..ebd68977 100644 --- a/maths-club-app/ios/App/Podfile +++ b/maths-club-app/ios/App/Podfile @@ -11,7 +11,8 @@ install! 'cocoapods', :disable_input_output_paths => true def capacitor_pods pod 'Capacitor', :path => '../../node_modules/@capacitor/ios' pod 'CapacitorCordova', :path => '../../node_modules/@capacitor/ios' - pod 'CapacitorCommunityFirebaseAnalytics', :path => '../../node_modules/@capacitor-community/firebase-analytics' + pod 'CapacitorCommunitySafeArea', :path => '../../node_modules/@capacitor-community/safe-area' + pod 'CapacitorFirebaseAnalytics', :path => '../../node_modules/@capacitor-firebase/analytics' pod 'CapacitorApp', :path => '../../node_modules/@capacitor/app' pod 'CapacitorDialog', :path => '../../node_modules/@capacitor/dialog' pod 'CapacitorPushNotifications', :path => '../../node_modules/@capacitor/push-notifications' diff --git a/maths-club-app/package.json b/maths-club-app/package.json index 5265042a..33cbb78c 100644 --- a/maths-club-app/package.json +++ b/maths-club-app/package.json @@ -1,6 +1,6 @@ { "name": "sami-maths-club-app", - "version": "3.0.0", + "version": "3.0.1", "scripts": { "ng": "ng", "start": "ng serve", @@ -29,7 +29,6 @@ "@capacitor/dialog": "^6.0.1", "@capacitor/push-notifications": "^6.0.2", "@capacitor/share": "^6.0.2", - "@capacitor/splash-screen": "^6.0.2", "@capacitor/status-bar": "^6.0.1", "@sentry/angular": "^8.29.0", "firebase": "^10.13.2", diff --git a/maths-club-app/src/app/app.component.html b/maths-club-app/src/app/app.component.html index 9aa5e4fe..dafa79be 100644 --- a/maths-club-app/src/app/app.component.html +++ b/maths-club-app/src/app/app.component.html @@ -1,12 +1,12 @@ - + home Problems -
+
Privacy Policy Terms and Conditions Contact diff --git a/maths-club-app/src/app/app.component.scss b/maths-club-app/src/app/app.component.scss index 9adb6ab8..c2669df9 100644 --- a/maths-club-app/src/app/app.component.scss +++ b/maths-club-app/src/app/app.component.scss @@ -6,7 +6,7 @@ mat-sidenav-container { } mat-sidenav { - --mat-sidenav-container-width: 200px; + --mat-sidenav-container-width: 240px; --mat-list-list-item-leading-icon-start-space: 8px; --mat-list-list-item-leading-icon-end-space: 8px; --mdc-list-list-item-leading-icon-color: black; @@ -24,6 +24,7 @@ mat-toolbar { .bottom-items { position: absolute; bottom: 0; + padding-bottom: var(--safe-area-inset-bottom); } .nav-title { flex: 1; diff --git a/maths-club-app/src/app/app.component.ts b/maths-club-app/src/app/app.component.ts index e5ceefb1..c1dd750f 100644 --- a/maths-club-app/src/app/app.component.ts +++ b/maths-club-app/src/app/app.component.ts @@ -21,6 +21,8 @@ import { toSignal } from "@angular/core/rxjs-interop"; import { Capacitor } from "@capacitor/core"; import { App } from "@capacitor/app"; +import CAPACITOR_CONFIG from "../../capacitor.config"; + import { environment } from "src/environments/environment"; import { AppService } from "./services/app.service"; import { Router, RouterLink, RouterOutlet } from "@angular/router"; @@ -72,6 +74,7 @@ export class AppComponent implements AfterViewInit { private sanitizer: DomSanitizer ) { if (Capacitor.isNativePlatform()) { + this.configureSafeAreaView(); this.configureDeepLinks(); } this.registerCustomIcons(); @@ -98,16 +101,9 @@ export class AppComponent implements AfterViewInit { * sometimes lost safeArea and status bar updates on load * (re-configure with same settings defined in capacitor.config.ts) * */ - private configureSplashAndStatus() { + private configureSafeAreaView() { SafeArea.enable({ - config: { - customColorsForSystemBars: true, - statusBarColor: "#03a9f4", // SAMI Theme color - statusBarContent: "light", - navigationBarColor: "#03a9f4", - navigationBarContent: "light", - offset: 0, - }, + config: CAPACITOR_CONFIG.plugins.SafeArea, }); } diff --git a/maths-club-app/yarn.lock b/maths-club-app/yarn.lock index bcad85e2..66f7becc 100644 --- a/maths-club-app/yarn.lock +++ b/maths-club-app/yarn.lock @@ -2017,15 +2017,6 @@ __metadata: languageName: node linkType: hard -"@capacitor/splash-screen@npm:^6.0.2": - version: 6.0.2 - resolution: "@capacitor/splash-screen@npm:6.0.2" - peerDependencies: - "@capacitor/core": ^6.0.0 - checksum: 10c0/4bb604d3e708dbb4d2e3d0bc994daac1507262f9aa9854316efab8ce2449ec01546425ecf33ed88a6165c30af6e7171750472b6d54af249ab9b8b1dbbde5374c - languageName: node - linkType: hard - "@capacitor/status-bar@npm:^6.0.1": version: 6.0.1 resolution: "@capacitor/status-bar@npm:6.0.1" @@ -12259,7 +12250,6 @@ __metadata: "@capacitor/ios": "npm:6.1.2" "@capacitor/push-notifications": "npm:^6.0.2" "@capacitor/share": "npm:^6.0.2" - "@capacitor/splash-screen": "npm:^6.0.2" "@capacitor/status-bar": "npm:^6.0.1" "@sentry/angular": "npm:^8.29.0" "@types/jasmine": "npm:~3.7.1" diff --git a/package.json b/package.json index 55abf020..1e134f9f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "sami-maths-club", - "version": "3.0.0", + "version": "3.0.1", "description": "", "main": "index.js", "scripts": { From 28d7e6c3d61dcd21369cf6dcab6be590cbbfeda5 Mon Sep 17 00:00:00 2001 From: chrismclarke Date: Mon, 23 Sep 2024 21:47:28 -0700 Subject: [PATCH 11/16] chore: update styles --- .../app/src/main/res/values-v31/styles.xml | 18 ++++++++++++++++++ .../android/app/src/main/res/values/styles.xml | 2 -- 2 files changed, 18 insertions(+), 2 deletions(-) create mode 100644 maths-club-app/android/app/src/main/res/values-v31/styles.xml diff --git a/maths-club-app/android/app/src/main/res/values-v31/styles.xml b/maths-club-app/android/app/src/main/res/values-v31/styles.xml new file mode 100644 index 00000000..456e43d9 --- /dev/null +++ b/maths-club-app/android/app/src/main/res/values-v31/styles.xml @@ -0,0 +1,18 @@ + + + + + diff --git a/maths-club-app/android/app/src/main/res/values/styles.xml b/maths-club-app/android/app/src/main/res/values/styles.xml index e5d36f21..c2eb4b26 100644 --- a/maths-club-app/android/app/src/main/res/values/styles.xml +++ b/maths-club-app/android/app/src/main/res/values/styles.xml @@ -23,8 +23,6 @@ @drawable/splash_logo - @drawable/sami_branding - From 6aea95445517388fc2df65bcc731b13bef591551 Mon Sep 17 00:00:00 2001 From: chrismclarke Date: Mon, 23 Sep 2024 22:10:25 -0700 Subject: [PATCH 12/16] feat: crashlytics --- maths-club-app/android/app/build.gradle | 1 + .../android/app/capacitor.build.gradle | 2 + maths-club-app/android/build.gradle | 3 +- .../android/capacitor.settings.gradle | 6 ++ .../ios/App/App.xcodeproj/project.pbxproj | 4 +- maths-club-app/ios/App/Podfile | 2 + maths-club-app/package.json | 2 + maths-club-app/src/app/app.component.html | 6 +- maths-club-app/src/app/app.component.ts | 3 + .../app/services/crashlytics.service.spec.ts | 0 .../src/app/services/crashlytics.service.ts | 66 +++++++++++++++++++ maths-club-app/yarn.lock | 23 +++++++ 12 files changed, 114 insertions(+), 4 deletions(-) create mode 100644 maths-club-app/src/app/services/crashlytics.service.spec.ts create mode 100644 maths-club-app/src/app/services/crashlytics.service.ts diff --git a/maths-club-app/android/app/build.gradle b/maths-club-app/android/app/build.gradle index ad9de42e..10a35ed8 100644 --- a/maths-club-app/android/app/build.gradle +++ b/maths-club-app/android/app/build.gradle @@ -48,6 +48,7 @@ try { def servicesJSON = file('google-services.json') if (servicesJSON.text) { apply plugin: 'com.google.gms.google-services' + apply plugin: 'com.google.firebase.crashlytics' } } catch(Exception e) { logger.info("google-services.json not found, google-services plugin not applied. Push Notifications won't work") diff --git a/maths-club-app/android/app/capacitor.build.gradle b/maths-club-app/android/app/capacitor.build.gradle index 222c52c0..041972c2 100644 --- a/maths-club-app/android/app/capacitor.build.gradle +++ b/maths-club-app/android/app/capacitor.build.gradle @@ -11,7 +11,9 @@ apply from: "../capacitor-cordova-android-plugins/cordova.variables.gradle" dependencies { implementation project(':capacitor-community-safe-area') implementation project(':capacitor-firebase-analytics') + implementation project(':capacitor-firebase-crashlytics') implementation project(':capacitor-app') + implementation project(':capacitor-device') implementation project(':capacitor-dialog') implementation project(':capacitor-push-notifications') implementation project(':capacitor-share') diff --git a/maths-club-app/android/build.gradle b/maths-club-app/android/build.gradle index 85a5dda2..cc19b697 100644 --- a/maths-club-app/android/build.gradle +++ b/maths-club-app/android/build.gradle @@ -1,7 +1,7 @@ // Top-level build file where you can add configuration options common to all sub-projects/modules. buildscript { - + repositories { google() mavenCentral() @@ -9,6 +9,7 @@ buildscript { dependencies { classpath 'com.android.tools.build:gradle:8.2.1' classpath 'com.google.gms:google-services:4.4.0' + classpath 'com.google.firebase:firebase-crashlytics-gradle:3.0.2' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files diff --git a/maths-club-app/android/capacitor.settings.gradle b/maths-club-app/android/capacitor.settings.gradle index cd93ebc2..7e184423 100644 --- a/maths-club-app/android/capacitor.settings.gradle +++ b/maths-club-app/android/capacitor.settings.gradle @@ -8,9 +8,15 @@ project(':capacitor-community-safe-area').projectDir = new File('../node_modules include ':capacitor-firebase-analytics' project(':capacitor-firebase-analytics').projectDir = new File('../node_modules/@capacitor-firebase/analytics/android') +include ':capacitor-firebase-crashlytics' +project(':capacitor-firebase-crashlytics').projectDir = new File('../node_modules/@capacitor-firebase/crashlytics/android') + include ':capacitor-app' project(':capacitor-app').projectDir = new File('../node_modules/@capacitor/app/android') +include ':capacitor-device' +project(':capacitor-device').projectDir = new File('../node_modules/@capacitor/device/android') + include ':capacitor-dialog' project(':capacitor-dialog').projectDir = new File('../node_modules/@capacitor/dialog/android') diff --git a/maths-club-app/ios/App/App.xcodeproj/project.pbxproj b/maths-club-app/ios/App/App.xcodeproj/project.pbxproj index fe5fca1d..e4f44227 100644 --- a/maths-club-app/ios/App/App.xcodeproj/project.pbxproj +++ b/maths-club-app/ios/App/App.xcodeproj/project.pbxproj @@ -122,8 +122,8 @@ 504EC2FC1FED79650016851F /* Project object */ = { isa = PBXProject; attributes = { - LastSwiftUpdateCheck = 0920; - LastUpgradeCheck = 0920; + LastSwiftUpdateCheck = 920; + LastUpgradeCheck = 920; TargetAttributes = { 504EC3031FED79650016851F = { CreatedOnToolsVersion = 9.2; diff --git a/maths-club-app/ios/App/Podfile b/maths-club-app/ios/App/Podfile index ebd68977..cf0deab0 100644 --- a/maths-club-app/ios/App/Podfile +++ b/maths-club-app/ios/App/Podfile @@ -13,7 +13,9 @@ def capacitor_pods pod 'CapacitorCordova', :path => '../../node_modules/@capacitor/ios' pod 'CapacitorCommunitySafeArea', :path => '../../node_modules/@capacitor-community/safe-area' pod 'CapacitorFirebaseAnalytics', :path => '../../node_modules/@capacitor-firebase/analytics' + pod 'CapacitorFirebaseCrashlytics', :path => '../../node_modules/@capacitor-firebase/crashlytics' pod 'CapacitorApp', :path => '../../node_modules/@capacitor/app' + pod 'CapacitorDevice', :path => '../../node_modules/@capacitor/device' pod 'CapacitorDialog', :path => '../../node_modules/@capacitor/dialog' pod 'CapacitorPushNotifications', :path => '../../node_modules/@capacitor/push-notifications' pod 'CapacitorShare', :path => '../../node_modules/@capacitor/share' diff --git a/maths-club-app/package.json b/maths-club-app/package.json index 33cbb78c..c271dbe1 100644 --- a/maths-club-app/package.json +++ b/maths-club-app/package.json @@ -24,8 +24,10 @@ "@angular/router": "^18.2.3", "@capacitor-community/safe-area": "^6.0.0-alpha.7", "@capacitor-firebase/analytics": "^6.1.0", + "@capacitor-firebase/crashlytics": "^6.1.0", "@capacitor/app": "^6.0.1", "@capacitor/core": "^6.1.2", + "@capacitor/device": "^6.0.1", "@capacitor/dialog": "^6.0.1", "@capacitor/push-notifications": "^6.0.2", "@capacitor/share": "^6.0.2", diff --git a/maths-club-app/src/app/app.component.html b/maths-club-app/src/app/app.component.html index dafa79be..70a228b5 100644 --- a/maths-club-app/src/app/app.component.html +++ b/maths-club-app/src/app/app.component.html @@ -1,6 +1,10 @@ - + home Problems diff --git a/maths-club-app/src/app/app.component.ts b/maths-club-app/src/app/app.component.ts index c1dd750f..b640406a 100644 --- a/maths-club-app/src/app/app.component.ts +++ b/maths-club-app/src/app/app.component.ts @@ -33,6 +33,7 @@ import { SeoService } from "./services/seo.service"; import { AppOpenTargetComponent } from "./components/app-open-target"; import { SafeArea } from "@capacitor-community/safe-area"; +import { CrashlyticsService } from "./services/crashlytics.service"; @Component({ selector: "app-root", @@ -68,6 +69,7 @@ export class AppComponent implements AfterViewInit { notifications: NotificationService, private analytics: AnalyticsService, + private crashlytics: CrashlyticsService, private zone: NgZone, private router: Router, private iconRegistry: MatIconRegistry, @@ -82,6 +84,7 @@ export class AppComponent implements AfterViewInit { ngAfterViewInit() { // this.notifications.init() + this.crashlytics.init(); this.analytics.init(); if (Capacitor.getPlatform() === "web") { this.toggleAppOpenTargetSheet(); diff --git a/maths-club-app/src/app/services/crashlytics.service.spec.ts b/maths-club-app/src/app/services/crashlytics.service.spec.ts new file mode 100644 index 00000000..e69de29b diff --git a/maths-club-app/src/app/services/crashlytics.service.ts b/maths-club-app/src/app/services/crashlytics.service.ts new file mode 100644 index 00000000..c242fcb6 --- /dev/null +++ b/maths-club-app/src/app/services/crashlytics.service.ts @@ -0,0 +1,66 @@ +import { Injectable } from "@angular/core"; +import { Capacitor } from "@capacitor/core"; +import { Device } from "@capacitor/device"; +import { + FirebaseCrashlytics, + RecordExceptionOptions, +} from "@capacitor-firebase/crashlytics"; +import { environment } from "src/environments/environment"; + +@Injectable({ + providedIn: "root", +}) +/** + * Automates reporting of crash data to firebase crashlytics, and adds methods + * to allow custom reporting for non-fatal exceptions (e.g. error messages) + * https://github.com/capacitor-community/firebase-crashlytics + */ +export class CrashlyticsService { + /** Service will only be enabled in production on native device (not supported on web) */ + private enabled = Capacitor.isNativePlatform() && environment.production; + + public async init() { + if (this.enabled) { + const { + setEnabled, + setUserId, + sendUnsentReports, + setCustomKey, + } = FirebaseCrashlytics; + await setEnabled({ enabled: true }); + const { identifier: uuid } = await Device.getId(); + await setUserId({ userId: uuid }); + // populate webview useragent info + const { webViewVersion } = await Device.getInfo(); + await setCustomKey({ + key: "userAgent", + type: "string", + value: navigator.userAgent || "", + }); + await setCustomKey({ + key: "webViewVersion", + type: "string", + value: webViewVersion || "", + }); + await setCustomKey({ + key: "pathname", + type: "string", + value: location.pathname || "", + }); + sendUnsentReports(); + } else { + this.loadDummyMethods(); + } + } + + public recordException = FirebaseCrashlytics.recordException; + + /** When using on unsupported device fill dummy methods for interoperability */ + private loadDummyMethods() { + this.recordException = async (options: RecordExceptionOptions) => { + console.warn("[Crashlytics] skipping report", options); + }; + } + + private crash = FirebaseCrashlytics.crash; +} diff --git a/maths-club-app/yarn.lock b/maths-club-app/yarn.lock index 66f7becc..7d7ad6bf 100644 --- a/maths-club-app/yarn.lock +++ b/maths-club-app/yarn.lock @@ -1925,6 +1925,18 @@ __metadata: languageName: node linkType: hard +"@capacitor-firebase/crashlytics@npm:^6.1.0": + version: 6.1.0 + resolution: "@capacitor-firebase/crashlytics@npm:6.1.0" + peerDependencies: + "@capacitor/core": ^6.0.0 + peerDependenciesMeta: + firebase: + optional: true + checksum: 10c0/dae52c07116aa2fd21ef441ef1a1f56a4c6f7b55651d6294ff9c89593e67b9cab397fd862f2233d659040c0690903401d5b0b3811d72a68bc61ad614cb81e2d7 + languageName: node + linkType: hard + "@capacitor/android@npm:6.1.2": version: 6.1.2 resolution: "@capacitor/android@npm:6.1.2" @@ -1981,6 +1993,15 @@ __metadata: languageName: node linkType: hard +"@capacitor/device@npm:^6.0.1": + version: 6.0.1 + resolution: "@capacitor/device@npm:6.0.1" + peerDependencies: + "@capacitor/core": ^6.0.0 + checksum: 10c0/8be47b8772eb9199777ddbb70a7aa48b6cd4c1ef52a67a760926b3279a7135ef100966032eab3b7044f2819e9435ea0c06b871724983d4755c959d76be2cb153 + languageName: node + linkType: hard + "@capacitor/dialog@npm:^6.0.1": version: 6.0.1 resolution: "@capacitor/dialog@npm:6.0.1" @@ -12242,10 +12263,12 @@ __metadata: "@angular/router": "npm:^18.2.3" "@capacitor-community/safe-area": "npm:^6.0.0-alpha.7" "@capacitor-firebase/analytics": "npm:^6.1.0" + "@capacitor-firebase/crashlytics": "npm:^6.1.0" "@capacitor/android": "npm:6.1.2" "@capacitor/app": "npm:^6.0.1" "@capacitor/cli": "npm:^6.1.2" "@capacitor/core": "npm:^6.1.2" + "@capacitor/device": "npm:^6.0.1" "@capacitor/dialog": "npm:^6.0.1" "@capacitor/ios": "npm:6.1.2" "@capacitor/push-notifications": "npm:^6.0.2" From 1fcd2c5b48e265ecd6e5af6380a5ae1339524461 Mon Sep 17 00:00:00 2001 From: chrismclarke Date: Mon, 23 Sep 2024 22:10:48 -0700 Subject: [PATCH 13/16] chore: bump version --- maths-club-app/android/app/build.gradle | 4 ++-- maths-club-app/ios/App/App/Info.plist | 2 +- maths-club-app/package.json | 2 +- package.json | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/maths-club-app/android/app/build.gradle b/maths-club-app/android/app/build.gradle index 10a35ed8..192daf9a 100644 --- a/maths-club-app/android/app/build.gradle +++ b/maths-club-app/android/app/build.gradle @@ -7,8 +7,8 @@ android { applicationId "io.c2dev.samimathsclub" minSdkVersion rootProject.ext.minSdkVersion targetSdkVersion rootProject.ext.targetSdkVersion - versionCode 3000001 - versionName "3.0.1" + versionCode 3000002 + versionName "3.0.2" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" aaptOptions { // Files and dirs to omit from the packaged assets dir, modified to accommodate modern web apps. diff --git a/maths-club-app/ios/App/App/Info.plist b/maths-club-app/ios/App/App/Info.plist index 40a244c5..415061ad 100644 --- a/maths-club-app/ios/App/App/Info.plist +++ b/maths-club-app/ios/App/App/Info.plist @@ -17,7 +17,7 @@ CFBundlePackageType APPL CFBundleShortVersionString - 3.0.1 + 3.0.2 CFBundleVersion $(CURRENT_PROJECT_VERSION) LSRequiresIPhoneOS diff --git a/maths-club-app/package.json b/maths-club-app/package.json index c271dbe1..cd060550 100644 --- a/maths-club-app/package.json +++ b/maths-club-app/package.json @@ -1,6 +1,6 @@ { "name": "sami-maths-club-app", - "version": "3.0.1", + "version": "3.0.2", "scripts": { "ng": "ng", "start": "ng serve", diff --git a/package.json b/package.json index 1e134f9f..86d7b6a3 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "sami-maths-club", - "version": "3.0.1", + "version": "3.0.2", "description": "", "main": "index.js", "scripts": { From fbca5e19f791034013245b7792b087b46fde47db Mon Sep 17 00:00:00 2001 From: chrismclarke Date: Tue, 24 Sep 2024 11:51:09 -0700 Subject: [PATCH 14/16] feat: splash delay --- .../io/c2dev/samimathsclub/MainActivity.java | 27 +++++++++- .../io/c2dev/samimathsclub/SplashDelay.java | 49 +++++++++++++++++++ .../{splash_logo.xml => splash_animated.xml} | 0 .../{splash_logo.xml => splash_static.xml} | 0 .../app/src/main/res/values-v31/styles.xml | 9 +--- .../app/src/main/res/values-v33/styles.xml | 12 +++++ .../app/src/main/res/values/styles.xml | 9 +--- 7 files changed, 90 insertions(+), 16 deletions(-) create mode 100644 maths-club-app/android/app/src/main/java/io/c2dev/samimathsclub/SplashDelay.java rename maths-club-app/android/app/src/main/res/drawable-v31/{splash_logo.xml => splash_animated.xml} (100%) rename maths-club-app/android/app/src/main/res/drawable/{splash_logo.xml => splash_static.xml} (100%) create mode 100644 maths-club-app/android/app/src/main/res/values-v33/styles.xml diff --git a/maths-club-app/android/app/src/main/java/io/c2dev/samimathsclub/MainActivity.java b/maths-club-app/android/app/src/main/java/io/c2dev/samimathsclub/MainActivity.java index b883ccf1..6f48dc83 100644 --- a/maths-club-app/android/app/src/main/java/io/c2dev/samimathsclub/MainActivity.java +++ b/maths-club-app/android/app/src/main/java/io/c2dev/samimathsclub/MainActivity.java @@ -1,5 +1,30 @@ package io.c2dev.samimathsclub; +import android.os.Bundle; +import android.util.Log; +import android.view.View; + import com.getcapacitor.BridgeActivity; -public class MainActivity extends BridgeActivity {} +import androidx.annotation.Nullable; + + +public class MainActivity extends BridgeActivity { + @Override + protected void onCreate(@Nullable Bundle savedInstanceState) { + // Track how long app startup takes to adjust how long to keep splash screen displayed + long START_TIME = System.currentTimeMillis(); + + super.onCreate(savedInstanceState); + final View content = findViewById(android.R.id.content); + + // Ensure splash is displayed for at least 800ms (default dismisses on first draw) + long SPLASH_MIN_DURATION = 800; + long END_TIME = System.currentTimeMillis(); + long TIME_ELAPSED = END_TIME - START_TIME; + long SPLASH_DELAY = SPLASH_MIN_DURATION - TIME_ELAPSED; + if(SPLASH_DELAY > 0){ + new SplashDelay().run(SPLASH_DELAY, content); + } + } +} diff --git a/maths-club-app/android/app/src/main/java/io/c2dev/samimathsclub/SplashDelay.java b/maths-club-app/android/app/src/main/java/io/c2dev/samimathsclub/SplashDelay.java new file mode 100644 index 00000000..3970aa8f --- /dev/null +++ b/maths-club-app/android/app/src/main/java/io/c2dev/samimathsclub/SplashDelay.java @@ -0,0 +1,49 @@ +package io.c2dev.samimathsclub; + +import android.os.Handler; +import android.util.Log; +import android.view.View; +import android.view.ViewTreeObserver; + +/** + * Delay the splash screen dismiss for a fixed period of time + * + * Adapted from + * https://stackoverflow.com/a/76099488 + * https://developer.android.com/develop/ui/views/launch/splash-screen#suspend-drawing + * https://github.com/ionic-team/capacitor-plugins/blob/main/splash-screen/android/src/main/java/com/capacitorjs/plugins/splashscreen/SplashScreen.java + * + * Could potentially be replaced by integrating more closely with capacitor splashscreen plugin + * although unclear whether different assets for android 31+ supported + */ +public class SplashDelay { + + private boolean isVisible = false; + private ViewTreeObserver.OnPreDrawListener onPreDrawListener; + + public void run(long DELAY, View content) { + // Set up an OnPreDrawListener to the root view. + this.onPreDrawListener = new ViewTreeObserver.OnPreDrawListener() { + @Override + public boolean onPreDraw() { + // Start Timer On First Run + if (!isVisible) { + isVisible = true; + + new Handler().postDelayed(() -> { + // Splash screen is done... start drawing content. + isVisible = false; + content.getViewTreeObserver().removeOnPreDrawListener(this); + }, + DELAY + ); + } + // Not ready to dismiss splash screen + return false; + } + }; + + content.getViewTreeObserver().addOnPreDrawListener(this.onPreDrawListener); + } + + } diff --git a/maths-club-app/android/app/src/main/res/drawable-v31/splash_logo.xml b/maths-club-app/android/app/src/main/res/drawable-v31/splash_animated.xml similarity index 100% rename from maths-club-app/android/app/src/main/res/drawable-v31/splash_logo.xml rename to maths-club-app/android/app/src/main/res/drawable-v31/splash_animated.xml diff --git a/maths-club-app/android/app/src/main/res/drawable/splash_logo.xml b/maths-club-app/android/app/src/main/res/drawable/splash_static.xml similarity index 100% rename from maths-club-app/android/app/src/main/res/drawable/splash_logo.xml rename to maths-club-app/android/app/src/main/res/drawable/splash_static.xml diff --git a/maths-club-app/android/app/src/main/res/values-v31/styles.xml b/maths-club-app/android/app/src/main/res/values-v31/styles.xml index 456e43d9..1c3563cd 100644 --- a/maths-club-app/android/app/src/main/res/values-v31/styles.xml +++ b/maths-club-app/android/app/src/main/res/values-v31/styles.xml @@ -4,15 +4,8 @@ diff --git a/maths-club-app/android/app/src/main/res/values-v33/styles.xml b/maths-club-app/android/app/src/main/res/values-v33/styles.xml new file mode 100644 index 00000000..85af1598 --- /dev/null +++ b/maths-club-app/android/app/src/main/res/values-v33/styles.xml @@ -0,0 +1,12 @@ + + + + + diff --git a/maths-club-app/android/app/src/main/res/values/styles.xml b/maths-club-app/android/app/src/main/res/values/styles.xml index c2eb4b26..aaecf6ab 100644 --- a/maths-club-app/android/app/src/main/res/values/styles.xml +++ b/maths-club-app/android/app/src/main/res/values/styles.xml @@ -19,13 +19,8 @@ From 82ba9c0c705ecae83e449a5d2b9e9605263a21b3 Mon Sep 17 00:00:00 2001 From: chrismclarke Date: Tue, 24 Sep 2024 11:51:24 -0700 Subject: [PATCH 15/16] chore: bump version --- maths-club-app/android/app/build.gradle | 4 ++-- maths-club-app/ios/App/App/Info.plist | 2 +- maths-club-app/package.json | 2 +- package.json | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/maths-club-app/android/app/build.gradle b/maths-club-app/android/app/build.gradle index 192daf9a..06540939 100644 --- a/maths-club-app/android/app/build.gradle +++ b/maths-club-app/android/app/build.gradle @@ -7,8 +7,8 @@ android { applicationId "io.c2dev.samimathsclub" minSdkVersion rootProject.ext.minSdkVersion targetSdkVersion rootProject.ext.targetSdkVersion - versionCode 3000002 - versionName "3.0.2" + versionCode 3000003 + versionName "3.0.3" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" aaptOptions { // Files and dirs to omit from the packaged assets dir, modified to accommodate modern web apps. diff --git a/maths-club-app/ios/App/App/Info.plist b/maths-club-app/ios/App/App/Info.plist index 415061ad..40524c00 100644 --- a/maths-club-app/ios/App/App/Info.plist +++ b/maths-club-app/ios/App/App/Info.plist @@ -17,7 +17,7 @@ CFBundlePackageType APPL CFBundleShortVersionString - 3.0.2 + 3.0.3 CFBundleVersion $(CURRENT_PROJECT_VERSION) LSRequiresIPhoneOS diff --git a/maths-club-app/package.json b/maths-club-app/package.json index cd060550..3fa8bee0 100644 --- a/maths-club-app/package.json +++ b/maths-club-app/package.json @@ -1,6 +1,6 @@ { "name": "sami-maths-club-app", - "version": "3.0.2", + "version": "3.0.3", "scripts": { "ng": "ng", "start": "ng serve", diff --git a/package.json b/package.json index 86d7b6a3..96102fde 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "sami-maths-club", - "version": "3.0.2", + "version": "3.0.3", "description": "", "main": "index.js", "scripts": { From a6be008714d729d27c982afcc4d8ab52eba44bd5 Mon Sep 17 00:00:00 2001 From: chrismclarke Date: Tue, 24 Sep 2024 11:52:35 -0700 Subject: [PATCH 16/16] chore: update todos --- TODO.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/TODO.md b/TODO.md index 9e411e48..d7bee70c 100644 --- a/TODO.md +++ b/TODO.md @@ -77,4 +77,8 @@ - [x] Improve typography - [x] Fix mat-card shadow -- [ ] notch fixes and layout +- [x] notch fixes and layout + +**Content** + +- [ ] Separate out into standalone git repo and add as submodule to app repo