Skip to content

ios: react to change in connectivity. #3428

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

bznein
Copy link
Collaborator

@bznein bznein commented Jun 25, 2025

Use NwPathMonitor to monitor change in connectivity, and trigger the offline banner when going offline, and a manual reconnection when going back online.

Before asking for reviews, here is a check list of the most common things you might need to consider:

  • updating the Changelog
  • writing unit tests
  • checking if your changes affect other coins or tokens in unintended ways
  • testing on multiple environments (Qt, Android, ...)
  • having an AI review your changes

@bznein bznein requested a review from benma June 25, 2025 11:15
@bznein bznein force-pushed the offlineIOS branch 3 times, most recently from 9776180 to 6756b78 Compare June 30, 2025 14:05
@bznein
Copy link
Collaborator Author

bznein commented Jun 30, 2025

@benma This would be ready for review; however, while testing on the simulator, the banner seems to work fine when going offline, but not when going back online. I still don't have an iPhone to test on, so if you could test and report if it behaves fine on a real device it would be great!

@bznein
Copy link
Collaborator Author

bznein commented Jul 2, 2025

@benma This would be ready for review; however, while testing on the simulator, the banner seems to work fine when going offline, but not when going back online. I still don't have an iPhone to test on, so if you could test and report if it behaves fine on a real device it would be great!

@benma I received my iPhone and tested on it. Ready for review for real :)

@bznein
Copy link
Collaborator Author

bznein commented Jul 9, 2025

@benma gentle ping :)

@@ -464,7 +470,7 @@
INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES;
INFOPLIST_KEY_UILaunchScreen_Generation = YES;
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait";
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

These changes have been made by Xcode automatically, not sure the reason or whether they should be reverted or not

Copy link
Contributor

Choose a reason for hiding this comment

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

git blame will tell you the reason for this line, it's deliberate :) should definitely revert

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

well git blame won't tell me why XCode changed it, I meant :D reverted!

@@ -184,6 +185,10 @@ struct BitBoxAppApp: App {
.edgesIgnoringSafeArea(.all)
.onAppear {
setupGoAPI(goAPI: goAPI)
_ = NetworkMonitor.shared
Copy link
Contributor

Choose a reason for hiding this comment

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

Why not use that? isOnline = NetworkMonitor.shared.monitor.currentPath.status == .satisfied

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

monitor is private within NetworkMonitor so if we want to do this we need to make it non-private. I don't have a strong preference but I went for an alternative approach of adding an isOnline method and calling that instead

@@ -464,7 +470,7 @@
INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES;
INFOPLIST_KEY_UILaunchScreen_Generation = YES;
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait";
Copy link
Contributor

Choose a reason for hiding this comment

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

git blame will tell you the reason for this line, it's deliberate :) should definitely revert

@bznein bznein force-pushed the offlineIOS branch 2 times, most recently from 57c53fb to 39c812d Compare July 15, 2025 15:59
Use NwPathMonitor to monitor change in connectivity, and trigger the
offline banner when going offline, and a manual reconnection when going
back online.
@bznein bznein requested a review from benma July 15, 2025 16:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants