Skip to content

Commit

Permalink
Merge pull request #2046 from IDEMSInternational/core/capacitor-5
Browse files Browse the repository at this point in the history
Core/capacitor 5
  • Loading branch information
esmeetewinkel authored Aug 24, 2023
2 parents 76ed06a + 00cc45f commit 1bc714f
Show file tree
Hide file tree
Showing 22 changed files with 229 additions and 186 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/android-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -104,11 +104,11 @@ jobs:
# Android Build
#############################################################################
# Java version mapping: https://stackoverflow.com/a/47457251/5693245
- name: Set up JDK 11
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
distribution: "zulu"
java-version: "11"
java-version: "17"
java-package: jdk
cache: "gradle"
- name: Setup Android SDK
Expand Down
1 change: 1 addition & 0 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
apply plugin: 'com.android.application'

android {
namespace "international.idems.plh_teens"
compileSdkVersion rootProject.ext.compileSdkVersion
defaultConfig {
applicationId "international.idems.plh_teens"
Expand Down
5 changes: 2 additions & 3 deletions android/app/capacitor.build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

android {
compileOptions {
sourceCompatibility JavaVersion.VERSION_11
targetCompatibility JavaVersion.VERSION_11
sourceCompatibility JavaVersion.VERSION_17
targetCompatibility JavaVersion.VERSION_17
}
}

Expand All @@ -22,7 +22,6 @@ dependencies {
implementation project(':capacitor-splash-screen')
implementation project(':capawesome-capacitor-app-update')
implementation project(':capacitor-blob-writer')
implementation project(':capacitor-firebase-auth')

}

Expand Down
2 changes: 1 addition & 1 deletion android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="international.idems.plh_teens">
>

<application
android:allowBackup="true"
Expand Down
4 changes: 3 additions & 1 deletion android/app/src/main/assets/capacitor.config.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"appId": "international.idems.plh_teens",
"appName": "PLH Teens",
"bundledWebRuntime": false,
"webDir": "www",
"plugins": {
"SplashScreen": {
Expand All @@ -15,5 +14,8 @@
"google.com"
]
}
},
"server": {
"androidScheme": "http"
}
}
4 changes: 0 additions & 4 deletions android/app/src/main/assets/capacitor.plugins.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,5 @@
{
"pkg": "capacitor-blob-writer",
"classpath": "com.equimaps.capacitorblobwriter.BlobWriter"
},
{
"pkg": "capacitor-firebase-auth",
"classpath": "com.baumblatt.capacitor.firebase.auth.CapacitorFirebaseAuth"
}
]
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,10 @@
import com.getcapacitor.Plugin;

import java.util.ArrayList;
import com.baumblatt.capacitor.firebase.auth.CapacitorFirebaseAuth;

public class MainActivity extends BridgeActivity {
@Override
public void onCreate(Bundle savedInstanceState) {
// https://github.com/baumblatt/capacitor-firebase-auth/issues/170
// https://capacitorjs.com/docs/updating/4-0#change-registerplugin-order
registerPlugin(CapacitorFirebaseAuth.class);
super.onCreate(savedInstanceState);
}
}
4 changes: 2 additions & 2 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ buildscript {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:7.3.1'
classpath 'com.google.gms:google-services:4.3.13'
classpath 'com.android.tools.build:gradle:8.1.1'
classpath 'com.google.gms:google-services:4.3.15'

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
Expand Down
3 changes: 0 additions & 3 deletions android/capacitor.settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,3 @@ project(':capawesome-capacitor-app-update').projectDir = new File('../node_modul

include ':capacitor-blob-writer'
project(':capacitor-blob-writer').projectDir = new File('../node_modules/capacitor-blob-writer/android')

include ':capacitor-firebase-auth'
project(':capacitor-firebase-auth').projectDir = new File('../node_modules/capacitor-firebase-auth/android')
3 changes: 1 addition & 2 deletions android/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,4 @@ org.gradle.jvmargs=-Xmx1536m
# Android operating system, and which are packaged with your app's APK
# https://developer.android.com/topic/libraries/support-library/androidx-rn
android.useAndroidX=true
# Automatically convert third-party libraries to use AndroidX
android.enableJetifier=true

2 changes: 1 addition & 1 deletion android/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Sun Dec 04 19:15:48 PST 2022
distributionBase=GRADLE_USER_HOME
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0.2-all.zip
distributionPath=wrapper/dists
zipStorePath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
22 changes: 11 additions & 11 deletions android/variables.gradle
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
ext {
minSdkVersion = 22
compileSdkVersion = 32
targetSdkVersion = 32
androidxActivityVersion = '1.4.0'
androidxAppCompatVersion = '1.4.2'
compileSdkVersion = 33
targetSdkVersion = 33
androidxActivityVersion = '1.7.0'
androidxAppCompatVersion = '1.6.1'
androidxCoordinatorLayoutVersion = '1.2.0'
firebaseMessagingVersion = '23.0.5'
androidxCoreVersion = '1.8.0'
androidxFragmentVersion = '1.4.1'
firebaseMessagingVersion = '23.1.2'
androidxCoreVersion = '1.10.0'
androidxFragmentVersion = '1.5.6'
junitVersion = '4.13.2'
androidxJunitVersion = '1.1.3'
androidxEspressoCoreVersion = '3.4.0'
androidxJunitVersion = '1.1.5'
androidxEspressoCoreVersion = '3.5.1'
cordovaAndroidVersion = '10.1.1'
rgcfaIncludeGoogle = true
coreSplashScreenVersion = '1.0.0-rc01'
androidxWebkitVersion = '1.4.0'
coreSplashScreenVersion = '1.0.0'
androidxWebkitVersion = '1.6.1'
}
4 changes: 3 additions & 1 deletion capacitor.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import { CapacitorConfig } from "@capacitor/cli";
const config: CapacitorConfig = {
appId: "international.idems.plh_teens",
appName: "PLH Teens",
bundledWebRuntime: false,
webDir: "www",
plugins: {
SplashScreen: {
Expand All @@ -19,6 +18,9 @@ const config: CapacitorConfig = {
providers: ["google.com"],
},
},
server: {
androidScheme: "http",
},
};

export default config;
33 changes: 16 additions & 17 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,21 +40,20 @@
"@angular/platform-browser": "~15.0.4",
"@angular/platform-browser-dynamic": "~15.0.4",
"@angular/router": "~15.0.4",
"@capacitor-community/firebase-crashlytics": "^1.3.0",
"@capacitor-firebase/authentication": "^1.2.0",
"@capacitor-firebase/performance": "^1.2.0",
"@capacitor/android": "^4.6.0",
"@capacitor/app": "^4.1.1",
"@capacitor/cli": "^4.6.0",
"@capacitor/clipboard": "^4.1.0",
"@capacitor/core": "^4.6.0",
"@capacitor/device": "^4.1.0",
"@capacitor/filesystem": "^4.1.4",
"@capacitor/local-notifications": "^4.1.4",
"@capacitor/push-notifications": "^4.1.2",
"@capacitor/share": "^4.1.1",
"@capacitor/splash-screen": "^4.1.2",
"@capawesome/capacitor-app-update": "^2.0.1",
"@capacitor-community/firebase-crashlytics": "^3.0.0",
"@capacitor-firebase/authentication": "^5.1.0",
"@capacitor-firebase/performance": "^5.1.0",
"@capacitor/android": "^5.2.3",
"@capacitor/app": "^5.0.6",
"@capacitor/clipboard": "^5.0.6",
"@capacitor/core": "^5.2.3",
"@capacitor/device": "^5.0.6",
"@capacitor/filesystem": "^5.1.2",
"@capacitor/local-notifications": "^5.0.6",
"@capacitor/push-notifications": "^5.0.6",
"@capacitor/share": "^5.0.6",
"@capacitor/splash-screen": "^5.0.6",
"@capawesome/capacitor-app-update": "^5.0.1",
"@ionic-native/core": "^5.36.0",
"@ionic-native/device": "^5.36.0",
"@ionic-native/http": "^5.36.0",
Expand All @@ -68,8 +67,7 @@
"@supabase/supabase-js": "^2.13.1",
"app-data": "workspace:*",
"bootstrap-datepicker": "^1.10.0",
"capacitor-blob-writer": "^1.1.9",
"capacitor-firebase-auth": "^3.0.0",
"capacitor-blob-writer": "^1.1.14",
"clone": "^2.1.2",
"cordova-res": "^0.15.4",
"core-js": "^3.27.1",
Expand Down Expand Up @@ -121,6 +119,7 @@
"@angular/compiler": "~15.0.4",
"@angular/compiler-cli": "~15.0.4",
"@angular/language-service": "~15.0.4",
"@capacitor/cli": "^5.0.0",
"@compodoc/compodoc": "^1.1.19",
"@ionic/angular-toolkit": "^7.0.0",
"@ionic/cli": "^6.18.0",
Expand Down
2 changes: 1 addition & 1 deletion src/app/shared/services/analytics/analytics.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export class AnalyticsService extends SyncServiceBase {
this.matomoTracker.setCookieSameSite("Lax");

// set user id whenever ready
Device.getId().then(({ uuid }) => {
Device.getId().then(({ identifier: uuid }) => {
this.matomoTracker.setUserId(uuid);
});
}
Expand Down
2 changes: 1 addition & 1 deletion src/app/shared/services/auth/auth.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Injectable } from "@angular/core";
import { Auth } from "@angular/fire/auth";
import { FirebaseAuthentication, User } from "@capacitor-firebase/authentication";
import { BehaviorSubject, firstValueFrom } from "rxjs";
import { first, filter } from "rxjs/operators";
import { filter } from "rxjs/operators";
import { IAppConfig } from "../../model";
import { AppConfigService } from "../app-config/app-config.service";
import { SyncServiceBase } from "../syncService.base";
Expand Down
2 changes: 1 addition & 1 deletion src/app/shared/services/crashlytics/crashlytics.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export class CrashlyticsService extends AsyncServiceBase {
private async initialise() {
if (Capacitor.isNativePlatform()) {
await this.setEnabled({ enabled: true });
const { uuid } = await Device.getId();
const { identifier: uuid } = await Device.getId();
await this.setUserId({ userId: uuid });
// populate webview useragent info
const { webViewVersion } = await Device.getInfo();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ export class ErrorHandlerService extends ErrorHandler {
enabled: true,
tracesSampleRate: 0, // ensure performance traces not sent (not installed)
});
const { uuid } = await Device.getId();
const { identifier: uuid } = await Device.getId();
Sentry.setUser({ id: uuid });
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,11 @@ export class LocalNotificationService extends AsyncServiceBase {
return false;
}
}
// Return state of already granted
const { display } = await LocalNotifications.checkPermissions();
if (display === "granted") {
return true;
}
// Use notifications api to check permissions. Run in parallel with a 5-second
// timeout to resolve in cases where prompt does not appear or user fails to interact with it
const granted = await Promise.race([
Expand Down
2 changes: 1 addition & 1 deletion src/app/shared/services/server/server.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export class ServerService extends SyncServiceBase {
this.device_info = await Device.getInfo();
}
if (!this.app_user_id) {
const { uuid } = await Device.getId();
const { identifier: uuid } = await Device.getId();
this.app_user_id = uuid;
}
console.log("[SERVER] sync data");
Expand Down
2 changes: 1 addition & 1 deletion src/app/shared/services/userMeta/userMeta.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export class UserMetaService extends AsyncServiceBase {
userMetaValues.forEach((v) => {
userMeta[v.key] = v.value;
});
const { uuid } = await Device.getId();
const { identifier: uuid } = await Device.getId();
// fix legacy user IDs - note this can likely be removed after v0.16
if (userMeta.uuid && userMeta.uuid !== uuid) {
await this.setUserMeta({ uuid, uuid_temp: userMeta.uuid });
Expand Down
Loading

0 comments on commit 1bc714f

Please sign in to comment.