Skip to content

Commit

Permalink
Merge dd8bcd3 into de75563
Browse files Browse the repository at this point in the history
  • Loading branch information
alexrisch authored Dec 9, 2024
2 parents de75563 + dd8bcd3 commit 61c7da3
Show file tree
Hide file tree
Showing 25 changed files with 728 additions and 83 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { AttachmentContainer } from "@/components/Chat/Attachment/attachment-con
import { AttachmentLoading } from "@/components/Chat/Attachment/attachment-loading";
import { MessageLayout } from "@/components/Chat/Message/components/message-layout";
import { Text } from "@/design-system/Text";
import { translate } from "@/i18n";
import { getLocalAttachment } from "@/utils/attachment/handleAttachment";
import { useQuery } from "@tanstack/react-query";
import {
Expand Down Expand Up @@ -84,7 +85,7 @@ const Content = memo(function Content(props: {
if (attachmentError || !attachment) {
return (
<AttachmentContainer>
<Text>Couldn't find attachment</Text>
<Text>{translate("attachment_not_found")}</Text>
</AttachmentContainer>
);
}
Expand Down
12 changes: 8 additions & 4 deletions components/DebugButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import config from "../config";
import { showActionSheetWithOptions } from "./StateHandlers/ActionSheetStateHandler";
import { useAccountsList } from "../data/store/accountsStore";
import mmkv from "../utils/mmkv";
import { translate } from "@/i18n";

export const useDebugEnabled = (address?: string) => {
const accounts = useAccountsList();
Expand Down Expand Up @@ -103,15 +104,15 @@ const DebugButton = forwardRef((props, ref) => {
...(debugEnabled ? debugMethods : {}),
"Share current session logs": async () => {
Share.open({
title: "Converse Log Session",
title: translate("debug.converse_log_session"),
url: `file://${loggingFilePath}`,
type: "text/plain",
});
},
"Share native logs": async () => {
const nativeLogFilePath = await getNativeLogFile();
Share.open({
title: "LibXMTP Logs",
title: translate("debug.libxmtp_log_session"),
url: `file://${nativeLogFilePath}`,
type: "text/plain",
});
Expand All @@ -122,7 +123,7 @@ const DebugButton = forwardRef((props, ref) => {
return Alert.alert("No previous session logging file found");
}
Share.open({
title: "Converse Log Session",
title: translate("debug.converse_log_session"),
url: `file://${previousLoggingFile}`,
type: "text/plain",
});
Expand All @@ -148,7 +149,10 @@ const DebugButton = forwardRef((props, ref) => {

showActionSheetWithOptions(
{
title: `Converse v${appVersion} (${buildNumber})`,
title: translate("debug.converse_version", {
version: appVersion,
buildNumber,
}),
options,
cancelButtonIndex: options.indexOf("Cancel"),
},
Expand Down
8 changes: 5 additions & 3 deletions components/EphemeralAccountBanner.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { translate } from "@/i18n";
import { useDisconnectActionSheet } from "@hooks/useDisconnectActionSheet";
import {
itemSeparatorColor,
Expand All @@ -24,10 +25,11 @@ export default function EphemeralAccountBanner() {
style={styles.tempAccountBanner}
>
<View style={styles.tempAccountBannerLeft}>
<Text style={styles.tempAccountTitle}>This account is ephemeral</Text>
<Text style={styles.tempAccountTitle}>
{translate("ephemeral_account_banner.title")}
</Text>
<Text style={styles.tempAccountSubtitle} numberOfLines={4}>
Disconnect to permanently remove your device from these conversations
and ensure deniability.
{translate("ephemeral_account_banner.subtitle")}
</Text>
</View>
</TouchableOpacity>
Expand Down
8 changes: 3 additions & 5 deletions components/InitialLoad.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
} from "react-native";

import ActivityIndicator from "./ActivityIndicator/ActivityIndicator";
import { translate } from "@/i18n";

export default function InitialLoad() {
const headerHeight = useHeaderHeight();
Expand All @@ -22,11 +23,8 @@ export default function InitialLoad() {
]}
>
<ActivityIndicator />
<Text style={styles.welcome}>Welcome to Converse!</Text>
<Text style={styles.p}>
We’re checking if you already own{"\n"}conversations on the XMTP
network.
</Text>
<Text style={styles.welcome}>{translate("initial_load.title")}</Text>
<Text style={styles.p}>{translate("initial_load.subtitle")}</Text>
</View>
);
}
Expand Down
23 changes: 13 additions & 10 deletions components/Recommendations/Recommendations.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import { useSelect } from "@data/store/storeHelpers";
import { useRouter } from "@navigation/useNavigation";
import { refreshRecommendationsForAccount } from "@utils/recommendations";
import ActivityIndicator from "@components/ActivityIndicator/ActivityIndicator";
import { translate } from "@/i18n";

const EXPIRE_AFTER = 86400000; // 1 DAY

Expand Down Expand Up @@ -130,15 +131,16 @@ export default function Recommendations({
<>
<Text style={styles.emoji}>👋</Text>
<Text style={styles.title}>
Find people who have interests in common with you. Start
talking to them.
{translate("recommendations.title")}
</Text>
</>
</View>
)}
{visibility === "EMBEDDED" && showTitle && (
<View style={styles.sectionTitleContainer}>
<Text style={styles.sectionTitle}>RECOMMENDED PROFILES</Text>
<Text style={styles.sectionTitle}>
{translate("recommendations.section_title")}
</Text>
</View>
)}
</>
Expand Down Expand Up @@ -188,7 +190,9 @@ export default function Recommendations({
return (
<View style={styles.fetching}>
<ActivityIndicator />
<Text style={styles.fetchingText}>Loading your recommendations</Text>
<Text style={styles.fetchingText}>
{translate("recommendations.loading")}
</Text>
</View>
);
}
Expand All @@ -198,16 +202,15 @@ export default function Recommendations({
<>
<Text style={styles.emoji}>😐</Text>
<Text style={styles.title}>
We did not find people to match you with. We’re still early and we’re
not using that many signals. You can{" "}
{translate("recommendations.no_recommendations")}
<Text style={styles.clickableText} onPress={openSignalList}>
find the current list here
{translate("recommendations.signal_list")}
</Text>
, please feel free to{" "}
{translate("recommendations.please_feel_free_to")}
<Text style={styles.clickableText} onPress={contactPol}>
contact our co-founder Pol
{translate("recommendations.contact_pol")}
</Text>{" "}
if you want us to add anything.{"\n\n"}Thank you!
{translate("recommendations.if_you_want_us_to_add_anything")}
</Text>
</>
);
Expand Down
23 changes: 14 additions & 9 deletions containers/GroupScreenMembersTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,15 @@ import logger from "@utils/logger";
import { navigate } from "@utils/navigation";
import { getPreferredName, getProfile } from "@utils/profile";
import { FC, memo, useMemo } from "react";
import { Alert, StyleSheet, Text, View, useColorScheme } from "react-native";
import { StyleSheet, Text, View, useColorScheme } from "react-native";

import { useGroupPermissionPolicyQuery } from "@queries/useGroupPermissionPolicyQuery";
import type { GroupWithCodecsType } from "@utils/xmtpRN/client";
import type { ConversationTopic } from "@xmtp/react-native-sdk";
import TableView, {
TableViewItemType,
} from "../components/TableView/TableView";
import { captureErrorWithFriendlyToast } from "@/utils/capture-error";

type GroupScreenMembersTableProps = {
topic: ConversationTopic | undefined;
Expand Down Expand Up @@ -72,7 +73,7 @@ export const GroupScreenMembersTable: FC<GroupScreenMembersTableProps> = memo(
);
items.push({
id: a.inboxId,
title: `${preferredName}${isCurrentUser ? " (you)" : ""}`,
title: `${preferredName}${isCurrentUser ? translate("you_parentheses") : ""}`,
action: () => {
const {
options,
Expand Down Expand Up @@ -112,7 +113,7 @@ export const GroupScreenMembersTable: FC<GroupScreenMembersTableProps> = memo(
await promoteToSuperAdmin(a.inboxId);
} catch (e) {
logger.error(e);
Alert.alert("An error occurred");
captureErrorWithFriendlyToast(e);
}
break;
case revokeSuperAdminIndex:
Expand All @@ -121,7 +122,7 @@ export const GroupScreenMembersTable: FC<GroupScreenMembersTableProps> = memo(
await revokeSuperAdmin(a.inboxId);
} catch (e) {
logger.error(e);
Alert.alert("An error occurred");
captureErrorWithFriendlyToast(e);
}
break;
case promoteAdminIndex:
Expand All @@ -130,7 +131,7 @@ export const GroupScreenMembersTable: FC<GroupScreenMembersTableProps> = memo(
await promoteToAdmin(a.inboxId);
} catch (e) {
logger.error(e);
Alert.alert("An error occurred");
captureErrorWithFriendlyToast(e);
}
break;
case revokeAdminIndex:
Expand All @@ -139,7 +140,7 @@ export const GroupScreenMembersTable: FC<GroupScreenMembersTableProps> = memo(
await revokeAdmin(a.inboxId);
} catch (e) {
logger.error(e);
Alert.alert("An error occurred");
captureErrorWithFriendlyToast(e);
}
break;
case removeIndex:
Expand All @@ -148,7 +149,7 @@ export const GroupScreenMembersTable: FC<GroupScreenMembersTableProps> = memo(
await removeMember([a.inboxId]);
} catch (e) {
logger.error(e);
Alert.alert("An error occurred");
captureErrorWithFriendlyToast(e);
}
break;
default:
Expand All @@ -159,10 +160,14 @@ export const GroupScreenMembersTable: FC<GroupScreenMembersTableProps> = memo(
rightView: (
<View style={styles.tableViewRight}>
{isSuperAdmin && (
<Text style={styles.adminText}>Super Admin</Text>
<Text style={styles.adminText}>
{translate("group_screen_member_actions.super_admin")}
</Text>
)}
{isAdmin && !isSuperAdmin && (
<Text style={styles.adminText}>Admin</Text>
<Text style={styles.adminText}>
{translate("group_screen_member_actions.admin")}
</Text>
)}
<TableViewPicto
symbol="chevron.right"
Expand Down
4 changes: 2 additions & 2 deletions i18n/i18n.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@ import i18n from "i18n-js";
import { I18nManager } from "react-native";

import { en, Translations } from "./translations/en";
import { fr } from "./translations/fr";

export { i18n };
// import fr from "./translations/fr";

i18n.fallbacks = true;

// to use regional locales use { "en-US": enUS } etc
i18n.translations = {
en,
"en-US": en,
// fr
fr,
};

const fallbackLocale = "en-US";
Expand Down
Loading

0 comments on commit 61c7da3

Please sign in to comment.