Skip to content

Commit

Permalink
use appContext from constructor arg when inside instance
Browse files Browse the repository at this point in the history
  • Loading branch information
jonesmac committed Nov 18, 2024
1 parent 7db9f72 commit c7153d1
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,17 @@ import network.xyo.data.PrefsDataStoreProtos.PrefsDataStore
import kotlinx.coroutines.flow.first
import kotlinx.coroutines.launch
import network.xyo.client.account.Account
import network.xyo.client.account.hexStringToByteArray
import network.xyo.client.account.model.AccountInstance
import network.xyo.client.settings.AccountPreferences
import network.xyo.client.xyoScope


class AccountPrefsRepository(context: Context, private val _accountPreferences: AccountPreferences = defaults.accountPreferences) {
private val appContext = context.applicationContext

// This should set the proper paths for the prefs datastore each time the the class is instantiated
@Volatile
private var prefsDataStore: DataStore<PrefsDataStore> = context.xyoAccountDataStore(
private var prefsDataStore: DataStore<PrefsDataStore> = appContext.xyoAccountDataStore(
accountPreferences.fileName, accountPreferences.storagePath
)

Expand Down

0 comments on commit c7153d1

Please sign in to comment.