davidliu

Allow for setting of sample's default url/token through gradle properties

... ... @@ -3,6 +3,17 @@ plugins {
id 'kotlin-android'
}
def getDefaultUrl() {
return hasProperty('livekitSampleUrl') ? livekitSampleUrl : "ws://www.example.com"
}
def getDefaultToken() {
return hasProperty('livekitSampleToken') ? livekitSampleToken : ""
}
final url = getDefaultUrl()
final token = getDefaultToken()
android {
compileSdk androidSdk.compileVersion
... ... @@ -18,6 +29,14 @@ android {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
buildConfigField "String", "DEFAULT_URL", "\"$url\""
buildConfigField "String", "DEFAULT_TOKEN", "\"$token\""
}
debug {
buildConfigField "String", "DEFAULT_URL", "\"$url\""
buildConfigField "String", "DEFAULT_TOKEN", "\"$token\""
}
}
compileOptions {
... ...
... ... @@ -32,8 +32,7 @@ class MainViewModel(application: Application) : AndroidViewModel(application) {
private const val PREFERENCES_KEY_URL = "url"
private const val PREFERENCES_KEY_TOKEN = "token"
const val URL = "ws://www.example.com"
const val TOKEN =
""
const val URL = BuildConfig.DEFAULT_URL
const val TOKEN = BuildConfig.DEFAULT_TOKEN
}
}
\ No newline at end of file
... ...