Commit Graph
24 Commits
Author SHA1 Message Date
Diego Romar 16d447ebd8 Add guard usage when attempting to create log files
For rotateLogsIfNeeded and clearLogs so that isReady is marked as false
in case calling FileManager.default.createFile returns nil; on exception,
isReady is set to false and fileHandle is set to nil so that log creation doesn't
fail silently.
2025-12-16 12:40:49 -03:00
Diego Romar ffb32269a8 Extract common getfilePath method usage when getting config and state files
File names were added to constants in GlobalConstants
Attempts to use applicationSupportDirectory as fallback if app group is not available;
Then documentDirectory, and finally, temporaryDirectory as last resort
2025-12-15 22:16:08 -03:00
Diego Romar 6bf5943e8e Use guard and preconditionFailure if it fails to call NetBirdSDKNewPreferences 2025-12-15 22:09:29 -03:00
Diego Romar b8a097e696 Add timer to fetchData to make sure isFetchingStatus is set to false
In the odd case the completionHandler for session.sendProviderMessage never gets called
2025-12-15 18:45:56 -03:00
Diego Romar 818614cb61 Use atomic property wrapper on isFetchingStatus to avoid racing conditions 2025-12-15 17:40:06 -03:00
mlsmaycon dc70b66ab0 fix comments 2025-12-15 01:00:37 +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 0aee71bfa8 Added fallback to Documents directory when App Group is unavailable 2025-12-14 18:59:10 +01:00
mlsmaycon a30ea8ec58 improve reliability when handling auth 2025-12-14 17:53:54 +01:00
mlsmaycon 08093a784a handle airplane mode 2025-12-14 16:27:42 +01:00
mlsmaycon da6bbe9252 fix comments 2025-12-14 14:13:13 +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 a1e2af09f1 Add completion handler usage when restarting client 2025-12-12 18:03:54 -03: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
Pascal Fischer 3e292e101f Remove force unwrap (#23) 2025-04-24 14:43:20 +02:00
Pascal Fischer f9bea1912a Route states support (#19) 2024-12-06 16:50:13 +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 577e241abd added some nullpointer checks to the extension code (#16) 2024-08-06 22:31:42 +02: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 1094707903 Add exit node support (#8)
* split default route into multiple smaller ones to avoid dns issues

* add project file
2024-04-26 22:35:39 +02:00
Maycon Santos 8209c91f03 open-source code 2024-02-28 19:22:16 +01:00