Skip to content

Conversation

@alextran1502
Copy link
Member

@alextran1502 alextran1502 commented Dec 2, 2025

  • Refactor the login form and its component, move away from using hooks
  • Test with normal and OAuth login flow

Copy link
Member

@shenlong-tanwen shenlong-tanwen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we're to start refactoring the widget code, Can we decide on how to want to handle the global / widget states and how we want the flow to be like before refactoring pages?

For instance, we don't really need a notifier just to pass method calls over to the service layer. We also should be having UI components like the ui library that we use as building blocks for the widget. The LoginCredentialsForm still takes in a lot of props as params but it will only be ever used in the login screen.

Ideally, we'd have global providers that persists values for the entirety of the app life cycle and we'd have auto disposable page level providers that maintains all the state logic for the current page. Most of our logic should be moved to such a provider and the Widget class should only be about building widgets. This would also make it easier to mock the provider and test the widget and provider independently

Comment on lines +99 to +105
return ServerAuthSettings(
endpoint: endpoint,
isOAuthEnabled: features.oauthEnabled,
isPasswordLoginEnabled: features.passwordLogin,
oAuthButtonText: config.oauthButtonText.isNotEmpty ? config.oauthButtonText : 'OAuth',
);
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have ServerInfoNotifier that fetches and stores all the above params, are we moving away from using it?

Comment on lines +15 to +27
class OAuthNotifier extends StateNotifier<AsyncValue<void>> {
final OAuthService _oAuthService;

OAuthNotifier(this._oAuthService) : super(const AsyncValue.data(null));

Future<OAuthLoginData?> getOAuthLoginData(String serverUrl) {
return _oAuthService.getOAuthLoginData(serverUrl);
}

Future<LoginResponseDto?> completeOAuthLogin(OAuthLoginData oAuthData) {
return _oAuthService.completeOAuthLogin(oAuthData);
}
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Feels redundant. We can access and use the oAuthServiceProvider provider directly

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants