-
Notifications
You must be signed in to change notification settings - Fork 541
Add warning if network unavailable #334
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
base: main
Are you sure you want to change the base?
Add warning if network unavailable #334
Conversation
- Add static callback for reporting network errors to UI - Will be used to display system messages when network operations fail
cool thank you! this is nice but it's not exactly what the issue is about. nostr relays could be unreachable due to many different reasons, but network permissions should be checked in all cases. |
@callebtc I added more context in the original issue, but the problem is the network permission cannot be checked, by design. Network is not a permission on normal Android, and GrapheneOS has added the network toggle at a lower level than Android's permission system intentionally, so that apps cannot distinguish between the permission being denied by the user or internet being unavailable for any other normal reason. So, unfortunately, I think the only thing we can do is detect a connection failure and prompt the user to ensure the device (and app for Graphene users) has an internet connection. |
Also, notice this message only appears if all Nostr relays are unreachable. Its totally expected that some relays will be unreachable, but if all relays are unreachable, then the user has a connectivity problem, right? |
that's maybe a reasonable assumption but it's not what the issue above is about. you might just have lost wifi. |
Yes, and in this case I still think its reasonable to inform the user Bitchat may not behave as expected, because it doesnt have a connection. The entire point is that we cannot know WHY there is no internet, but at least we can tell the user things won't behave well until we have internet 🤷 What behavior would you prefer to see? |
it could be many things:
|
the build seems to fail, could you check? |
3683586
to
e896436
Compare
No, network permission is not detectable. My idea was to detect the case when we cannot reach any relays, and assume this means we have SOME network problem (could be any reason). Then I let the user know that there is a network problem and they should check permissions, connection, etc. My question remains: if not this, what solution do you want to see?
Something was broken master when I opened the PR. It shouldn't be a problem now that main is fixed. The rebase isn't easy though, because the nostr connection logic has changed significantly. I want to make sure you actually like my proposal, before I go and do that work. |
…ager - Detect network-related exceptions (DNS, connection refused, etc.) - Report network error via callback (only once per session) - Add flag to prevent spamming error messages - Reset error flag on successful sends - Define NETWORK_ERROR_MESSAGE constant to avoid message duplication
- Set network error callback when initializing Nostr integration - Display network errors as system messages in chat - Messages appear greyed out like other system messages
e896436
to
ca6a786
Compare
I have reset the branch to where it was before I attempted the rebase, since the rebase ended up being a lot more work than anticipated. This way you can review my idea from the original PR. If you like the idea, then I will do the work of rebasing it and fixing the any errors. |
This PR adds a warning if Nostr relays cannot be reached. This resolves #322
There are existing build errors on main, so I am unable to test. Happy to test once those are resolved.
[edit] The original issue asks for a permission check. That is not possible, as there is no API to check the network permission. The best we can do is detect disconnection (ALL relays unreachable) and prompt the user to check their connection settings.