WIP: capacitor-firebase-auth might be dead

This commit is contained in:
Austin Chen 2022-06-27 14:55:01 -05:00
parent 6997e123f6
commit c92f032174
3 changed files with 17 additions and 7 deletions

View File

@ -5,10 +5,10 @@ const config: CapacitorConfig = {
appName: 'Manifold Markets', appName: 'Manifold Markets',
webDir: 'out', webDir: 'out',
bundledWebRuntime: false, bundledWebRuntime: false,
// TODO: Do we need this? server: {
// server: { // Allow these sites to be loaded from the webview
// allowNavigation: ['oneword-cf74a.firebaseapp.com', 'accounts.google.com'], allowNavigation: ['mantic-markets.firebaseapp.com', 'accounts.google.com'],
// }, },
plugins: { plugins: {
CapacitorFirebaseAuth: { CapacitorFirebaseAuth: {
providers: ['google.com'], providers: ['google.com'],

View File

@ -31,6 +31,8 @@ import { feed } from 'common/feed'
import { CATEGORY_LIST } from 'common/categories' import { CATEGORY_LIST } from 'common/categories'
import { safeLocalStorage } from '../util/local' import { safeLocalStorage } from '../util/local'
import { filterDefined } from 'common/util/array' import { filterDefined } from 'common/util/array'
import { cfaSignIn } from 'capacitor-firebase-auth'
import { Capacitor } from '@capacitor/core'
export type { User } export type { User }
@ -126,8 +128,16 @@ export function listenForLogin(onUser: (user: User | null) => void) {
} }
export async function firebaseLogin() { export async function firebaseLogin() {
const provider = new GoogleAuthProvider() if (Capacitor.getPlatform() === 'android') {
return signInWithPopup(auth, provider) // Seems broken, because we're on firebase v9 instead of v8...
console.log('firebaseLogin: android')
cfaSignIn('google.com').subscribe((u) => {
console.log('firebaseLogin:', u)
})
} else {
const provider = new GoogleAuthProvider()
return signInWithPopup(auth, provider)
}
} }
export async function firebaseLogout() { export async function firebaseLogout() {

View File

@ -10,7 +10,7 @@
"dev:emulate": "cross-env NEXT_PUBLIC_FIREBASE_EMULATE=TRUE yarn devdev", "dev:emulate": "cross-env NEXT_PUBLIC_FIREBASE_EMULATE=TRUE yarn devdev",
"ts": "tsc --noEmit --incremental --preserveWatchOutput --pretty", "ts": "tsc --noEmit --incremental --preserveWatchOutput --pretty",
"build": "next build", "build": "next build",
"export": "next export", "export": "next build && next export",
"start": "next start", "start": "next start",
"lint": "next lint", "lint": "next lint",
"format": "npx prettier --write .", "format": "npx prettier --write .",