Merge branch 'master' into 'master'
Fix: Use user-selected vending version See merge request AuroraOSS/AuroraStore!357
This commit is contained in:
@@ -68,10 +68,14 @@ class AuthViewModel @Inject constructor(
|
|||||||
|
|
||||||
private val spoofProvider: SpoofProvider get() = SpoofProvider(context)
|
private val spoofProvider: SpoofProvider get() = SpoofProvider(context)
|
||||||
val properties: Properties
|
val properties: Properties
|
||||||
get() = if (spoofProvider.isDeviceSpoofEnabled()) {
|
get() {
|
||||||
spoofProvider.getSpoofDeviceProperties()
|
val currentProperties = if (spoofProvider.isDeviceSpoofEnabled()) {
|
||||||
} else {
|
spoofProvider.getSpoofDeviceProperties()
|
||||||
NativeDeviceInfoProvider(context).getNativeDeviceProperties()
|
} else {
|
||||||
|
NativeDeviceInfoProvider(context).getNativeDeviceProperties()
|
||||||
|
}
|
||||||
|
setVendingVersion(currentProperties)
|
||||||
|
return currentProperties
|
||||||
}
|
}
|
||||||
val locale: Locale
|
val locale: Locale
|
||||||
get() = if (spoofProvider.isLocaleSpoofEnabled()) {
|
get() = if (spoofProvider.isLocaleSpoofEnabled()) {
|
||||||
@@ -228,24 +232,6 @@ class AuthViewModel @Inject constructor(
|
|||||||
|
|
||||||
private fun verifyAndSaveAuth(authData: AuthData, type: AccountType) {
|
private fun verifyAndSaveAuth(authData: AuthData, type: AccountType) {
|
||||||
liveData.postValue(AuthState.Verifying)
|
liveData.postValue(AuthState.Verifying)
|
||||||
|
|
||||||
val versionId = Preferences.getInteger(context, Preferences.PREFERENCE_VENDING_VERSION)
|
|
||||||
if (versionId > 0) {
|
|
||||||
val resources = context.resources
|
|
||||||
|
|
||||||
authData.deviceInfoProvider?.properties?.let {
|
|
||||||
it.setProperty(
|
|
||||||
"Vending.version",
|
|
||||||
resources.getStringArray(R.array.pref_vending_version_codes)[versionId]
|
|
||||||
)
|
|
||||||
|
|
||||||
it.setProperty(
|
|
||||||
"Vending.versionString",
|
|
||||||
resources.getStringArray(R.array.pref_vending_version)[versionId]
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (authData.authToken.isNotEmpty() && authData.deviceConfigToken.isNotEmpty()) {
|
if (authData.authToken.isNotEmpty() && authData.deviceConfigToken.isNotEmpty()) {
|
||||||
configAuthPref(authData, type, true)
|
configAuthPref(authData, type, true)
|
||||||
liveData.postValue(AuthState.SignedIn)
|
liveData.postValue(AuthState.SignedIn)
|
||||||
@@ -259,6 +245,18 @@ class AuthViewModel @Inject constructor(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun setVendingVersion(currentProperties: Properties) {
|
||||||
|
val vendingVersionIndex = Preferences.getInteger(context, Preferences.PREFERENCE_VENDING_VERSION)
|
||||||
|
if (vendingVersionIndex > 0) {
|
||||||
|
val resources = context.resources
|
||||||
|
val versionCodes = resources.getStringArray(R.array.pref_vending_version_codes)
|
||||||
|
val versionStrings = resources.getStringArray(R.array.pref_vending_version)
|
||||||
|
|
||||||
|
currentProperties.setProperty("Vending.version", versionCodes[vendingVersionIndex])
|
||||||
|
currentProperties.setProperty("Vending.versionString", versionStrings[vendingVersionIndex])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private fun configAuthPref(authData: AuthData, type: AccountType, signedIn: Boolean) {
|
private fun configAuthPref(authData: AuthData, type: AccountType, signedIn: Boolean) {
|
||||||
if (signedIn) {
|
if (signedIn) {
|
||||||
//Save Auth Data
|
//Save Auth Data
|
||||||
|
|||||||
Reference in New Issue
Block a user