allow other kinds of identification

This commit is contained in:
Milos Kozak 2021-11-28 18:20:52 +01:00
parent 367fe32090
commit 9ca1ab1f83
5 changed files with 16 additions and 5 deletions

View file

@ -25,6 +25,8 @@ import info.nightscout.androidaps.logging.LTag
import info.nightscout.androidaps.logging.UserEntryLogger
import info.nightscout.androidaps.plugins.configBuilder.PluginStore
import info.nightscout.androidaps.plugins.constraints.versionChecker.VersionCheckerUtils
import info.nightscout.androidaps.plugins.general.overview.notifications.Notification
import info.nightscout.androidaps.plugins.general.overview.notifications.NotificationStore
import info.nightscout.androidaps.receivers.BTReceiver
import info.nightscout.androidaps.receivers.ChargingStateReceiver
import info.nightscout.androidaps.receivers.KeepAliveReceiver.KeepAliveManager
@ -33,6 +35,7 @@ import info.nightscout.androidaps.receivers.TimeDateOrTZChangeReceiver
import info.nightscout.androidaps.services.AlarmSoundServiceHelper
import info.nightscout.androidaps.utils.ActivityMonitor
import info.nightscout.androidaps.utils.DateUtil
import info.nightscout.androidaps.utils.buildHelper.BuildHelper
import info.nightscout.androidaps.utils.locale.LocaleHelper
import info.nightscout.androidaps.utils.protection.PasswordCheck
import info.nightscout.androidaps.utils.sharedPreferences.SP
@ -55,6 +58,7 @@ class MainApp : DaggerApplication() {
@Inject lateinit var versionCheckersUtils: VersionCheckerUtils
@Inject lateinit var sp: SP
@Inject lateinit var config: Config
@Inject lateinit var buildHelper: BuildHelper
@Inject lateinit var configBuilder: ConfigBuilder
@Inject lateinit var keepAliveManager: KeepAliveManager
@Inject lateinit var plugins: List<@JvmSuppressWildcards PluginBase>
@ -65,6 +69,7 @@ class MainApp : DaggerApplication() {
@Inject lateinit var uel: UserEntryLogger
@Inject lateinit var passwordCheck: PasswordCheck
@Inject lateinit var alarmSoundServiceHelper: AlarmSoundServiceHelper
@Inject lateinit var notificationStore: NotificationStore
override fun onCreate() {
super.onCreate()
@ -101,6 +106,9 @@ class MainApp : DaggerApplication() {
// trigger here to see the new version on app start after an update
versionCheckersUtils.triggerCheckVersion()
// check if identification is set
if (buildHelper.isDev() && sp.getStringOrNull(R.string.key_email_for_crash_report, null).isNullOrBlank())
notificationStore.add(Notification(Notification.IDENTIFICATION_NOT_SET, getString(R.string.identification_not_set), Notification.INFO))
// Register all tabs in app here
pluginStore.plugins = plugins

View file

@ -331,6 +331,7 @@ class OverviewFragment : DaggerFragment(), View.OnClickListener, OnLongClickList
updateSensitivity("onResume")
updateGraph("onResume")
updatePumpStatus("onResume")
updateNotification("onResume")
}
@Synchronized

View file

@ -1083,7 +1083,7 @@
<string name="cannula">Cannula</string>
<string name="userentry">User entry</string>
<string name="common_values">Use values of your largest food you usually eat\n</string>
<string name="summary_email_for_crash_report">This email address will attached to crash reports so we can contact you in urgent cases. It\'s optional.</string>
<string name="summary_email_for_crash_report">This identification will attached to crash reports so we can contact you in urgent cases. It\'s optional.</string>
<string name="email_address">Email address</string>
<string name="privacy_settings">Privacy setting</string>
<string name="privacy_summary">You can provide optional email address if you want to be notified about app crashes. This is not an automated service. You will be contacted by developers in dangerous situations.</string>
@ -1135,5 +1135,7 @@
<string name="recalculated_data_used">Recalculated data used</string>
<string name="bg_too_close">BG too close:\n%1$s\n%2$s</string>
<string name="key_last_processed_glunovo_timestamp" translatable="false">last_processed_glunovo_timestamp</string>
<string name="identification">Identification (email, FB or Discord nick etc)</string>
<string name="identification_not_set">Identification not set in dev mode</string>
</resources>

View file

@ -16,12 +16,11 @@
<info.nightscout.androidaps.utils.textValidator.ValidatingEditTextPreference
android:dialogMessage="@string/summary_email_for_crash_report"
android:inputType="textEmailAddress"
android:inputType="text"
android:key="@string/key_email_for_crash_report"
android:selectAllOnFocus="true"
android:summary="@string/summary_email_for_crash_report"
android:title="@string/email_address"
validate:testType="email" />
android:title="@string/identification" />
</PreferenceCategory>

View file

@ -128,6 +128,7 @@ open class Notification {
const val VERSION_EXPIRE = 74
const val INVALID_PROFILE_NOT_ACCEPTED = 75
const val MDT_INVALID_HISTORY_DATA = 76
const val IDENTIFICATION_NOT_SET = 77
const val USER_MESSAGE = 1000