Commit Graph
25 Commits
Author SHA1 Message Date
Diego Romar 4dc2025407 Add explicit dismissal of ChangeServerAlert when clicking Confirm button 2025-12-15 23:07:03 -03:00
Diego Romar 7c032cd01c Use FileManager.copyItem instead of loading logs into memory
Log and delete tempDir if rootViewController isn't found
2025-12-15 22:40:09 -03:00
Diego Romar 5e3f38f765 Offload file IO to backgroud thread while sharing logs 2025-12-15 17:06:23 -03:00
Diego Romar d9402e0598 minor UI bugfixes (#40)
* Remove setting of statusDetailsValid to false on handleServerChanged()

This variable is used to show the splash screen until the app successfully starts polling,
then it's set to true and and it's never set to false again afterwards.

* Change DispatchQueue.global usage for Task.detached to stop network extension

Gets rid of warning: Main actor-isolated property 'networkExtensionAdapter'
can not be referenced from a Sendable closure.

The ViewModel class is marked @MainActor, which means networkExtensionAdapter
is isolated to the main actor. Accessing it from a DispatchQueue.global closure
(which runs on a background thread) violates Swift's actor isolation rules.

* Manually stop and start polling when navigating to and from ServerView

Choosing to Change Server creates a dialog that when clicked on the Confirm
button, it stops the client connection.  This is handled via the handleServerChanged method.

When app starts, though, it polls in a loop for the current state of the connection via startPollingDetails.
It is overwriting the states manually assigned inside handleServerChanged.
This commit manually turns off the polling when handleServerChanged is called, and turns it back on
after user navigates away from ServerView.
2025-12-15 19:41:14 +01:00
mlsmaycon a07b82df9f remove print and reduce max log app size to 100kb 2025-12-15 00:36:46 +01:00
mlsmaycon 50b01653a6 update airplane mode handler 2025-12-15 00:30:17 +01:00
mlsmaycon 1028f7c433 fix comment 2025-12-14 21:25:53 +01:00
mlsmaycon b369f73ee3 handle airplane mode freezes 2025-12-14 21:10:07 +01:00
mlsmaycon 6defc9fc4f Uses temporary directory instead of Documents 2025-12-14 18:10:50 +01:00
mlsmaycon 4177849640 add popoverPresentationController when running on ipad 2025-12-14 18:08:51 +01:00
mlsmaycon a30ea8ec58 improve reliability when handling auth 2025-12-14 17:53:54 +01:00
mlsmaycon da6bbe9252 fix comments 2025-12-14 14:13:13 +01:00
mlsmaycon a3f6cb438f add build and test workflows and handle missing firebase files 2025-12-13 22:48:36 +01:00
mlsmaycon 08c206efe2 Fix UI stuck in connecting state during network type switches
Message:
  When switching between wifi and cellular, the Go engine fires rapid state
  changes (connecting → disconnecting → connected) that confused the UI
  animation state machine, causing it to get stuck in "Connecting..." state.

  Changes:
  - Add isRestarting flag to suppress intermediate state updates during restart
  - Add recovery path in playDisconnectingLoop when engine reconnects
  - Add status polling guard to prevent concurrent fetchData calls
  - Add AppLogger for unified Swift logging to shared container
  - Update share logs to export both engine and app log files
2025-12-13 22:38:57 +01:00
Diego Romar 675c560a63 Add force relay connection option (#37)
* Add some tests calling sdk method to set environment variable

* Add GlobalConstants and EnvVarPackager

* Add EnvList as parameter to NetBirdSDKClient.run method

* Add option to toggle force relay connection to AdvancedView

MainViewModel code is stil WIP

* Add usage of appGroup when using shared UserDefaults

* Use the defined App Group identifier for userPreferencesSuiteName

* Add ForceRelayAlert to be displayed when user toggles the option in AdvancedView

* Extract code that grays out background when an Alert is displayed in AdvancedView to a common function

* Remove prints

* Replace @StateObject with @EnvironmentObject property wrapper for viewModel in Alerts

Their parent view (AdvancedView) also accesses it via @EnvironmentObject property

* Replace force unwrap with flatMap

* Add default value for keyForceRelayConnection when reading from defaults

If the key isn't set, it will use the value by default

* Update forceRelayConnection property with the provided value when setForcedRelayConnection is called

* Remove redundant parameter for LogLevelAlert

* Add default value usage for keyForceRelayConnection in MainViewModel

* Wrap onConnected()'s self.completionHandler(nil) call with DispatchQueue.main.async

So that the call happens in the main thread to correctly handle UI state update (Connecting... -> Connected)
2025-12-12 14:30:17 -03:00
Diego Romar 87387e9e31 feature: add device registration with setup keys (#35)
* Add NetBird logo to Use NetBird Server button

* Add plus and minus icons

* Add ServerViewModel

* Refactor ServerView to modularize view creation

Still WIP

* Change project file to include new ViewModel

* Add ServerView button actions

* Add Extensions for View and function to hide keyboard

* Add server field error text

* Hide keyboard on button / screen tap

* Make sdk calls non-blocking

* Add URL and setupKey validation on ServerViewModel

* Add enable/disable UI flow

* Use Task.detached on serverView to not lock main thread when calling SDK methods

* Clear SSO not supported message on server textEdit change

* Consolidate error messages and flags

* Change ServerViewErrors to a class/ObservableObject to make SwiftUI detect changes

* Add better exception handling

* Clear setup key field error when toggling Add this device...

* Block Add device toggle when UI is disabled

* Add JustifiedText View implementation to justify text

* Set height on JustifiedText as optional

Add early return if view width calculation isn't ready

* Remove redundant guard

* Rename closure parameter

Also add ViewModel environment object to #Preview

* Replace usage of Color(red: 0, green: 0, blue: 0, opacity: 0) with Color.clear

* Add user input sanitization

* Add tap gesture to dismiss keyboard when tapping outside of an input field

* Bump version to 0.0.13.4

* Add ellipsis animation to Validating text when UI is blocked

* Bump version to 0.0.13.5
2025-12-03 15:53:48 -03:00
Pascal Fischer 81272b93d6 Add support for lazy connection states (#31) 2025-09-05 14:55:23 +02:00
Pascal Fischer 3e292e101f Remove force unwrap (#23) 2025-04-24 14:43:20 +02:00
Pascal Fischer 965c035d05 Rename routes to networks and add state support (#21) 2025-01-20 15:30:31 +01:00
Pascal Fischer 462f404213 allow copy of peer ip and some fixed crashed due to nullpointer (#18) 2024-12-03 22:43:01 +01:00
pascal-fischer c5cb60160c Add DNS routes support (#12) 2024-07-17 16:00:30 +02:00
pascal-fischer b132cc70d7 Add route selection and detailed status output (#10) 2024-05-13 16:58:12 +02:00
pascal-fischer cd954d80cd Add log export option (#7) 2024-04-30 11:45:27 +02:00
pascal-fischer ae50616f8a add switches to enable rosenpass (#6) 2024-04-26 22:37:52 +02:00
Maycon Santos 8209c91f03 open-source code 2024-02-28 19:22:16 +01:00