feat(ui): Translate the entire UI
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:moxxyv2/i18n/strings.g.dart';
|
||||
import 'package:moxxyv2/ui/bloc/blocklist_bloc.dart';
|
||||
import 'package:moxxyv2/ui/constants.dart';
|
||||
import 'package:moxxyv2/ui/helpers.dart';
|
||||
@@ -30,9 +31,9 @@ class BlocklistPage extends StatelessWidget {
|
||||
padding: const EdgeInsets.only(top: 8),
|
||||
child: Image.asset('assets/images/happy_news.png'),
|
||||
),
|
||||
const Padding(
|
||||
padding: EdgeInsets.only(top: 8),
|
||||
child: Text('You have no users blocked'),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(top: 8),
|
||||
child: Text(t.pages.blocklist.noUsersBlocked),
|
||||
)
|
||||
],
|
||||
),
|
||||
@@ -59,8 +60,8 @@ class BlocklistPage extends StatelessWidget {
|
||||
icon: const Icon(Icons.delete),
|
||||
color: Colors.red,
|
||||
onPressed: () => showConfirmationDialog(
|
||||
'Unblock $jid?',
|
||||
'Are you sure you want to unblock $jid? You will receive messages from this user again.',
|
||||
t.pages.blocklist.unblockJidConfirmTitle(jid: jid),
|
||||
t.pages.blocklist.unblockJidConfirmBody(jid: jid),
|
||||
context,
|
||||
() {
|
||||
context.read<BlocklistBloc>().add(UnblockedJidEvent(jid));
|
||||
@@ -79,15 +80,15 @@ class BlocklistPage extends StatelessWidget {
|
||||
return BlocBuilder<BlocklistBloc, BlocklistState>(
|
||||
builder: (context, state) => Scaffold(
|
||||
appBar: BorderlessTopbar.simple(
|
||||
'Blocklist',
|
||||
t.pages.blocklist.title,
|
||||
extra: [
|
||||
Expanded(child: Container()),
|
||||
PopupMenuButton(
|
||||
onSelected: (BlocklistOptions result) {
|
||||
if (result == BlocklistOptions.unblockAll) {
|
||||
showConfirmationDialog(
|
||||
'Are you sure?',
|
||||
'Are you sure you want to unblock all users?',
|
||||
t.pages.blocklist.unblockAllConfirmTitle,
|
||||
t.pages.blocklist.unblockAllConfirmBody,
|
||||
context,
|
||||
() {
|
||||
context.read<BlocklistBloc>().add(UnblockedAllEvent());
|
||||
@@ -98,10 +99,10 @@ class BlocklistPage extends StatelessWidget {
|
||||
},
|
||||
icon: const Icon(Icons.more_vert),
|
||||
itemBuilder: (BuildContext context) => [
|
||||
const PopupMenuItem(
|
||||
PopupMenuItem(
|
||||
value: BlocklistOptions.unblockAll,
|
||||
child: Text('Unblock all'),
|
||||
)
|
||||
child: Text(t.pages.blocklist.unblockAll),
|
||||
),
|
||||
],
|
||||
)
|
||||
],
|
||||
|
||||
@@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:get_it/get_it.dart';
|
||||
import 'package:moxxmpp/moxxmpp.dart';
|
||||
import 'package:moxxyv2/i18n/strings.g.dart';
|
||||
import 'package:moxxyv2/ui/bloc/conversation_bloc.dart';
|
||||
import 'package:moxxyv2/ui/bloc/conversations_bloc.dart';
|
||||
import 'package:moxxyv2/ui/bloc/profile_bloc.dart' as profile;
|
||||
@@ -59,9 +60,9 @@ class ConversationTopbar extends StatelessWidget implements PreferredSizeWidget
|
||||
switch (state) {
|
||||
case ChatState.paused:
|
||||
case ChatState.active:
|
||||
return const Text(
|
||||
'Online',
|
||||
style: TextStyle(
|
||||
return Text(
|
||||
t.pages.conversation.online,
|
||||
style: const TextStyle(
|
||||
color: Colors.green,
|
||||
),
|
||||
);
|
||||
@@ -130,8 +131,8 @@ class ConversationTopbar extends StatelessWidget implements PreferredSizeWidget
|
||||
const Icon(Icons.lock) :
|
||||
const Icon(Icons.lock_open),
|
||||
itemBuilder: (BuildContext c) => [
|
||||
popupItemWithIcon(EncryptionOption.none, 'Unencrypted', Icons.lock_open),
|
||||
popupItemWithIcon(EncryptionOption.omemo, 'Encrypted', Icons.lock),
|
||||
popupItemWithIcon(EncryptionOption.none, t.pages.conversation.unencrypted, Icons.lock_open),
|
||||
popupItemWithIcon(EncryptionOption.omemo, t.pages.conversation.encrypted, Icons.lock),
|
||||
],
|
||||
),
|
||||
// ignore: implicit_dynamic_type
|
||||
@@ -140,8 +141,8 @@ class ConversationTopbar extends StatelessWidget implements PreferredSizeWidget
|
||||
switch (result) {
|
||||
case ConversationOption.close: {
|
||||
showConfirmationDialog(
|
||||
'Close Chat',
|
||||
'Are you sure you want to close this chat?',
|
||||
t.pages.conversation.closeChatConfirmTitle,
|
||||
t.pages.conversation.closeChatConfirmSubtext,
|
||||
context,
|
||||
() {
|
||||
context.read<ConversationsBloc>().add(
|
||||
@@ -159,8 +160,8 @@ class ConversationTopbar extends StatelessWidget implements PreferredSizeWidget
|
||||
},
|
||||
icon: const Icon(Icons.more_vert),
|
||||
itemBuilder: (BuildContext c) => [
|
||||
popupItemWithIcon(ConversationOption.close, 'Close chat', Icons.close),
|
||||
popupItemWithIcon(ConversationOption.block, 'Block contact', Icons.block)
|
||||
popupItemWithIcon(ConversationOption.close, t.pages.conversation.closeChat, Icons.close),
|
||||
popupItemWithIcon(ConversationOption.block, t.pages.conversation.blockUser, Icons.block)
|
||||
],
|
||||
),
|
||||
],
|
||||
|
||||
@@ -40,7 +40,7 @@ class Intro extends StatelessWidget {
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: paddingVeryLarge),
|
||||
child: Text(
|
||||
t.pages.intro.subtitle,
|
||||
t.global.moxxySubtitle,
|
||||
style: const TextStyle(
|
||||
fontSize: fontsizeBody,
|
||||
),
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:moxxyv2/i18n/strings.g.dart';
|
||||
import 'package:moxxyv2/ui/bloc/devices_bloc.dart';
|
||||
import 'package:moxxyv2/ui/constants.dart';
|
||||
import 'package:moxxyv2/ui/helpers.dart';
|
||||
@@ -60,8 +61,8 @@ class DevicesPage extends StatelessWidget {
|
||||
|
||||
void _recreateSessions(BuildContext context) {
|
||||
showConfirmationDialog(
|
||||
'Recreate sessions?',
|
||||
"This will recreate the cryptographic sessions with the contact. Use only if this device throws decryption errors or your contact's devices throw decryption errors.",
|
||||
t.pages.profile.devices.recreateSessionsConfirmTitle,
|
||||
t.pages.profile.devices.recreateSessionsConfirmBody,
|
||||
context,
|
||||
() {
|
||||
context.read<DevicesBloc>().add(SessionsRecreatedEvent());
|
||||
@@ -74,7 +75,7 @@ class DevicesPage extends StatelessWidget {
|
||||
return BlocBuilder<DevicesBloc, DevicesState>(
|
||||
builder: (context, state) => Scaffold(
|
||||
appBar: BorderlessTopbar.simple(
|
||||
'Devices',
|
||||
t.pages.profile.devices.title,
|
||||
extra: [
|
||||
const Spacer(),
|
||||
PopupMenuButton(
|
||||
@@ -88,7 +89,7 @@ class DevicesPage extends StatelessWidget {
|
||||
PopupMenuItem(
|
||||
value: DevicesOptions.recreateSessions,
|
||||
enabled: state.devices.isNotEmpty,
|
||||
child: const Text('Rebuild sessions'),
|
||||
child: Text(t.pages.profile.devices.recreateSessions),
|
||||
)
|
||||
],
|
||||
),
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:get_it/get_it.dart';
|
||||
import 'package:moxxyv2/i18n/strings.g.dart';
|
||||
import 'package:moxxyv2/ui/bloc/own_devices_bloc.dart';
|
||||
import 'package:moxxyv2/ui/constants.dart';
|
||||
import 'package:moxxyv2/ui/helpers.dart';
|
||||
@@ -65,15 +66,15 @@ class OwnDevicesPage extends StatelessWidget {
|
||||
return Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
const Align(
|
||||
Align(
|
||||
alignment: Alignment.centerLeft,
|
||||
child: Padding(
|
||||
padding: EdgeInsets.only(
|
||||
padding: const EdgeInsets.only(
|
||||
left: 16,
|
||||
),
|
||||
child: Text(
|
||||
'This device',
|
||||
style: TextStyle(
|
||||
t.pages.profile.owndevices.thisDevice,
|
||||
style: const TextStyle(
|
||||
fontSize: fontsizeSubtitle,
|
||||
),
|
||||
),
|
||||
@@ -90,16 +91,16 @@ class OwnDevicesPage extends StatelessWidget {
|
||||
),
|
||||
...state.keys.isNotEmpty ?
|
||||
[
|
||||
const Align(
|
||||
Align(
|
||||
alignment: Alignment.centerLeft,
|
||||
child: Padding(
|
||||
padding: EdgeInsets.only(
|
||||
padding: const EdgeInsets.only(
|
||||
top: 32,
|
||||
left: 16,
|
||||
),
|
||||
child: Text(
|
||||
'Other devices',
|
||||
style: TextStyle(
|
||||
t.pages.profile.owndevices.otherDevices,
|
||||
style: const TextStyle(
|
||||
fontSize: fontsizeSubtitle,
|
||||
),
|
||||
),
|
||||
@@ -139,8 +140,8 @@ class OwnDevicesPage extends StatelessWidget {
|
||||
},
|
||||
onDeletePressed: () {
|
||||
showConfirmationDialog(
|
||||
'Delete device',
|
||||
'This means that contacts will not be able to encrypt for that device. Continue?',
|
||||
t.pages.profile.owndevices.deleteDeviceConfirmTitle,
|
||||
t.pages.profile.owndevices.deleteDeviceConfirmBody,
|
||||
context,
|
||||
() {
|
||||
context.read<OwnDevicesBloc>().add(OwnDeviceRemovedEvent(item.deviceId));
|
||||
@@ -154,8 +155,8 @@ class OwnDevicesPage extends StatelessWidget {
|
||||
|
||||
void _recreateSessions(BuildContext context) {
|
||||
showConfirmationDialog(
|
||||
'Recreate own sessions?',
|
||||
'This will recreate the cryptographic sessions with your own devices. Use only if your own devices throw decryption errors.',
|
||||
t.pages.profile.owndevices.recreateOwnSessionsConfirmTitle,
|
||||
t.pages.profile.owndevices.recreateOwnSessionsConfirmBody,
|
||||
context,
|
||||
() {
|
||||
context.read<OwnDevicesBloc>().add(OwnSessionsRecreatedEvent());
|
||||
@@ -165,8 +166,8 @@ class OwnDevicesPage extends StatelessWidget {
|
||||
|
||||
void _recreateDevice(BuildContext context) {
|
||||
showConfirmationDialog(
|
||||
'Recreate own device?',
|
||||
"This will recreate this device's cryptographic identity. It might take some time and will cause decryption errors until you sent a message to your contacts. If they verified your device, they will have to do it again. Continue?",
|
||||
t.pages.profile.owndevices.recreateOwnDeviceConfirmTitle,
|
||||
t.pages.profile.owndevices.recreateOwnDeviceConfirmBody,
|
||||
context,
|
||||
() {
|
||||
context.read<OwnDevicesBloc>().add(OwnDeviceRegeneratedEvent());
|
||||
@@ -179,7 +180,7 @@ class OwnDevicesPage extends StatelessWidget {
|
||||
return BlocBuilder<OwnDevicesBloc, OwnDevicesState>(
|
||||
builder: (context, state) => Scaffold(
|
||||
appBar: BorderlessTopbar.simple(
|
||||
'Own Devices',
|
||||
t.pages.profile.owndevices.title,
|
||||
extra: [
|
||||
const Spacer(),
|
||||
PopupMenuButton(
|
||||
@@ -198,11 +199,11 @@ class OwnDevicesPage extends StatelessWidget {
|
||||
PopupMenuItem(
|
||||
value: OwnDevicesOptions.recreateSessions,
|
||||
enabled: state.keys.isNotEmpty,
|
||||
child: const Text('Rebuild sessions'),
|
||||
child: Text(t.pages.profile.owndevices.recreateOwnSessions),
|
||||
),
|
||||
const PopupMenuItem(
|
||||
PopupMenuItem(
|
||||
value: OwnDevicesOptions.recreateDevice,
|
||||
child: Text('Recreate identity'),
|
||||
child: Text(t.pages.profile.owndevices.recreateOwnDevice),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:moxxyv2/i18n/strings.g.dart';
|
||||
import 'package:moxxyv2/ui/constants.dart';
|
||||
import 'package:moxxyv2/ui/widgets/topbar.dart';
|
||||
import 'package:url_launcher/url_launcher.dart';
|
||||
@@ -24,7 +25,7 @@ class SettingsAboutPage extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: BorderlessTopbar.simple('About'),
|
||||
appBar: BorderlessTopbar.simple(t.pages.settings.about.title),
|
||||
body: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: paddingVeryLarge),
|
||||
child: Column(
|
||||
@@ -33,26 +34,26 @@ class SettingsAboutPage extends StatelessWidget {
|
||||
'assets/images/logo.png',
|
||||
width: 200, height: 200,
|
||||
),
|
||||
const Text(
|
||||
'moxxy',
|
||||
style: TextStyle(
|
||||
Text(
|
||||
t.global.title,
|
||||
style: const TextStyle(
|
||||
fontSize: 40,
|
||||
),
|
||||
),
|
||||
const Padding(
|
||||
padding: EdgeInsets.symmetric(vertical: 8),
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 8),
|
||||
child: Text(
|
||||
'An experimental XMPP client that is beautiful, modern and easy to use',
|
||||
style: TextStyle(
|
||||
t.global.moxxySubtitle,
|
||||
style: const TextStyle(
|
||||
fontSize: 15,
|
||||
),
|
||||
),
|
||||
),
|
||||
const Text('Licensed under GPL3'),
|
||||
Text(t.pages.settings.about.licensed),
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 8),
|
||||
child: ElevatedButton(
|
||||
child: const Text('View source code'),
|
||||
child: Text(t.pages.settings.about.viewSourceCode),
|
||||
onPressed: () => _openUrl('https://github.com/PapaTutuWawa/moxxyv2'),
|
||||
),
|
||||
)
|
||||
|
||||
@@ -3,6 +3,7 @@ import 'dart:io';
|
||||
import 'package:file_picker/file_picker.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:moxxyv2/i18n/strings.g.dart';
|
||||
import 'package:moxxyv2/shared/models/preferences.dart';
|
||||
import 'package:moxxyv2/ui/bloc/cropbackground_bloc.dart';
|
||||
import 'package:moxxyv2/ui/bloc/preferences_bloc.dart';
|
||||
@@ -63,16 +64,16 @@ class ConversationSettingsPage extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: BorderlessTopbar.simple('Chat'),
|
||||
appBar: BorderlessTopbar.simple(t.pages.settings.conversation.title),
|
||||
body: BlocBuilder<PreferencesBloc, PreferencesState>(
|
||||
builder: (context, state) => SettingsList(
|
||||
sections: [
|
||||
SettingsSection(
|
||||
title: const Text('Appearance'),
|
||||
title: Text(t.pages.settings.conversation.appearance),
|
||||
tiles: [
|
||||
SettingsTile(
|
||||
title: const Text('Select background image'),
|
||||
description: const Text('This image will be the background of all your chats'),
|
||||
title: Text(t.pages.settings.conversation.selectBackgroundImage),
|
||||
description: Text(t.pages.settings.conversation.selectBackgroundImageDescription),
|
||||
onPressed: (context) async {
|
||||
final backgroundPath = await _pickBackgroundImage();
|
||||
|
||||
@@ -85,11 +86,11 @@ class ConversationSettingsPage extends StatelessWidget {
|
||||
},
|
||||
),
|
||||
SettingsTile(
|
||||
title: const Text('Remove background image'),
|
||||
title: Text(t.pages.settings.conversation.removeBackgroundImage),
|
||||
onPressed: (context) {
|
||||
showConfirmationDialog(
|
||||
'Are you sure?',
|
||||
'Are you sure you want to remove your conversation background image?',
|
||||
t.pages.settings.conversation.removeBackgroundImageConfirmTitle,
|
||||
t.pages.settings.conversation.removeBackgroundImageConfirmBody,
|
||||
context,
|
||||
() async {
|
||||
await _removeBackgroundImage(context, state);
|
||||
@@ -100,10 +101,10 @@ class ConversationSettingsPage extends StatelessWidget {
|
||||
],
|
||||
),
|
||||
SettingsSection(
|
||||
title: const Text('New Conversations'),
|
||||
title: Text(t.pages.settings.conversation.newChatsSection),
|
||||
tiles: [
|
||||
SettingsTile.switchTile(
|
||||
title: const Text('Mute new chats by default'),
|
||||
title: Text(t.pages.settings.conversation.newChatsMuteByDefault),
|
||||
initialValue: state.defaultMuteState,
|
||||
onToggle: (value) => context.read<PreferencesBloc>().add(
|
||||
PreferencesChangedEvent(
|
||||
@@ -112,7 +113,7 @@ class ConversationSettingsPage extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
SettingsTile.switchTile(
|
||||
title: const Text('Enable end-to-end encryption by default. WARNING: Experimental'),
|
||||
title: Text(t.pages.settings.conversation.newChatsE2EE),
|
||||
initialValue: state.enableOmemoByDefault,
|
||||
onToggle: (value) => context.read<PreferencesBloc>().add(
|
||||
PreferencesChangedEvent(
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:moxxyv2/i18n/strings.g.dart';
|
||||
import 'package:moxxyv2/shared/models/preferences.dart';
|
||||
import 'package:moxxyv2/ui/bloc/preferences_bloc.dart';
|
||||
import 'package:moxxyv2/ui/constants.dart';
|
||||
@@ -7,7 +8,6 @@ import 'package:moxxyv2/ui/widgets/topbar.dart';
|
||||
import 'package:settings_ui/settings_ui.dart';
|
||||
|
||||
class DebuggingPage extends StatelessWidget {
|
||||
|
||||
DebuggingPage({ super.key })
|
||||
: _ipController = TextEditingController(),
|
||||
_passphraseController = TextEditingController(),
|
||||
@@ -26,15 +26,15 @@ class DebuggingPage extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: BorderlessTopbar.simple('Debugging'),
|
||||
appBar: BorderlessTopbar.simple(t.pages.settings.debugging.title),
|
||||
body: BlocBuilder<PreferencesBloc, PreferencesState>(
|
||||
builder: (context, state) => SettingsList(
|
||||
sections: [
|
||||
SettingsSection(
|
||||
title: const Text('General'),
|
||||
title: Text(t.pages.settings.debugging.generalSection),
|
||||
tiles: [
|
||||
SettingsTile.switchTile(
|
||||
title: const Text('Enable debugging'),
|
||||
title: Text(t.pages.settings.debugging.generalEnableDebugging),
|
||||
onToggle: (value) => context.read<PreferencesBloc>().add(
|
||||
PreferencesChangedEvent(
|
||||
state.copyWith(debugEnabled: value),
|
||||
@@ -43,14 +43,14 @@ class DebuggingPage extends StatelessWidget {
|
||||
initialValue: state.debugEnabled,
|
||||
),
|
||||
SettingsTile(
|
||||
title: const Text('Encryption password'),
|
||||
description: const Text('The logs may contain sensitive information so pick a strong passphrase'),
|
||||
title: Text(t.pages.settings.debugging.generalEncryptionPassword),
|
||||
description: Text(t.pages.settings.debugging.generalEncryptionPasswordSubtext),
|
||||
onPressed: (context) {
|
||||
showDialog<void>(
|
||||
context: context,
|
||||
barrierDismissible: true,
|
||||
builder: (BuildContext context) => AlertDialog(
|
||||
title: const Text('Debug Passphrase'),
|
||||
title: Text(t.pages.settings.debugging.generalEncryptionPassword),
|
||||
content: TextField(
|
||||
minLines: 1,
|
||||
obscureText: true,
|
||||
@@ -58,7 +58,7 @@ class DebuggingPage extends StatelessWidget {
|
||||
),
|
||||
actions: [
|
||||
TextButton(
|
||||
child: const Text('Okay'),
|
||||
child: Text(t.global.dialogAccept),
|
||||
onPressed: () {
|
||||
context.read<PreferencesBloc>().add(
|
||||
PreferencesChangedEvent(
|
||||
@@ -74,21 +74,21 @@ class DebuggingPage extends StatelessWidget {
|
||||
},
|
||||
),
|
||||
SettingsTile(
|
||||
title: const Text('Logging IP'),
|
||||
description: const Text('The IP the logs should be sent to'),
|
||||
title: Text(t.pages.settings.debugging.generalLoggingIp),
|
||||
description: Text(t.pages.settings.debugging.generalLoggingIpSubtext),
|
||||
onPressed: (context) {
|
||||
showDialog<void>(
|
||||
context: context,
|
||||
barrierDismissible: true,
|
||||
builder: (BuildContext context) => AlertDialog(
|
||||
title: const Text('Logging IP'),
|
||||
title: Text(t.pages.settings.debugging.generalLoggingIp),
|
||||
content: TextField(
|
||||
minLines: 1,
|
||||
controller: _ipController,
|
||||
),
|
||||
actions: [
|
||||
TextButton(
|
||||
child: const Text('Okay'),
|
||||
child: Text(t.global.dialogAccept),
|
||||
onPressed: () {
|
||||
context.read<PreferencesBloc>().add(
|
||||
PreferencesChangedEvent(
|
||||
@@ -104,14 +104,14 @@ class DebuggingPage extends StatelessWidget {
|
||||
},
|
||||
),
|
||||
SettingsTile(
|
||||
title: const Text('Logging Port'),
|
||||
description: const Text('The Port the logs should be sent to'),
|
||||
title: Text(t.pages.settings.debugging.generalLoggingPort),
|
||||
description: Text(t.pages.settings.debugging.generalLoggingPortSubtext),
|
||||
onPressed: (context) {
|
||||
showDialog<void>(
|
||||
context: context,
|
||||
barrierDismissible: true,
|
||||
builder: (BuildContext context) => AlertDialog(
|
||||
title: const Text('Logging Port'),
|
||||
title: Text(t.pages.settings.debugging.generalLoggingPort),
|
||||
content: TextField(
|
||||
minLines: 1,
|
||||
controller: _portController,
|
||||
@@ -119,7 +119,7 @@ class DebuggingPage extends StatelessWidget {
|
||||
),
|
||||
actions: [
|
||||
TextButton(
|
||||
child: const Text('Okay'),
|
||||
child: Text(t.global.dialogAccept),
|
||||
onPressed: () {
|
||||
context.read<PreferencesBloc>().add(
|
||||
PreferencesChangedEvent(
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:moxxyv2/i18n/strings.g.dart';
|
||||
import 'package:moxxyv2/ui/constants.dart';
|
||||
import 'package:moxxyv2/ui/widgets/topbar.dart';
|
||||
import 'package:url_launcher/url_launcher.dart';
|
||||
@@ -31,7 +32,7 @@ class LicenseRow extends StatelessWidget {
|
||||
Widget build(BuildContext context) {
|
||||
return ListTile(
|
||||
title: Text(library.name),
|
||||
subtitle: Text('Licensed under ${library.license}'),
|
||||
subtitle: Text(t.pages.settings.licenses.licensedUnder(license: library.license)),
|
||||
onTap: _openUrl,
|
||||
);
|
||||
}
|
||||
@@ -50,7 +51,7 @@ class SettingsLicensesPage extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: BorderlessTopbar.simple('Licenses'),
|
||||
appBar: BorderlessTopbar.simple(t.pages.settings.licenses.title),
|
||||
body: ListView.builder(
|
||||
itemCount: usedLibraryList.length,
|
||||
itemBuilder: (context, index) => LicenseRow(library: usedLibraryList[index]),
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:moxxyv2/i18n/strings.g.dart';
|
||||
import 'package:moxxyv2/shared/models/preferences.dart';
|
||||
import 'package:moxxyv2/ui/bloc/preferences_bloc.dart';
|
||||
import 'package:moxxyv2/ui/constants.dart';
|
||||
@@ -66,18 +67,18 @@ class NetworkPage extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: BorderlessTopbar.simple('Network'),
|
||||
appBar: BorderlessTopbar.simple(t.pages.settings.network.title),
|
||||
body: BlocBuilder<PreferencesBloc, PreferencesState>(
|
||||
builder: (context, state) => SettingsList(
|
||||
sections: [
|
||||
SettingsSection(
|
||||
title: const Text('Automatic Downloads'),
|
||||
title: Text(t.pages.settings.network.automaticDownloadsSection),
|
||||
tiles: [
|
||||
SettingsTile(
|
||||
title: const Text('Moxxy will automatically download files on...'),
|
||||
title: Text(t.pages.settings.network.automaticDownloadsText),
|
||||
),
|
||||
SettingsTile.switchTile(
|
||||
title: const Text('Wifi'),
|
||||
title: Text(t.pages.settings.network.wifi),
|
||||
initialValue: state.autoDownloadWifi,
|
||||
onToggle: (value) => context.read<PreferencesBloc>().add(
|
||||
PreferencesChangedEvent(
|
||||
@@ -86,7 +87,7 @@ class NetworkPage extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
SettingsTile.switchTile(
|
||||
title: const Text('Mobile Data'),
|
||||
title: Text(t.pages.settings.network.mobileData),
|
||||
initialValue: state.autoDownloadMobile,
|
||||
onToggle: (value) => context.read<PreferencesBloc>().add(
|
||||
PreferencesChangedEvent(
|
||||
@@ -95,8 +96,8 @@ class NetworkPage extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
SettingsTile(
|
||||
title: const Text('Maximum Download Size'),
|
||||
description: const Text('The maximum file size for a file to be automatically downloaded'),
|
||||
title: Text(t.pages.settings.network.automaticDownloadsMaximumSize),
|
||||
description: Text(t.pages.settings.network.automaticDownloadsMaximumSizeSubtext),
|
||||
onPressed: (context) {
|
||||
showModalBottomSheet<dynamic>(
|
||||
context: context,
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:moxxyv2/i18n/strings.g.dart';
|
||||
import 'package:moxxyv2/shared/models/preferences.dart';
|
||||
import 'package:moxxyv2/ui/bloc/preferences_bloc.dart';
|
||||
import 'package:moxxyv2/ui/constants.dart';
|
||||
@@ -20,16 +21,16 @@ class PrivacyPage extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: BorderlessTopbar.simple('Privacy'),
|
||||
appBar: BorderlessTopbar.simple(t.pages.settings.privacy.title),
|
||||
body: BlocBuilder<PreferencesBloc, PreferencesState>(
|
||||
builder: (context, state) => SettingsList(
|
||||
sections: [
|
||||
SettingsSection(
|
||||
title: const Text('General'),
|
||||
title: Text(t.pages.settings.privacy.generalSection),
|
||||
tiles: [
|
||||
SettingsTile.switchTile(
|
||||
title: const Text('Show contact requests'),
|
||||
description: const Text('This will show people who added you to their contact list but sent no message yet'),
|
||||
title: Text(t.pages.settings.privacy.showContactRequests),
|
||||
description: Text(t.pages.settings.privacy.showContactRequestsSubtext),
|
||||
initialValue: state.showSubscriptionRequests,
|
||||
onToggle: (value) => context.read<PreferencesBloc>().add(
|
||||
PreferencesChangedEvent(
|
||||
@@ -38,8 +39,8 @@ class PrivacyPage extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
SettingsTile.switchTile(
|
||||
title: const Text('Make profile picture public'),
|
||||
description: const Text('If enabled, everyone can see your profile picture. If disabled, only users on your contact list can see your profile picture.'),
|
||||
title: Text(t.pages.settings.privacy.profilePictureVisibility),
|
||||
description: Text(t.pages.settings.privacy.profilePictureVisibilitSubtext),
|
||||
initialValue: state.isAvatarPublic,
|
||||
onToggle: (value) => context.read<PreferencesBloc>().add(
|
||||
PreferencesChangedEvent(
|
||||
@@ -48,8 +49,8 @@ class PrivacyPage extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
SettingsTile.switchTile(
|
||||
title: const Text('Auto-accept subscription requests'),
|
||||
description: const Text('If enabled, subscription requests will be automatically accepted if the user is in the contact list.'),
|
||||
title: Text(t.pages.settings.privacy.autoAcceptSubscriptionRequests),
|
||||
description: Text(t.pages.settings.privacy.autoAcceptSubscriptionRequestsSubtext),
|
||||
initialValue: state.autoAcceptSubscriptionRequests,
|
||||
onToggle: (value) => context.read<PreferencesBloc>().add(
|
||||
PreferencesChangedEvent(
|
||||
@@ -60,11 +61,11 @@ class PrivacyPage extends StatelessWidget {
|
||||
],
|
||||
),
|
||||
SettingsSection(
|
||||
title: const Text('Conversation'),
|
||||
title: Text(t.pages.settings.privacy.conversationsSection),
|
||||
tiles: [
|
||||
SettingsTile.switchTile(
|
||||
title: const Text('Send chat markers'),
|
||||
description: const Text('This will tell your conversation partner if you received or read a message'),
|
||||
title: Text(t.pages.settings.privacy.sendChatMarkers),
|
||||
description: Text(t.pages.settings.privacy.sendChatMarkersSubtext),
|
||||
initialValue: state.sendChatMarkers,
|
||||
onToggle: (value) => context.read<PreferencesBloc>().add(
|
||||
PreferencesChangedEvent(
|
||||
@@ -73,8 +74,8 @@ class PrivacyPage extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
SettingsTile.switchTile(
|
||||
title: const Text('Send chat states'),
|
||||
description: const Text('This will show your conversation partner if you are typing or looking at the chat'),
|
||||
title: Text(t.pages.settings.privacy.sendChatStates),
|
||||
description: Text(t.pages.settings.privacy.sendChatStatesSubtext),
|
||||
initialValue: state.sendChatStates,
|
||||
onToggle: (value) => context.read<PreferencesBloc>().add(
|
||||
PreferencesChangedEvent(
|
||||
@@ -85,7 +86,7 @@ class PrivacyPage extends StatelessWidget {
|
||||
],
|
||||
),
|
||||
SettingsSection(
|
||||
title: const Text('Redirects'),
|
||||
title: Text(t.pages.settings.privacy.redirectsSection),
|
||||
tiles: [
|
||||
RedirectSettingsTile(
|
||||
'Youtube',
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:moxxyv2/i18n/strings.g.dart';
|
||||
import 'package:moxxyv2/ui/constants.dart';
|
||||
import 'package:moxxyv2/ui/widgets/textfield.dart';
|
||||
|
||||
@@ -22,7 +23,7 @@ class RedirectDialogState extends State<RedirectDialog> {
|
||||
|
||||
if (value.isEmpty) {
|
||||
setState(() {
|
||||
errorText = 'URL cannot be empty';
|
||||
errorText = t.pages.settings.privacy.urlEmpty;
|
||||
});
|
||||
return false;
|
||||
}
|
||||
@@ -30,7 +31,7 @@ class RedirectDialogState extends State<RedirectDialog> {
|
||||
final parsed = Uri.tryParse(value);
|
||||
if (parsed == null) {
|
||||
setState(() {
|
||||
errorText = 'Invalid URL';
|
||||
errorText = t.pages.settings.privacy.urlInvalid;
|
||||
});
|
||||
return false;
|
||||
}
|
||||
@@ -48,7 +49,9 @@ class RedirectDialogState extends State<RedirectDialog> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return AlertDialog(
|
||||
title: Text('${widget.serviceName} Redirect'),
|
||||
title: Text(
|
||||
t.pages.settings.privacy.redirectDialogTitle(serviceName: widget.serviceName),
|
||||
),
|
||||
content: Padding(
|
||||
padding: const EdgeInsets.all(16),
|
||||
child: Column(
|
||||
@@ -76,7 +79,7 @@ class RedirectDialogState extends State<RedirectDialog> {
|
||||
),
|
||||
actions: [
|
||||
TextButton(
|
||||
child: const Text('Okay'),
|
||||
child: Text(t.global.dialogAccept),
|
||||
onPressed: () {
|
||||
if (_validateUrl()) {
|
||||
Navigator.of(context).pop();
|
||||
@@ -86,7 +89,7 @@ class RedirectDialogState extends State<RedirectDialog> {
|
||||
},
|
||||
),
|
||||
TextButton(
|
||||
child: const Text('Cancel'),
|
||||
child: Text(t.global.dialogCancel),
|
||||
onPressed: () => Navigator.of(context).pop(),
|
||||
),
|
||||
],
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:moxxyv2/i18n/strings.g.dart';
|
||||
import 'package:moxxyv2/shared/models/preferences.dart';
|
||||
import 'package:moxxyv2/ui/bloc/preferences_bloc.dart';
|
||||
import 'package:moxxyv2/ui/helpers.dart';
|
||||
@@ -27,16 +28,23 @@ class RedirectSettingsTile extends AbstractSettingsTile {
|
||||
Widget build(BuildContext context) {
|
||||
return BlocBuilder<PreferencesBloc, PreferencesState>(
|
||||
builder: (context, state) => SettingsTile(
|
||||
title: Text('$serviceName Redirect'),
|
||||
title: Text(t.pages.settings.privacy.redirectsTitle(serviceName: serviceName)),
|
||||
description: Column(
|
||||
children: [
|
||||
Align(
|
||||
alignment: Alignment.centerLeft,
|
||||
child: Text('This will redirect $serviceName links that you tap to a proxy service, e.g. $exampleProxy'),
|
||||
child: Text(
|
||||
t.pages.settings.privacy.redirectText(
|
||||
serviceName: serviceName,
|
||||
exampleProxy: exampleProxy,
|
||||
),
|
||||
),
|
||||
),
|
||||
Align(
|
||||
alignment: Alignment.centerLeft,
|
||||
child: Text('Currently selected: ${getProxy(state)}'),
|
||||
child: Text(
|
||||
t.pages.settings.privacy.currentlySelected(proxy: getProxy(state)),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -58,8 +66,8 @@ class RedirectSettingsTile extends AbstractSettingsTile {
|
||||
onChanged: (value) {
|
||||
if (getProxy(state).isEmpty) {
|
||||
showInfoDialog(
|
||||
'Cannot enable $serviceName redirects',
|
||||
'You must first set a proxy service to redirect to. To do so, tap the field next to the switch.',
|
||||
t.pages.settings.privacy.cannotEnableRedirect(serviceName: serviceName),
|
||||
t.pages.settings.privacy.cannotEnableRedirectSubtext,
|
||||
context,
|
||||
);
|
||||
return;
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get_it/get_it.dart';
|
||||
import 'package:moxxyv2/i18n/strings.g.dart';
|
||||
import 'package:moxxyv2/ui/bloc/preferences_bloc.dart';
|
||||
import 'package:moxxyv2/ui/constants.dart';
|
||||
import 'package:moxxyv2/ui/helpers.dart';
|
||||
@@ -20,43 +21,43 @@ class SettingsPage extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: BorderlessTopbar.simple('Settings'),
|
||||
appBar: BorderlessTopbar.simple(t.pages.settings.settings.title),
|
||||
body: SettingsList(
|
||||
sections: [
|
||||
SettingsSection(
|
||||
title: const Text('Conversations'),
|
||||
title: Text(t.pages.settings.settings.conversationsSection),
|
||||
tiles: [
|
||||
SettingsTile(
|
||||
title: const Text('Chat'),
|
||||
title: Text(t.pages.settings.conversation.title),
|
||||
leading: const Icon(Icons.chat_bubble),
|
||||
onPressed: (context) => Navigator.pushNamed(context, conversationSettingsRoute),
|
||||
),
|
||||
SettingsTile(
|
||||
title: const Text('Network'),
|
||||
title: Text(t.pages.settings.network.title),
|
||||
leading: const Icon(Icons.network_wifi),
|
||||
onPressed: (context) => Navigator.pushNamed(context, networkRoute),
|
||||
),
|
||||
SettingsTile(
|
||||
title: const Text('Privacy'),
|
||||
title: Text(t.pages.settings.privacy.title),
|
||||
leading: const Icon(Icons.shield),
|
||||
onPressed: (context) => Navigator.pushNamed(context, privacyRoute),
|
||||
)
|
||||
],
|
||||
),
|
||||
SettingsSection(
|
||||
title: const Text('Account'),
|
||||
title: Text(t.pages.settings.settings.accountSection),
|
||||
tiles: [
|
||||
SettingsTile(
|
||||
title: const Text('Blocklist'),
|
||||
title: Text(t.pages.blocklist.title),
|
||||
leading: const Icon(Icons.block),
|
||||
onPressed: (context) => Navigator.pushNamed(context, blocklistRoute),
|
||||
),
|
||||
SettingsTile(
|
||||
title: const Text('Sign out'),
|
||||
title: Text(t.pages.settings.settings.signOut),
|
||||
leading: const Icon(Icons.logout),
|
||||
onPressed: (context) => showConfirmationDialog(
|
||||
'Sign Out',
|
||||
'You are about to sign out. Proceed?',
|
||||
t.pages.settings.settings.signOutConfirmTitle,
|
||||
t.pages.settings.settings.signOutConfirmBody,
|
||||
context,
|
||||
() async {
|
||||
GetIt.I.get<PreferencesBloc>().add(SignedOutEvent());
|
||||
@@ -66,15 +67,15 @@ class SettingsPage extends StatelessWidget {
|
||||
],
|
||||
),
|
||||
SettingsSection(
|
||||
title: const Text('Miscellaneous'),
|
||||
title: Text(t.pages.settings.settings.miscellaneousSection),
|
||||
tiles: [
|
||||
SettingsTile(
|
||||
title: const Text('About'),
|
||||
title: Text(t.pages.settings.about.title),
|
||||
leading: const Icon(Icons.info),
|
||||
onPressed: (context) => Navigator.pushNamed(context, aboutRoute),
|
||||
),
|
||||
SettingsTile(
|
||||
title: const Text('Open-Source licenses'),
|
||||
title: Text(t.pages.settings.licenses.title),
|
||||
leading: const Icon(Icons.description),
|
||||
onPressed: (context) => Navigator.pushNamed(context, licensesRoute),
|
||||
)
|
||||
@@ -83,10 +84,10 @@ class SettingsPage extends StatelessWidget {
|
||||
// TODO(Unknown): Maybe also have a switch somewhere
|
||||
...kDebugMode ? [
|
||||
SettingsSection(
|
||||
title: const Text('Debugging'),
|
||||
title: Text(t.pages.settings.settings.debuggingSection),
|
||||
tiles: [
|
||||
SettingsTile(
|
||||
title: const Text('Debugging options'),
|
||||
title: Text(t.pages.settings.debugging.title),
|
||||
leading: const Icon(Icons.info),
|
||||
onPressed: (context) => Navigator.pushNamed(context, debuggingRoute),
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user