Update translations.
This commit is contained in:
@@ -4898,9 +4898,140 @@
|
|||||||
<folder_node>
|
<folder_node>
|
||||||
<name>settings</name>
|
<name>settings</name>
|
||||||
<children>
|
<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>
|
<folder_node>
|
||||||
<name>labels</name>
|
<name>labels</name>
|
||||||
<children>
|
<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>
|
<concept_node>
|
||||||
<name>version</name>
|
<name>version</name>
|
||||||
<definition_loaded>false</definition_loaded>
|
<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 { selectDeleteAfterUpload } from "@/redux/app/app.selectors";
|
||||||
|
import { signOutStart } from "@/redux/user/user.actions";
|
||||||
import { selectBodyshop, selectCurrentUser } from "@/redux/user/user.selectors";
|
import { selectBodyshop, selectCurrentUser } from "@/redux/user/user.selectors";
|
||||||
import { registerForPushNotificationsAsync } from "@/util/notificationHandler";
|
import { registerForPushNotificationsAsync } from "@/util/notificationHandler";
|
||||||
import { formatBytes } from "@/util/uploadUtils";
|
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 * as Application from "expo-application";
|
||||||
import Constants from "expo-constants";
|
import Constants from "expo-constants";
|
||||||
import * as Notifications from "expo-notifications";
|
import * as Notifications from "expo-notifications";
|
||||||
|
import { useEffect, useState } from "react";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { Alert, ScrollView, StyleSheet, View } from "react-native";
|
import { Alert, ScrollView, StyleSheet, View } from "react-native";
|
||||||
import { Button, Card, Divider, List, Text } from "react-native-paper";
|
import { Button, Card, Divider, List, Text } from "react-native-paper";
|
||||||
@@ -22,16 +23,27 @@ const mapStateToProps = createStructuredSelector({
|
|||||||
currentUser: selectCurrentUser,
|
currentUser: selectCurrentUser,
|
||||||
});
|
});
|
||||||
|
|
||||||
const mapDispatchToProps = (dispatch) => ({});
|
const mapDispatchToProps = (dispatch) => ({
|
||||||
|
signOutStart: () => dispatch(signOutStart()),
|
||||||
|
});
|
||||||
export default connect(mapStateToProps, mapDispatchToProps)(Tab);
|
export default connect(mapStateToProps, mapDispatchToProps)(Tab);
|
||||||
|
|
||||||
function Tab({ bodyshop, currentUser }) {
|
function Tab({ bodyshop, currentUser, signOutStart }) {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
|
const [permissionState, setPermissionState] = useState(null);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
(async () => {
|
||||||
|
const status = await Notifications.getPermissionsAsync();
|
||||||
|
|
||||||
|
setPermissionState(status);
|
||||||
|
})();
|
||||||
|
}, []);
|
||||||
|
|
||||||
const handleClearStorage = () => {
|
const handleClearStorage = () => {
|
||||||
Alert.alert(
|
Alert.alert(
|
||||||
"Clear Local Cache",
|
"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" },
|
{ text: "Cancel", style: "cancel" },
|
||||||
{
|
{
|
||||||
@@ -40,7 +52,10 @@ function Tab({ bodyshop, currentUser }) {
|
|||||||
onPress: async () => {
|
onPress: async () => {
|
||||||
try {
|
try {
|
||||||
await AsyncStorage.removeItem("persist:root");
|
await AsyncStorage.removeItem("persist:root");
|
||||||
Alert.alert("Cleared", "Local cache cleared.");
|
Alert.alert(
|
||||||
|
"Cleared",
|
||||||
|
"Local cache cleared. Please restart the app."
|
||||||
|
);
|
||||||
} catch (_e) {
|
} catch (_e) {
|
||||||
Alert.alert("Error", "Unable to clear local cache.");
|
Alert.alert("Error", "Unable to clear local cache.");
|
||||||
}
|
}
|
||||||
@@ -54,7 +69,7 @@ function Tab({ bodyshop, currentUser }) {
|
|||||||
<SafeAreaView style={{ flex: 1 }}>
|
<SafeAreaView style={{ flex: 1 }}>
|
||||||
<ScrollView contentContainerStyle={styles.container}>
|
<ScrollView contentContainerStyle={styles.container}>
|
||||||
<Text variant="headlineMedium" style={styles.title}>
|
<Text variant="headlineMedium" style={styles.title}>
|
||||||
Settings
|
{t("settings.titles.settings")}
|
||||||
</Text>
|
</Text>
|
||||||
|
|
||||||
<Card style={styles.section}>
|
<Card style={styles.section}>
|
||||||
@@ -90,18 +105,14 @@ function Tab({ bodyshop, currentUser }) {
|
|||||||
</List.Section>
|
</List.Section>
|
||||||
</Card.Content>
|
</Card.Content>
|
||||||
<Card.Actions>
|
<Card.Actions>
|
||||||
<Button
|
<Button onPress={handleClearStorage} icon="delete-outline">
|
||||||
onPress={handleClearStorage}
|
{t("settings.actions.clearcache")}
|
||||||
mode="contained-tonal"
|
|
||||||
icon="delete-outline"
|
|
||||||
>
|
|
||||||
Clear Cache
|
|
||||||
</Button>
|
</Button>
|
||||||
</Card.Actions>
|
</Card.Actions>
|
||||||
</Card>
|
</Card>
|
||||||
|
|
||||||
<Card style={styles.section}>
|
<Card style={styles.section}>
|
||||||
<Card.Title title="Theme" />
|
<Card.Title title={t("settings.labels.theme")} />
|
||||||
<Card.Content>
|
<Card.Content>
|
||||||
<List.Section>
|
<List.Section>
|
||||||
<View style={styles.inlineRow}>
|
<View style={styles.inlineRow}>
|
||||||
@@ -109,8 +120,22 @@ function Tab({ bodyshop, currentUser }) {
|
|||||||
</View>
|
</View>
|
||||||
</List.Section>
|
</List.Section>
|
||||||
</Card.Content>
|
</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>
|
<Card.Actions>
|
||||||
<Button
|
<Button
|
||||||
|
icon="bell-outline"
|
||||||
onPress={async () => {
|
onPress={async () => {
|
||||||
try {
|
try {
|
||||||
await registerForPushNotificationsAsync();
|
await registerForPushNotificationsAsync();
|
||||||
@@ -123,39 +148,7 @@ function Tab({ bodyshop, currentUser }) {
|
|||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
Enable Notifications
|
{t("settings.actions.enablenotifications")}
|
||||||
</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
|
|
||||||
</Button>
|
</Button>
|
||||||
</Card.Actions>
|
</Card.Actions>
|
||||||
</Card>
|
</Card>
|
||||||
@@ -163,15 +156,18 @@ function Tab({ bodyshop, currentUser }) {
|
|||||||
<Card style={styles.section}>
|
<Card style={styles.section}>
|
||||||
<Card.Content>
|
<Card.Content>
|
||||||
<Text style={styles.paragraph}>
|
<Text style={styles.paragraph}>
|
||||||
Signed in to bodyshop:{" "}
|
{`${t("settings.labels.signedinshop")} ${
|
||||||
{bodyshop?.shopname || bodyshop?.id || "Unknown"}
|
bodyshop?.shopname || bodyshop?.id || "Unknown"
|
||||||
|
}`}
|
||||||
</Text>
|
</Text>
|
||||||
<Text style={styles.paragraph}>
|
<Text style={styles.paragraph}>
|
||||||
Signed in to as: {currentUser?.email || "Unknown"}
|
{`${t("settings.labels.signedinuser")} ${currentUser?.email || "Unknown"}`}
|
||||||
</Text>
|
</Text>
|
||||||
</Card.Content>
|
</Card.Content>
|
||||||
<Card.Actions style={styles.actionsRow}>
|
<Card.Actions>
|
||||||
<SignOutButton />
|
<Button onPress={signOutStart}>
|
||||||
|
{t("general.actions.signout")}
|
||||||
|
</Button>
|
||||||
</Card.Actions>
|
</Card.Actions>
|
||||||
</Card>
|
</Card>
|
||||||
|
|
||||||
|
|||||||
@@ -293,7 +293,15 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"settings": {
|
"settings": {
|
||||||
|
"actions": {
|
||||||
|
"clearcache": "Clear Cache",
|
||||||
|
"enablenotifications": "Enable Notifications"
|
||||||
|
},
|
||||||
"labels": {
|
"labels": {
|
||||||
|
"notificationsenabled": "Notifications Enabled",
|
||||||
|
"signedinshop": "Sign in to shop:",
|
||||||
|
"signedinuser": "Signed in as:",
|
||||||
|
"theme": "Theme",
|
||||||
"version": "Version {{number}}"
|
"version": "Version {{number}}"
|
||||||
},
|
},
|
||||||
"titles": {
|
"titles": {
|
||||||
|
|||||||
@@ -293,7 +293,15 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"settings": {
|
"settings": {
|
||||||
|
"actions": {
|
||||||
|
"clearcache": "",
|
||||||
|
"enablenotifications": ""
|
||||||
|
},
|
||||||
"labels": {
|
"labels": {
|
||||||
|
"notificationsenabled": "",
|
||||||
|
"signedinshop": "",
|
||||||
|
"signedinuser": "",
|
||||||
|
"theme": "",
|
||||||
"version": ""
|
"version": ""
|
||||||
},
|
},
|
||||||
"titles": {
|
"titles": {
|
||||||
|
|||||||
@@ -293,7 +293,15 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"settings": {
|
"settings": {
|
||||||
|
"actions": {
|
||||||
|
"clearcache": "",
|
||||||
|
"enablenotifications": ""
|
||||||
|
},
|
||||||
"labels": {
|
"labels": {
|
||||||
|
"notificationsenabled": "",
|
||||||
|
"signedinshop": "",
|
||||||
|
"signedinuser": "",
|
||||||
|
"theme": "",
|
||||||
"version": ""
|
"version": ""
|
||||||
},
|
},
|
||||||
"titles": {
|
"titles": {
|
||||||
|
|||||||
@@ -52,14 +52,13 @@ async function registerForPushNotificationsAsync() {
|
|||||||
|
|
||||||
//Write the FCM token to database.
|
//Write the FCM token to database.
|
||||||
|
|
||||||
const result = await client.mutate({
|
await client.mutate({
|
||||||
mutation: UPDATE_FCM_TOKEN,
|
mutation: UPDATE_FCM_TOKEN,
|
||||||
variables: {
|
variables: {
|
||||||
email: (await getCurrentUser()).email,
|
email: (await getCurrentUser()).email,
|
||||||
token: { [pushTokenString]: { pushTokenString, platform: Platform.OS, timestamp: Date.now() } },
|
token: { [pushTokenString]: { pushTokenString, platform: Platform.OS, timestamp: Date.now() } },
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
console.log("FCM token updated in database:", result);
|
|
||||||
return pushTokenString;
|
return pushTokenString;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
throw error
|
throw error
|
||||||
|
|||||||
Reference in New Issue
Block a user