mirror of
https://github.com/CompassConnections/Compass.git
synced 2026-04-03 22:44:35 -04:00
Fix APK discrimination
This commit is contained in:
@@ -1,11 +1,13 @@
|
||||
import type { CapacitorConfig } from '@capacitor/cli';
|
||||
|
||||
const LOCAL_ANDROID = process.env.NEXT_PUBLIC_LOCAL_ANDROID !== undefined
|
||||
|
||||
const config: CapacitorConfig = {
|
||||
appId: 'com.compass.app',
|
||||
appName: 'Compass',
|
||||
webDir: 'web/.next',
|
||||
server: {
|
||||
url: 'https://compassmeet.com',
|
||||
url: LOCAL_ANDROID ? "http://10.0.2.2:3000" : 'https://compassmeet.com',
|
||||
cleartext: true
|
||||
},
|
||||
};
|
||||
|
||||
@@ -6,7 +6,6 @@ import {getAuth, GoogleAuthProvider, OAuthProvider, signInWithCredential, signIn
|
||||
import {safeLocalStorage} from '../util/local'
|
||||
import {app} from './init'
|
||||
import {SocialLogin} from "@capgo/capacitor-social-login";
|
||||
import {Capacitor} from "@capacitor/core";
|
||||
|
||||
dayjs.extend(utc)
|
||||
|
||||
@@ -79,11 +78,14 @@ export async function googleNativeLogin() {
|
||||
return userCredential
|
||||
}
|
||||
|
||||
export const isRunningInAPK = () => typeof window !== 'undefined' && (window as any).IS_APK === true
|
||||
|
||||
export async function firebaseLogin() {
|
||||
if (Capacitor.isNativePlatform()) {
|
||||
if (isRunningInAPK()) {
|
||||
console.log('Running in APK')
|
||||
return await googleNativeLogin()
|
||||
}
|
||||
console.log('Running in web')
|
||||
const provider = new GoogleAuthProvider()
|
||||
return signInWithPopup(auth, provider).then(async (result) => {
|
||||
return result
|
||||
|
||||
Reference in New Issue
Block a user