Updated the repo and made the the persistent in datastore
This commit is contained in:
@@ -38,25 +38,19 @@ class CheckInCheckOutDataStore @Inject constructor(@ApplicationContext context:
|
||||
preferences[CHECK_IN_Date] ?: ""
|
||||
}
|
||||
|
||||
val isCheckedIn : Flow<Boolean> = dataStore.data.map { preferences ->
|
||||
preferences[IS_CHECK_IN] ?: false
|
||||
}
|
||||
|
||||
val isCheckedOut : Flow<Boolean> = dataStore.data.map { preferences ->
|
||||
preferences[IS_CHECK_OUT] ?: false
|
||||
}
|
||||
|
||||
suspend fun saveLoginData(checkIn: String, checkOut: String) {
|
||||
suspend fun saveLoginData(checkOut: String) {
|
||||
dataStore.edit { preferences ->
|
||||
preferences[CHECK_IN_KEY] = checkIn
|
||||
preferences[CHECK_OUT_KEY] = checkOut
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
suspend fun saveLoginDate(checkDate: String) {
|
||||
suspend fun saveLoginDate(checkDate: String,checkInTime: String) {
|
||||
dataStore.edit { preferences ->
|
||||
preferences[CHECK_IN_Date] = checkDate
|
||||
preferences[CHECK_IN_KEY] = checkInTime
|
||||
}
|
||||
}
|
||||
|
||||
@@ -66,12 +60,6 @@ class CheckInCheckOutDataStore @Inject constructor(@ApplicationContext context:
|
||||
}
|
||||
}
|
||||
|
||||
suspend fun saveIsLogOut(isCheckOut: Boolean) {
|
||||
dataStore.edit { preferences ->
|
||||
preferences[IS_CHECK_OUT] = isCheckOut
|
||||
}
|
||||
}
|
||||
|
||||
suspend fun clearLoginData() {
|
||||
dataStore.edit { preferences ->
|
||||
preferences.remove(CHECK_IN_Date)
|
||||
|
||||
Reference in New Issue
Block a user