fix(ui): make internet resource off by default#6518
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
|
| Report | Wed, September 4, 2024 at 17:05:40 UTC |
| Project | Firezone |
| Branch | fix/internet-resource-ui |
| Testbed | github-actions |
Click to view all benchmark results
| Benchmark | Throughput | Throughput Results bits/s | (Δ%) | Throughput Lower Boundary bits/s | (%) |
|---|---|---|---|
| direct-tcp-client2server | ✅ (view plot) | 249,081,454.61 (+1.02%) | 238,104,360.87 (95.59%) |
| direct-tcp-server2client | ✅ (view plot) | 255,825,452.08 (+1.80%) | 243,473,768.23 (95.17%) |
| direct-udp-client2server | ✅ (view plot) | 307,110,372.58 (+5.78%) | 271,090,526.79 (88.27%) |
| direct-udp-server2client | ✅ (view plot) | 398,134,354.69 (-0.90%) | 388,364,859.09 (97.55%) |
| relayed-tcp-client2server | ✅ (view plot) | 248,353,066.40 (-0.57%) | 240,321,338.22 (96.77%) |
| relayed-tcp-server2client | ✅ (view plot) | 262,640,789.51 (+1.18%) | 249,878,775.24 (95.14%) |
| relayed-udp-client2server | ✅ (view plot) | 227,793,889.73 (-1.84%) | 220,878,630.63 (96.96%) |
| relayed-udp-server2client | ✅ (view plot) | 362,181,036.15 (+7.27%) | 316,663,607.09 (87.43%) |
Bencher - Continuous Benchmarking
View Public Perf Page
Docs | Repo | Chat | Help
7da9e1d to
3f05ea8
Compare
kotlin/android/app/src/main/java/dev/firezone/android/features/session/ui/ViewResource.kt
Outdated
Show resolved
Hide resolved
| } | ||
| } | ||
|
|
||
| fun Resource.toViewResource(resourceState: ResourceState): ViewResource { |
There was a problem hiding this comment.
I think a ctor on ViewResource would be more natural.
There was a problem hiding this comment.
I like to do the conversion as resource.toResourceViewModel instead of ResourceViewModel.from(...) and pass the resource in.
There was a problem hiding this comment.
Sure. My reasoning would be that if you think in terms of dependencies, then the view-stuff is okay to know about the actual entities but the entities shouldn't know about the view. Like, if you were to extract the view into a separate module / crate then you can only do that if the conversion function lives on the view-model type (or completely independent of both).
| fun internetResourceDisplayName(resource: Resource, state: ResourceState): String { | ||
| return if (!resource.canBeDisabled) { | ||
| "$OnSymbol ${resource.name}" | ||
| } else { | ||
| "${state.stateSymbol()} ${resource.name}" | ||
| } | ||
| } | ||
|
|
||
| fun displayName(resource: Resource, state: ResourceState): String { | ||
| if (resource.isInternetResource()) { | ||
| return internetResourceDisplayName(resource, state) | ||
| } else { | ||
| return resource.name | ||
| } | ||
| } |
There was a problem hiding this comment.
I'd expect utilities to be below the function that uses them.
| let internet_resource = self | ||
| .status | ||
| .internet_resource() | ||
| .ok_or(anyhow!("Tunnel not ready"))?; |
There was a problem hiding this comment.
| .ok_or(anyhow!("Tunnel not ready"))?; | |
| .context("Tunnel not ready")?; |
rust/gui-client/src-tauri/src/client/gui/system_tray/builder.rs
Outdated
Show resolved
Hide resolved
rust/gui-client/src-tauri/src/client/gui/system_tray/builder.rs
Outdated
Show resolved
Hide resolved
swift/apple/FirezoneKit/Sources/FirezoneKit/Views/MenuBar.swift
Outdated
Show resolved
Hide resolved
8d65387 to
e0f4735
Compare
Signed-off-by: conectado <gabrielalejandro7@gmail.com>
Signed-off-by: conectado <gabrielalejandro7@gmail.com>
Signed-off-by: conectado <gabrielalejandro7@gmail.com>
Signed-off-by: conectado <gabrielalejandro7@gmail.com>
Signed-off-by: conectado <gabrielalejandro7@gmail.com>
Signed-off-by: conectado <gabrielalejandro7@gmail.com>
Signed-off-by: conectado <gabrielalejandro7@gmail.com>
Signed-off-by: conectado <gabrielalejandro7@gmail.com>
Signed-off-by: conectado <gabrielalejandro7@gmail.com>
Signed-off-by: conectado <gabrielalejandro7@gmail.com>
5376c25 to
bd9c398
Compare
| return if (this.isEnabled()) { | ||
| ResourceState.DISABLED | ||
| } else { | ||
| ResourceState.ENABLED | ||
| } |
There was a problem hiding this comment.
Are these reversed? Seems a tad confusing.
There was a problem hiding this comment.
this function "toggles" it so it swap the state out
| public const val ON_SYMBOL: String = "<->" | ||
| public const val OFF_SYMBOL: String = " — " |
There was a problem hiding this comment.
Should these be defined on the companion object at the bottom?
Also I think public might be redundant?
There was a problem hiding this comment.
Should these be defined on the companion object at the bottom?
Is there any benefit to that? Also, shouldn't in that case be a companion to ResourceState?
| return "${state.stateSymbol()} ${resource.name}" | ||
| } | ||
|
|
||
| fun Resource.toResourceViewModel(resourceState: ResourceState): ResourceViewModel { |
There was a problem hiding this comment.
Shouldn't this function be defined on the Resource class?
There was a problem hiding this comment.
It's defined in the Resource class but not on the Resource module.
There was a problem hiding this comment.
I converted this to a constructor on ResourceViewModel
| tunnelService?.internetResourceToggled(internetState().toggle()) | ||
| refreshList() | ||
| Log.d(TAG, "Internet resource toggled ${internetState()}") |
There was a problem hiding this comment.
Next two lines only make sense to execute if the tunnelService is valid, no?
| tunnelService?.internetResourceToggled(internetState().toggle()) | |
| refreshList() | |
| Log.d(TAG, "Internet resource toggled ${internetState()}") | |
| tunnelService?.let { | |
| it.internetResourceToggled(internetState().toggle()) | |
| refreshList() | |
| Log.d(TAG, "Internet resource toggled ${internetState()}") | |
| } |
There was a problem hiding this comment.
is there any point at which this can actually happen to be nil? Maybe I just use !!?
With this PR we made internet resource disabled by default.
Since no other resource is disalable and internet resource behavior is particular we remove all client code to make non internet resource disalable.
Also, since the portal never makes the internet resource that can't be disabled we remove the whole code path to handle that.
Additionally, some other smaller refactors across the UI wrt internet resource
Fix #6509