fluffychat merge
This commit is contained in:
parent
8f9811f014
commit
6f87545bf9
4 changed files with 26 additions and 12 deletions
|
|
@ -80,7 +80,6 @@ class PutAnalyticsController extends BaseController<AnalyticsStream> {
|
|||
_analyticsStream = null;
|
||||
_languageStream?.cancel();
|
||||
_languageStream = null;
|
||||
_refreshAnalyticsIfOutdated();
|
||||
clearMessagesSinceUpdate();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -157,7 +157,7 @@ class PangeaController {
|
|||
}
|
||||
|
||||
/// check user information if not found then redirect to Date of birth page
|
||||
_handleLoginStateChange(LoginState state) {
|
||||
_handleLoginStateChange(LoginState state, String? userID) {
|
||||
switch (state) {
|
||||
case LoginState.loggedOut:
|
||||
case LoginState.softLoggedOut:
|
||||
|
|
@ -181,12 +181,12 @@ class PangeaController {
|
|||
Sentry.configureScope(
|
||||
(scope) => scope.setUser(
|
||||
SentryUser(
|
||||
id: matrixState.client.userID,
|
||||
name: matrixState.client.userID,
|
||||
id: userID,
|
||||
name: userID,
|
||||
),
|
||||
),
|
||||
);
|
||||
GoogleAnalytics.analyticsUserUpdate(matrixState.client.userID);
|
||||
GoogleAnalytics.analyticsUserUpdate(userID);
|
||||
}
|
||||
|
||||
Future<void> resetAnalytics() async {
|
||||
|
|
@ -197,8 +197,9 @@ class PangeaController {
|
|||
}
|
||||
|
||||
void _subscribeToStreams() {
|
||||
final userID = matrixState.client.userID;
|
||||
matrixState.client.onLoginStateChanged.stream
|
||||
.listen(_handleLoginStateChange);
|
||||
.listen((state) => _handleLoginStateChange(state, userID));
|
||||
_setLanguageStream();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -16,7 +16,10 @@ class PAuthGaurd {
|
|||
GoRouterState state,
|
||||
) async {
|
||||
if (pController != null) {
|
||||
if (Matrix.of(context).client.isLogged()) {
|
||||
if (Matrix.of(context)
|
||||
.widget
|
||||
.clients
|
||||
.any((client) => client.isLogged())) {
|
||||
final bool dobIsSet =
|
||||
await pController!.userController.isUserDataAvailableAndL2Set;
|
||||
return dobIsSet ? '/rooms' : '/user_age';
|
||||
|
|
@ -34,7 +37,10 @@ class PAuthGaurd {
|
|||
GoRouterState state,
|
||||
) async {
|
||||
if (pController != null) {
|
||||
if (!Matrix.of(context).client.isLogged()) {
|
||||
if (!Matrix.of(context)
|
||||
.widget
|
||||
.clients
|
||||
.any((client) => client.isLogged())) {
|
||||
return '/home';
|
||||
}
|
||||
final bool dobIsSet =
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:matrix/matrix.dart';
|
||||
|
||||
import 'package:fluffychat/l10n/l10n.dart';
|
||||
import 'package:fluffychat/pangea/common/config/environment.dart';
|
||||
|
|
@ -17,12 +18,17 @@ class LoginOrSignupView extends StatefulWidget {
|
|||
}
|
||||
|
||||
class LoginOrSignupViewState extends State<LoginOrSignupView> {
|
||||
Client? client;
|
||||
List<AppConfigOverride> _overrides = [];
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_loadOverrides();
|
||||
|
||||
Matrix.of(context).getLoginClient().then((c) {
|
||||
if (mounted) setState(() => client = c);
|
||||
});
|
||||
}
|
||||
|
||||
Future<void> _loadOverrides() async {
|
||||
|
|
@ -62,10 +68,12 @@ class LoginOrSignupViewState extends State<LoginOrSignupView> {
|
|||
),
|
||||
FullWidthButton(
|
||||
title: L10n.of(context).signIn,
|
||||
onPressed: () => context.go(
|
||||
'/home/login',
|
||||
extra: Matrix.of(context).client,
|
||||
),
|
||||
onPressed: client != null
|
||||
? () => context.go(
|
||||
'/home/login',
|
||||
extra: Matrix.of(context).client,
|
||||
)
|
||||
: null,
|
||||
),
|
||||
],
|
||||
);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue