This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package com.***.data.dataStoreManager | |
| import android.content.Context | |
| import androidx.datastore.core.DataStore | |
| import androidx.datastore.preferences.core.* | |
| import androidx.datastore.preferences.preferencesDataStore | |
| import kotlinx.coroutines.flow.Flow | |
| import kotlinx.coroutines.flow.first | |
| import kotlinx.coroutines.flow.map |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @Entity(tableName = "inbox", indices = [Index(value = ["uid"], unique = true)]) | |
| data class Message @JvmOverloads constructor( | |
| @PrimaryKey(autoGenerate = true) @ColumnInfo(name = _id) val id: Long?, | |
| @ColumnInfo(name = timestamp) val timestamp: Long | |
| @ColumnInfo(name = uid) val uid: Long, | |
| @ColumnInfo(name = is_read, defaultValue = "0") val isRead: Int = 0 | |
| @ColumnInfo(name = text) val text: String? | |
| ) | |
| @Database(entities = arrayOf(Message::class), version = 2) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class FirebaseMessagingService extends FirebaseMessagingService { | |
| @Override | |
| public void onMessageReceived(@NotNull RemoteMessage remoteMessage) { | |
| // Not getting messages here? See why this may be: https://goo.gl/39bRNJ | |
| Log.d(ContentValues.TAG, "From: " + remoteMessage.getFrom()); | |
| // Check if message contains a data payload. | |
| if (!remoteMessage.getData().isEmpty()) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| val millisInFuture: Int = 10 * 1000 | |
| val countdown_interval: Int = 1000 | |
| val timer: CountDownTimer = object: CountDownTimer(millisInFuture, countdown_interval) { | |
| override fun onFinish() { | |
| Log.i(TAG, "CountDownTimer onFinish") | |
| } | |
| override fun onTick(millisUntilFinished: Long) { | |
| Log.i(TAG, "CountDOwnTimer onTick: " + millisUntilFinished) |