language picker, console_page refactor, app settings controller #482

Open
misterfourtytwo wants to merge 34 commits from misterfourtytwo/selfprivacy.org.app:feat_token_management into master

linked task: #450 - TBD in another PR, after discussion with inex was decided that i'll only introduce context-dependant DI (done with InheritedWidgets for app settings in this PR)

Done:

  • feat: language picker - app preferences now have additional one.

#489 - without android API - it's not available on all versions as of now and supposes we use many locales by priority)
reloads whole app localization on change (based on implementation of l10n package currently in use), has list of language names in their respective language. after locale is changed new one is persisted in local storage.

  • feat: app_controller

introduced app_controller, which handles all application settings operations, their injection into widget tree and its rebuild on their change.
added splash_screen, which is shown until initialization is done, which needs further work on its UI.

If view needs a scrollbar, it should be added on all platforms. Framework, by default, adds them only on desktop, so if we add scrollbars in some places (our main builds are still smartphones), on desktop we will get double scrollbars.

  • fix: selectable new device key.

In devices menu, when key for the connection of new device is created, one can select key text for copy.

  • fix: typos in naming

changed isAuthotized to isAuthorized, and similar cases.

  • feat: infobox changed to use wrap.

shown as 1 line when content fits, wraps into column when not.

  • feat: console log feature refactor.

listing scroll performance fix, uniform code and widget UI for different log item types, dialog data can now be selected & copy-pasted, copy button now producec valid json objects, some console text added into translations, console_model now handles pause in itself, so UI pipeline doesn't disturb pause (like when revisiting page / hot reloading)

  • UI: list tiles now app-wide have circular border.
  • fix (UI): empty_page_placeholder title now properly centers when text is wider than viewport.
  • Refactored tab routing into more concise one.

code for tab selection is now shared between pickers, tab titles are properly reloaded on locale change.

  • some updates to belarusian translations.
  • some code tweaks

like more concise mappers with less boilerplate, interface implementation instead of additional widgets in widget tree.

>> linked task: https://git.selfprivacy.org/SelfPrivacy/selfprivacy.org.app/issues/450 - TBD in another PR, after discussion with inex was decided that i'll only introduce context-dependant DI (done with InheritedWidgets for app settings in this PR) Done: * feat: language picker - app preferences now have additional one. >> https://git.selfprivacy.org/SelfPrivacy/selfprivacy.org.app/issues/489 - without android API - it's not available on all versions as of now and supposes we use many locales by priority) >>reloads whole app localization on change (based on implementation of l10n package currently in use), has list of language names in their respective language. after locale is changed new one is persisted in local storage. * feat: app_controller >> introduced app_controller, which handles all application settings operations, their injection into widget tree and its rebuild on their change. >>added splash_screen, which is shown until initialization is done, which needs further work on its UI. * bumped dependency versions, not locked by flutter, changed discountinued `package_info` to `package_info_plus` * added flavor launch scripts for vscode. * [fixed issue with gradle which spams warnings at each build.](https://docs.flutter.dev/release/breaking-changes/flutter-gradle-plugin-apply) * fix: disable automatic scrollbar addition for desktop builds. >> If view needs a scrollbar, it should be added on all platforms. Framework, by default, adds them only on desktop, so if we add scrollbars in some places (our main builds are still smartphones), on desktop we will get double scrollbars. * fix: selectable new device key. >> In devices menu, when key for the connection of new device is created, one can select key text for copy. * fix: typos in naming >> changed `isAuthotized` to `isAuthorized`, and similar cases. * feat: infobox changed to use wrap. >> shown as 1 line when content fits, wraps into column when not. * feat: console log feature refactor. >> listing scroll performance fix, uniform code and widget UI for different log item types, dialog data can now be selected & copy-pasted, copy button now producec valid json objects, some console text added into translations, console_model now handles pause in itself, so UI pipeline doesn't disturb pause (like when revisiting page / hot reloading) * UI: list tiles now app-wide have circular border. * fix (UI): empty_page_placeholder title now properly centers when text is wider than viewport. * Refactored tab routing into more concise one. >> code for tab selection is now shared between pickers, tab titles are properly reloaded on locale change. * some updates to belarusian translations. * some code tweaks >> like more concise mappers with less boilerplate, interface implementation instead of additional widgets in widget tree.
misterfourtytwo added 5 commits 2024-03-12 03:03:53 +02:00
misterfourtytwo added 2 commits 2024-04-17 10:57:39 +03:00
misterfourtytwo added 6 commits 2024-04-20 12:54:03 +03:00
551305b55a fix: disable automatic scrollbar addition for desktop builds.
If view needs a scrollbar, it should be added on all platforms. Framework, by default, adds them only on desktop, so if we add scrollbars in some places (our main builds are still smartphones), on desktop we will get double scrollbars.
32769c9d9f fix: selectable new device key.
In devices menu, when key for the connection of new device is created, one can select key text for copy.
06513b6fa6 fix: typo in provider constructors.
Changed `isAuthotized` to `isAuthorized`.
22fbbb051e feat: infobox changed to use wrap.
shown as 1 line when content fits, wraps into column when not.
00545c34b4 feat: console log feature refactor.
listing scroll performance fix, uniform code and widget UI for different log item types, dialog data can now be selected & copy-pasted
misterfourtytwo added 3 commits 2024-04-30 01:49:18 +03:00
misterfourtytwo added 14 commits 2024-05-15 19:06:05 +03:00
misterfourtytwo added 1 commit 2024-05-15 19:12:22 +03:00
misterfourtytwo added 1 commit 2024-05-15 19:21:06 +03:00
misterfourtytwo added 1 commit 2024-05-18 01:45:13 +03:00
misterfourtytwo added 1 commit 2024-05-20 02:19:42 +03:00
4e0779f5e7 feat: some more work on console_page
* console_log's copy data is now a valid json object for all log types
* graphQLResponse now provides raw response object for copy
* console_model now handles pause in itself, so UI pipeline doesn't disturb pause (like when revisiting page / hot reloading)
* some minor console_page UI tweaks
misterfourtytwo changed title from WIP: feat_token_management to language picker, console_page refactor, app settings controller 2024-05-20 02:26:50 +03:00
misterfourtytwo requested review from inex 2024-05-20 02:50:59 +03:00
NaiJi reviewed 2024-05-21 02:49:52 +03:00
@ -28,0 +22,4 @@
// ...jobsState.clientJobList
// .whereType<CreateUserJob>()
// .map((final job) => job.user),
// ];
Collaborator

If we don't need the block of code, why not just delete it though

If we don't need the block of code, why not just delete it though

it's simplified logic for filtering jobs with creation of the same(by name) user, which should be added later, but out of scope of changes now

it's simplified logic for filtering jobs with creation of the same(by name) user, which should be added later, but out of scope of changes now
inex requested changes 2024-05-27 13:08:29 +03:00
@ -52,3 +52,3 @@
"connect_to_server_provider_text": "З дапамогай API токена праграма SelfPrivacy зможа ад вашага імя замовіць і наладзіць сервер",
"steps": {
"nixos_installation": "Ўстаноўка NixOS",
"nixos_installation": "Ўсталёўка NixOS",

Translations directly to the JSON files might cause conflicts with Weblate. It is better to use weblate.selfprivacy.org in the future if you want to change a translation.

Changing en.json is fine, as this is a source for all translations.

Translations directly to the JSON files might cause conflicts with Weblate. It is better to use weblate.selfprivacy.org in the future if you want to change a translation. Changing `en.json` is fine, as this is a source for all translations.

I guess it is about already existing keys, like, for when ill want to add translation for a new key, it will be ok?

I guess it is about already existing keys, like, for when ill want to add translation for a new key, it will be ok?
@ -0,0 +47,4 @@
: ThemeMode.light;
// // Make ThemeMode a private variable so it is not updated directly without
// // also persisting the changes with the repo..
// late ThemeMode _themeMode;

I guess it is no longer needed?

I guess it is no longer needed?
@ -0,0 +55,4 @@
bool get shouldShowOnboarding => _shouldShowOnboarding;
/// Load the user's settings from the SettingsService. It may load from a
/// local database or the internet. The controller only knows it can load the

From the internet?

From the internet?
@ -0,0 +3,4 @@
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:selfprivacy/config/get_it_config.dart';
/// basically, a bus for other blocs to listen to server status updates

Unused as of now, and I'm still not sure if it is a good idea to create dependencies between blocs.

Unused as of now, and I'm still not sure if it is a good idea to create dependencies between blocs.

well, i'd prefer an inheritedWidget, which holds this value for dependencies, but also explicitly listens to connectivity and app lifecycle state changes (l mean here when it is suspended, like when app active app changes on android), thus it will hold more meaning and could spare us from some errors.

well, i'd prefer an inheritedWidget, which holds this value for dependencies, but also explicitly listens to connectivity and app lifecycle state changes (l mean here when it is suspended, like when app active app changes on android), thus it will hold more meaning and could spare us from some errors.
@ -0,0 +4,4 @@
import 'package:selfprivacy/config/get_it_config.dart';
/// basically, a bus for other blocs to listen to server status updates
class ConnectionStatusBloc extends Bloc<ConnectionStatus, ConnectionStatus> {

Does passing the same enum as both Event and State even work?

Does passing the same enum as both Event and State even work?

why won't it?
you have one place, where events come, and another where state is. also, states are set from inside the bloc only.

why won't it? you have one place, where events come, and another where state is. also, states are set from inside the bloc only.
@ -0,0 +44,4 @@
void _updateQueue() {
// Make sure we don't have too many
if (logs.length > logBufferLimit) {
logs.removeRange(0, logs.length - logBufferLimit);

Why not using the same optimization as with _incomingQueue?

Why not using the same optimization as with `_incomingQueue`?

my guess was that buffer of 500 messages was a console feature, so I left it as is.
also, jumps between 750 and 500 elements in listing user sees are not perceived as stable behavior from user point of view.

_incomingQueue is an offscreen buffer, so it doesn't affect what is rendered and we could truncate it lazily, so jumps between 750 and 500 elements should be a ok.

my guess was that buffer of 500 messages was a console feature, so I left it as is. also, jumps between 750 and 500 elements in listing user sees are not perceived as stable behavior from user point of view. `_incomingQueue` is an offscreen buffer, so it doesn't affect what is rendered and we could truncate it lazily, so jumps between 750 and 500 elements should be a ok.
@ -93,0 +45,4 @@
padding: const EdgeInsets.symmetric(horizontal: 16),
child: Text(
'application_settings.dangerous_settings'.tr(),
style: Theme.of(context).textTheme.titleLarge!.copyWith(

This should be a labelLarge, looks broken as a titleLarge.

This should be a `labelLarge`, looks broken as a `titleLarge`.
@ -0,0 +13,4 @@
padding: const EdgeInsets.symmetric(horizontal: 16.0),
child: Text(
Localization.getLanguageName(context.locale),
style: Theme.of(context).textTheme.headlineSmall,

This is too big

This is too big
@ -0,0 +39,4 @@
Widget build(final BuildContext context) => SimpleDialog(
title: Text('application_settings.language'.tr()),
children: [
for (final locale

Probably add a "System default" value to reset our overwrite?

Probably add a "System default" value to reset our overwrite?
@ -0,0 +46,4 @@
Localization.getLanguageName(locale),
style: TextStyle(
fontWeight: locale == context.locale
? FontWeight.w800

How about using a radio button, not just the bold text?

How about using a radio button, not just the bold text?
@ -0,0 +19,4 @@
Text('application_settings.system_theme_mode_description'.tr()),
value: appController.systemThemeModeActive,
onChanged: appController.setSystemThemeModeFlag,
// onChanged: (final newValue) => appController.setThemeMode(

Why is it still there, commented out?

Why is it still there, commented out?
@ -0,0 +10,4 @@
if (log.uri != null) _KeyValueRow('uri', '${log.uri}'),
// headers bloc
if (log.headers?.isNotEmpty ?? false) ...[

Rest API requests dialogs expose the API token, and we don't want that (as this console is usually used to send us screenshots/copies of request data)

Rest API requests dialogs expose the API token, and we don't want that (as this console is usually used to send us screenshots/copies of request data)

so you propose to remove headers section or to hide it?

so you propose to remove headers section or to hide it?

Not necessary, just censoring the Authorization header should be enough.

Not necessary, just censoring the Authorization header should be enough.
This Pull Request doesn't have enough approvals yet. 0 of 1 approvals granted.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
Sign in to join this conversation.
No reviewers
No Milestone
No project
No Assignees
3 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: SelfPrivacy/selfprivacy.org.app#482
There is no content yet.