From 07118a870f8a065f052d1e55bbf43dc014e658f9 Mon Sep 17 00:00:00 2001 From: Loewy Date: Sat, 27 Jan 2024 15:11:42 -0800 Subject: [PATCH 1/2] android google-service.json linking --- App.tsx | 21 ++++++++++- android/app/build.gradle | 2 + android/app/google-services.json | 47 ++++++++++++++++++++++++ android/app/src/main/AndroidManifest.xml | 1 - android/build.gradle | 1 + app.json | 3 +- google-services.json | 47 ++++++++++++++++++++++++ 7 files changed, 118 insertions(+), 4 deletions(-) create mode 100644 android/app/google-services.json create mode 100644 google-services.json diff --git a/App.tsx b/App.tsx index 6a47ac6..63ac043 100644 --- a/App.tsx +++ b/App.tsx @@ -1,9 +1,26 @@ -import React from "react"; -import { Text } from "react-native"; +import React, { useEffect, useState } from "react"; +import { Alert, Text } from "react-native"; import ClientProvider from "./graphql/client"; import ShotsContainer from "./component/shot"; +import auth, { FirebaseAuthTypes } from '@react-native-firebase/auth'; + + const App: React.FC = () => { + const testFirebaseAuth = async () => { + try { + // Attempt to sign in anonymously + const userCredential: FirebaseAuthTypes.UserCredential = await auth().signInAnonymously(); + console.log('Signed in anonymously, User:', userCredential.user); + } catch (error) { + console.error('Error with Firebase Auth:', error); + } + }; + + useEffect(() => { + testFirebaseAuth(); + }, []); + return ( diff --git a/android/app/build.gradle b/android/app/build.gradle index bcb313f..489dcc7 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -178,3 +178,5 @@ dependencies { apply from: new File(["node", "--print", "require.resolve('@react-native-community/cli-platform-android/package.json')"].execute(null, rootDir).text.trim(), "../native_modules.gradle"); applyNativeModulesAppBuildGradle(project) + +apply plugin: 'com.google.gms.google-services' \ No newline at end of file diff --git a/android/app/google-services.json b/android/app/google-services.json new file mode 100644 index 0000000..d12e130 --- /dev/null +++ b/android/app/google-services.json @@ -0,0 +1,47 @@ +{ + "project_info": { + "project_number": "735905563616", + "project_id": "railbird-infra", + "storage_bucket": "railbird-infra.appspot.com" + }, + "client": [ + { + "client_info": { + "mobilesdk_app_id": "1:735905563616:android:7eefd99f68d2f7db702185", + "android_client_info": { + "package_name": "android.railbird.app" + } + }, + "oauth_client": [ + { + "client_id": "735905563616-v12rcdm7pkm1r2t5v09th5bs9j3ah1e4.apps.googleusercontent.com", + "client_type": 3 + } + ], + "api_key": [ + { + "current_key": "AIzaSyA5o4LpiDFl8Q8AaA2eGjbgdS7tMfupCWg" + } + ], + "services": { + "appinvite_service": { + "other_platform_oauth_client": [ + { + "client_id": "735905563616-v12rcdm7pkm1r2t5v09th5bs9j3ah1e4.apps.googleusercontent.com", + "client_type": 3 + }, + { + "client_id": "735905563616-ncd8794ocn2f25qmnaascn88upfgokp0.apps.googleusercontent.com", + "client_type": 2, + "ios_info": { + "bundle_id": "ai.railbird.railbird", + "app_store_id": "6469274937" + } + } + ] + } + } + } + ], + "configuration_version": "1" +} \ No newline at end of file diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index 72ac973..1eb663c 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -25,7 +25,6 @@ - diff --git a/android/build.gradle b/android/build.gradle index bf861db..63179df 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -17,6 +17,7 @@ buildscript { mavenCentral() } dependencies { + classpath 'com.google.gms:google-services:4.3.3' classpath('com.android.tools.build:gradle:7.4.2') classpath('com.facebook.react:react-native-gradle-plugin') } diff --git a/app.json b/app.json index 4683198..e9a87f7 100644 --- a/app.json +++ b/app.json @@ -36,7 +36,8 @@ "foregroundImage": "./assets/adaptive-icon.png", "backgroundColor": "#ffffff" }, - "package": "android.railbird.app" + "package": "android.railbird.app", + "googleServicesFile": "./google-services.json" }, "web": { "favicon": "./assets/favicon.png" diff --git a/google-services.json b/google-services.json new file mode 100644 index 0000000..d12e130 --- /dev/null +++ b/google-services.json @@ -0,0 +1,47 @@ +{ + "project_info": { + "project_number": "735905563616", + "project_id": "railbird-infra", + "storage_bucket": "railbird-infra.appspot.com" + }, + "client": [ + { + "client_info": { + "mobilesdk_app_id": "1:735905563616:android:7eefd99f68d2f7db702185", + "android_client_info": { + "package_name": "android.railbird.app" + } + }, + "oauth_client": [ + { + "client_id": "735905563616-v12rcdm7pkm1r2t5v09th5bs9j3ah1e4.apps.googleusercontent.com", + "client_type": 3 + } + ], + "api_key": [ + { + "current_key": "AIzaSyA5o4LpiDFl8Q8AaA2eGjbgdS7tMfupCWg" + } + ], + "services": { + "appinvite_service": { + "other_platform_oauth_client": [ + { + "client_id": "735905563616-v12rcdm7pkm1r2t5v09th5bs9j3ah1e4.apps.googleusercontent.com", + "client_type": 3 + }, + { + "client_id": "735905563616-ncd8794ocn2f25qmnaascn88upfgokp0.apps.googleusercontent.com", + "client_type": 2, + "ios_info": { + "bundle_id": "ai.railbird.railbird", + "app_store_id": "6469274937" + } + } + ] + } + } + } + ], + "configuration_version": "1" +} \ No newline at end of file From 3d9845e1b35af0fe9ea67e9dfca95d3f7f3b53a7 Mon Sep 17 00:00:00 2001 From: Loewy Date: Sat, 27 Jan 2024 15:17:09 -0800 Subject: [PATCH 2/2] revert App.tsx --- App.tsx | 21 ++------------------- 1 file changed, 2 insertions(+), 19 deletions(-) diff --git a/App.tsx b/App.tsx index 63ac043..6a47ac6 100644 --- a/App.tsx +++ b/App.tsx @@ -1,26 +1,9 @@ -import React, { useEffect, useState } from "react"; -import { Alert, Text } from "react-native"; +import React from "react"; +import { Text } from "react-native"; import ClientProvider from "./graphql/client"; import ShotsContainer from "./component/shot"; -import auth, { FirebaseAuthTypes } from '@react-native-firebase/auth'; - - const App: React.FC = () => { - const testFirebaseAuth = async () => { - try { - // Attempt to sign in anonymously - const userCredential: FirebaseAuthTypes.UserCredential = await auth().signInAnonymously(); - console.log('Signed in anonymously, User:', userCredential.user); - } catch (error) { - console.error('Error with Firebase Auth:', error); - } - }; - - useEffect(() => { - testFirebaseAuth(); - }, []); - return (