diff --git a/src/android/.idea/compiler.xml b/src/android/.idea/compiler.xml
new file mode 100644
index 00000000..61a9130c
--- /dev/null
+++ b/src/android/.idea/compiler.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/android/.idea/misc.xml b/src/android/.idea/misc.xml
index 974f06ab..921bc777 100644
--- a/src/android/.idea/misc.xml
+++ b/src/android/.idea/misc.xml
@@ -1,4 +1,4 @@
-
+
\ No newline at end of file
diff --git a/src/android/app/build.gradle b/src/android/app/build.gradle
index b9b27ab1..564b5dd2 100644
--- a/src/android/app/build.gradle
+++ b/src/android/app/build.gradle
@@ -66,6 +66,15 @@ dependencies {
androidTestImplementation "androidx.test.ext:junit:$androidxJunitVersion"
androidTestImplementation "androidx.test.espresso:espresso-core:$androidxEspressoCoreVersion"
implementation project(':capacitor-cordova-android-plugins')
+ // Import the BoM for the Firebase platform
+ implementation platform('com.google.firebase:firebase-bom:26.5.0')
+
+ // Declare the dependency for the Firebase Authentication library
+ // When using the BoM, you don't specify versions in Firebase library dependencies
+ implementation 'com.google.firebase:firebase-auth'
+
+ // Also declare the dependency for the Google Play services library and specify its version
+ implementation 'com.google.android.gms:play-services-auth:19.0.0'
}
apply from: 'capacitor.build.gradle'
diff --git a/src/android/app/capacitor.build.gradle b/src/android/app/capacitor.build.gradle
index 837cd452..dc88ff5b 100644
--- a/src/android/app/capacitor.build.gradle
+++ b/src/android/app/capacitor.build.gradle
@@ -9,7 +9,7 @@ android {
apply from: "../capacitor-cordova-android-plugins/cordova.variables.gradle"
dependencies {
-
+ implementation project(':codetrix-studio-capacitor-google-auth')
}
diff --git a/src/android/app/google-services.json b/src/android/app/google-services.json
new file mode 100644
index 00000000..b6b4ff1c
--- /dev/null
+++ b/src/android/app/google-services.json
@@ -0,0 +1,64 @@
+{
+ "project_info": {
+ "project_number": "200739882604",
+ "firebase_url": "https://dynamicbible-7c6cf.firebaseio.com",
+ "project_id": "dynamicbible-7c6cf",
+ "storage_bucket": "dynamicbible-7c6cf.appspot.com"
+ },
+ "client": [
+ {
+ "client_info": {
+ "mobilesdk_app_id": "1:200739882604:android:98d382a57407577e",
+ "android_client_info": {
+ "package_name": "walljm.dynamicbible"
+ }
+ },
+ "oauth_client": [
+ {
+ "client_id": "200739882604-cdsthjn22k31civpbbp3hv1vhhqan27u.apps.googleusercontent.com",
+ "client_type": 1,
+ "android_info": {
+ "package_name": "walljm.dynamicbible",
+ "certificate_hash": "61703efe57998735ca5d22fec522d099cea1e83c"
+ }
+ },
+ {
+ "client_id": "200739882604-vl9sdm2o394c9v8dlnt6j41ng99bfdc4.apps.googleusercontent.com",
+ "client_type": 1,
+ "android_info": {
+ "package_name": "walljm.dynamicbible",
+ "certificate_hash": "51e2a302e891905184570920c3b9ec332cc9a15b"
+ }
+ },
+ {
+ "client_id": "200739882604-vlavth3q12b5vbm8jflb791e84dnr2a5.apps.googleusercontent.com",
+ "client_type": 1,
+ "android_info": {
+ "package_name": "walljm.dynamicbible",
+ "certificate_hash": "f431037c6ae25c37ec4d3cb5626220143e864f37"
+ }
+ },
+ {
+ "client_id": "200739882604-i4mk6rp4mcb8n590j5kc8i6bncpm5bo1.apps.googleusercontent.com",
+ "client_type": 3
+ }
+ ],
+ "api_key": [
+ {
+ "current_key": "AIzaSyA05ZDn1nyjceJSpDta5esnvKSV4RKEbH4"
+ }
+ ],
+ "services": {
+ "appinvite_service": {
+ "other_platform_oauth_client": [
+ {
+ "client_id": "200739882604-418lja1hb6d76ttfsdo3fdu733svukqj.apps.googleusercontent.com",
+ "client_type": 3
+ }
+ ]
+ }
+ }
+ }
+ ],
+ "configuration_version": "1"
+}
diff --git a/src/android/app/src/main/assets/capacitor.config.json b/src/android/app/src/main/assets/capacitor.config.json
index 41a16a90..c060cfca 100644
--- a/src/android/app/src/main/assets/capacitor.config.json
+++ b/src/android/app/src/main/assets/capacitor.config.json
@@ -7,7 +7,13 @@
"plugins": {
"SplashScreen": {
"launchShowDuration": 0
+ },
+ "GoogleAuth": {
+ "scopes": ["profile", "email"],
+ "serverClientId": "200739882604-i4mk6rp4mcb8n590j5kc8i6bncpm5bo1.apps.googleusercontent.com",
+ "forceCodeForRefreshToken" : true
}
+
},
"cordova": {}
}
diff --git a/src/android/app/src/main/java/com/walljm/dynamicbible/MainActivity.java b/src/android/app/src/main/java/com/walljm/dynamicbible/MainActivity.java
index 25c55f88..ab61b1f7 100644
--- a/src/android/app/src/main/java/com/walljm/dynamicbible/MainActivity.java
+++ b/src/android/app/src/main/java/com/walljm/dynamicbible/MainActivity.java
@@ -6,6 +6,7 @@ import com.getcapacitor.BridgeActivity;
import com.getcapacitor.Plugin;
import java.util.ArrayList;
+import com.codetrixstudio.capacitor.GoogleAuth.GoogleAuth;
public class MainActivity extends BridgeActivity {
@Override
@@ -16,6 +17,7 @@ public class MainActivity extends BridgeActivity {
this.init(savedInstanceState, new ArrayList>() {{
// Additional plugins you've installed go here
// Ex: add(TotallyAwesomePlugin.class);
+ add(GoogleAuth.class);
}});
}
}
diff --git a/src/android/app/src/main/res/values/strings.xml b/src/android/app/src/main/res/values/strings.xml
index 5c4a9ac5..91516985 100644
--- a/src/android/app/src/main/res/values/strings.xml
+++ b/src/android/app/src/main/res/values/strings.xml
@@ -4,4 +4,5 @@
dynamicbible
walljm.dynamicbible
walljm.dynamicbible
+ 200739882604-i4mk6rp4mcb8n590j5kc8i6bncpm5bo1.apps.googleusercontent.com
diff --git a/src/android/build.gradle b/src/android/build.gradle
index f1dc744c..0d5dc23a 100644
--- a/src/android/build.gradle
+++ b/src/android/build.gradle
@@ -10,7 +10,7 @@ buildscript {
}
}
dependencies {
- classpath 'com.android.tools.build:gradle:4.1.0'
+ classpath 'com.android.tools.build:gradle:4.1.2'
classpath 'com.google.gms:google-services:4.3.3'
classpath "com.github.triplet.gradle:play-publisher:3.1.0"
diff --git a/src/android/capacitor.settings.gradle b/src/android/capacitor.settings.gradle
index 9a5fa872..56690ca8 100644
--- a/src/android/capacitor.settings.gradle
+++ b/src/android/capacitor.settings.gradle
@@ -1,3 +1,6 @@
// DO NOT EDIT THIS FILE! IT IS GENERATED EACH TIME "capacitor update" IS RUN
include ':capacitor-android'
project(':capacitor-android').projectDir = new File('../node_modules/@capacitor/android/capacitor')
+
+include ':codetrix-studio-capacitor-google-auth'
+project(':codetrix-studio-capacitor-google-auth').projectDir = new File('../node_modules/@codetrix-studio/capacitor-google-auth/android')
diff --git a/src/capacitor.config.json b/src/capacitor.config.json
index 41a16a90..c060cfca 100644
--- a/src/capacitor.config.json
+++ b/src/capacitor.config.json
@@ -7,7 +7,13 @@
"plugins": {
"SplashScreen": {
"launchShowDuration": 0
+ },
+ "GoogleAuth": {
+ "scopes": ["profile", "email"],
+ "serverClientId": "200739882604-i4mk6rp4mcb8n590j5kc8i6bncpm5bo1.apps.googleusercontent.com",
+ "forceCodeForRefreshToken" : true
}
+
},
"cordova": {}
}
diff --git a/src/package-lock.json b/src/package-lock.json
index d9b1244e..a3bad9a6 100644
--- a/src/package-lock.json
+++ b/src/package-lock.json
@@ -1847,6 +1847,29 @@
"resolved": "https://registry.npmjs.org/@capacitor/ios/-/ios-2.4.0.tgz",
"integrity": "sha512-G4WcQHS4RuK94Ncoi5K+r12DWPqkB8yZKupQrJaGT1S/Zyc3mcA9m1f4HwRPlYCwyxQ6lCd8+N9GYxLu7Kv+SA=="
},
+ "@codetrix-studio/capacitor-google-auth": {
+ "version": "2.1.3",
+ "resolved": "https://registry.npmjs.org/@codetrix-studio/capacitor-google-auth/-/capacitor-google-auth-2.1.3.tgz",
+ "integrity": "sha512-uglDFmaE9109dAEq+EIXIkAmST9zn8U+aw/f48bHdD52yKEPWExpHqUR0v0W4OeY4jepB7SUgBk8mCcLjxDmDA==",
+ "requires": {
+ "@capacitor/core": "^2.4.6"
+ },
+ "dependencies": {
+ "@capacitor/core": {
+ "version": "2.4.6",
+ "resolved": "https://registry.npmjs.org/@capacitor/core/-/core-2.4.6.tgz",
+ "integrity": "sha512-3KLSMorCELA5RNRXwHOGlRGuxXaxCEYHC29wOUxObicI2mf14hbMJWylt4QBzNmSqh3/ha7u4/CAZMoJUQR/QA==",
+ "requires": {
+ "tslib": "^1.9.0"
+ }
+ },
+ "tslib": {
+ "version": "1.14.1",
+ "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz",
+ "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg=="
+ }
+ }
+ },
"@dabh/diagnostics": {
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/@dabh/diagnostics/-/diagnostics-2.0.2.tgz",
diff --git a/src/package.json b/src/package.json
index aa255954..cfc1d353 100644
--- a/src/package.json
+++ b/src/package.json
@@ -30,6 +30,7 @@
"@capacitor/cli": "^2.4.0",
"@capacitor/core": "^2.4.0",
"@capacitor/ios": "^2.4.0",
+ "@codetrix-studio/capacitor-google-auth": "^2.1.3",
"@ngx-pwa/local-storage": "^10.0.1",
"@types/mathjs": "^6.0.5",
"angular2-uuid": "^1.1.1",
diff --git a/src/src/app/components/settings/settings.component.ts b/src/src/app/components/settings/settings.component.ts
index 56a6b91f..4ddbde6e 100644
--- a/src/src/app/components/settings/settings.component.ts
+++ b/src/src/app/components/settings/settings.component.ts
@@ -7,8 +7,9 @@ import { MatDialog } from '@angular/material/dialog';
import { AngularFireAuth } from '@angular/fire/auth';
import { auth } from 'firebase/app';
+import { Capacitor, Plugins } from '@capacitor/core';
+import '@codetrix-studio/capacitor-google-auth';
-import { Storable } from 'src/app/common/storable';
import { SubscriberBase } from '../../common/subscriber-base';
import { DisplaySettings } from 'src/app/models/app-state';
import { CardFonts } from 'src/app/constants';
@@ -40,8 +41,8 @@ export class SettingsComponent extends SubscriberBase {
constructor(
public appService: AppService,
- private navService: NavService,
public authService: AngularFireAuth,
+ private navService: NavService,
private dialog: MatDialog,
private snackBar: MatSnackBar
) {
@@ -74,14 +75,24 @@ export class SettingsComponent extends SubscriberBase {
);
}
- login() {
- this.authService.signInWithPopup(new auth.GoogleAuthProvider()).then((cred) => {
- console.log('Authenticated.');
- });
+ async login() {
+ if (Capacitor.isNative) {
+ const googleUser = await Plugins.GoogleAuth.signIn();
+ const credential = auth.GoogleAuthProvider.credential(googleUser.authentication.idToken);
+ this.authService.signInAndRetrieveDataWithCredential(credential);
+ } else {
+ this.authService.signInWithPopup(new auth.GoogleAuthProvider()).then((cred) => {
+ console.log('Authenticated.');
+ });
+ }
}
- logout() {
- this.authService.signOut();
+ async logout() {
+ if (Capacitor.isNative) {
+ await Plugins.GoogleAuth.signOut();
+ }
+ await this.authService.signOut();
+ this.appService.setUser(null); // clear the user.
}
//#region Page Settings
diff --git a/src/src/app/constants.ts b/src/src/app/constants.ts
index a76c4597..9d6c6e0f 100644
--- a/src/src/app/constants.ts
+++ b/src/src/app/constants.ts
@@ -13,7 +13,7 @@ export const FirebaseConfig = {
authDomain: 'dynamicbible-7c6cf.firebaseapp.com',
databaseURL: 'https://dynamicbible-7c6cf.firebaseio.com',
projectId: 'dynamicbible-7c6cf',
- storageBucket: '',
+ storageBucket: 'dynamicbible-7c6cf.appspot.com',
messagingSenderId: '200739882604',
};
// export const FirebaseConfig = {
@@ -23,5 +23,4 @@ export const FirebaseConfig = {
// projectId: 'dynamic-bible-testing',
// storageBucket: 'dynamic-bible-testing.appspot.com',
// messagingSenderId: '813845246474',
-// appId: '1:813845246474:web:6dccfa057b6cb3067565f3',
// };