mirror of
https://gitlab.com/famedly/fluffychat.git
synced 2025-12-02 05:27:33 +01:00
fix: onboarding UX
- add option to enable locale based homeservers Signed-off-by: TheOneWithTheBraid <the-one@with-the-braid.cf>
This commit is contained in:
parent
6e0610dfdc
commit
c0d918cbe9
@ -6,5 +6,6 @@
|
|||||||
"privacy_url": "https://fluffychat.im/en/privacy.html",
|
"privacy_url": "https://fluffychat.im/en/privacy.html",
|
||||||
"render_html": false,
|
"render_html": false,
|
||||||
"hide_redacted_events": false,
|
"hide_redacted_events": false,
|
||||||
"hide_unknown_events": false
|
"hide_unknown_events": false,
|
||||||
|
"use_location_based_homeserver": true
|
||||||
}
|
}
|
||||||
@ -60,6 +60,7 @@ abstract class AppConfig {
|
|||||||
'https://github.com/googlefonts/noto-emoji/';
|
'https://github.com/googlefonts/noto-emoji/';
|
||||||
static const double borderRadius = 16.0;
|
static const double borderRadius = 16.0;
|
||||||
static const double columnWidth = 360.0;
|
static const double columnWidth = 360.0;
|
||||||
|
static bool useLocaleBasedHomeserver = true;
|
||||||
|
|
||||||
static void loadFromJson(Map<String, dynamic> json) {
|
static void loadFromJson(Map<String, dynamic> json) {
|
||||||
if (json['chat_color'] != null) {
|
if (json['chat_color'] != null) {
|
||||||
@ -95,5 +96,8 @@ abstract class AppConfig {
|
|||||||
if (json['hide_unknown_events'] is bool) {
|
if (json['hide_unknown_events'] is bool) {
|
||||||
hideUnknownEvents = json['hide_unknown_events'];
|
hideUnknownEvents = json['hide_unknown_events'];
|
||||||
}
|
}
|
||||||
|
if (json['use_location_based_homeserver'] is bool) {
|
||||||
|
useLocaleBasedHomeserver = json['use_location_based_homeserver'];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
|
import 'dart:ui';
|
||||||
|
|
||||||
import 'package:flutter/foundation.dart';
|
import 'package:flutter/foundation.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
@ -90,7 +91,8 @@ class HomeserverPickerController extends State<HomeserverPicker> {
|
|||||||
|
|
||||||
void _loadHomeserverList() async {
|
void _loadHomeserverList() async {
|
||||||
try {
|
try {
|
||||||
final homeserverList = await JoinmatrixOrgParser().fetchHomeservers();
|
final homeserverList =
|
||||||
|
await const JoinmatrixOrgParser().fetchHomeservers();
|
||||||
final benchmark = await HomeserverListProvider.benchmarkHomeserver(
|
final benchmark = await HomeserverListProvider.benchmarkHomeserver(
|
||||||
homeserverList,
|
homeserverList,
|
||||||
timeout: const Duration(seconds: 10),
|
timeout: const Duration(seconds: 10),
|
||||||
@ -159,6 +161,14 @@ class HomeserverPickerController extends State<HomeserverPicker> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void _defaultHomeserverByLocale() {
|
||||||
|
final servers =
|
||||||
|
LocalHomeserverParser(window.locale.countryCode).fetchHomeservers();
|
||||||
|
if (servers.isNotEmpty) {
|
||||||
|
setState(() => homeserverController.text = servers.first.baseUrl.host);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void dispose() {
|
void dispose() {
|
||||||
homeserverFocusNode.removeListener(_updateFocus);
|
homeserverFocusNode.removeListener(_updateFocus);
|
||||||
@ -169,6 +179,10 @@ class HomeserverPickerController extends State<HomeserverPicker> {
|
|||||||
void initState() {
|
void initState() {
|
||||||
homeserverFocusNode.addListener(_updateFocus);
|
homeserverFocusNode.addListener(_updateFocus);
|
||||||
_checkTorBrowser();
|
_checkTorBrowser();
|
||||||
|
if (AppConfig.useLocaleBasedHomeserver) {
|
||||||
|
WidgetsBinding.instance
|
||||||
|
.addPostFrameCallback((timeStamp) => _defaultHomeserverByLocale());
|
||||||
|
}
|
||||||
super.initState();
|
super.initState();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1047,7 +1047,7 @@ packages:
|
|||||||
name: matrix_homeserver_recommendations
|
name: matrix_homeserver_recommendations
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.2.1"
|
version: "0.3.0"
|
||||||
matrix_link_text:
|
matrix_link_text:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
|
|||||||
@ -61,7 +61,7 @@ dependencies:
|
|||||||
localstorage: ^4.0.0+1
|
localstorage: ^4.0.0+1
|
||||||
lottie: ^1.2.2
|
lottie: ^1.2.2
|
||||||
matrix: ^0.10.3
|
matrix: ^0.10.3
|
||||||
matrix_homeserver_recommendations: ^0.2.1
|
matrix_homeserver_recommendations: ^0.3.0
|
||||||
matrix_link_text: ^1.0.2
|
matrix_link_text: ^1.0.2
|
||||||
native_imaging:
|
native_imaging:
|
||||||
git: https://gitlab.com/famedly/company/frontend/libraries/native_imaging.git
|
git: https://gitlab.com/famedly/company/frontend/libraries/native_imaging.git
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user