Update translations.
This commit is contained in:
@@ -4898,9 +4898,140 @@
|
||||
<folder_node>
|
||||
<name>settings</name>
|
||||
<children>
|
||||
<folder_node>
|
||||
<name>actions</name>
|
||||
<children>
|
||||
<concept_node>
|
||||
<name>clearcache</name>
|
||||
<definition_loaded>false</definition_loaded>
|
||||
<description></description>
|
||||
<comment></comment>
|
||||
<default_text></default_text>
|
||||
<translations>
|
||||
<translation>
|
||||
<language>en-US</language>
|
||||
<approved>false</approved>
|
||||
</translation>
|
||||
<translation>
|
||||
<language>es-MX</language>
|
||||
<approved>false</approved>
|
||||
</translation>
|
||||
<translation>
|
||||
<language>fr-CA</language>
|
||||
<approved>false</approved>
|
||||
</translation>
|
||||
</translations>
|
||||
</concept_node>
|
||||
<concept_node>
|
||||
<name>enablenotifications</name>
|
||||
<definition_loaded>false</definition_loaded>
|
||||
<description></description>
|
||||
<comment></comment>
|
||||
<default_text></default_text>
|
||||
<translations>
|
||||
<translation>
|
||||
<language>en-US</language>
|
||||
<approved>false</approved>
|
||||
</translation>
|
||||
<translation>
|
||||
<language>es-MX</language>
|
||||
<approved>false</approved>
|
||||
</translation>
|
||||
<translation>
|
||||
<language>fr-CA</language>
|
||||
<approved>false</approved>
|
||||
</translation>
|
||||
</translations>
|
||||
</concept_node>
|
||||
</children>
|
||||
</folder_node>
|
||||
<folder_node>
|
||||
<name>labels</name>
|
||||
<children>
|
||||
<concept_node>
|
||||
<name>notificationsenabled</name>
|
||||
<definition_loaded>false</definition_loaded>
|
||||
<description></description>
|
||||
<comment></comment>
|
||||
<default_text></default_text>
|
||||
<translations>
|
||||
<translation>
|
||||
<language>en-US</language>
|
||||
<approved>false</approved>
|
||||
</translation>
|
||||
<translation>
|
||||
<language>es-MX</language>
|
||||
<approved>false</approved>
|
||||
</translation>
|
||||
<translation>
|
||||
<language>fr-CA</language>
|
||||
<approved>false</approved>
|
||||
</translation>
|
||||
</translations>
|
||||
</concept_node>
|
||||
<concept_node>
|
||||
<name>signedinshop</name>
|
||||
<definition_loaded>false</definition_loaded>
|
||||
<description></description>
|
||||
<comment></comment>
|
||||
<default_text></default_text>
|
||||
<translations>
|
||||
<translation>
|
||||
<language>en-US</language>
|
||||
<approved>false</approved>
|
||||
</translation>
|
||||
<translation>
|
||||
<language>es-MX</language>
|
||||
<approved>false</approved>
|
||||
</translation>
|
||||
<translation>
|
||||
<language>fr-CA</language>
|
||||
<approved>false</approved>
|
||||
</translation>
|
||||
</translations>
|
||||
</concept_node>
|
||||
<concept_node>
|
||||
<name>signedinuser</name>
|
||||
<definition_loaded>false</definition_loaded>
|
||||
<description></description>
|
||||
<comment></comment>
|
||||
<default_text></default_text>
|
||||
<translations>
|
||||
<translation>
|
||||
<language>en-US</language>
|
||||
<approved>false</approved>
|
||||
</translation>
|
||||
<translation>
|
||||
<language>es-MX</language>
|
||||
<approved>false</approved>
|
||||
</translation>
|
||||
<translation>
|
||||
<language>fr-CA</language>
|
||||
<approved>false</approved>
|
||||
</translation>
|
||||
</translations>
|
||||
</concept_node>
|
||||
<concept_node>
|
||||
<name>theme</name>
|
||||
<definition_loaded>false</definition_loaded>
|
||||
<description></description>
|
||||
<comment></comment>
|
||||
<default_text></default_text>
|
||||
<translations>
|
||||
<translation>
|
||||
<language>en-US</language>
|
||||
<approved>false</approved>
|
||||
</translation>
|
||||
<translation>
|
||||
<language>es-MX</language>
|
||||
<approved>false</approved>
|
||||
</translation>
|
||||
<translation>
|
||||
<language>fr-CA</language>
|
||||
<approved>false</approved>
|
||||
</translation>
|
||||
</translations>
|
||||
</concept_node>
|
||||
<concept_node>
|
||||
<name>version</name>
|
||||
<definition_loaded>false</definition_loaded>
|
||||
|
||||
@@ -1,25 +0,0 @@
|
||||
import React from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { Button } from "react-native";
|
||||
import { connect } from "react-redux";
|
||||
import { createStructuredSelector } from "reselect";
|
||||
import { signOutStart } from "../../redux/user/user.actions";
|
||||
const mapStateToProps = createStructuredSelector({
|
||||
//currentUser: selectCurrentUser
|
||||
});
|
||||
const mapDispatchToProps = (dispatch) => ({
|
||||
//setUserLanguage: language => dispatch(setUserLanguage(language))
|
||||
signOutStart: () => dispatch(signOutStart()),
|
||||
});
|
||||
|
||||
export function SignOutButton({ signOutStart }) {
|
||||
const { t } = useTranslation();
|
||||
return (
|
||||
<Button
|
||||
style={{ margin: 8 }}
|
||||
onPress={() => signOutStart()}
|
||||
title={t("general.actions.signout")}
|
||||
/>
|
||||
);
|
||||
}
|
||||
export default connect(mapStateToProps, mapDispatchToProps)(SignOutButton);
|
||||
@@ -1,5 +1,5 @@
|
||||
import SignOutButton from "@/components-old/sign-out-button/sign-out-button.component";
|
||||
import { selectDeleteAfterUpload } from "@/redux/app/app.selectors";
|
||||
import { signOutStart } from "@/redux/user/user.actions";
|
||||
import { selectBodyshop, selectCurrentUser } from "@/redux/user/user.selectors";
|
||||
import { registerForPushNotificationsAsync } from "@/util/notificationHandler";
|
||||
import { formatBytes } from "@/util/uploadUtils";
|
||||
@@ -7,6 +7,7 @@ import AsyncStorage from "@react-native-async-storage/async-storage";
|
||||
import * as Application from "expo-application";
|
||||
import Constants from "expo-constants";
|
||||
import * as Notifications from "expo-notifications";
|
||||
import { useEffect, useState } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { Alert, ScrollView, StyleSheet, View } from "react-native";
|
||||
import { Button, Card, Divider, List, Text } from "react-native-paper";
|
||||
@@ -22,16 +23,27 @@ const mapStateToProps = createStructuredSelector({
|
||||
currentUser: selectCurrentUser,
|
||||
});
|
||||
|
||||
const mapDispatchToProps = (dispatch) => ({});
|
||||
const mapDispatchToProps = (dispatch) => ({
|
||||
signOutStart: () => dispatch(signOutStart()),
|
||||
});
|
||||
export default connect(mapStateToProps, mapDispatchToProps)(Tab);
|
||||
|
||||
function Tab({ bodyshop, currentUser }) {
|
||||
function Tab({ bodyshop, currentUser, signOutStart }) {
|
||||
const { t } = useTranslation();
|
||||
const [permissionState, setPermissionState] = useState(null);
|
||||
|
||||
useEffect(() => {
|
||||
(async () => {
|
||||
const status = await Notifications.getPermissionsAsync();
|
||||
|
||||
setPermissionState(status);
|
||||
})();
|
||||
}, []);
|
||||
|
||||
const handleClearStorage = () => {
|
||||
Alert.alert(
|
||||
"Clear Local Cache",
|
||||
"This will remove persisted Redux state. Media already uploaded won't be affected. Continue?",
|
||||
"This will remove cache and settings. Continue?",
|
||||
[
|
||||
{ text: "Cancel", style: "cancel" },
|
||||
{
|
||||
@@ -40,7 +52,10 @@ function Tab({ bodyshop, currentUser }) {
|
||||
onPress: async () => {
|
||||
try {
|
||||
await AsyncStorage.removeItem("persist:root");
|
||||
Alert.alert("Cleared", "Local cache cleared.");
|
||||
Alert.alert(
|
||||
"Cleared",
|
||||
"Local cache cleared. Please restart the app."
|
||||
);
|
||||
} catch (_e) {
|
||||
Alert.alert("Error", "Unable to clear local cache.");
|
||||
}
|
||||
@@ -54,7 +69,7 @@ function Tab({ bodyshop, currentUser }) {
|
||||
<SafeAreaView style={{ flex: 1 }}>
|
||||
<ScrollView contentContainerStyle={styles.container}>
|
||||
<Text variant="headlineMedium" style={styles.title}>
|
||||
Settings
|
||||
{t("settings.titles.settings")}
|
||||
</Text>
|
||||
|
||||
<Card style={styles.section}>
|
||||
@@ -90,18 +105,14 @@ function Tab({ bodyshop, currentUser }) {
|
||||
</List.Section>
|
||||
</Card.Content>
|
||||
<Card.Actions>
|
||||
<Button
|
||||
onPress={handleClearStorage}
|
||||
mode="contained-tonal"
|
||||
icon="delete-outline"
|
||||
>
|
||||
Clear Cache
|
||||
<Button onPress={handleClearStorage} icon="delete-outline">
|
||||
{t("settings.actions.clearcache")}
|
||||
</Button>
|
||||
</Card.Actions>
|
||||
</Card>
|
||||
|
||||
<Card style={styles.section}>
|
||||
<Card.Title title="Theme" />
|
||||
<Card.Title title={t("settings.labels.theme")} />
|
||||
<Card.Content>
|
||||
<List.Section>
|
||||
<View style={styles.inlineRow}>
|
||||
@@ -109,8 +120,22 @@ function Tab({ bodyshop, currentUser }) {
|
||||
</View>
|
||||
</List.Section>
|
||||
</Card.Content>
|
||||
<Card.Actions></Card.Actions>
|
||||
</Card>
|
||||
<Card style={styles.section}>
|
||||
<Card.Title title="Notifications" />
|
||||
<Card.Content>
|
||||
<List.Section>
|
||||
<View style={styles.inlineRow}>
|
||||
<Text>{`${t("settings.labels.notificationsenabled")}: ${
|
||||
permissionState?.granted === true ? "Yes" : "No"
|
||||
}`}</Text>
|
||||
</View>
|
||||
</List.Section>
|
||||
</Card.Content>
|
||||
<Card.Actions>
|
||||
<Button
|
||||
icon="bell-outline"
|
||||
onPress={async () => {
|
||||
try {
|
||||
await registerForPushNotificationsAsync();
|
||||
@@ -123,39 +148,7 @@ function Tab({ bodyshop, currentUser }) {
|
||||
}
|
||||
}}
|
||||
>
|
||||
Enable Notifications
|
||||
</Button>
|
||||
<Button
|
||||
onPress={async () => {
|
||||
const projectId =
|
||||
Constants?.expoConfig?.extra?.eas?.projectId ??
|
||||
Constants?.easConfig?.projectId;
|
||||
|
||||
const pushTokenString = (
|
||||
await Notifications.getExpoPushTokenAsync({
|
||||
projectId,
|
||||
})
|
||||
).data;
|
||||
const message = {
|
||||
to: pushTokenString,
|
||||
sound: "default",
|
||||
title: "Original Title",
|
||||
body: "And here is the body!",
|
||||
data: { someData: "goes here" },
|
||||
};
|
||||
|
||||
await fetch("https://exp.host/--/api/v2/push/send", {
|
||||
method: "POST",
|
||||
headers: {
|
||||
Accept: "application/json",
|
||||
"Accept-encoding": "gzip, deflate",
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
body: JSON.stringify(message),
|
||||
});
|
||||
}}
|
||||
>
|
||||
Test Noti
|
||||
{t("settings.actions.enablenotifications")}
|
||||
</Button>
|
||||
</Card.Actions>
|
||||
</Card>
|
||||
@@ -163,15 +156,18 @@ function Tab({ bodyshop, currentUser }) {
|
||||
<Card style={styles.section}>
|
||||
<Card.Content>
|
||||
<Text style={styles.paragraph}>
|
||||
Signed in to bodyshop:{" "}
|
||||
{bodyshop?.shopname || bodyshop?.id || "Unknown"}
|
||||
{`${t("settings.labels.signedinshop")} ${
|
||||
bodyshop?.shopname || bodyshop?.id || "Unknown"
|
||||
}`}
|
||||
</Text>
|
||||
<Text style={styles.paragraph}>
|
||||
Signed in to as: {currentUser?.email || "Unknown"}
|
||||
{`${t("settings.labels.signedinuser")} ${currentUser?.email || "Unknown"}`}
|
||||
</Text>
|
||||
</Card.Content>
|
||||
<Card.Actions style={styles.actionsRow}>
|
||||
<SignOutButton />
|
||||
<Card.Actions>
|
||||
<Button onPress={signOutStart}>
|
||||
{t("general.actions.signout")}
|
||||
</Button>
|
||||
</Card.Actions>
|
||||
</Card>
|
||||
|
||||
|
||||
@@ -293,7 +293,15 @@
|
||||
}
|
||||
},
|
||||
"settings": {
|
||||
"actions": {
|
||||
"clearcache": "Clear Cache",
|
||||
"enablenotifications": "Enable Notifications"
|
||||
},
|
||||
"labels": {
|
||||
"notificationsenabled": "Notifications Enabled",
|
||||
"signedinshop": "Sign in to shop:",
|
||||
"signedinuser": "Signed in as:",
|
||||
"theme": "Theme",
|
||||
"version": "Version {{number}}"
|
||||
},
|
||||
"titles": {
|
||||
|
||||
@@ -293,7 +293,15 @@
|
||||
}
|
||||
},
|
||||
"settings": {
|
||||
"actions": {
|
||||
"clearcache": "",
|
||||
"enablenotifications": ""
|
||||
},
|
||||
"labels": {
|
||||
"notificationsenabled": "",
|
||||
"signedinshop": "",
|
||||
"signedinuser": "",
|
||||
"theme": "",
|
||||
"version": ""
|
||||
},
|
||||
"titles": {
|
||||
|
||||
@@ -293,7 +293,15 @@
|
||||
}
|
||||
},
|
||||
"settings": {
|
||||
"actions": {
|
||||
"clearcache": "",
|
||||
"enablenotifications": ""
|
||||
},
|
||||
"labels": {
|
||||
"notificationsenabled": "",
|
||||
"signedinshop": "",
|
||||
"signedinuser": "",
|
||||
"theme": "",
|
||||
"version": ""
|
||||
},
|
||||
"titles": {
|
||||
|
||||
@@ -52,14 +52,13 @@ async function registerForPushNotificationsAsync() {
|
||||
|
||||
//Write the FCM token to database.
|
||||
|
||||
const result = await client.mutate({
|
||||
await client.mutate({
|
||||
mutation: UPDATE_FCM_TOKEN,
|
||||
variables: {
|
||||
email: (await getCurrentUser()).email,
|
||||
token: { [pushTokenString]: { pushTokenString, platform: Platform.OS, timestamp: Date.now() } },
|
||||
},
|
||||
});
|
||||
console.log("FCM token updated in database:", result);
|
||||
return pushTokenString;
|
||||
} catch (error) {
|
||||
throw error
|
||||
|
||||
Reference in New Issue
Block a user