Skip to content

Commit

Permalink
Add version information to preferences screen
Browse files Browse the repository at this point in the history
Signed-off-by: Saeed Rezaee <saeed.rezaee@kynetics.it>
  • Loading branch information
SaeedRe committed May 7, 2024
1 parent 5ba2809 commit 4ac252e
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 12 deletions.
Expand Up @@ -19,6 +19,7 @@ import android.util.Log
import androidx.appcompat.app.AlertDialog
import androidx.preference.*
import com.cronutils.descriptor.CronDescriptor
import com.kynetics.uf.android.BuildConfig
import com.kynetics.uf.android.R
import com.kynetics.uf.android.UpdateFactoryService
import com.kynetics.uf.android.api.ApiCommunicationVersion
Expand Down Expand Up @@ -159,6 +160,11 @@ class UFPreferenceFragment : PreferenceFragmentCompat(), SharedPreferences.OnSha
return
}

if (key == getString(R.string.shared_preferences_service_versions_key)) {
preference.summary = "${BuildConfig.VERSION_NAME} (${BuildConfig.VERSION_CODE})"
return
}

if (key == getString(R.string.shared_preferences_target_token_received_from_server_key)){
preference.summary = sharedPrefs.getString(key, "").toPwdFormat()
}
Expand Down
3 changes: 3 additions & 0 deletions uf-client-service/src/main/res/values/strings.xml
Expand Up @@ -61,7 +61,10 @@
<string name="shared_preferences_time_windows_cron_expression_key">TIME_WINDOWS_CRON_EXPRESSION</string>
<string name="shared_preferences_schedule_update_title">Schedule Update</string>
<string name="shared_preferences_time_windows_duration_key">TIME_WINDOWS_DURATION</string>
<string name="shared_preferences_service_versions_title">UF Service Version (VersionCode)</string>
<string name="shared_preferences_service_versions_key">UF_SERVICE_VERSION</string>
<string name="force_update_label">Force update</string>
<string name="preferences_about_label">UF Service Information</string>
<string name="time_windows_size_label">Time windows duration in seconds</string>

</resources>
33 changes: 21 additions & 12 deletions uf-client-service/src/main/res/xml/pref_general.xml
Expand Up @@ -71,18 +71,6 @@
android:key="@string/shared_preferences_api_mode_key"
android:title="@string/shared_preferences_api_mode_title" />

<Preference
android:inputType="textCapWords"
android:key="@string/shared_preferences_current_state_key"
android:title="@string/shared_preferences_current_state_title"
android:maxLines="1"
android:selectAllOnFocus="true"
android:singleLine="true" />

<Preference
android:key="@string/shared_preferences_system_update_type_key"
android:title="@string/shared_preferences_system_update_type_title" />

<PreferenceCategory
android:title="@string/force_update_label">
<com.kynetics.uf.android.ui.preferences.EditTextValidateSchedulePreference
Expand All @@ -98,5 +86,26 @@
android:key="@string/shared_preferences_time_windows_duration_key" />
</PreferenceCategory>

<PreferenceCategory
android:title="@string/preferences_about_label">

<Preference
android:inputType="textCapWords"
android:key="@string/shared_preferences_current_state_key"
android:title="@string/shared_preferences_current_state_title"
android:maxLines="1"
android:selectAllOnFocus="true"
android:singleLine="true" />

<Preference
android:key="@string/shared_preferences_system_update_type_key"
android:title="@string/shared_preferences_system_update_type_title" />

<Preference
android:key="@string/shared_preferences_service_versions_key"
android:title="@string/shared_preferences_service_versions_title" />

</PreferenceCategory>


</PreferenceScreen>

0 comments on commit 4ac252e

Please sign in to comment.