mirror of
https://github.com/streetwriters/notesnook.git
synced 2025-12-22 22:49:45 +01:00
mobile: fix localization
This commit is contained in:
@@ -235,7 +235,7 @@ export const AttachmentDialog = ({
|
|||||||
for (let i = 0; i < filteredAttachments.placeholders.length; i++) {
|
for (let i = 0; i < filteredAttachments.placeholders.length; i++) {
|
||||||
if (!getState().isWorking) {
|
if (!getState().isWorking) {
|
||||||
ToastManager.show({
|
ToastManager.show({
|
||||||
message: "Attachment recheck cancelled",
|
message: strings.attachmentRecheckCancelled(),
|
||||||
type: "info",
|
type: "info",
|
||||||
context: isSheet ? "local" : "global"
|
context: isSheet ? "local" : "global"
|
||||||
});
|
});
|
||||||
@@ -322,7 +322,7 @@ export const AttachmentDialog = ({
|
|||||||
) : null}
|
) : null}
|
||||||
{!isSheet ? (
|
{!isSheet ? (
|
||||||
<Header
|
<Header
|
||||||
title="Manage attachments"
|
title={strings.manageAttachments()}
|
||||||
renderedInRoute="SettingsGroup"
|
renderedInRoute="SettingsGroup"
|
||||||
canGoBack
|
canGoBack
|
||||||
headerRightButtons={[
|
headerRightButtons={[
|
||||||
@@ -330,23 +330,25 @@ export const AttachmentDialog = ({
|
|||||||
onPress() {
|
onPress() {
|
||||||
onCheck();
|
onCheck();
|
||||||
},
|
},
|
||||||
title: "Recheck all"
|
title: strings.recheckAll()
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
onPress() {
|
onPress() {
|
||||||
if (!attachments) return;
|
if (!attachments) return;
|
||||||
presentDialog({
|
presentDialog({
|
||||||
title: `Download ${attachments.placeholders.length} attachments`,
|
title: strings.doAction(
|
||||||
paragraph:
|
"attachment",
|
||||||
"Are you sure you want to download all attachments?",
|
attachments.placeholders.length,
|
||||||
positiveText: "Download",
|
"download"
|
||||||
|
),
|
||||||
|
positiveText: strings.network.download(),
|
||||||
positivePress: async () => {
|
positivePress: async () => {
|
||||||
downloadAttachments(await attachments.ids());
|
downloadAttachments(await attachments.ids());
|
||||||
},
|
},
|
||||||
negativeText: "Cancel"
|
negativeText: strings.cancel()
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
title: "Download all"
|
title: strings.downloadAllAttachments()
|
||||||
}
|
}
|
||||||
]}
|
]}
|
||||||
/>
|
/>
|
||||||
@@ -388,15 +390,16 @@ export const AttachmentDialog = ({
|
|||||||
onPress={() => {
|
onPress={() => {
|
||||||
if (!attachments) return;
|
if (!attachments) return;
|
||||||
presentDialog({
|
presentDialog({
|
||||||
title: `Download ${attachments.placeholders.length} attachments`,
|
title: strings.doAction(
|
||||||
paragraph:
|
"attachment",
|
||||||
"Are you sure you want to download all attachments?",
|
attachments.placeholders.length,
|
||||||
context: "local",
|
"download"
|
||||||
positiveText: "Download",
|
),
|
||||||
|
positiveText: strings.network.download(),
|
||||||
positivePress: async () => {
|
positivePress: async () => {
|
||||||
downloadAttachments(await attachments.ids());
|
downloadAttachments(await attachments.ids());
|
||||||
},
|
},
|
||||||
negativeText: "Cancel"
|
negativeText: strings.cancel()
|
||||||
});
|
});
|
||||||
}}
|
}}
|
||||||
size={SIZE.lg}
|
size={SIZE.lg}
|
||||||
@@ -457,14 +460,16 @@ export const AttachmentDialog = ({
|
|||||||
<Paragraph>
|
<Paragraph>
|
||||||
{rechecker.isWorking
|
{rechecker.isWorking
|
||||||
? note
|
? note
|
||||||
? `Checking ${rechecker.filter.toLowerCase()} note attachments`
|
? strings.checkingNoteAttachments()
|
||||||
: `Checking ${rechecker.filter.toLowerCase()} attachments`
|
: strings.checkingAllAttachments()
|
||||||
: "Attachments recheck complete"}
|
: strings.attachmentRecheckComplete()}
|
||||||
</Paragraph>
|
</Paragraph>
|
||||||
<Paragraph>
|
<Paragraph>
|
||||||
{`${rechecker.isWorking ? "Please wait... " : ""}Passed: ${
|
{`${
|
||||||
|
rechecker.isWorking ? `${strings.pleaseWait()} ` : ""
|
||||||
|
}${strings.passed()}: ${
|
||||||
rechecker.passed
|
rechecker.passed
|
||||||
}, Failed: ${rechecker.failed}`}
|
}, ${strings.failed()}: ${rechecker.failed}`}
|
||||||
</Paragraph>
|
</Paragraph>
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
|
|||||||
@@ -17,6 +17,9 @@ You should have received a copy of the GNU General Public License
|
|||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import { Notebook } from "@notesnook/core";
|
||||||
|
import { strings } from "@notesnook/intl";
|
||||||
|
import { useThemeColors } from "@notesnook/theme";
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import { Linking, View } from "react-native";
|
import { Linking, View } from "react-native";
|
||||||
import Icon from "react-native-vector-icons/MaterialCommunityIcons";
|
import Icon from "react-native-vector-icons/MaterialCommunityIcons";
|
||||||
@@ -26,26 +29,22 @@ import {
|
|||||||
SUPPORT_SVG,
|
SUPPORT_SVG,
|
||||||
WELCOME_SVG
|
WELCOME_SVG
|
||||||
} from "../../assets/images/assets";
|
} from "../../assets/images/assets";
|
||||||
import { ThemeStore } from "../../stores/use-theme-store";
|
import useRotator from "../../hooks/use-rotator";
|
||||||
import { eSendEvent } from "../../services/event-manager";
|
import { eSendEvent } from "../../services/event-manager";
|
||||||
|
import { getContainerBorder } from "../../utils/colors";
|
||||||
import { getElevationStyle } from "../../utils/elevation";
|
import { getElevationStyle } from "../../utils/elevation";
|
||||||
import { eOpenAddNotebookDialog } from "../../utils/events";
|
import { eOpenAddNotebookDialog } from "../../utils/events";
|
||||||
import { SIZE } from "../../utils/size";
|
import { SIZE } from "../../utils/size";
|
||||||
import useRotator from "../../hooks/use-rotator";
|
|
||||||
import { AccentColorPicker } from "../../screens/settings/appearance";
|
|
||||||
import { Button } from "../ui/button";
|
|
||||||
import { SvgView } from "../ui/svg";
|
|
||||||
import { PinItem } from "../side-menu/pinned-section";
|
import { PinItem } from "../side-menu/pinned-section";
|
||||||
|
import { Button } from "../ui/button";
|
||||||
import Seperator from "../ui/seperator";
|
import Seperator from "../ui/seperator";
|
||||||
|
import { SvgView } from "../ui/svg";
|
||||||
import Heading from "../ui/typography/heading";
|
import Heading from "../ui/typography/heading";
|
||||||
import Paragraph from "../ui/typography/paragraph";
|
import Paragraph from "../ui/typography/paragraph";
|
||||||
import { useThemeColors } from "@notesnook/theme";
|
|
||||||
import { getContainerBorder } from "../../utils/colors";
|
|
||||||
import { strings } from "@notesnook/intl";
|
|
||||||
|
|
||||||
export type TStep = {
|
export type TStep = {
|
||||||
text?: string;
|
text?: string;
|
||||||
walkthroughItem: (colors: ThemeStore["colors"]) => React.ReactNode;
|
walkthroughItem: (colors: any) => React.ReactNode;
|
||||||
title?: string;
|
title?: string;
|
||||||
button?: {
|
button?: {
|
||||||
type: "next" | "done";
|
type: "next" | "done";
|
||||||
@@ -62,18 +61,18 @@ const NotebookWelcome = () => {
|
|||||||
const { colors } = useThemeColors();
|
const { colors } = useThemeColors();
|
||||||
const data = useRotator([
|
const data = useRotator([
|
||||||
{
|
{
|
||||||
title: "Work and office",
|
title: strings.workAndOffice(),
|
||||||
description: "Everything related to my job",
|
description: strings.workAndOfficeDesc(),
|
||||||
count: 2
|
count: 2
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: "School work",
|
title: strings.schoolWork(),
|
||||||
description: "I don't like doing this but I have to.",
|
description: strings.schoolWorkDesc(),
|
||||||
count: 5
|
count: 5
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: "Recipes",
|
title: strings.recipes(),
|
||||||
description: "I love cooking and collecting recipes",
|
description: strings.recipesDesc(),
|
||||||
count: 10
|
count: 10
|
||||||
}
|
}
|
||||||
]);
|
]);
|
||||||
@@ -122,17 +121,17 @@ const notebooks: { id: string; steps: TStep[] } = {
|
|||||||
id: "notebooks",
|
id: "notebooks",
|
||||||
steps: [
|
steps: [
|
||||||
{
|
{
|
||||||
title: "Notebooks",
|
title: strings.notebooks(),
|
||||||
text: "Boost your productivity with Notebooks and organize your notes.",
|
text: strings.boostProductivityNotebook(),
|
||||||
walkthroughItem: () => <NotebookWelcome />,
|
walkthroughItem: () => <NotebookWelcome />,
|
||||||
button: {
|
button: {
|
||||||
type: "next",
|
type: "next",
|
||||||
title: "Next"
|
title: strings.next()
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: "Notebook > Notes",
|
title: strings.notebookNotes(),
|
||||||
text: "Every Notebook can have notes and sub notebooks.",
|
text: strings.notebookNotesDesc(),
|
||||||
walkthroughItem: (colors: any) => (
|
walkthroughItem: (colors: any) => (
|
||||||
<View
|
<View
|
||||||
style={{
|
style={{
|
||||||
@@ -154,9 +153,9 @@ const notebooks: { id: string; steps: TStep[] } = {
|
|||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Heading size={SIZE.md} color={colors.primary.heading}>
|
<Heading size={SIZE.md} color={colors.primary.heading}>
|
||||||
Work and office
|
{strings.workAndOffice()}
|
||||||
</Heading>
|
</Heading>
|
||||||
<Paragraph>Everything related to my job in one place.</Paragraph>
|
<Paragraph>{strings.workAndOfficeDesc()}</Paragraph>
|
||||||
|
|
||||||
<Paragraph
|
<Paragraph
|
||||||
style={{
|
style={{
|
||||||
@@ -165,7 +164,7 @@ const notebooks: { id: string; steps: TStep[] } = {
|
|||||||
size={SIZE.xs}
|
size={SIZE.xs}
|
||||||
color={colors.secondary.paragraph}
|
color={colors.secondary.paragraph}
|
||||||
>
|
>
|
||||||
Notebook - 2 notes
|
{strings.notes(2)}
|
||||||
</Paragraph>
|
</Paragraph>
|
||||||
</View>
|
</View>
|
||||||
<View
|
<View
|
||||||
@@ -184,7 +183,7 @@ const notebooks: { id: string; steps: TStep[] } = {
|
|||||||
size={SIZE.sm}
|
size={SIZE.sm}
|
||||||
name="bookmark"
|
name="bookmark"
|
||||||
/>{" "}
|
/>{" "}
|
||||||
Tasks
|
{strings.tasks()}
|
||||||
</Paragraph>
|
</Paragraph>
|
||||||
</View>
|
</View>
|
||||||
<View
|
<View
|
||||||
@@ -200,7 +199,7 @@ const notebooks: { id: string; steps: TStep[] } = {
|
|||||||
>
|
>
|
||||||
<Paragraph size={SIZE.xs}>
|
<Paragraph size={SIZE.xs}>
|
||||||
<Icon color={colors.primary.icon} size={SIZE.sm} name="note" />{" "}
|
<Icon color={colors.primary.icon} size={SIZE.sm} name="note" />{" "}
|
||||||
February 2022 Week 2
|
{strings.taskAValue()}
|
||||||
</Paragraph>
|
</Paragraph>
|
||||||
</View>
|
</View>
|
||||||
<View
|
<View
|
||||||
@@ -216,7 +215,7 @@ const notebooks: { id: string; steps: TStep[] } = {
|
|||||||
>
|
>
|
||||||
<Paragraph size={SIZE.xs}>
|
<Paragraph size={SIZE.xs}>
|
||||||
<Icon color={colors.primary.icon} size={SIZE.sm} name="note" />{" "}
|
<Icon color={colors.primary.icon} size={SIZE.sm} name="note" />{" "}
|
||||||
February 2022 Week 1
|
{strings.taskBValue()}
|
||||||
</Paragraph>
|
</Paragraph>
|
||||||
</View>
|
</View>
|
||||||
<View
|
<View
|
||||||
@@ -235,19 +234,19 @@ const notebooks: { id: string; steps: TStep[] } = {
|
|||||||
size={SIZE.sm}
|
size={SIZE.sm}
|
||||||
name="bookmark"
|
name="bookmark"
|
||||||
/>{" "}
|
/>{" "}
|
||||||
Meetings
|
{strings.meetings()}
|
||||||
</Paragraph>
|
</Paragraph>
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
),
|
),
|
||||||
button: {
|
button: {
|
||||||
type: "next",
|
type: "next",
|
||||||
title: "Next"
|
title: strings.next()
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: "Easy access",
|
title: strings.easyAccess(),
|
||||||
text: "You can create shortcuts of frequently accessed notebooks in the side menu",
|
text: strings.easyAccessDesc(),
|
||||||
walkthroughItem: () => (
|
walkthroughItem: () => (
|
||||||
<View
|
<View
|
||||||
style={{
|
style={{
|
||||||
@@ -256,29 +255,31 @@ const notebooks: { id: string; steps: TStep[] } = {
|
|||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<PinItem
|
<PinItem
|
||||||
index={0}
|
isPlaceholder={true}
|
||||||
placeholder={true}
|
item={
|
||||||
item={{
|
{
|
||||||
title: "Tasks",
|
title: strings.tasks(),
|
||||||
type: "topic"
|
type: "notebook"
|
||||||
}}
|
} as Notebook
|
||||||
|
}
|
||||||
onPress={() => {}}
|
onPress={() => {}}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<PinItem
|
<PinItem
|
||||||
index={1}
|
isPlaceholder={true}
|
||||||
placeholder={true}
|
item={
|
||||||
item={{
|
{
|
||||||
title: "Work and office",
|
title: strings.workAndOffice(),
|
||||||
type: "notebook"
|
type: "notebook"
|
||||||
}}
|
} as Notebook
|
||||||
|
}
|
||||||
onPress={() => {}}
|
onPress={() => {}}
|
||||||
/>
|
/>
|
||||||
</View>
|
</View>
|
||||||
),
|
),
|
||||||
button: {
|
button: {
|
||||||
type: "done",
|
type: "done",
|
||||||
title: "Add your first notebook",
|
title: strings.addFirstNotebook(),
|
||||||
action: () => {
|
action: () => {
|
||||||
eSendEvent(eOpenAddNotebookDialog);
|
eSendEvent(eOpenAddNotebookDialog);
|
||||||
}
|
}
|
||||||
@@ -287,67 +288,32 @@ const notebooks: { id: string; steps: TStep[] } = {
|
|||||||
]
|
]
|
||||||
};
|
};
|
||||||
|
|
||||||
const ChooseTheme = () => {
|
|
||||||
return (
|
|
||||||
<View
|
|
||||||
style={{
|
|
||||||
alignItems: "center",
|
|
||||||
marginTop: 20
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<Heading>Make yourself at home</Heading>
|
|
||||||
|
|
||||||
<Paragraph
|
|
||||||
style={{
|
|
||||||
textAlign: "center",
|
|
||||||
alignSelf: "center",
|
|
||||||
maxWidth: "80%"
|
|
||||||
}}
|
|
||||||
size={SIZE.md}
|
|
||||||
>
|
|
||||||
Pick a theme of your choice
|
|
||||||
</Paragraph>
|
|
||||||
<Seperator />
|
|
||||||
<AccentColorPicker />
|
|
||||||
<Seperator />
|
|
||||||
</View>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
const trialstarted: { id: string; steps: TStep[] } = {
|
const trialstarted: { id: string; steps: TStep[] } = {
|
||||||
id: "trialstarted",
|
id: "trialstarted",
|
||||||
steps: [
|
steps: [
|
||||||
{
|
{
|
||||||
title: "Your trial is activated",
|
title: strings.trialStarted(),
|
||||||
text: "You can use all premium features for free for the next 14 days",
|
text: strings.trialStartedDesc(),
|
||||||
walkthroughItem: (colors) => (
|
walkthroughItem: (colors) => (
|
||||||
<SvgView src={LAUNCH_ROCKET(colors.primary.paragraph)} />
|
<SvgView src={LAUNCH_ROCKET(colors.primary.paragraph)} />
|
||||||
),
|
),
|
||||||
button: {
|
button: {
|
||||||
type: "next",
|
type: "next",
|
||||||
title: "Next"
|
title: strings.next()
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
{
|
|
||||||
walkthroughItem: () => <ChooseTheme />,
|
|
||||||
button: {
|
|
||||||
type: "next",
|
|
||||||
title: "Next"
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: "Join the cause",
|
title: strings.joinTheCause(),
|
||||||
text: "Meet other privacy-minded people and talk to us directly about your concerns, issues and suggestions.",
|
text: strings.meetPrivacyMinded(),
|
||||||
walkthroughItem: (colors) => (
|
walkthroughItem: (colors) => (
|
||||||
<SvgView src={COMMUNITY_SVG(colors.primary.paragraph)} />
|
<SvgView src={COMMUNITY_SVG(colors.primary.paragraph)} />
|
||||||
),
|
),
|
||||||
button: {
|
button: {
|
||||||
type: "done",
|
type: "done",
|
||||||
title: "Continue"
|
title: strings.continue()
|
||||||
},
|
},
|
||||||
actionButton: {
|
actionButton: {
|
||||||
text: "Join Discord Community",
|
text: strings.joinDiscord(),
|
||||||
action: () => {
|
action: () => {
|
||||||
Linking.openURL("https://discord.gg/zQBK97EE22").catch(console.log);
|
Linking.openURL("https://discord.gg/zQBK97EE22").catch(console.log);
|
||||||
}
|
}
|
||||||
@@ -360,14 +326,14 @@ const emailconfirmed: { id: string; steps: TStep[] } = {
|
|||||||
id: "emailconfirmed",
|
id: "emailconfirmed",
|
||||||
steps: [
|
steps: [
|
||||||
{
|
{
|
||||||
title: "Email confirmed",
|
title: strings.emailConfirmed(),
|
||||||
text: "Your email was confirmed successfully. Thank you for choosing end-to-end encrypted note taking.",
|
text: strings.emailNotConfirmedDesc(),
|
||||||
walkthroughItem: (colors) => (
|
walkthroughItem: (colors) => (
|
||||||
<SvgView src={WELCOME_SVG(colors.primary.paragraph)} />
|
<SvgView src={WELCOME_SVG(colors.primary.paragraph)} />
|
||||||
),
|
),
|
||||||
button: {
|
button: {
|
||||||
type: "done",
|
type: "done",
|
||||||
title: "Continue"
|
title: strings.continue()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
@@ -382,15 +348,14 @@ const Support = () => {
|
|||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<SvgView src={SUPPORT_SVG()} />
|
<SvgView src={SUPPORT_SVG()} />
|
||||||
<Heading>Get Priority Support</Heading>
|
<Heading>{strings.prioritySupport()}</Heading>
|
||||||
<Paragraph
|
<Paragraph
|
||||||
style={{
|
style={{
|
||||||
textAlign: "center"
|
textAlign: "center"
|
||||||
}}
|
}}
|
||||||
size={SIZE.md}
|
size={SIZE.md}
|
||||||
>
|
>
|
||||||
You can reach out to us via multiple channels if you face an issue or
|
{strings.weAreAlwaysListening()}
|
||||||
want to just talk.
|
|
||||||
</Paragraph>
|
</Paragraph>
|
||||||
<Seperator />
|
<Seperator />
|
||||||
|
|
||||||
@@ -405,7 +370,7 @@ const Support = () => {
|
|||||||
}}
|
}}
|
||||||
icon="discord"
|
icon="discord"
|
||||||
type="secondary"
|
type="secondary"
|
||||||
title="Join our community on Discord"
|
title={strings.joinDiscord()}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
@@ -419,7 +384,7 @@ const Support = () => {
|
|||||||
}}
|
}}
|
||||||
icon="telegram"
|
icon="telegram"
|
||||||
type="secondary"
|
type="secondary"
|
||||||
title="Join our Telegram group"
|
title={strings.joinTelegram()}
|
||||||
/>
|
/>
|
||||||
<Button
|
<Button
|
||||||
style={{
|
style={{
|
||||||
@@ -429,7 +394,7 @@ const Support = () => {
|
|||||||
}}
|
}}
|
||||||
icon="bug"
|
icon="bug"
|
||||||
type="secondary"
|
type="secondary"
|
||||||
title="Submit an issue from Settings"
|
title={strings.reportAnIssue()}
|
||||||
/>
|
/>
|
||||||
<Button
|
<Button
|
||||||
style={{
|
style={{
|
||||||
@@ -439,7 +404,7 @@ const Support = () => {
|
|||||||
}}
|
}}
|
||||||
icon="mail"
|
icon="mail"
|
||||||
type="secondary"
|
type="secondary"
|
||||||
title="Email us at support@streetwriters.co"
|
title={strings.emailSupport()}
|
||||||
/>
|
/>
|
||||||
</View>
|
</View>
|
||||||
);
|
);
|
||||||
@@ -449,21 +414,21 @@ const prouser: { id: string; steps: TStep[] } = {
|
|||||||
id: "prouser",
|
id: "prouser",
|
||||||
steps: [
|
steps: [
|
||||||
{
|
{
|
||||||
title: "Welcome to Notesnook Pro",
|
title: strings.welcomeToNotesnookPro(),
|
||||||
text: "Thank you for reaffirming our idea that privacy comes first",
|
text: strings.thankYouPrivacy(),
|
||||||
walkthroughItem: (colors) => (
|
walkthroughItem: (colors) => (
|
||||||
<SvgView src={LAUNCH_ROCKET(colors.primary.paragraph)} />
|
<SvgView src={LAUNCH_ROCKET(colors.primary.paragraph)} />
|
||||||
),
|
),
|
||||||
button: {
|
button: {
|
||||||
type: "next",
|
type: "next",
|
||||||
title: "Next"
|
title: strings.next()
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
walkthroughItem: () => <Support />,
|
walkthroughItem: () => <Support />,
|
||||||
button: {
|
button: {
|
||||||
type: "done",
|
type: "done",
|
||||||
title: "Continue"
|
title: strings.continue()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -146,15 +146,16 @@ const Editor = React.memo(
|
|||||||
onRenderProcessGone={onError}
|
onRenderProcessGone={onError}
|
||||||
nestedScrollEnabled
|
nestedScrollEnabled
|
||||||
onError={onError}
|
onError={onError}
|
||||||
injectedJavaScriptBeforeContentLoaded={`
|
injectedJavaScript={`
|
||||||
globalThis.LINGUI_LOCALE = "${i18n.locale}";
|
|
||||||
globalThis.LINGUI_LOCALE_DATA = ${JSON.stringify({
|
|
||||||
[i18n.locale]: i18n.messages
|
|
||||||
})};
|
|
||||||
globalThis.__DEV__ = ${__DEV__}
|
globalThis.__DEV__ = ${__DEV__}
|
||||||
globalThis.readonly=${readonly};
|
globalThis.readonly=${readonly};
|
||||||
globalThis.noToolbar=${noToolbar};
|
globalThis.noToolbar=${noToolbar};
|
||||||
globalThis.noHeader=${noHeader};
|
globalThis.noHeader=${noHeader};
|
||||||
|
globalThis.LINGUI_LOCALE = "${i18n.locale}";
|
||||||
|
globalThis.LINGUI_LOCALE_DATA = ${JSON.stringify({
|
||||||
|
[i18n.locale]: i18n.messages
|
||||||
|
})};
|
||||||
|
globalThis.loadApp();
|
||||||
`}
|
`}
|
||||||
useSharedProcessPool={false}
|
useSharedProcessPool={false}
|
||||||
javaScriptEnabled={true}
|
javaScriptEnabled={true}
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
|
|
||||||
import { formatBytes, getFormattedDate } from "@notesnook/common";
|
import { formatBytes, getFormattedDate } from "@notesnook/common";
|
||||||
import { LegacyBackupFile } from "@notesnook/core";
|
import { LegacyBackupFile } from "@notesnook/core";
|
||||||
|
import { strings } from "@notesnook/intl";
|
||||||
import { useThemeColors } from "@notesnook/theme";
|
import { useThemeColors } from "@notesnook/theme";
|
||||||
import React, { useEffect, useState } from "react";
|
import React, { useEffect, useState } from "react";
|
||||||
import { ActivityIndicator, FlatList, Platform, View } from "react-native";
|
import { ActivityIndicator, FlatList, Platform, View } from "react-native";
|
||||||
@@ -46,7 +47,6 @@ import SettingsService from "../../../services/settings";
|
|||||||
import { refreshAllStores } from "../../../stores/create-db-collection-store";
|
import { refreshAllStores } from "../../../stores/create-db-collection-store";
|
||||||
import { useUserStore } from "../../../stores/use-user-store";
|
import { useUserStore } from "../../../stores/use-user-store";
|
||||||
import { SIZE } from "../../../utils/size";
|
import { SIZE } from "../../../utils/size";
|
||||||
import { strings } from "@notesnook/intl";
|
|
||||||
|
|
||||||
type PasswordOrKey = { password?: string; encryptionKey?: string };
|
type PasswordOrKey = { password?: string; encryptionKey?: string };
|
||||||
|
|
||||||
@@ -533,12 +533,11 @@ const BackupItem = ({
|
|||||||
}}
|
}}
|
||||||
onPress={() => {
|
onPress={() => {
|
||||||
presentDialog({
|
presentDialog({
|
||||||
title: `Restore ${itemName}`,
|
title: `${strings.restore()} ${itemName}`,
|
||||||
paragraph: `Are you sure you want to restore this backup?`,
|
paragraph: strings.restoreBackupConfirm(),
|
||||||
positiveText: "Restore",
|
positiveText: strings.restore(),
|
||||||
negativeText: "Cancel",
|
negativeText: strings.cancel(),
|
||||||
positivePress: async () => {
|
positivePress: async () => {
|
||||||
console.log("file path", (item as ScopedStorage.FileType).uri);
|
|
||||||
restoreBackup({
|
restoreBackup({
|
||||||
uri:
|
uri:
|
||||||
Platform.OS === "android"
|
Platform.OS === "android"
|
||||||
|
|||||||
@@ -145,14 +145,16 @@ export function ServersConfiguration() {
|
|||||||
.catch(() => undefined);
|
.catch(() => undefined);
|
||||||
if (!version)
|
if (!version)
|
||||||
throw new Error(
|
throw new Error(
|
||||||
`${strings.couldNotConnectTo()} ${server.title}.`
|
`${strings.couldNotConnectTo(server.title)}`
|
||||||
);
|
);
|
||||||
if (version.id !== server.id)
|
if (version.id !== server.id)
|
||||||
throw new Error(
|
throw new Error(
|
||||||
`${strings.incorrectServerUrl(url)} ${server.title}.`
|
`${strings.incorrectServerUrl(url, server.title)}.`
|
||||||
);
|
);
|
||||||
if (!isServerCompatible(version.version)) {
|
if (!isServerCompatible(version.version)) {
|
||||||
throw new Error(strings.serverVersionMismatch());
|
throw new Error(
|
||||||
|
strings.serverVersionMismatch(server.title, url)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
setSuccess(true);
|
setSuccess(true);
|
||||||
|
|||||||
@@ -339,21 +339,21 @@ export const settingsGroups: SettingSection[] = [
|
|||||||
presentDialog({
|
presentDialog({
|
||||||
title: strings.clearCacheConfirm(),
|
title: strings.clearCacheConfirm(),
|
||||||
paragraph: strings.clearCacheConfirmDesc(),
|
paragraph: strings.clearCacheConfirmDesc(),
|
||||||
positiveText: "Clear",
|
positiveText: strings.clear(),
|
||||||
positivePress: async () => {
|
positivePress: async () => {
|
||||||
filesystem.clearCache();
|
filesystem.clearCache();
|
||||||
ToastManager.show({
|
ToastManager.show({
|
||||||
heading: "Cache cleared",
|
heading: strings.cacheCleared(),
|
||||||
message: "All cached attachments have been removed",
|
message: strings.cacheClearedDesc(),
|
||||||
type: "success"
|
type: "success"
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
description(current) {
|
description(current) {
|
||||||
return `${strings.clearCacheDesc()}. Current cache size: ${
|
return `${strings.clearCacheDesc()}. ${strings.currentCacheSize(
|
||||||
current as number
|
`${current}`
|
||||||
}`;
|
)}`;
|
||||||
},
|
},
|
||||||
useHook: () => {
|
useHook: () => {
|
||||||
const [cacheSize, setCacheSize] = React.useState(0);
|
const [cacheSize, setCacheSize] = React.useState(0);
|
||||||
@@ -380,7 +380,7 @@ export const settingsGroups: SettingSection[] = [
|
|||||||
presentDialog({
|
presentDialog({
|
||||||
title: strings.logout(),
|
title: strings.logout(),
|
||||||
paragraph: strings.logoutConfirmation(),
|
paragraph: strings.logoutConfirmation(),
|
||||||
positiveText: "Logout",
|
positiveText: strings.logout(),
|
||||||
check: {
|
check: {
|
||||||
info: strings.backupDataBeforeLogout(),
|
info: strings.backupDataBeforeLogout(),
|
||||||
defaultValue: true
|
defaultValue: true
|
||||||
@@ -804,8 +804,8 @@ export const settingsGroups: SettingSection[] = [
|
|||||||
{
|
{
|
||||||
id: "servers",
|
id: "servers",
|
||||||
type: "screen",
|
type: "screen",
|
||||||
name: "Servers",
|
name: strings.servers(),
|
||||||
description: "Configure server URLs for Notesnook",
|
description: strings.serversConfigurationDesc(),
|
||||||
icon: "server",
|
icon: "server",
|
||||||
component: "server-config"
|
component: "server-config"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,11 +33,9 @@ import { strings } from "@notesnook/intl";
|
|||||||
function confirmDeleteAllNotes(items, type, context) {
|
function confirmDeleteAllNotes(items, type, context) {
|
||||||
return new Promise((resolve) => {
|
return new Promise((resolve) => {
|
||||||
presentDialog({
|
presentDialog({
|
||||||
title: `Delete ${
|
title: strings.doAction("type", items.length, "delete"),
|
||||||
items.length > 1 ? `${items.length} ${type}s` : `${type}`
|
positiveText: strings.delete(),
|
||||||
}?`,
|
negativeText: strings.cancel(),
|
||||||
positiveText: "Delete",
|
|
||||||
negativeText: "Cancel",
|
|
||||||
positivePress: (_inputValue, value) => {
|
positivePress: (_inputValue, value) => {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
resolve({ delete: true, deleteNotes: value });
|
resolve({ delete: true, deleteNotes: value });
|
||||||
|
|||||||
@@ -34,7 +34,6 @@ export async function unlockVault({
|
|||||||
paragraph: string;
|
paragraph: string;
|
||||||
}) {
|
}) {
|
||||||
if (unlockPromise) {
|
if (unlockPromise) {
|
||||||
console.log("Unlocking.... waiting for unlock promise");
|
|
||||||
return unlockPromise;
|
return unlockPromise;
|
||||||
}
|
}
|
||||||
unlockPromise = new Promise(async (resolve) => {
|
unlockPromise = new Promise(async (resolve) => {
|
||||||
@@ -58,10 +57,10 @@ export async function unlockVault({
|
|||||||
context: context,
|
context: context,
|
||||||
input: true,
|
input: true,
|
||||||
secureTextEntry: true,
|
secureTextEntry: true,
|
||||||
positiveText: "Unlock",
|
positiveText: strings.unlock(),
|
||||||
title: title,
|
title: title,
|
||||||
paragraph: paragraph,
|
paragraph: paragraph,
|
||||||
inputPlaceholder: "Enter password",
|
inputPlaceholder: strings.enterPassword(),
|
||||||
positivePress: async (value) => {
|
positivePress: async (value) => {
|
||||||
const unlocked = await db.vault.unlock(value);
|
const unlocked = await db.vault.unlock(value);
|
||||||
if (!unlocked) {
|
if (!unlocked) {
|
||||||
|
|||||||
@@ -30,6 +30,17 @@ setI18nGlobal(i18n);
|
|||||||
i18n.activate("en");
|
i18n.activate("en");
|
||||||
setI18nGlobal(i18n);
|
setI18nGlobal(i18n);
|
||||||
|
|
||||||
|
if (global.__DEV__) {
|
||||||
|
const err = console.error;
|
||||||
|
console.error = function (message) {
|
||||||
|
if (typeof message === 'string' && message.includes('VirtualizedLists should never be')) {
|
||||||
|
err.apply(console, ["VirtualizedLists should never be nested inside plain ScrollViews"]);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
err.apply(console, arguments);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
ScriptManager.shared.addResolver(async (scriptId) => {
|
ScriptManager.shared.addResolver(async (scriptId) => {
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ GNU General Public License for more details.
|
|||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
import "./utils/index";
|
||||||
global.Buffer = require("buffer").Buffer;
|
global.Buffer = require("buffer").Buffer;
|
||||||
import { i18n } from "@lingui/core";
|
import { i18n } from "@lingui/core";
|
||||||
import "@notesnook/editor/styles/fonts.mobile.css";
|
import "@notesnook/editor/styles/fonts.mobile.css";
|
||||||
@@ -27,16 +28,31 @@ import { createRoot } from "react-dom/client";
|
|||||||
import App from "./App";
|
import App from "./App";
|
||||||
import "./index.css";
|
import "./index.css";
|
||||||
|
|
||||||
const locale = globalThis.LINGUI_LOCALE_DATA
|
if (globalThis.__DEV__) {
|
||||||
|
const logFn = global.console.log;
|
||||||
|
global.console.log = function () {
|
||||||
|
//@ts-ignore
|
||||||
|
logFn.apply(console, arguments);
|
||||||
|
globalThis.logger("info", ...arguments);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
let appLoaded = false;
|
||||||
|
function loadApp() {
|
||||||
|
if (appLoaded) return;
|
||||||
|
appLoaded = true;
|
||||||
|
const locale = globalThis.LINGUI_LOCALE_DATA
|
||||||
? Promise.resolve(globalThis.LINGUI_LOCALE_DATA)
|
? Promise.resolve(globalThis.LINGUI_LOCALE_DATA)
|
||||||
: globalThis.__DEV__ || process.env.NODE_ENV === "development"
|
: globalThis.__DEV__ || process.env.NODE_ENV === "development"
|
||||||
? import("@notesnook/intl/locales/$pseudo-LOCALE.json").then(
|
? import("@notesnook/intl/locales/$pseudo-LOCALE.json").then(
|
||||||
({ default: locale }) => ({ en: locale.messages })
|
({ default: locale }) => ({ en: locale.messages })
|
||||||
)
|
)
|
||||||
: import("@notesnook/intl/locales/$en.json").then(({ default: locale }) => ({
|
: import("@notesnook/intl/locales/$en.json").then(
|
||||||
|
({ default: locale }) => ({
|
||||||
en: locale.messages
|
en: locale.messages
|
||||||
}));
|
})
|
||||||
locale.then((locale) => {
|
);
|
||||||
|
|
||||||
|
locale.then((locale) => {
|
||||||
i18n.load(locale);
|
i18n.load(locale);
|
||||||
i18n.activate(globalThis.LINGUI_LOCALE || "en");
|
i18n.activate(globalThis.LINGUI_LOCALE || "en");
|
||||||
setI18nGlobal(i18n);
|
setI18nGlobal(i18n);
|
||||||
@@ -46,4 +62,6 @@ locale.then((locale) => {
|
|||||||
const root = createRoot(rootElement);
|
const root = createRoot(rootElement);
|
||||||
root.render(<App />);
|
root.render(<App />);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
globalThis.loadApp = loadApp;
|
||||||
|
|||||||
@@ -59,6 +59,7 @@ declare global {
|
|||||||
var pendingResolvers: {
|
var pendingResolvers: {
|
||||||
[key: string]: (value: any) => void;
|
[key: string]: (value: any) => void;
|
||||||
};
|
};
|
||||||
|
|
||||||
var readonlyEditor: boolean;
|
var readonlyEditor: boolean;
|
||||||
var statusBars: Record<
|
var statusBars: Record<
|
||||||
number,
|
number,
|
||||||
@@ -141,6 +142,8 @@ declare global {
|
|||||||
|
|
||||||
function logger(type: "info" | "warn" | "error", ...logs: unknown[]): void;
|
function logger(type: "info" | "warn" | "error", ...logs: unknown[]): void;
|
||||||
function dbLogger(type: "log" | "error", ...logs: unknown[]): void;
|
function dbLogger(type: "log" | "error", ...logs: unknown[]): void;
|
||||||
|
|
||||||
|
function loadApp(): void;
|
||||||
/**
|
/**
|
||||||
* Function to post message to react native
|
* Function to post message to react native
|
||||||
* @param type
|
* @param type
|
||||||
|
|||||||
@@ -27,7 +27,7 @@
|
|||||||
"compile": "lingui compile --typescript",
|
"compile": "lingui compile --typescript",
|
||||||
"build-locale": "npm run extract && npm run compile",
|
"build-locale": "npm run extract && npm run compile",
|
||||||
"build": "npm run build-locale && npx vite build && node scripts/postbuild.mjs",
|
"build": "npm run build-locale && npx vite build && node scripts/postbuild.mjs",
|
||||||
"watch": "nodemon --watch ./src/*.ts --exec \"npx vite build\"",
|
"watch": "npx vite build --watch",
|
||||||
"postinstall": "patch-package"
|
"postinstall": "patch-package"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ You should have received a copy of the GNU General Public License
|
|||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
import { plural, select, t } from "@lingui/macro";
|
import { plural, select, t } from "@lingui/macro";
|
||||||
|
import { fail } from "assert";
|
||||||
|
|
||||||
const actions = {
|
const actions = {
|
||||||
deleted: () => t`deleted`,
|
deleted: () => t`deleted`,
|
||||||
@@ -42,7 +43,8 @@ const doActions = {
|
|||||||
edit: () => t`Edit`,
|
edit: () => t`Edit`,
|
||||||
create: () => t`Created`,
|
create: () => t`Created`,
|
||||||
rename: () => t`Rename`,
|
rename: () => t`Rename`,
|
||||||
remove: () => t`Remove`
|
remove: () => t`Remove`,
|
||||||
|
download: () => t`Download`
|
||||||
};
|
};
|
||||||
|
|
||||||
const inProgressActions = {
|
const inProgressActions = {
|
||||||
@@ -999,6 +1001,8 @@ $headline$: Use starting line of the note as title.`,
|
|||||||
account: () => t`account`,
|
account: () => t`account`,
|
||||||
subscribeToPro: () => t`Subscribe to Pro`,
|
subscribeToPro: () => t`Subscribe to Pro`,
|
||||||
trialStarted: () => t`Your free trial has started`,
|
trialStarted: () => t`Your free trial has started`,
|
||||||
|
trialStartedDesc: () =>
|
||||||
|
t`You can use all premium features for free for the next 14 days`,
|
||||||
subDetails: () => t`Subscription details`,
|
subDetails: () => t`Subscription details`,
|
||||||
signedUpOn: (date: string) => t`Signed up on ${date}`,
|
signedUpOn: (date: string) => t`Signed up on ${date}`,
|
||||||
trialEndsOn: (date: string) => t`Your free trial ends on ${date}`,
|
trialEndsOn: (date: string) => t`Your free trial ends on ${date}`,
|
||||||
@@ -2425,5 +2429,34 @@ Use this if changes from other devices are not appearing on this device. This wi
|
|||||||
increase: (title: string) => t`Increase ${title}`,
|
increase: (title: string) => t`Increase ${title}`,
|
||||||
decrease: (title: string) => t`Decrease ${title}`,
|
decrease: (title: string) => t`Decrease ${title}`,
|
||||||
saved: () => t`Saved`,
|
saved: () => t`Saved`,
|
||||||
saving: () => t`Saving`
|
saving: () => t`Saving`,
|
||||||
|
attachmentRecheckCancelled: () => t`Attachment recheck cancelled`,
|
||||||
|
recheckAll: () => t`Recheck all`,
|
||||||
|
attachmentRecheckComplete: () => t`Attachments recheck complete`,
|
||||||
|
checkingNoteAttachments: () => t`Checking note attachments`,
|
||||||
|
checkingAllAttachments: () => t`Checking all attachments`,
|
||||||
|
passed: () => t`Passed`,
|
||||||
|
failed: () => t`Failed`,
|
||||||
|
cacheClearedDesc: () => t`All cached attachments have been cleared.`,
|
||||||
|
currentCacheSize: (size: string) => t`Current cache size: ${size}`,
|
||||||
|
restoreBackupConfirm: () => t`Restore backup?`,
|
||||||
|
serversConfigurationDesc: () => t`Configure server URLs for Notesnook`,
|
||||||
|
prioritySupport: () => t`Get Priority support`,
|
||||||
|
boostProductivityNotebook: () =>
|
||||||
|
t`Boost your productivity with Notebooks and organize your notes.`,
|
||||||
|
notebookNotes: () => t` "Notebook > Notes"`,
|
||||||
|
notebookNotesDesc: () => t`Every Notebook can have notes and sub notebooks.`,
|
||||||
|
workAndOffice: () => t`Work & Office`,
|
||||||
|
workAndOfficeDesc: () => t`Everything related to my job in one place.`,
|
||||||
|
tasks: () => t`Tasks`,
|
||||||
|
taskAValue: () => t`February 2022 Week 2`,
|
||||||
|
taskBValue: () => t`February 2022 Week 3`,
|
||||||
|
meetings: () => t`Meetings`,
|
||||||
|
easyAccess: () => t`Easy access`,
|
||||||
|
easyAccessDesc: () =>
|
||||||
|
t`You can create shortcuts of frequently accessed notebooks in the side menu`,
|
||||||
|
schoolWork: () => t`School work`,
|
||||||
|
schoolWorkDesc: () => t`Everything related to my school in one place.`,
|
||||||
|
recipes: () => t`Recipes`,
|
||||||
|
recipesDesc: () => t`I love cooking and collecting recipes.`
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user