Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix google auth in share extension #16

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@

# VSCode
.vscode/

# But don't ignore the settings.json file
!.vscode/settings.json
jsconfig.json

# Xcode
Expand Down
9 changes: 9 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"editor.defaultFormatter": "dbaeumer.vscode-eslint",
"editor.codeActionsOnSave": {
"source.fixAll.eslint": "always"
},
"eslint.format.enable": true,
"lldb.library": "/Applications/Xcode.app/Contents/SharedFrameworks/LLDB.framework/Versions/A/LLDB",
"lldb.launch.expressions": "native"
}
8 changes: 4 additions & 4 deletions examples/with-firebase/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import auth, { type FirebaseAuthTypes } from "@react-native-firebase/auth";
import { useEffect, useState } from "react";
import { Alert, Button, StyleSheet, Text, View } from "react-native";

import { AppleAuthLoginButton } from "./components/AppleAuthLogin";
import { Login } from "./components/Login";

export default function App() {
const [session, setSession] = useState<FirebaseAuthTypes.User | null>(null);
Expand Down Expand Up @@ -37,7 +37,7 @@ export default function App() {
<Text
style={{ fontFamily: "Inter-Black", fontSize: 24, marginBottom: 10 }}
>
Basic Example
Firebase Auth Example
</Text>
<Text
style={{
Expand All @@ -63,13 +63,13 @@ export default function App() {
auth()
.signOut()
.catch((error) =>
Alert.alert("Authentication Error", error.message)
Alert.alert("Authentication Error", error.message),
)
}
/>
</View>
) : (
<AppleAuthLoginButton />
<Login />
)}
</View>
</View>
Expand Down
61 changes: 33 additions & 28 deletions examples/with-firebase/ShareExtension.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { type InitialProps, close } from "expo-share-extension";
import { useEffect, useState } from "react";
import { Alert, Button, Text, View, StyleSheet } from "react-native";

import { AppleAuthLoginButton } from "./components/AppleAuthLogin";
import { Login } from "./components/Login";

export default function ShareExtension({ url, text }: InitialProps) {
const [session, setSession] = useState<FirebaseAuthTypes.User | null>(null);
Expand Down Expand Up @@ -35,35 +35,42 @@ export default function ShareExtension({ url, text }: InitialProps) {

return (
<View style={styles.container}>
<Text
style={{ fontFamily: "Inter-Black", fontSize: 24, marginBottom: 10 }}
>
Firebase Example
</Text>
{url && (
<View style={{ flex: 1 }}>
<Text
style={{
fontFamily: "Inter-Black",
fontSize: 24,
marginBottom: 10,
textAlign: "center",
color: "#313639",
fontSize: 16,
}}
>
URL: {url}
Firebase Example
</Text>
)}
{text && (
<Text
style={{
textAlign: "center",
color: "#313639",
fontSize: 16,
}}
>
Text: {text}
</Text>
)}
<Button title="Close" onPress={close} />
<View style={{ paddingTop: 30 }}>
{url && (
<Text
style={{
textAlign: "center",
color: "#313639",
fontSize: 16,
}}
>
URL: {url}
</Text>
)}
{text && (
<Text
style={{
textAlign: "center",
color: "#313639",
fontSize: 16,
}}
>
Text: {text}
</Text>
)}
<Button title="Close" onPress={close} />
</View>
<View style={{ flex: 1, paddingTop: 30 }}>
{session ? (
<View>
<Text
Expand All @@ -81,13 +88,13 @@ export default function ShareExtension({ url, text }: InitialProps) {
auth()
.signOut()
.catch((error) =>
Alert.alert("Authentication Error", error.message)
Alert.alert("Authentication Error", error.message),
)
}
/>
</View>
) : (
<AppleAuthLoginButton />
<Login />
)}
</View>
</View>
Expand All @@ -99,8 +106,6 @@ const styles = StyleSheet.create({
flex: 1,
borderRadius: 20,
backgroundColor: "#FAF8F5",
alignItems: "center",
justifyContent: "center",
padding: 30,
},
});
1 change: 1 addition & 0 deletions examples/with-firebase/app.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
}
],
"expo-apple-authentication",
"@react-native-google-signin/google-signin",
"@react-native-firebase/app",
"@react-native-firebase/auth",
[
Expand Down
39 changes: 0 additions & 39 deletions examples/with-firebase/components/AppleAuthLogin.tsx

This file was deleted.

37 changes: 37 additions & 0 deletions examples/with-firebase/components/Login.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import * as AppleAuthentication from "expo-apple-authentication";
import { Pressable, Text, View } from "react-native";

import { signInWithApple, signInWithGoogle } from "../lib/auth";

export const Login = () => {
return (
<View style={{ flex: 1, alignItems: "center", gap: 10 }}>
<Pressable
onPress={signInWithGoogle}
style={{
alignItems: "center",
justifyContent: "center",
backgroundColor: "lightblue",
width: "80%",
height: 50,
borderRadius: 10,
borderColor: "lightblue",
borderWidth: 1,
shadowColor: "lightblue",
shadowOffset: { width: 0, height: 0 },
shadowOpacity: 0.2,
shadowRadius: 10,
}}
>
<Text style={{ fontSize: 18 }}>Sign In with Google</Text>
</Pressable>
<AppleAuthentication.AppleAuthenticationButton
buttonType={AppleAuthentication.AppleAuthenticationButtonType.SIGN_IN}
buttonStyle={AppleAuthentication.AppleAuthenticationButtonStyle.BLACK}
cornerRadius={10}
onPress={signInWithApple}
style={{ height: 50, width: "80%" }}
/>
</View>
);
};
38 changes: 36 additions & 2 deletions examples/with-firebase/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -815,6 +815,12 @@ PODS:
- abseil/base/base_internal
- abseil/base/config
- abseil/meta/type_traits
- AppAuth (1.7.3):
- AppAuth/Core (= 1.7.3)
- AppAuth/ExternalUserAgent (= 1.7.3)
- AppAuth/Core (1.7.3)
- AppAuth/ExternalUserAgent (1.7.3):
- AppAuth/Core
- boost (1.83.0)
- BoringSSL-GRPC (0.0.32):
- BoringSSL-GRPC/Implementation (= 0.0.32)
Expand Down Expand Up @@ -899,6 +905,10 @@ PODS:
- glog
- RCT-Folly (= 2022.05.16.00)
- React-Core
- ExpoAdapterGoogleSignIn (11.0.1):
- ExpoModulesCore
- GoogleSignIn (~> 7.0)
- React-Core
- ExpoAppleAuthentication (6.3.0):
- ExpoModulesCore
- ExpoFileSystem (16.0.8):
Expand All @@ -912,7 +922,7 @@ PODS:
- React-NativeModulesApple
- React-RCTAppDelegate
- ReactCommon/turbomodule/core
- ExpoShareExtension (1.4.0):
- ExpoShareExtension (1.5.0):
- ExpoModulesCore
- EXSplashScreen (0.26.4):
- ExpoModulesCore
Expand Down Expand Up @@ -975,6 +985,10 @@ PODS:
- FirebaseSharedSwift (10.23.0)
- fmt (6.2.1)
- glog (0.3.5)
- GoogleSignIn (7.0.0):
- AppAuth (~> 1.5)
- GTMAppAuth (< 3.0, >= 1.3)
- GTMSessionFetcher/Core (< 4.0, >= 1.1)
- GoogleUtilities/AppDelegateSwizzler (7.13.0):
- GoogleUtilities/Environment
- GoogleUtilities/Logger
Expand Down Expand Up @@ -1075,6 +1089,9 @@ PODS:
- gRPC-Core/Privacy (= 1.62.1)
- gRPC-Core/Interface (1.62.1)
- gRPC-Core/Privacy (1.62.1)
- GTMAppAuth (2.0.0):
- AppAuth/Core (~> 1.6)
- GTMSessionFetcher/Core (< 4.0, >= 1.5)
- GTMSessionFetcher/Core (3.3.2)
- hermes-engine (0.73.6):
- hermes-engine/Pre-built (= 0.73.6)
Expand Down Expand Up @@ -2138,6 +2155,9 @@ PODS:
- nanopb (< 2.30910.0, >= 2.30908.0)
- React-Core
- RNFBApp
- RNGoogleSignin (11.0.1):
- GoogleSignIn (~> 7.0.0)
- React-Core
- SocketRocket (0.6.1)
- Yoga (1.14.0)

Expand All @@ -2153,6 +2173,7 @@ DEPENDENCIES:
- expo-dev-launcher (from `../node_modules/expo-dev-launcher`)
- expo-dev-menu (from `../node_modules/expo-dev-menu`)
- expo-dev-menu-interface (from `../node_modules/expo-dev-menu-interface/ios`)
- "ExpoAdapterGoogleSignIn (from `../node_modules/@react-native-google-signin/google-signin/expo/ios`)"
- ExpoAppleAuthentication (from `../node_modules/expo-apple-authentication/ios`)
- ExpoFileSystem (from `../node_modules/expo-file-system/ios`)
- ExpoKeepAwake (from `../node_modules/expo-keep-awake/ios`)
Expand Down Expand Up @@ -2211,11 +2232,13 @@ DEPENDENCIES:
- "RNFBApp (from `../node_modules/@react-native-firebase/app`)"
- "RNFBAuth (from `../node_modules/@react-native-firebase/auth`)"
- "RNFBFirestore (from `../node_modules/@react-native-firebase/firestore`)"
- "RNGoogleSignin (from `../node_modules/@react-native-google-signin/google-signin`)"
- Yoga (from `../node_modules/react-native/ReactCommon/yoga`)

SPEC REPOS:
trunk:
- abseil
- AppAuth
- BoringSSL-GRPC
- Firebase
- FirebaseAppCheckInterop
Expand All @@ -2227,9 +2250,11 @@ SPEC REPOS:
- FirebaseFirestoreInternal
- FirebaseSharedSwift
- fmt
- GoogleSignIn
- GoogleUtilities
- "gRPC-C++"
- gRPC-Core
- GTMAppAuth
- GTMSessionFetcher
- leveldb-library
- libevent
Expand Down Expand Up @@ -2261,6 +2286,8 @@ EXTERNAL SOURCES:
:path: "../node_modules/expo-dev-menu"
expo-dev-menu-interface:
:path: "../node_modules/expo-dev-menu-interface/ios"
ExpoAdapterGoogleSignIn:
:path: "../node_modules/@react-native-google-signin/google-signin/expo/ios"
ExpoAppleAuthentication:
:path: "../node_modules/expo-apple-authentication/ios"
ExpoFileSystem:
Expand Down Expand Up @@ -2372,11 +2399,14 @@ EXTERNAL SOURCES:
:path: "../node_modules/@react-native-firebase/auth"
RNFBFirestore:
:path: "../node_modules/@react-native-firebase/firestore"
RNGoogleSignin:
:path: "../node_modules/@react-native-google-signin/google-signin"
Yoga:
:path: "../node_modules/react-native/ReactCommon/yoga"

SPEC CHECKSUMS:
abseil: ebec4f56469dd7ce9ab08683c0319a68aa0ad86e
AppAuth: a13994980c1ec792f7e2e665acd4d4aa6be43240
boost: d3f49c53809116a5d38da093a8aa78bf551aed09
BoringSSL-GRPC: 1e2348957acdbcad360b80a264a90799984b2ba6
DoubleConversion: fea03f2699887d960129cc54bba7e52542b6f953
Expand All @@ -2389,11 +2419,12 @@ SPEC CHECKSUMS:
expo-dev-launcher: 957d62f7ec983d02091c97fca9ac73c115b54f77
expo-dev-menu: 68ea53d923996e27b20ce02b51cc820fc2327a83
expo-dev-menu-interface: 7ba029c9d1a82ac22b9b584c00514860b060553e
ExpoAdapterGoogleSignIn: 8b749750f4b43e884a89d5c5c8a64ae21854e84d
ExpoAppleAuthentication: 4fc9972356977f009911f2f3a5f56319c2a5b11b
ExpoFileSystem: eecaf6796aed0f4dd20042dc2ca2cac6c4bc1185
ExpoKeepAwake: 0f5cad99603a3268e50af9a6eb8b76d0d9ac956c
ExpoModulesCore: 9e2287ef69fb71b578d4b1e4e8e7a3c8abb04fe4
ExpoShareExtension: 92d54dccb01e825bd7adcd234da4efe752feea2d
ExpoShareExtension: 8a07aced7f0058537e4811f7231b0a7296308191
EXSplashScreen: 6bd596128cd52fac91997ebc64f3d394c843a8f9
EXUpdatesInterface: 3e444e2093e25b7ca0999a7d8c16e8392dee70c3
FBLazyVector: f64d1e2ea739b4d8f7e4740cde18089cd97fe864
Expand All @@ -2409,9 +2440,11 @@ SPEC CHECKSUMS:
FirebaseSharedSwift: c92645b392db3c41a83a0aa967de16f8bad25568
fmt: ff9d55029c625d3757ed641535fd4a75fedc7ce9
glog: c5d68082e772fa1c511173d6b30a9de2c05a69a2
GoogleSignIn: b232380cf495a429b8095d3178a8d5855b42e842
GoogleUtilities: d053d902a8edaa9904e1bd00c37535385b8ed152
"gRPC-C++": 12f33a422dcab88dcd0c53e52cd549a929f0f244
gRPC-Core: 6ec9002832e1e22c5bb8c54994b050b0ee4205c6
GTMAppAuth: 99fb010047ba3973b7026e45393f51f27ab965ae
GTMSessionFetcher: 0e876eea9782ec6462e91ab872711c357322c94f
hermes-engine: 9cecf9953a681df7556b8cc9c74905de8f3293c0
leveldb-library: 06a69cc7582d64b29424a63e085e683cc188230a
Expand Down Expand Up @@ -2463,6 +2496,7 @@ SPEC CHECKSUMS:
RNFBApp: 3fd1f8d5b50cfaf718255e1faef207827c561d47
RNFBAuth: 3f243bd9f552260525e3b4478e8ad22b7ef72af8
RNFBFirestore: d70c99f4ea191c654a2d4cf743456b6f0aecb108
RNGoogleSignin: 24d3b3261f78b0fae0aa013f8ab6f8d25e369b0c
SocketRocket: f32cd54efbe0f095c4d7594881e52619cfe80b17
Yoga: d17d2cc8105eed528474683b42e2ea310e1daf61

Expand Down
Loading