Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prod v0.5.9 #886

Merged
merged 6 commits into from
Feb 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ android {
applicationId "com.mutinywallet.mutinywallet"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 49
versionName "0.5.8"
versionCode 50
versionName "0.5.9"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
aaptOptions {
// Files and dirs to omit from the packaged assets dir, modified to accommodate modern web apps.
Expand Down
4 changes: 2 additions & 2 deletions ios/App/App.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@
INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.finance";
IPHONEOS_DEPLOYMENT_TARGET = 14.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
MARKETING_VERSION = 1.5.8;
MARKETING_VERSION = 1.5.9;
OTHER_SWIFT_FLAGS = "$(inherited) \"-D\" \"COCOAPODS\" \"-DDEBUG\"";
PRODUCT_BUNDLE_IDENTIFIER = com.mutinywallet.mutiny;
PRODUCT_NAME = "$(TARGET_NAME)";
Expand All @@ -387,7 +387,7 @@
INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.finance";
IPHONEOS_DEPLOYMENT_TARGET = 14.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
MARKETING_VERSION = 1.5.8;
MARKETING_VERSION = 1.5.9;
PRODUCT_BUNDLE_IDENTIFIER = com.mutinywallet.mutiny;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "mutiny-wallet",
"version": "0.5.8",
"version": "0.5.9",
"license": "MIT",
"packageManager": "pnpm@8.6.6",
"scripts": {
Expand Down Expand Up @@ -55,7 +55,7 @@
"@kobalte/core": "^0.9.8",
"@kobalte/tailwindcss": "^0.5.0",
"@modular-forms/solid": "^0.18.1",
"@mutinywallet/mutiny-wasm": "0.5.8",
"@mutinywallet/mutiny-wasm": "0.5.9",
"@mutinywallet/waila-wasm": "^0.2.6",
"@solid-primitives/upload": "^0.0.111",
"@solidjs/meta": "^0.29.1",
Expand Down
8 changes: 4 additions & 4 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions src/components/ActivityDetailsModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -571,8 +571,8 @@ export function ActivityDetailsModal(props: {
</FancyCard>
</Dialog.Title>
<Hr />
<Switch>
<Show when={data.latest}>
<Show when={data.latest}>
<Switch>
<Match when={kind() === "Lightning"}>
<LightningDetails
info={data() as MutinyInvoice}
Expand All @@ -596,8 +596,8 @@ export function ActivityDetailsModal(props: {
info={data() as ChannelClosure}
/>
</Match>
</Show>
</Switch>
</Switch>
</Show>
</div>
</Suspense>
</Dialog.Content>
Expand Down
11 changes: 8 additions & 3 deletions src/components/ChooseCurrency.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const COMBINED_OPTIONS: Currency[] = [USD_OPTION, BTC_OPTION, ...FIAT_OPTIONS];
export function ChooseCurrency() {
const i18n = useI18n();
const [error, setError] = createSignal<Error>();
const [_state, actions] = useMegaStore();
const [state, actions] = useMegaStore();
const [loading, setLoading] = createSignal(false);
const navigate = useNavigate();

Expand All @@ -37,7 +37,7 @@ export function ChooseCurrency() {
const [_chooseCurrencyForm, { Form, Field }] =
createForm<ChooseCurrencyForm>({
initialValues: {
fiatCurrency: ""
fiatCurrency: state.fiat.value
},
validate: (values) => {
const errors: Record<string, string> = {};
Expand Down Expand Up @@ -82,7 +82,12 @@ export function ChooseCurrency() {
>
<For each={COMBINED_OPTIONS}>
{({ value, label }) => (
<option value={value}>{label}</option>
<option
selected={field.value === value}
value={value}
>
{label}
</option>
)}
</For>
</select>
Expand Down
95 changes: 95 additions & 0 deletions src/components/ChooseLanguage.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
import { createForm } from "@modular-forms/solid";
import { useNavigate } from "@solidjs/router";
import { createSignal, For, Show } from "solid-js";

import { Button, ExternalLink, InfoBox, NiceP, VStack } from "~/components";
import { useI18n } from "~/i18n/context";
import { useMegaStore } from "~/state/megaStore";
import { eify, EN_OPTION, Language, LANGUAGE_OPTIONS, timeout } from "~/utils";

type ChooseLanguageForm = {
selectedLanguage: string;
};

const COMBINED_OPTIONS: Language[] = [EN_OPTION, ...LANGUAGE_OPTIONS];

export function ChooseLanguage() {
const i18n = useI18n();
const [error, setError] = createSignal<Error>();
const [state, actions] = useMegaStore();
const [loading, setLoading] = createSignal(false);
const navigate = useNavigate();

const [_chooseLanguageForm, { Form, Field }] =
createForm<ChooseLanguageForm>({
initialValues: {
selectedLanguage: state.lang ?? ""
},
validate: (values) => {
const errors: Record<string, string> = {};
if (values.selectedLanguage === undefined) {
errors.selectedLanguage = i18n.t(
"settings.language.error_unsupported_language"
);
}
return errors;
}
});

const handleFormSubmit = async (f: ChooseLanguageForm) => {
setLoading(true);
try {
actions.saveLanguage(f.selectedLanguage);

await i18n.changeLanguage(f.selectedLanguage);

await timeout(1000);
navigate("/");
} catch (e) {
console.error(e);
setError(eify(e));
setLoading(false);
}
};

return (
<VStack>
<Form onSubmit={handleFormSubmit} class="flex flex-col gap-4">
<NiceP>{i18n.t("settings.language.caption")}</NiceP>
<ExternalLink href="https://github.com/MutinyWallet/mutiny-web/issues/new">
{i18n.t("settings.language.request_language_support_link")}
</ExternalLink>
<div />
<VStack>
<Field name="selectedLanguage">
{(field, props) => (
<select
{...props}
value={field.value}
class="w-full rounded-lg bg-m-grey-750 py-2 pl-4 pr-12 text-base font-normal text-white"
>
<For each={COMBINED_OPTIONS}>
{({ value, shortName }) => (
<option
selected={field.value === shortName}
value={shortName}
>
{value}
</option>
)}
</For>
</select>
)}
</Field>
<Show when={error()}>
<InfoBox accent="red">{error()?.message}</InfoBox>
</Show>
<div />
<Button intent="blue" loading={loading()}>
{i18n.t("settings.language.select_language")}
</Button>
</VStack>
</Form>
</VStack>
);
}
59 changes: 3 additions & 56 deletions src/components/Logs.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,7 @@
import { MutinyWallet } from "@mutinywallet/mutiny-wasm";
import { createSignal, Show } from "solid-js";

import {
Button,
InfoBox,
InnerCard,
NiceP,
SimpleDialog,
TextField,
VStack
} from "~/components";
import { Button, InfoBox, InnerCard, NiceP, VStack } from "~/components";
import { useI18n } from "~/i18n/context";
import { downloadTextFile, eify } from "~/utils";

Expand All @@ -18,40 +10,22 @@ export function Logs() {

// Create state for errors, password and dialog visibility
const [error, setError] = createSignal<Error>();
const [exportDecrypt, setExportDecrypt] = createSignal(false);
const [password, setPassword] = createSignal<string>();

async function handleSave() {
try {
setError(undefined);
const logs = await MutinyWallet.get_logs(password()); // Use password if required
const logs = await MutinyWallet.get_logs();
await downloadTextFile(
logs.join("") || "",
"mutiny-logs.txt",
"text/plain"
);
} catch (e) {
console.error(e);
const err = eify(e);
if (err.message === "Incorrect password entered.") {
setExportDecrypt(true);
} else {
setError(err);
}
setError(eify(e));
}
}

function savePassword(e: Event) {
e.preventDefault();
handleSave();
setPassword(undefined); // clear password after use
setExportDecrypt(false); // close the dialog
}

function noop() {
// noop
}

return (
<InnerCard title={i18n.t("settings.emergency_kit.logs.title")}>
<VStack>
Expand All @@ -65,33 +39,6 @@ export function Logs() {
<Show when={error()}>
<InfoBox accent="red">{error()?.message}</InfoBox>
</Show>
<SimpleDialog
title={i18n.t("settings.emergency_kit.logs.password")}
open={exportDecrypt()}
>
<form onSubmit={savePassword}>
<div class="flex flex-col gap-4">
<TextField
name="password"
type="password"
ref={noop}
value={password()}
onInput={(e) => setPassword(e.currentTarget.value)}
error={""}
onBlur={noop}
onChange={noop}
/>
<Show when={error()}>
<InfoBox accent="red">{error()?.message}</InfoBox>
</Show>
<Button intent="blue" onClick={savePassword}>
{i18n.t(
"settings.emergency_kit.logs.confirm_password_label"
)}
</Button>
</div>
</form>
</SimpleDialog>
</InnerCard>
);
}
1 change: 1 addition & 0 deletions src/components/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export * from "./AmountEditable";
export * from "./BalanceBox";
export * from "./BetaWarningModal";
export * from "./ChooseCurrency";
export * from "./ChooseLanguage";
export * from "./ContactEditor";
export * from "./ContactForm";
export * from "./ContactViewer";
Expand Down
6 changes: 4 additions & 2 deletions src/i18n/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,10 @@ const i18n = use(LanguageDetector).init(
fallbackNS: false,
debug: true,
detection: {
order: ["querystring", "navigator", "htmlTag"],
lookupQuerystring: "lang"
order: ["localStorage", "querystring", "navigator", "htmlTag"],
lookupQuerystring: "lang",
lookupLocalStorage: "i18nextLng",
caches: ["localStorage"]
},
resources: resources
// FIXME: this doesn't work when deployed
Expand Down
10 changes: 10 additions & 0 deletions src/i18n/en/translations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -432,6 +432,16 @@ export default {
"Request support for more currencies",
error_unsupported_currency: "Please Select a supported currency."
},
language: {
title: "Language",
caption: "Choose your preferred language",
select_language: "Select Language",
select_language_label: "Language",
select_language_caption:
"Choosing a new currency will change the wallet language, ignoring current browser language",
request_language_support_link: "Request support for more languages",
error_unsupported_language: "Please Select a supported language."
},
lnurl_auth: {
title: "LNURL Auth",
auth: "Auth",
Expand Down
2 changes: 2 additions & 0 deletions src/router.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import {
EmergencyKit,
Encrypt,
Gift,
Language,
ManageFederations,
Plus,
Restore,
Expand Down Expand Up @@ -111,6 +112,7 @@ export function Router() {
<Route path="/channels" component={Channels} />
<Route path="/connections" component={Connections} />
<Route path="/currency" component={Currency} />
<Route path="/language" component={Language} />
<Route path="/emergencykit" component={EmergencyKit} />
<Route path="/encrypt" component={Encrypt} />
<Route path="/gift" component={Gift} />
Expand Down
Loading
Loading