Skip to content

Commit 3b8f04c

Browse files
authored
Merge pull request #2230 from IDEMSInternational/chore/update-firebase-bom
chore: update Firebase BoM; refactor: auth actions
2 parents d44eb13 + fcd997f commit 3b8f04c

File tree

4 files changed

+39
-6
lines changed

4 files changed

+39
-6
lines changed

android/app/build.gradle

+1-3
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,12 @@ dependencies {
3737
implementation project(':capacitor-cordova-android-plugins')
3838

3939
// Import the BoM for the Firebase platform
40-
implementation platform('com.google.firebase:firebase-bom:29.3.0')
40+
implementation platform('com.google.firebase:firebase-bom:32.7.2')
4141

4242
// Declare the dependencies for the Crashlytics and Analytics libraries
4343
// When using the BoM, you don't specify versions in Firebase library dependencies
4444
implementation 'com.google.firebase:firebase-crashlytics'
4545
implementation 'com.google.firebase:firebase-perf'
46-
// https://github.com/mixpanel/mixpanel-android/issues/744
47-
implementation("com.google.firebase:firebase-iid")
4846
}
4947

5048
apply from: 'capacitor.build.gradle'

packages/data-models/flowTypes.ts

+5
Original file line numberDiff line numberDiff line change
@@ -379,11 +379,16 @@ export namespace FlowTypes {
379379
"asset_pack",
380380
"audio_end",
381381
"audio_play",
382+
"auth",
382383
"changed",
383384
"emit",
384385
"feedback",
385386
"go_to",
386387
"go_to_url",
388+
/**
389+
* @deprecated since v0.16.27
390+
* Use `auth: sign_in_google` instead
391+
* */
387392
"google_auth",
388393
"open_external",
389394
"pop_up",

src/app/shared/components/template/services/instance/template-action.service.ts

-2
Original file line numberDiff line numberDiff line change
@@ -226,8 +226,6 @@ export class TemplateActionService extends SyncServiceBase {
226226
);
227227
const processor = new TemplateProcessService(this.injector);
228228
return processor.processTemplateWithoutRender(templateToProcess);
229-
case "google_auth":
230-
return await this.authService.signInWithGoogle();
231229
case "emit":
232230
const [emit_value, emit_data] = args;
233231
const container: TemplateContainerComponent = this.container;

src/app/shared/services/auth/auth.service.ts

+33-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import { filter } from "rxjs/operators";
66
import { IAppConfig } from "../../model";
77
import { AppConfigService } from "../app-config/app-config.service";
88
import { SyncServiceBase } from "../syncService.base";
9+
import { TemplateActionRegistry } from "../../components/template/services/instance/template-action.registry";
910

1011
@Injectable({
1112
providedIn: "root",
@@ -15,13 +16,18 @@ export class AuthService extends SyncServiceBase {
1516
appFields: IAppConfig["APP_FIELDS"];
1617

1718
// include auth import to ensure app registered
18-
constructor(auth: Auth, private appConfigService: AppConfigService) {
19+
constructor(
20+
auth: Auth,
21+
private appConfigService: AppConfigService,
22+
private templateActionRegistry: TemplateActionRegistry
23+
) {
1924
super("Auth");
2025
this.initialise();
2126
}
2227
private initialise() {
2328
this.subscribeToAppConfigChanges();
2429
this.addAuthListeners();
30+
this.registerTemplateActionHandlers();
2531
}
2632

2733
/** Return a promise that resolves after a signed in user defined */
@@ -42,6 +48,32 @@ export class AuthService extends SyncServiceBase {
4248
return user;
4349
}
4450

51+
private registerTemplateActionHandlers() {
52+
this.templateActionRegistry.register({
53+
auth: async ({ args }) => {
54+
const [actionId] = args;
55+
const childActions = {
56+
sign_in_google: async () => await this.signInWithGoogle(),
57+
sign_out: async () => await this.signOut(),
58+
};
59+
// To support deprecated "share" action (previously used to share text only),
60+
// assume text is being shared if first arg is not an actionId
61+
if (!(actionId in childActions)) {
62+
console.error(`[AUTH] - No action, "${actionId}"`);
63+
return;
64+
}
65+
return childActions[actionId]();
66+
},
67+
/**
68+
* @deprecated since v0.16.27
69+
* Use `auth: sign_in_google` instead
70+
* */
71+
google_auth: async () => {
72+
return await this.signInWithGoogle();
73+
},
74+
});
75+
}
76+
4577
/** Listen to auth state changes and update local subject accordingly */
4678
private addAuthListeners() {
4779
FirebaseAuthentication.addListener("authStateChange", ({ user }) => {

0 commit comments

Comments
 (0)