Skip to content
This repository has been archived by the owner on Jan 10, 2025. It is now read-only.

Commit

Permalink
Fix NetworkManager initialization to use lazy delegate
Browse files Browse the repository at this point in the history
  • Loading branch information
valldrac committed Aug 6, 2024
1 parent d8a24c7 commit bc78172
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -217,8 +217,9 @@ object AppDependencies {
val webSocketObserver: Observable<WebSocketConnectionState> = _webSocketObserver

@JvmStatic
val networkManager: NetworkManager
get() = provider.provideNetworkManager()
val networkManager: NetworkManager by lazy {
provider.provideNetworkManager()
}

private val _networkModule = resettableLazy {
NetworkDependenciesModule(application, provider, _webSocketObserver)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,6 @@ public static NetworkManager create(@NonNull Context context) {
return new NetworkManager(ApplicationContext.getInstance(), OrbotHelper.get(context));
}

public boolean isNetworkEnabled() {
return Networking.isEnabled();
}

public void setNetworkEnabled(boolean enabled) {
Networking.setEnabled(enabled);
if (enabled) {
Expand Down

0 comments on commit bc78172

Please sign in to comment.