traccar / traccar-client-ios

Traccar Client for iOS
https://www.traccar.org/client
Apache License 2.0
204 stars 304 forks source link

Allow the app to be configured with an MDM #81

Open AxelRieben opened 3 months ago

AxelRieben commented 3 months ago

This PR allows you to configure the application with an MDM (Mobile Device Management). When settings are configured with MDM they are hidden in the user interface. To inform the user of the settings that are currently configured, these are displayed at startup in the "Status" screen. To respect the user's privacy, the activation or deactivation of tracking cannot be configured by MDM.

The functionality has been tested with SimpleMDM and AirWatch MDMs.

To simulate sending MDM parameters to an iOS simulator, it is possible to use this command:

xcrun simctl spawn booted defaults write org.traccar.client.TraccarClient com.apple.configuration.managed -dict "device_id_preference" "john.doe" "server_url_preference" "https://traccar.com:5555" "accuracy_preference" "high" "frequency_preference" "300" "distance_preference" "50" "angle_preference" "100" "buffer_preference" "0"
tananaev commented 3 months ago

Why do we want to hide managed settings?

AxelRieben commented 3 months ago

Thanks for your return. I see two advantages:

And if we still want to display the settings, and therefore allow the user to modify them, this leads to additional complexity. Due to the fact that we now need to know whether at startup we should take the MDM configuration or keep the user configuration.

tananaev commented 3 months ago

Well, I'm assuming we shouldn't let them modify it if it's forced by MDM, but they can see it.

AxelRieben commented 3 months ago

I tried to display the settings in a disabled way. But I haven't found a way to do it with the library used (InAppSettingsKit).