NSCv3: strip trailing slash from url
This commit is contained in:
parent
6fb8339238
commit
87ca7ef6cf
5 changed files with 9 additions and 7 deletions
|
@ -9,12 +9,13 @@ import java.io.File
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
import javax.inject.Singleton
|
import javax.inject.Singleton
|
||||||
|
|
||||||
|
@Suppress("KotlinConstantConditions")
|
||||||
@Singleton
|
@Singleton
|
||||||
class ConfigImpl @Inject constructor(
|
class ConfigImpl @Inject constructor(
|
||||||
fileListProvider: PrefFileListProvider
|
fileListProvider: PrefFileListProvider
|
||||||
) : Config {
|
) : Config {
|
||||||
|
|
||||||
override val SUPPORTEDNSVERSION = 140206 // 14.2.6
|
override val SUPPORTED_NS_VERSION = 140206 // 14.2.6
|
||||||
override val APS = BuildConfig.FLAVOR == "full"
|
override val APS = BuildConfig.FLAVOR == "full"
|
||||||
override val NSCLIENT = BuildConfig.FLAVOR == "aapsclient" || BuildConfig.FLAVOR == "aapsclient2"
|
override val NSCLIENT = BuildConfig.FLAVOR == "aapsclient" || BuildConfig.FLAVOR == "aapsclient2"
|
||||||
override val PUMPCONTROL = BuildConfig.FLAVOR == "pumpcontrol"
|
override val PUMPCONTROL = BuildConfig.FLAVOR == "pumpcontrol"
|
||||||
|
|
|
@ -2,7 +2,7 @@ package info.nightscout.interfaces
|
||||||
|
|
||||||
@Suppress("PropertyName")
|
@Suppress("PropertyName")
|
||||||
interface Config {
|
interface Config {
|
||||||
val SUPPORTEDNSVERSION: Int
|
val SUPPORTED_NS_VERSION: Int
|
||||||
val APS: Boolean
|
val APS: Boolean
|
||||||
val NSCLIENT: Boolean
|
val NSCLIENT: Boolean
|
||||||
val PUMPCONTROL: Boolean
|
val PUMPCONTROL: Boolean
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
@file:Suppress("SpellCheckingInspection")
|
||||||
|
|
||||||
package info.nightscout.plugins.sync.nsclient.data
|
package info.nightscout.plugins.sync.nsclient.data
|
||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
|
@ -63,7 +65,7 @@ import javax.inject.Singleton
|
||||||
"showForecast": "ar2",
|
"showForecast": "ar2",
|
||||||
"focusHours": 3,
|
"focusHours": 3,
|
||||||
"heartbeat": 60,
|
"heartbeat": 60,
|
||||||
"baseURL": "http:\/\/barascgm.sysop.cz:82",
|
"baseURL": "http:\/\/xxxxxxxxxxxx",
|
||||||
"authDefaultRoles": "readable",
|
"authDefaultRoles": "readable",
|
||||||
"thresholds": {
|
"thresholds": {
|
||||||
"bgHigh": 252,
|
"bgHigh": 252,
|
||||||
|
@ -150,7 +152,7 @@ class NSSettingsStatusImpl @Inject constructor(
|
||||||
override fun handleNewData(status: JSONObject) {
|
override fun handleNewData(status: JSONObject) {
|
||||||
data = status
|
data = status
|
||||||
aapsLogger.debug(LTag.NSCLIENT, "Got versions: Nightscout: ${getVersion()}")
|
aapsLogger.debug(LTag.NSCLIENT, "Got versions: Nightscout: ${getVersion()}")
|
||||||
if (getVersionNum() < config.SUPPORTEDNSVERSION) {
|
if (getVersionNum() < config.SUPPORTED_NS_VERSION) {
|
||||||
uiInteraction.addNotification(Notification.OLD_NS, rh.gs(R.string.unsupported_ns_version), Notification.NORMAL)
|
uiInteraction.addNotification(Notification.OLD_NS, rh.gs(R.string.unsupported_ns_version), Notification.NORMAL)
|
||||||
} else {
|
} else {
|
||||||
rxBus.send(EventDismissNotification(Notification.OLD_NS))
|
rxBus.send(EventDismissNotification(Notification.OLD_NS))
|
||||||
|
@ -177,7 +179,7 @@ class NSSettingsStatusImpl @Inject constructor(
|
||||||
JsonHelper.safeGetJSONObject(data, "extendedSettings", null)
|
JsonHelper.safeGetJSONObject(data, "extendedSettings", null)
|
||||||
|
|
||||||
// valid property is "warn" or "urgent"
|
// valid property is "warn" or "urgent"
|
||||||
// plugings "iage" "sage" "cage" "pbage"
|
// plugins "iage" "sage" "cage" "pbage"
|
||||||
private fun getExtendedWarnValue(plugin: String, property: String): Double? {
|
private fun getExtendedWarnValue(plugin: String, property: String): Double? {
|
||||||
val extendedSettings = getExtendedSettings() ?: return null
|
val extendedSettings = getExtendedSettings() ?: return null
|
||||||
val pluginJson = extendedSettings.optJSONObject(plugin) ?: return null
|
val pluginJson = extendedSettings.optJSONObject(plugin) ?: return null
|
||||||
|
|
|
@ -17,7 +17,6 @@ import info.nightscout.shared.utils.T
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
import javax.inject.Singleton
|
import javax.inject.Singleton
|
||||||
|
|
||||||
@Suppress("SpellCheckingInspection")
|
|
||||||
@Singleton
|
@Singleton
|
||||||
class ProcessedDeviceStatusDataImpl @Inject constructor(
|
class ProcessedDeviceStatusDataImpl @Inject constructor(
|
||||||
private val rh: ResourceHelper,
|
private val rh: ResourceHelper,
|
||||||
|
|
|
@ -251,7 +251,7 @@ class NSClientV3Plugin @Inject constructor(
|
||||||
|
|
||||||
private fun setClient() {
|
private fun setClient() {
|
||||||
nsAndroidClient = NSAndroidClientImpl(
|
nsAndroidClient = NSAndroidClientImpl(
|
||||||
baseUrl = sp.getString(info.nightscout.core.utils.R.string.key_nsclientinternal_url, "").lowercase().replace("https://", ""),
|
baseUrl = sp.getString(info.nightscout.core.utils.R.string.key_nsclientinternal_url, "").lowercase().replace("https://", "").replace(Regex("/$"), ""),
|
||||||
accessToken = sp.getString(R.string.key_ns_client_token, ""),
|
accessToken = sp.getString(R.string.key_ns_client_token, ""),
|
||||||
context = context,
|
context = context,
|
||||||
logging = true
|
logging = true
|
||||||
|
|
Loading…
Reference in a new issue