Skip to content

Commit

Permalink
TW-1780: Add app=chat to parameter whenever call to signup in TWP
Browse files Browse the repository at this point in the history
  • Loading branch information
nqhhdev authored and hoangdat committed May 23, 2024
1 parent 3d91449 commit c2888c6
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
2 changes: 2 additions & 0 deletions lib/config/app_config.dart
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ abstract class AppConfig {
///`HOME_SERVER`: Homeserver, sample is `https://example.com`
static String homeserver = sampleValue;

static String appParameter = 'chat';

static String? platform;

static double toolbarHeight(BuildContext context) =>
Expand Down
12 changes: 7 additions & 5 deletions lib/pages/twake_welcome/twake_welcome.dart
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class TwakeWelcome extends StatefulWidget {

class TwakeWelcomeController extends State<TwakeWelcome> with ConnectPageMixin {
void goToHomeserverPicker() {
if (widget.arg?.isAddAnotherAccount == true) {
if (widget.arg != null && widget.arg?.isAddAnotherAccount == true) {
context.push('/rooms/addaccount/homeserverpicker');
} else {
context.push('/home/homeserverpicker');
Expand All @@ -54,14 +54,14 @@ class TwakeWelcomeController extends State<TwakeWelcome> with ConnectPageMixin {
'post_registered_redirect_url';

String get loginUrl =>
"${AppConfig.registrationUrl}?$postLoginRedirectUrlPathParams=${AppConfig.appOpenUrlScheme}://redirect";
"${AppConfig.registrationUrl}?$postLoginRedirectUrlPathParams=${AppConfig.appOpenUrlScheme}://redirect&app=${AppConfig.appParameter}";

String get signupUrl =>
"${AppConfig.registrationUrl}?$postRegisteredRedirectUrlPathParams=${AppConfig.appOpenUrlScheme}://redirect";
"${AppConfig.registrationUrl}?$postRegisteredRedirectUrlPathParams=${AppConfig.appOpenUrlScheme}://redirect&app=${AppConfig.appParameter}";

MatrixState get matrix => Matrix.of(context);

void onClickSignIn() async {
void onClickSignIn() {
Logs().d("TwakeIdController::onClickSignIn: Login Url - $loginUrl");
_redirectRegistrationUrl(loginUrl);
}
Expand Down Expand Up @@ -92,7 +92,9 @@ class TwakeWelcomeController extends State<TwakeWelcome> with ConnectPageMixin {
}

Future<bool> _homeserverExisted() async {
if (widget.arg?.isAddAnotherAccount == false) return false;
if (widget.arg != null && widget.arg?.isAddAnotherAccount == false) {
return false;
}
try {
final allHomeserverLoggedIn = (await ClientManager.getClients())
.where((client) => client.homeserver != null)
Expand Down
2 changes: 1 addition & 1 deletion lib/presentation/mixins/connect_page_mixin.dart
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ mixin ConnectPageMixin {
required String redirectUrl,
}) {
final redirectUrlEncode = Uri.encodeQueryComponent(redirectUrl);
return '${AppConfig.registrationUrl}?$redirectPublicPlatformOnWeb=$redirectUrlEncode&${AppConfig.appParameter}';
return '${AppConfig.registrationUrl}?$redirectPublicPlatformOnWeb=$redirectUrlEncode&app=${AppConfig.appParameter}';
}

String? _getLogoutUrl(
Expand Down

0 comments on commit c2888c6

Please sign in to comment.