Skip to content

ALCO-655. Add isRsaConnectionStateEnabled fun #85

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: ALCO-640
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion api/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ android {
minSdkVersion 22
targetSdkVersion 29
versionCode 800
versionName "0.0.8"
versionName "0.0.8-ALCO-655-1"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ internal object SettingsContract {
const val ALCOHOL_ENABLED_COLUMN_NAME = "ALCOHOL_ENABLED"
const val LINK_EGAIS_COMMODITY_COLUMN_NAME = "LINK_EGAIS_COMMODITY"
const val UTM_SYNCHRONIZATION_COLUMN_NAME = "UTM_SYNCHRONIZATION"
const val RSA_CONNECTION_STATE_COLUMN_NAME = "RSA_CONNECTION_STATE"
const val CLOUD_SYNCHRONIZATION_COLUMN_NAME = "CLOUD_SYNCHRONIZATION"
const val BEER_TAPS_ENABLED_COLUMN_NAME = "BEER_TAPS"
const val EXCISE_ALCOHOL_ON_TAP_ENABLED_COLUMN_NAME = "EXCISE_ALCOHOL_ON_TAP"
Expand All @@ -22,6 +23,7 @@ internal object SettingsContract {
private const val ALCOHOL_CONTROL_TYPE_PATH = "AlcoholControlType"
private const val LINK_EGAIS_COMMODITY_PATH = "LinkEgaisCommodity"
private const val UTM_SYNCHRONIZATION_PATH = "UtmSynchronization"
private const val RSA_CONNECTION_STATE_PATH = "RsaConnectionState"
private const val CLOUD_SYNCHRONIZATION_PATH = "CloudSynchronization"
private const val BEER_TAPS_ENABLED_PATH = "BeerTapsEnabled"
private const val EXCISE_ALCOHOL_ON_TAP_ENABLED_PATH = "ExciseAlcoholOnTapEnabled"
Expand All @@ -35,6 +37,7 @@ internal object SettingsContract {
val ALCOHOL_ENABLED_URI: Uri = Uri.withAppendedPath(BASE_URI, ALCOHOL_ENABLED_PATH)
val LINK_EGAIS_COMMODITY_URI: Uri = Uri.withAppendedPath(BASE_URI, LINK_EGAIS_COMMODITY_PATH)
val UTM_SYNCHRONIZATION_URI: Uri = Uri.withAppendedPath(BASE_URI, UTM_SYNCHRONIZATION_PATH)
val RSA_CONNECTION_STATE_URI: Uri = Uri.withAppendedPath(BASE_URI, RSA_CONNECTION_STATE_PATH)
val CLOUD_SYNCHRONIZATION_URI: Uri = Uri.withAppendedPath(BASE_URI, CLOUD_SYNCHRONIZATION_PATH)
val BEER_TAPS_ENABLED_URI: Uri = Uri.withAppendedPath(BASE_URI, BEER_TAPS_ENABLED_PATH)
val EXCISE_ALCOHOL_ON_TAP_ENABLED_URI: Uri = Uri.withAppendedPath(BASE_URI, EXCISE_ALCOHOL_ON_TAP_ENABLED_PATH)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,21 @@ class SettingsQuery {
} ?: true
}

fun isRsaConnectionStateEnabled(context: Context): Boolean {
return context.contentResolver.query(
SettingsContract.RSA_CONNECTION_STATE_URI,
null,
null,
null,
null
)
?.use { cursor ->
cursor.moveToFirst()
cursor.getString(cursor.getColumnIndex(SettingsContract.RSA_CONNECTION_STATE_COLUMN_NAME))
?.toBoolean()
} ?: false
}

fun isCloudSyncEnabled(context: Context): Boolean {
return context.contentResolver.query(
SettingsContract.CLOUD_SYNCHRONIZATION_URI,
Expand Down