Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Custom server no network dialog #WPB-11627 #3543

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from

Conversation

m-zagorski
Copy link
Contributor

@m-zagorski m-zagorski commented Oct 23, 2024

TaskWPB-11627 [Android] Show information to user when he tries to login, but no network is available

https://wearezeta.atlassian.net/browse/WPB-11627

What's new in this PR?

Issues

When we're trying to connect with custom server and we didnt have internet connection, we didnt display correct popup

Solutions

Due to the matter of handling invalid json being exactly the same as no network, we have to check on our own if we're connected to internet or not. Depending on that we display no network dialog.

Testing

How to Test

Attachments (Optional)

Screenshot_20241023_073149_Wire Beta


PR Post Submission Checklist for internal contributors (Optional)

  • Wire's Github Workflow has automatically linked the PR to a JIRA issue

PR Post Merge Checklist for internal contributors

  • If any soft of configuration variable was introduced by this PR, it has been added to the relevant documents and the CI jobs have been updated.

References
  1. https://sparkbox.com/foundry/semantic_commit_messages
  2. https://github.com/wireapp/.github#usage
  3. E.g. feat(conversation-list): Sort conversations by most emojis in the title #SQPIT-764.

@echoes-hq echoes-hq bot added the echoes: bugs Technical or functional defects in the product label Oct 23, 2024
Copy link

sonarcloud bot commented Oct 23, 2024

@@ -122,7 +125,8 @@ class WireActivityViewModel @Inject constructor(
private val observeScreenshotCensoringConfigUseCaseProviderFactory: ObserveScreenshotCensoringConfigUseCaseProvider.Factory,
private val globalDataStore: Lazy<GlobalDataStore>,
private val observeIfE2EIRequiredDuringLoginUseCaseProviderFactory: ObserveIfE2EIRequiredDuringLoginUseCaseProvider.Factory,
private val workManager: Lazy<WorkManager>
private val workManager: Lazy<WorkManager>,
private val networkStateObserver: Lazy<NetworkStateObserver>
Copy link
Member

Choose a reason for hiding this comment

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

this is over kill you don't need to check the network state, we can do the request to get the json with custom server meta data and check the error returned it is a network error with something list Io Exception then display this error

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That is unfortunately not doable:

  • When we dont have internet connection and the config is valid we're getting:
    GenericError(cause=java.net.UnknownHostException: Unable to resolve host "nginz-https.bund-next-column-offline-android.wire.link": No address associated with hostname)

  • When we have internet connection and the config is invalid we're getting:
    GenericError(cause=java.net.UnknownHostException: Unable to resolve host "nginz-https.unreachable.wire.link": No address associated with hostname)

So we're unable to know if the config was wrong or not with the exception we're getting

Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe we could slightly change the copy and use this dialog in both cases?
Like: "You don't seem to be connected to the Internet or the config link you used is broken. Please check your Internet connection and try again." 😄

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Well yeah we could have only one for malformed json and no internet connection :D that'd solve the issue too

@codecov-commenter
Copy link

codecov-commenter commented Oct 23, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 45.32%. Comparing base (bc37f84) to head (cea4197).
Report is 3 commits behind head on develop.

Additional details and impacted files
@@           Coverage Diff            @@
##           develop    #3543   +/-   ##
========================================
  Coverage    45.31%   45.32%           
========================================
  Files          470      469    -1     
  Lines        15710    15719    +9     
  Branches      2629     2631    +2     
========================================
+ Hits          7119     7124    +5     
- Misses        7844     7847    +3     
- Partials       747      748    +1     
Files with missing lines Coverage Δ
...rc/main/kotlin/com/wire/android/ui/WireActivity.kt 0.00% <ø> (ø)
...otlin/com/wire/android/ui/WireActivityViewModel.kt 71.80% <100.00%> (+0.46%) ⬆️

... and 10 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update bc37f84...cea4197. Read the comment docs.

@m-zagorski m-zagorski changed the title Custom server no network dialog feat: Custom server no network dialog #WPB-11627 Oct 23, 2024
Copy link
Contributor

Built wire-android-staging-compat-pr-3543.apk is available for download

Copy link
Contributor

Built wire-android-dev-debug-pr-3543.apk is available for download

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
echoes: bugs Technical or functional defects in the product size/S
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants