Aplicacion movil Android para el sistema SIO (Sistema Integral de Operaciones) de Drenax. Permite a los operadores gestionar sus servicios diarios. Funcionalidades principales: - Login y autenticacion JWT - Checklist de vehiculos - Gestion de jornada laboral - Lista de servicios asignados - Captura de evidencias fotograficas - Firma digital del cliente - Encuestas de satisfaccion - Notificaciones push (Firebase) - Almacenamiento offline (ObjectBox) - Geolocalizacion y mapas Stack tecnologico: - Kotlin - Android SDK 33 - Retrofit + OkHttp - ObjectBox - Firebase (FCM, Crashlytics, Analytics) - Google Maps Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
65 lines
2.5 KiB
Kotlin
65 lines
2.5 KiB
Kotlin
package com.iesoluciones.siodrenax
|
|
|
|
import android.content.Context
|
|
|
|
class PreferencesHelper(context: Context) {
|
|
|
|
private val fileName = "share_preferences_file"
|
|
private val prefs = context.getSharedPreferences(fileName, Context.MODE_PRIVATE)
|
|
|
|
private val TOKEN_API = "tokenApi"
|
|
private val TOKEN_FIREBASE = "tokenFirebase"
|
|
private val IS_MANAGER = "isManager"
|
|
private val CHECK_LIST_PROGRESS = "checkListProgress"
|
|
private val IS_ENABLE_HERRAMIENTA_SURVEY = "isEnableHerramientaSurvey"
|
|
private val WORKDAY_STARTED = "workday_started"
|
|
private val WORKDAY_ID = "workday_id"
|
|
private val GPS_INTERVAL_IN_MINUTES = "gps_interval"
|
|
private val ORDER_PROGRESS = "order_in_progress"
|
|
private val IS_ENABLE_TO_SYNC = "syncEnable"
|
|
|
|
var tokenApi: String?
|
|
get() = prefs.getString(TOKEN_API, null)
|
|
set(value) = prefs.edit().putString(TOKEN_API, value).apply()
|
|
|
|
var tokenFirebase: String?
|
|
get() = prefs.getString(TOKEN_FIREBASE, "default_token_firebase")
|
|
set(value) = prefs.edit().putString(TOKEN_FIREBASE, value).apply()
|
|
|
|
var isManager: Boolean
|
|
get() = prefs.getBoolean(IS_MANAGER, false)
|
|
set(value) = prefs.edit().putBoolean(IS_MANAGER, value).apply()
|
|
|
|
var checkListProgress: String?
|
|
get() = prefs.getString(CHECK_LIST_PROGRESS, null)
|
|
set(value) = prefs.edit().putString(CHECK_LIST_PROGRESS, value).apply()
|
|
|
|
var isEnableHerramientaSurvey: Boolean
|
|
get() = prefs.getBoolean(IS_ENABLE_HERRAMIENTA_SURVEY, true)
|
|
set(value) = prefs.edit().putBoolean(IS_ENABLE_HERRAMIENTA_SURVEY, value).apply()
|
|
|
|
var workdayStarted: Boolean
|
|
get() = prefs.getBoolean(WORKDAY_STARTED, false)
|
|
set(value) = prefs.edit().putBoolean(WORKDAY_STARTED, value).apply()
|
|
|
|
var workdayId: Int
|
|
get() = prefs.getInt(WORKDAY_ID, 0)
|
|
set(value) = prefs.edit().putInt(WORKDAY_ID, value).apply()
|
|
|
|
var gpsInterval: Int
|
|
get() = prefs.getInt(GPS_INTERVAL_IN_MINUTES, 3)
|
|
set(value) = prefs.edit().putInt(GPS_INTERVAL_IN_MINUTES, value).apply()
|
|
|
|
var orderInProgress: Long?
|
|
get() = prefs.getLong(ORDER_PROGRESS, 0L)
|
|
set(value){
|
|
if (value == null)
|
|
prefs.edit().remove(ORDER_PROGRESS).apply()
|
|
else
|
|
prefs.edit().putLong(ORDER_PROGRESS, value).apply()
|
|
}
|
|
|
|
var isEnableToSync: Boolean
|
|
get() = prefs.getBoolean(IS_ENABLE_TO_SYNC, true)
|
|
set(value) = prefs.edit().putBoolean(IS_ENABLE_TO_SYNC, value).apply()
|
|
} |