-
Notifications
You must be signed in to change notification settings - Fork 493
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
ui: port syspolicy handler code to new app #304
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, but @agottardo should take a look as well.
} | ||
} | ||
|
||
fun keyExists(key: String): Boolean { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: the one line method here isn't really needed (unless it's called by something else I'm not seeing.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we are using this in App.getSyspolicyStringValue - MDMSettings has all the MDMSettings we've created, and we want to check to see if there is one with the key we're given
import com.tailscale.ipn.App | ||
import com.tailscale.ipn.ui.util.set | ||
import kotlinx.coroutines.flow.MutableStateFlow | ||
import kotlinx.coroutines.flow.StateFlow | ||
|
||
abstract class MDMSetting<T>(defaultValue: T, val key: String, val localizedTitle: String) { | ||
// Don't keep track of the key if shouldRegisterKey is false - shouldRegisterKey should be false when creating an MDMSetting for retrieving a setting. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this mean that all initializer calls in MDMSettings.kt need to be updated with shouldRegisterKey: false
?. The default value here is true
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no, they should register keys. when we are checking to see if there exists an MDMSetting for a certain key, shouldRegisterKey should be false. I updated the comment to hopefully be a little clearer
libtailscale/syspolicy_handler.go
Outdated
|
||
// androidHandler is a syspolicy handler for the Android version of the Tailscale client, | ||
// which lets the main networking code read values set via the Android RestrictionsManager. | ||
type androidHandler struct { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: since this isn't in its own package, a more specific name would be good, like syspolicyHandler
.
port over #199 from cmd/tailscale and legacy_android to libtailscale and android/ Updates tailscale/corp#18202 Signed-off-by: kari-ts <kari@tailscale.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a simpler way to do it.
Updates tailscale/corp#18202 Signed-off-by: Percy Wegmann <percy@tailscale.com>
* ui: port syspolicy handler code to new app port over #199 from cmd/tailscale and legacy_android to libtailscale and android/ Updates tailscale/corp#18202 Signed-off-by: kari-ts <kari@tailscale.com> * android: PR suggestions for syspolicyHandler (#308) Updates tailscale/corp#18202 Signed-off-by: Percy Wegmann <percy@tailscale.com> --------- Signed-off-by: kari-ts <kari@tailscale.com> Signed-off-by: Percy Wegmann <percy@tailscale.com> Co-authored-by: Percy Wegmann <percy@tailscale.com>
port over #199 from cmd/tailscale and legacy_android to libtailscale and android/
fix issue where we were creating MDMSettings every time we were retrieving policy settings
Updates tailscale/corp#18202