@@ -68,10 +68,14 @@ class DataStoreManager(private val context: Context) {
6868 private val ESSENTIALS_CONNECTION_ENABLED = booleanPreferencesKey(" essentials_connection_enabled" )
6969
7070 private val DEFAULT_TAB = stringPreferencesKey(" default_tab" )
71+ private val FIRST_MAC_CONNECTION_TIME = longPreferencesKey(" first_mac_connection_time" )
72+ private val LAST_PROMPT_DISMISSED_VERSION = intPreferencesKey(" last_prompt_dismissed_version" )
73+ private val HAS_RATED_APP = booleanPreferencesKey(" has_rated_app" )
7174
7275
7376 // Call monitoring preferences
7477 private val CALL_SYNC_ENABLED = booleanPreferencesKey(" call_sync_enabled" )
78+ private val DEVICE_DISCOVERY_ENABLED = booleanPreferencesKey(" device_discovery_enabled" )
7579 private val LAST_CALL_SYNC_TIMESTAMP = longPreferencesKey(" last_call_sync_timestamp" )
7680 private val DEVICE_ID = stringPreferencesKey(" device_id" )
7781
@@ -284,6 +288,44 @@ class DataStoreManager(private val context: Context) {
284288 }
285289 }
286290
291+ suspend fun setFirstMacConnectionTime (time : Long ) {
292+ context.dataStore.edit { prefs ->
293+ if (prefs[FIRST_MAC_CONNECTION_TIME ] == null ) {
294+ prefs[FIRST_MAC_CONNECTION_TIME ] = time
295+ }
296+ }
297+ }
298+
299+ fun getFirstMacConnectionTime (): Flow <Long > {
300+ return context.dataStore.data.map { prefs ->
301+ prefs[FIRST_MAC_CONNECTION_TIME ] ? : 0L
302+ }
303+ }
304+
305+ suspend fun setLastPromptDismissedVersion (version : Int ) {
306+ context.dataStore.edit { prefs ->
307+ prefs[LAST_PROMPT_DISMISSED_VERSION ] = version
308+ }
309+ }
310+
311+ fun getLastPromptDismissedVersion (): Flow <Int > {
312+ return context.dataStore.data.map { prefs ->
313+ prefs[LAST_PROMPT_DISMISSED_VERSION ] ? : - 1
314+ }
315+ }
316+
317+ suspend fun setHasRatedApp (hasRated : Boolean ) {
318+ context.dataStore.edit { prefs ->
319+ prefs[HAS_RATED_APP ] = hasRated
320+ }
321+ }
322+
323+ fun hasRatedApp (): Flow <Boolean > {
324+ return context.dataStore.data.map { prefs ->
325+ prefs[HAS_RATED_APP ] ? : false
326+ }
327+ }
328+
287329 suspend fun saveLastConnectedDevice (device : ConnectedDevice ) {
288330 context.dataStore.edit { preferences ->
289331 preferences[LAST_CONNECTED_PC_NAME ] = device.name
@@ -774,6 +816,18 @@ class DataStoreManager(private val context: Context) {
774816 }
775817 }
776818
819+ suspend fun setDeviceDiscoveryEnabled (enabled : Boolean ) {
820+ context.dataStore.edit { preferences ->
821+ preferences[DEVICE_DISCOVERY_ENABLED ] = enabled
822+ }
823+ }
824+
825+ fun getDeviceDiscoveryEnabled (): Flow <Boolean > {
826+ return context.dataStore.data.map { preferences ->
827+ preferences[DEVICE_DISCOVERY_ENABLED ] != false // Default to enabled
828+ }
829+ }
830+
777831 suspend fun setLastCallSyncTimestamp (timestamp : Long ) {
778832 context.dataStore.edit { preferences ->
779833 preferences[LAST_CALL_SYNC_TIMESTAMP ] = timestamp
0 commit comments