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',
webDir: 'out',
bundledWebRuntime: false,
// TODO: Do we need this?
// server: {
// allowNavigation: ['oneword-cf74a.firebaseapp.com', 'accounts.google.com'],
// },
server: {
// Allow these sites to be loaded from the webview
allowNavigation: ['mantic-markets.firebaseapp.com', 'accounts.google.com'],
},
plugins: {
CapacitorFirebaseAuth: {
providers: ['google.com'],

View File

@ -31,6 +31,8 @@ import { feed } from 'common/feed'
import { CATEGORY_LIST } from 'common/categories'
import { safeLocalStorage } from '../util/local'
import { filterDefined } from 'common/util/array'
import { cfaSignIn } from 'capacitor-firebase-auth'
import { Capacitor } from '@capacitor/core'
export type { User }
@ -126,8 +128,16 @@ export function listenForLogin(onUser: (user: User | null) => void) {
}
export async function firebaseLogin() {
const provider = new GoogleAuthProvider()
return signInWithPopup(auth, provider)
if (Capacitor.getPlatform() === 'android') {
// 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() {

View File

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