mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-04 01:20:12 +00:00
Improvements to logging (#457)
* Use `.info` logging in most places. * Remove old objc logging support. * Fix table view controller. * Make sure timeline item content isn't logged. * Add tests.
This commit is contained in:
@@ -63,7 +63,6 @@ final class LoginCoordinator: CoordinatorProtocol {
|
||||
func start() {
|
||||
viewModel.callback = { [weak self] action in
|
||||
guard let self else { return }
|
||||
MXLog.debug("LoginViewModel did callback with result: \(action).")
|
||||
|
||||
switch action {
|
||||
case .selectServer:
|
||||
@@ -118,6 +117,8 @@ final class LoginCoordinator: CoordinatorProtocol {
|
||||
|
||||
/// Processes an error to either update the flow or display it to the user.
|
||||
private func handleError(_ error: AuthenticationServiceError) {
|
||||
MXLog.info("Error occurred: \(error)")
|
||||
|
||||
switch error {
|
||||
case .invalidCredentials:
|
||||
viewModel.displayError(.alert(ElementL10n.authInvalidLoginParam))
|
||||
@@ -150,6 +151,7 @@ final class LoginCoordinator: CoordinatorProtocol {
|
||||
|
||||
/// Requests the authentication coordinator to log in using the specified credentials.
|
||||
private func login(username: String, password: String) {
|
||||
MXLog.info("Starting login with password.")
|
||||
startLoading(isInteractionBlocking: true)
|
||||
|
||||
Task {
|
||||
|
||||
+2
-1
@@ -49,7 +49,6 @@ final class ServerSelectionCoordinator: CoordinatorProtocol {
|
||||
func start() {
|
||||
viewModel.callback = { [weak self] action in
|
||||
guard let self else { return }
|
||||
MXLog.debug("ServerSelectionViewModel did callback with action: \(action).")
|
||||
|
||||
switch action {
|
||||
case .confirm(let homeserverAddress):
|
||||
@@ -87,9 +86,11 @@ final class ServerSelectionCoordinator: CoordinatorProtocol {
|
||||
Task {
|
||||
switch await authenticationService.configure(for: homeserverAddress) {
|
||||
case .success:
|
||||
MXLog.info("Selected homeserver: \(homeserverAddress)")
|
||||
callback?(.updated)
|
||||
stopLoading()
|
||||
case .failure(let error):
|
||||
MXLog.info("Invalid homeserver: \(homeserverAddress)")
|
||||
stopLoading()
|
||||
handleError(error)
|
||||
}
|
||||
|
||||
@@ -70,7 +70,7 @@ final class SoftLogoutCoordinator: CoordinatorProtocol {
|
||||
func start() {
|
||||
viewModel.callback = { [weak self] result in
|
||||
guard let self else { return }
|
||||
MXLog.debug("[SoftLogoutCoordinator] SoftLogoutViewModel did complete with result: \(result).")
|
||||
MXLog.info("[SoftLogoutCoordinator] SoftLogoutViewModel did complete with result: \(result).")
|
||||
|
||||
switch result {
|
||||
case .login(let password):
|
||||
@@ -112,8 +112,6 @@ final class SoftLogoutCoordinator: CoordinatorProtocol {
|
||||
|
||||
/// Shows the forgot password screen.
|
||||
@MainActor private func showForgotPasswordScreen() {
|
||||
MXLog.debug("[SoftLogoutCoordinator] showForgotPasswordScreen")
|
||||
|
||||
viewModel.displayError(.alert("Not implemented."))
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user