Merge branch 'dev' into omnipod_eros_andy
This commit is contained in:
commit
9b0a4b742d
7 changed files with 304 additions and 28 deletions
|
@ -109,7 +109,7 @@ android {
|
||||||
targetSdkVersion 28
|
targetSdkVersion 28
|
||||||
multiDexEnabled true
|
multiDexEnabled true
|
||||||
versionCode 1500
|
versionCode 1500
|
||||||
version "2.5.0-dev"
|
version "2.6-dev"
|
||||||
buildConfigField "String", "VERSION", '"' + version + '"'
|
buildConfigField "String", "VERSION", '"' + version + '"'
|
||||||
buildConfigField "String", "BUILDVERSION", '"' + generateGitBuild() + '-' + generateDate() + '"'
|
buildConfigField "String", "BUILDVERSION", '"' + generateGitBuild() + '-' + generateDate() + '"'
|
||||||
buildConfigField "String", "REMOTE", '"' + generateGitRemote() + '"'
|
buildConfigField "String", "REMOTE", '"' + generateGitRemote() + '"'
|
||||||
|
|
|
@ -15,21 +15,14 @@ import java.io.IOException
|
||||||
import java.net.URL
|
import java.net.URL
|
||||||
import java.util.concurrent.TimeUnit
|
import java.util.concurrent.TimeUnit
|
||||||
|
|
||||||
|
|
||||||
// check network connection
|
// check network connection
|
||||||
fun isConnected(): Boolean {
|
fun isConnected(): Boolean {
|
||||||
val connMgr = MainApp.instance().applicationContext.getSystemService(Context.CONNECTIVITY_SERVICE) as ConnectivityManager
|
val connMgr = MainApp.instance().applicationContext.getSystemService(Context.CONNECTIVITY_SERVICE) as ConnectivityManager
|
||||||
return connMgr.activeNetworkInfo?.isConnected ?: false
|
return connMgr.activeNetworkInfo?.isConnected ?: false
|
||||||
}
|
}
|
||||||
|
|
||||||
fun findVersion(file :String?): String? {
|
|
||||||
val regex = "(.*)version(.*)\"(((\\d+)\\.)+(\\d+))\"(.*)".toRegex()
|
|
||||||
return file?.lines()?.filter { regex.matches(it) }?.mapNotNull { regex.matchEntire(it)?.groupValues?.getOrNull(3) }?.firstOrNull()
|
|
||||||
}
|
|
||||||
|
|
||||||
private val log = LoggerFactory.getLogger(L.CORE)
|
private val log = LoggerFactory.getLogger(L.CORE)
|
||||||
|
|
||||||
|
|
||||||
fun triggerCheckVersion() {
|
fun triggerCheckVersion() {
|
||||||
|
|
||||||
if (!SP.contains(R.string.key_last_time_this_version_detected)) {
|
if (!SP.contains(R.string.key_last_time_this_version_detected)) {
|
||||||
|
@ -56,13 +49,34 @@ private fun checkVersion() = if (isConnected()) {
|
||||||
log.debug("Github master version no checked. No connectivity")
|
log.debug("Github master version no checked. No connectivity")
|
||||||
|
|
||||||
fun compareWithCurrentVersion(newVersion: String?, currentVersion: String) {
|
fun compareWithCurrentVersion(newVersion: String?, currentVersion: String) {
|
||||||
val comparison: Int? = newVersion?.versionStrip()?.compareTo(currentVersion.versionStrip())
|
|
||||||
when {
|
val newVersionElements = newVersion.toNumberList()
|
||||||
comparison == null -> onVersionNotDetectable()
|
val currentVersionElements = currentVersion.toNumberList()
|
||||||
comparison == 0 -> onSameVersionDetected()
|
|
||||||
comparison > 0 -> onNewVersionDetected(currentVersion = currentVersion, newVersion = newVersion)
|
if (newVersionElements == null || newVersionElements.isEmpty()) {
|
||||||
else -> onOlderVersionDetected()
|
onVersionNotDetectable()
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (currentVersionElements == null || currentVersionElements.isEmpty()) {
|
||||||
|
// current version scrambled?!
|
||||||
|
onNewVersionDetected(currentVersion, newVersion)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
newVersionElements.take(3).forEachIndexed { i, newElem ->
|
||||||
|
val currElem: Int = currentVersionElements.getOrNull(i)
|
||||||
|
?: return onNewVersionDetected(currentVersion, newVersion)
|
||||||
|
|
||||||
|
(newElem - currElem).let {
|
||||||
|
when {
|
||||||
|
it > 0 -> return onNewVersionDetected(currentVersion, newVersion)
|
||||||
|
it < 0 -> return onOlderVersionDetected()
|
||||||
|
it == 0 -> Unit
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
onSameVersionDetected()
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun onOlderVersionDetected() {
|
private fun onOlderVersionDetected() {
|
||||||
|
@ -75,7 +89,7 @@ fun onSameVersionDetected() {
|
||||||
}
|
}
|
||||||
|
|
||||||
fun onVersionNotDetectable() {
|
fun onVersionNotDetectable() {
|
||||||
log.debug("fetch failed, ignore and smartcast to non-null")
|
log.debug("fetch failed")
|
||||||
}
|
}
|
||||||
|
|
||||||
fun onNewVersionDetected(currentVersion: String, newVersion: String?) {
|
fun onNewVersionDetected(currentVersion: String, newVersion: String?) {
|
||||||
|
@ -88,6 +102,7 @@ fun onNewVersionDetected(currentVersion: String, newVersion: String?) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Deprecated(replaceWith = ReplaceWith("numericVersionPart()"), message = "Will not work if RCs have another index number in it.")
|
||||||
fun String.versionStrip() = this.mapNotNull {
|
fun String.versionStrip() = this.mapNotNull {
|
||||||
when (it) {
|
when (it) {
|
||||||
in '0'..'9' -> it
|
in '0'..'9' -> it
|
||||||
|
@ -96,6 +111,16 @@ fun String.versionStrip() = this.mapNotNull {
|
||||||
}
|
}
|
||||||
}.joinToString(separator = "")
|
}.joinToString(separator = "")
|
||||||
|
|
||||||
|
fun String.numericVersionPart(): String =
|
||||||
|
"(((\\d+)\\.)+(\\d+))(\\D(.*))?".toRegex().matchEntire(this)?.groupValues?.getOrNull(1) ?: ""
|
||||||
|
|
||||||
|
fun String?.toNumberList() =
|
||||||
|
this?.numericVersionPart().takeIf { !it.isNullOrBlank() }?.split(".")?.map { it.toInt() }
|
||||||
|
|
||||||
|
fun findVersion(file: String?): String? {
|
||||||
|
val regex = "(.*)version(.*)\"(((\\d+)\\.)+(\\d+))\"(.*)".toRegex()
|
||||||
|
return file?.lines()?.filter { regex.matches(it) }?.mapNotNull { regex.matchEntire(it)?.groupValues?.getOrNull(3) }?.firstOrNull()
|
||||||
|
}
|
||||||
|
|
||||||
val CHECK_EVERY = TimeUnit.DAYS.toMillis(1)
|
val CHECK_EVERY = TimeUnit.DAYS.toMillis(1)
|
||||||
val WARN_EVERY = TimeUnit.DAYS.toMillis(1)
|
val WARN_EVERY = TimeUnit.DAYS.toMillis(1)
|
||||||
|
|
|
@ -20,7 +20,7 @@ class NsClientReceiverDelegate {
|
||||||
|
|
||||||
private final Context context;
|
private final Context context;
|
||||||
|
|
||||||
private NetworkChangeReceiver networkChangeReceiver = NetworkChangeReceiver.instance;
|
private NetworkChangeReceiver networkChangeReceiver = new NetworkChangeReceiver();
|
||||||
private ChargingStateReceiver chargingStateReceiver = new ChargingStateReceiver();
|
private ChargingStateReceiver chargingStateReceiver = new ChargingStateReceiver();
|
||||||
|
|
||||||
private boolean allowedChargingState = true;
|
private boolean allowedChargingState = true;
|
||||||
|
|
|
@ -114,6 +114,7 @@ class WizardDialog : DialogFragment() {
|
||||||
log.debug("guarding: ok already clicked")
|
log.debug("guarding: ok already clicked")
|
||||||
} else {
|
} else {
|
||||||
okClicked = true
|
okClicked = true
|
||||||
|
calculateInsulin()
|
||||||
parentContext?.let { context ->
|
parentContext?.let { context ->
|
||||||
wizard?.confirmAndExecute(context)
|
wizard?.confirmAndExecute(context)
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,11 +28,7 @@ public class NetworkChangeReceiver extends BroadcastReceiver {
|
||||||
|
|
||||||
// TODO: Split NSClient into network state component that can be used by several plugins and logic for plugin
|
// TODO: Split NSClient into network state component that can be used by several plugins and logic for plugin
|
||||||
public static void fetch() {
|
public static void fetch() {
|
||||||
NetworkChangeReceiver.instance.grabNetworkStatus(MainApp.instance().getApplicationContext());
|
new NetworkChangeReceiver().grabNetworkStatus(MainApp.instance().getApplicationContext());
|
||||||
}
|
|
||||||
|
|
||||||
private NetworkChangeReceiver() {
|
|
||||||
super();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -1331,9 +1331,9 @@
|
||||||
<string name="tidepool_upload_bg">Upload BG tests</string>
|
<string name="tidepool_upload_bg">Upload BG tests</string>
|
||||||
|
|
||||||
<string name="key_smbmaxminutes" translatable="false">smbmaxminutes</string>
|
<string name="key_smbmaxminutes" translatable="false">smbmaxminutes</string>
|
||||||
<string name="dst_plugin_name" translatable="false">Dayligh Saving time</string>
|
<string name="dst_plugin_name" translatable="false">Daylight Saving time</string>
|
||||||
<string name="dst_in_24h_warning">Dayligh Saving time change in 24h or less</string>
|
<string name="dst_in_24h_warning">Daylight Saving time change in 24h or less</string>
|
||||||
<string name="dst_loop_disabled_warning">Daylight saving time change less than 3 hours ago - Closed loop disabled</string>
|
<string name="dst_loop_disabled_warning">Daylight Saving time change less than 3 hours ago - Closed loop disabled</string>
|
||||||
<string name="storage">internal storage constraint</string>
|
<string name="storage">internal storage constraint</string>
|
||||||
<string name="diskfull">Free at least %1$d MB from internal storage! Loop disabled!</string>
|
<string name="diskfull">Free at least %1$d MB from internal storage! Loop disabled!</string>
|
||||||
<string name="wrongformat">Wrong format</string>
|
<string name="wrongformat">Wrong format</string>
|
||||||
|
|
|
@ -16,6 +16,70 @@ import org.powermock.modules.junit4.PowerMockRunner
|
||||||
|
|
||||||
@RunWith(PowerMockRunner::class)
|
@RunWith(PowerMockRunner::class)
|
||||||
class VersionCheckerUtilsKtTest {
|
class VersionCheckerUtilsKtTest {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun `should keep 2 digit version`() {
|
||||||
|
assertEquals("1.2", "1.2".numericVersionPart())
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun `should keep 3 digit version`() {
|
||||||
|
assertEquals("1.2.3", "1.2.3".numericVersionPart())
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun `should keep 4 digit version`() {
|
||||||
|
assertEquals("1.2.3.4", "1.2.3.4".numericVersionPart())
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun `should strip 2 digit version RC`() {
|
||||||
|
assertEquals("1.2", "1.2-RC1".numericVersionPart())
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun `should strip 2 digit version RC old format`() {
|
||||||
|
assertEquals("1.2", "1.2RC1".numericVersionPart())
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun `should strip 2 digit version RC without digit`() {
|
||||||
|
assertEquals("1.2", "1.2-RC".numericVersionPart())
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun `should strip 2 digit version dev`() {
|
||||||
|
assertEquals("1.2", "1.2-dev".numericVersionPart())
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun `should strip 2 digit version dev old format 1`() {
|
||||||
|
assertEquals("1.2", "1.2dev".numericVersionPart())
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun `should strip 2 digit version dev old format 2`() {
|
||||||
|
assertEquals("1.2", "1.2dev-a3".numericVersionPart())
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun `should strip 3 digit version RC`() {
|
||||||
|
assertEquals("1.2.3", "1.2.3-RC1".numericVersionPart())
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun `should strip 4 digit version RC`() {
|
||||||
|
assertEquals("1.2.3.4", "1.2.3.4-RC5".numericVersionPart())
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun `should strip even with dot`() {
|
||||||
|
assertEquals("1.2", "1.2.RC5".numericVersionPart())
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun findVersionMatchesRegularVersion() {
|
fun findVersionMatchesRegularVersion() {
|
||||||
val buildGradle = """blabla
|
val buildGradle = """blabla
|
||||||
|
@ -154,6 +218,33 @@ class VersionCheckerUtilsKtTest {
|
||||||
PowerMockito.verifyNoMoreInteractions(SP::class.java)
|
PowerMockito.verifyNoMoreInteractions(SP::class.java)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@PrepareForTest(MainApp::class, L::class, SP::class)
|
||||||
|
fun `should not find update on fourth version digit`() {
|
||||||
|
prepareMainApp()
|
||||||
|
compareWithCurrentVersion(newVersion = "2.5.0", currentVersion = "2.5.0.1")
|
||||||
|
|
||||||
|
//verify(bus, times(0)).post(any())
|
||||||
|
|
||||||
|
PowerMockito.verifyStatic(SP::class.java, times(1))
|
||||||
|
SP.putLong(eq(R.string.key_last_time_this_version_detected), ArgumentMatchers.anyLong())
|
||||||
|
PowerMockito.verifyNoMoreInteractions(SP::class.java)
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@PrepareForTest(MainApp::class, L::class, SP::class)
|
||||||
|
fun `should not find update on personal version with same number` (){
|
||||||
|
prepareMainApp()
|
||||||
|
compareWithCurrentVersion(newVersion = "2.5.0", currentVersion = "2.5.0-myversion")
|
||||||
|
|
||||||
|
//verify(bus, times(0)).post(any())
|
||||||
|
|
||||||
|
PowerMockito.verifyStatic(SP::class.java, times(1))
|
||||||
|
SP.putLong(eq(R.string.key_last_time_this_version_detected), ArgumentMatchers.anyLong())
|
||||||
|
PowerMockito.verifyNoMoreInteractions(SP::class.java)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@PrepareForTest(MainApp::class, L::class, SP::class)
|
@PrepareForTest(MainApp::class, L::class, SP::class)
|
||||||
fun `find same version`() {
|
fun `find same version`() {
|
||||||
|
@ -177,6 +268,27 @@ class VersionCheckerUtilsKtTest {
|
||||||
@Test
|
@Test
|
||||||
@PrepareForTest(MainApp::class, L::class, SP::class)
|
@PrepareForTest(MainApp::class, L::class, SP::class)
|
||||||
fun `find higher version`() {
|
fun `find higher version`() {
|
||||||
|
val buildGradle = """blabla
|
||||||
|
| android {
|
||||||
|
| aosenuthoae
|
||||||
|
| }
|
||||||
|
| version = "3.0.0"
|
||||||
|
| appName = "Aaoeu"
|
||||||
|
""".trimMargin()
|
||||||
|
prepareMainApp()
|
||||||
|
compareWithCurrentVersion(findVersion(buildGradle), currentVersion = "2.2.2")
|
||||||
|
|
||||||
|
PowerMockito.verifyStatic(SP::class.java, times(1))
|
||||||
|
SP.getLong(eq(R.string.key_last_versionchecker_warning), ArgumentMatchers.anyLong())
|
||||||
|
PowerMockito.verifyStatic(SP::class.java, times(1))
|
||||||
|
SP.putLong(eq(R.string.key_last_versionchecker_warning), ArgumentMatchers.anyLong())
|
||||||
|
PowerMockito.verifyNoMoreInteractions(SP::class.java)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@PrepareForTest(MainApp::class, L::class, SP::class)
|
||||||
|
fun `find higher version with longer number`() {
|
||||||
val buildGradle = """blabla
|
val buildGradle = """blabla
|
||||||
| android {
|
| android {
|
||||||
| aosenuthoae
|
| aosenuthoae
|
||||||
|
@ -194,6 +306,148 @@ class VersionCheckerUtilsKtTest {
|
||||||
PowerMockito.verifyNoMoreInteractions(SP::class.java)
|
PowerMockito.verifyNoMoreInteractions(SP::class.java)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@PrepareForTest(MainApp::class, L::class, SP::class)
|
||||||
|
fun `find higher version after RC`() {
|
||||||
|
val buildGradle = """blabla
|
||||||
|
| android {
|
||||||
|
| aosenuthoae
|
||||||
|
| }
|
||||||
|
| version = "3.0.0"
|
||||||
|
| appName = "Aaoeu"
|
||||||
|
""".trimMargin()
|
||||||
|
prepareMainApp()
|
||||||
|
compareWithCurrentVersion(findVersion(buildGradle), currentVersion = "3.0-RC04")
|
||||||
|
|
||||||
|
PowerMockito.verifyStatic(SP::class.java, times(1))
|
||||||
|
SP.getLong(eq(R.string.key_last_versionchecker_warning), ArgumentMatchers.anyLong())
|
||||||
|
PowerMockito.verifyStatic(SP::class.java, times(1))
|
||||||
|
SP.putLong(eq(R.string.key_last_versionchecker_warning), ArgumentMatchers.anyLong())
|
||||||
|
PowerMockito.verifyNoMoreInteractions(SP::class.java)
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@PrepareForTest(MainApp::class, L::class, SP::class)
|
||||||
|
fun `find higher version after RC 2 - typo`() {
|
||||||
|
val buildGradle = """blabla
|
||||||
|
| android {
|
||||||
|
| aosenuthoae
|
||||||
|
| }
|
||||||
|
| version = "3.0.0"
|
||||||
|
| appName = "Aaoeu"
|
||||||
|
""".trimMargin()
|
||||||
|
prepareMainApp()
|
||||||
|
compareWithCurrentVersion(findVersion(buildGradle), currentVersion = "3.0RC04")
|
||||||
|
|
||||||
|
PowerMockito.verifyStatic(SP::class.java, times(1))
|
||||||
|
SP.getLong(eq(R.string.key_last_versionchecker_warning), ArgumentMatchers.anyLong())
|
||||||
|
PowerMockito.verifyStatic(SP::class.java, times(1))
|
||||||
|
SP.putLong(eq(R.string.key_last_versionchecker_warning), ArgumentMatchers.anyLong())
|
||||||
|
PowerMockito.verifyNoMoreInteractions(SP::class.java)
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@PrepareForTest(MainApp::class, L::class, SP::class)
|
||||||
|
fun `find higher version after RC 3 - typo`() {
|
||||||
|
val buildGradle = """blabla
|
||||||
|
| android {
|
||||||
|
| aosenuthoae
|
||||||
|
| }
|
||||||
|
| version = "3.0.0"
|
||||||
|
| appName = "Aaoeu"
|
||||||
|
""".trimMargin()
|
||||||
|
prepareMainApp()
|
||||||
|
compareWithCurrentVersion(findVersion(buildGradle), currentVersion = "3.RC04")
|
||||||
|
|
||||||
|
PowerMockito.verifyStatic(SP::class.java, times(1))
|
||||||
|
SP.getLong(eq(R.string.key_last_versionchecker_warning), ArgumentMatchers.anyLong())
|
||||||
|
PowerMockito.verifyStatic(SP::class.java, times(1))
|
||||||
|
SP.putLong(eq(R.string.key_last_versionchecker_warning), ArgumentMatchers.anyLong())
|
||||||
|
PowerMockito.verifyNoMoreInteractions(SP::class.java)
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@PrepareForTest(MainApp::class, L::class, SP::class)
|
||||||
|
fun `find higher version after RC 4 - typo`() {
|
||||||
|
val buildGradle = """blabla
|
||||||
|
| android {
|
||||||
|
| aosenuthoae
|
||||||
|
| }
|
||||||
|
| version = "3.0.0"
|
||||||
|
| appName = "Aaoeu"
|
||||||
|
""".trimMargin()
|
||||||
|
prepareMainApp()
|
||||||
|
compareWithCurrentVersion(findVersion(buildGradle), currentVersion = "3.0.RC04")
|
||||||
|
|
||||||
|
PowerMockito.verifyStatic(SP::class.java, times(1))
|
||||||
|
SP.getLong(eq(R.string.key_last_versionchecker_warning), ArgumentMatchers.anyLong())
|
||||||
|
PowerMockito.verifyStatic(SP::class.java, times(1))
|
||||||
|
SP.putLong(eq(R.string.key_last_versionchecker_warning), ArgumentMatchers.anyLong())
|
||||||
|
PowerMockito.verifyNoMoreInteractions(SP::class.java)
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@PrepareForTest(MainApp::class, L::class, SP::class)
|
||||||
|
fun `find higher version on multi digit numbers`() {
|
||||||
|
val buildGradle = """blabla
|
||||||
|
| android {
|
||||||
|
| aosenuthoae
|
||||||
|
| }
|
||||||
|
| version = "3.7.12"
|
||||||
|
| appName = "Aaoeu"
|
||||||
|
""".trimMargin()
|
||||||
|
prepareMainApp()
|
||||||
|
compareWithCurrentVersion(findVersion(buildGradle), currentVersion = "3.7.9")
|
||||||
|
|
||||||
|
PowerMockito.verifyStatic(SP::class.java, times(1))
|
||||||
|
SP.getLong(eq(R.string.key_last_versionchecker_warning), ArgumentMatchers.anyLong())
|
||||||
|
PowerMockito.verifyStatic(SP::class.java, times(1))
|
||||||
|
SP.putLong(eq(R.string.key_last_versionchecker_warning), ArgumentMatchers.anyLong())
|
||||||
|
PowerMockito.verifyNoMoreInteractions(SP::class.java)
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@PrepareForTest(MainApp::class, L::class, SP::class)
|
||||||
|
fun `don't find higher version on higher but shorter version`() {
|
||||||
|
val buildGradle = """blabla
|
||||||
|
| android {
|
||||||
|
| aosenuthoae
|
||||||
|
| }
|
||||||
|
| version = "2.2.2"
|
||||||
|
| appName = "Aaoeu"
|
||||||
|
""".trimMargin()
|
||||||
|
prepareMainApp()
|
||||||
|
compareWithCurrentVersion(findVersion(buildGradle), currentVersion = "2.3")
|
||||||
|
|
||||||
|
//verify(bus, times(0)).post(any())
|
||||||
|
|
||||||
|
PowerMockito.verifyStatic(SP::class.java, times(1))
|
||||||
|
SP.putLong(eq(R.string.key_last_time_this_version_detected), ArgumentMatchers.anyLong())
|
||||||
|
PowerMockito.verifyNoMoreInteractions(SP::class.java)
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@PrepareForTest(MainApp::class, L::class, SP::class)
|
||||||
|
fun `don't find higher version if on next RC`() {
|
||||||
|
val buildGradle = """blabla
|
||||||
|
| android {
|
||||||
|
| aosenuthoae
|
||||||
|
| }
|
||||||
|
| version = "2.2.2"
|
||||||
|
| appName = "Aaoeu"
|
||||||
|
""".trimMargin()
|
||||||
|
prepareMainApp()
|
||||||
|
compareWithCurrentVersion(findVersion(buildGradle), currentVersion = "2.3-RC")
|
||||||
|
|
||||||
|
//verify(bus, times(0)).post(any())
|
||||||
|
|
||||||
|
PowerMockito.verifyStatic(SP::class.java, times(1))
|
||||||
|
SP.putLong(eq(R.string.key_last_time_this_version_detected), ArgumentMatchers.anyLong())
|
||||||
|
PowerMockito.verifyNoMoreInteractions(SP::class.java)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@PrepareForTest(System::class)
|
@PrepareForTest(System::class)
|
||||||
|
|
Loading…
Reference in a new issue