fluffychat merge
This commit is contained in:
parent
d79daee47f
commit
38f36f6958
4 changed files with 41 additions and 35 deletions
|
|
@ -4,7 +4,6 @@ import 'package:flutter/services.dart';
|
|||
import 'package:collection/collection.dart';
|
||||
import 'package:flutter_dotenv/flutter_dotenv.dart';
|
||||
import 'package:flutter_secure_storage/flutter_secure_storage.dart';
|
||||
import 'package:flutter_vodozemac/flutter_vodozemac.dart' as vod;
|
||||
import 'package:get_storage/get_storage.dart';
|
||||
import 'package:matrix/matrix.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
|
|
@ -51,8 +50,9 @@ void main() async {
|
|||
// widget bindings are initialized already.
|
||||
WidgetsFlutterBinding.ensureInitialized();
|
||||
|
||||
await vod.init();
|
||||
|
||||
// #Pangea
|
||||
// await vod.init();
|
||||
// Pangea#
|
||||
Logs().nativeColors = !PlatformInfos.isIOS;
|
||||
final store = await SharedPreferences.getInstance();
|
||||
final clients = await ClientManager.getClients(store: store);
|
||||
|
|
|
|||
|
|
@ -52,17 +52,17 @@ class LoginController extends State<Login> {
|
|||
// TODO: implement initState
|
||||
super.initState();
|
||||
loadingSignIn = true;
|
||||
// pangeaController.checkHomeServerAction().then((value) {
|
||||
// setState(() {
|
||||
// loadingSignIn = false;
|
||||
// });
|
||||
// }).catchError((e) {
|
||||
// final String err = e.toString();
|
||||
// setState(() {
|
||||
// loadingSignIn = false;
|
||||
// passwordError = err.toLocalizedString(context);
|
||||
// });
|
||||
// });
|
||||
pangeaController.checkHomeServerAction().then((value) {
|
||||
setState(() {
|
||||
loadingSignIn = false;
|
||||
});
|
||||
}).catchError((e) {
|
||||
final String err = e.toString();
|
||||
setState(() {
|
||||
loadingSignIn = false;
|
||||
passwordError = err.toLocalizedString(context);
|
||||
});
|
||||
});
|
||||
|
||||
usernameController.addListener(() => setState(() {}));
|
||||
passwordController.addListener(() => setState(() {}));
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ import 'package:get_storage/get_storage.dart';
|
|||
import 'package:matrix/matrix.dart';
|
||||
import 'package:sentry_flutter/sentry_flutter.dart';
|
||||
|
||||
import 'package:fluffychat/config/app_config.dart';
|
||||
import 'package:fluffychat/pangea/analytics_misc/get_analytics_controller.dart';
|
||||
import 'package:fluffychat/pangea/analytics_misc/put_analytics_controller.dart';
|
||||
import 'package:fluffychat/pangea/choreographer/controllers/contextual_definition_controller.dart';
|
||||
|
|
@ -130,29 +131,30 @@ class PangeaController {
|
|||
await Future.wait(futures);
|
||||
}
|
||||
|
||||
// Future<void> checkHomeServerAction() async {
|
||||
// if (matrixState.getLoginClient().homeserver != null) {
|
||||
// await Future.delayed(Duration.zero);
|
||||
// return;
|
||||
// }
|
||||
Future<void> checkHomeServerAction() async {
|
||||
final client = await matrixState.getLoginClient();
|
||||
if (client.homeserver != null) {
|
||||
await Future.delayed(Duration.zero);
|
||||
return;
|
||||
}
|
||||
|
||||
// final String homeServer =
|
||||
// AppConfig.defaultHomeserver.trim().toLowerCase().replaceAll(' ', '-');
|
||||
// var homeserver = Uri.parse(homeServer);
|
||||
// if (homeserver.scheme.isEmpty) {
|
||||
// homeserver = Uri.https(homeServer, '');
|
||||
// }
|
||||
final String homeServer =
|
||||
AppConfig.defaultHomeserver.trim().toLowerCase().replaceAll(' ', '-');
|
||||
var homeserver = Uri.parse(homeServer);
|
||||
if (homeserver.scheme.isEmpty) {
|
||||
homeserver = Uri.https(homeServer, '');
|
||||
}
|
||||
|
||||
// try {
|
||||
// await matrixState.getLoginClient().register();
|
||||
// matrixState.loginRegistrationSupported = true;
|
||||
// } on MatrixException catch (e) {
|
||||
// matrixState.loginRegistrationSupported =
|
||||
// e.requireAdditionalAuthentication;
|
||||
// }
|
||||
try {
|
||||
await client.register();
|
||||
matrixState.loginRegistrationSupported = true;
|
||||
} on MatrixException catch (e) {
|
||||
matrixState.loginRegistrationSupported =
|
||||
e.requireAdditionalAuthentication;
|
||||
}
|
||||
|
||||
// // setState(() => error = (e).toLocalizedString(context));
|
||||
// }
|
||||
// setState(() => error = (e).toLocalizedString(context));
|
||||
}
|
||||
|
||||
/// check user information if not found then redirect to Date of birth page
|
||||
_handleLoginStateChange(LoginState state) {
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ import 'package:fluffychat/pangea/common/config/environment.dart';
|
|||
import 'package:fluffychat/pangea/login/pages/pangea_login_scaffold.dart';
|
||||
import 'package:fluffychat/pangea/login/widgets/app_config_dialog.dart';
|
||||
import 'package:fluffychat/pangea/login/widgets/full_width_button.dart';
|
||||
import 'package:fluffychat/widgets/matrix.dart';
|
||||
|
||||
class LoginOrSignupView extends StatefulWidget {
|
||||
const LoginOrSignupView({super.key});
|
||||
|
|
@ -61,7 +62,10 @@ class LoginOrSignupViewState extends State<LoginOrSignupView> {
|
|||
),
|
||||
FullWidthButton(
|
||||
title: L10n.of(context).signIn,
|
||||
onPressed: () => context.go('/home/login'),
|
||||
onPressed: () => context.go(
|
||||
'/home/login',
|
||||
extra: Matrix.of(context).client,
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue