Waseel: driver app, dispatch, POI suggestions, map fixes
This commit is contained in:
+10
-8
@@ -5,6 +5,7 @@ import { Image, Text, View, Alert } from "react-native";
|
||||
|
||||
import { icons } from "@/constants";
|
||||
import { googleAuth } from "@/lib/auth";
|
||||
import { useT } from "@/lib/i18n";
|
||||
import { useSession } from "@/lib/session";
|
||||
|
||||
import { CustomButton } from "./custom-button";
|
||||
@@ -39,6 +40,7 @@ function GoogleOAuth({
|
||||
androidClientId?: string;
|
||||
}) {
|
||||
const { setSession } = useSession();
|
||||
const t = useT();
|
||||
|
||||
const [request, response, promptAsync] = Google.useIdTokenAuthRequest({
|
||||
clientId,
|
||||
@@ -52,7 +54,7 @@ function GoogleOAuth({
|
||||
const idToken = response.params?.id_token;
|
||||
|
||||
if (!idToken) {
|
||||
Alert.alert("Google sign-in failed", "No token returned. Try again.");
|
||||
Alert.alert(t("components.oauth.alertFailTitle"), t("components.oauth.alertFailNoToken"));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -63,12 +65,12 @@ function GoogleOAuth({
|
||||
} catch (err: any) {
|
||||
console.error("OAuth error", err);
|
||||
Alert.alert(
|
||||
"Google sign-in failed",
|
||||
err?.message || "Please try again.",
|
||||
t("components.oauth.alertFailTitle"),
|
||||
err?.message || t("components.oauth.alertFailFallback"),
|
||||
);
|
||||
}
|
||||
})();
|
||||
}, [response, setSession]);
|
||||
}, [response, setSession, t]);
|
||||
|
||||
const handleGoogleOAuth = useCallback(() => {
|
||||
void promptAsync();
|
||||
@@ -77,11 +79,11 @@ function GoogleOAuth({
|
||||
return (
|
||||
<View>
|
||||
<View className="flex flex-row justify-center items-center mt-4 gap-x-3">
|
||||
<View className="flex-1 h-px bg-general-100" />
|
||||
<View className="flex-1 h-px bg-general-100 dark:bg-neutral-700" />
|
||||
|
||||
<Text className="text-lg">Or</Text>
|
||||
<Text className="text-lg text-black dark:text-white">{t("components.oauth.or")}</Text>
|
||||
|
||||
<View className="flex-1 h-px bg-general-100" />
|
||||
<View className="flex-1 h-px bg-general-100 dark:bg-neutral-700" />
|
||||
</View>
|
||||
|
||||
<CustomButton
|
||||
@@ -90,7 +92,7 @@ function GoogleOAuth({
|
||||
iconLeft={() => (
|
||||
<Image
|
||||
source={icons.google}
|
||||
alt="Google logo"
|
||||
alt={t("components.oauth.googleLogoAlt")}
|
||||
resizeMode="contain"
|
||||
className="h-5 w-5 mx-2"
|
||||
/>
|
||||
|
||||
Reference in New Issue
Block a user