-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Renamed package and main class to Updatotron (#11)
- Loading branch information
1 parent
6ceded4
commit cef0c04
Showing
37 changed files
with
224 additions
and
266 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 0 additions & 24 deletions
24
app/src/androidTest/java/com/steamclock/versioncheckkotlinsample/ExampleInstrumentedTest.kt
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
package com.steamclock.updatotronsample | ||
|
||
import android.app.Application | ||
import androidx.lifecycle.ProcessLifecycleOwner | ||
import com.steamclock.updatotron.DefaultUpgradeDialog | ||
import com.steamclock.updatotron.Updatotron | ||
import com.steamclock.updatotron.Config | ||
import com.steamclock.updatotron.interfaces.DefaultPackageDetails | ||
import com.steamclock.updatotron.interfaces.URLFetcher | ||
import java.net.URL | ||
|
||
class App : Application() { | ||
|
||
override fun onCreate() { | ||
super.onCreate() | ||
setupUpdatotron() | ||
} | ||
|
||
private fun setupUpdatotron() { | ||
val updatotron = Updatotron( | ||
Config( | ||
packageDetails = DefaultPackageDetails( | ||
BuildConfig.VERSION_NAME, | ||
BuildConfig.VERSION_CODE, | ||
packageManager, | ||
packageName | ||
), | ||
url = "https://doesn't_matter", | ||
urlFetcher = MockURLFetcher | ||
) | ||
) | ||
|
||
// Add the following line if you want the version check to be automatically | ||
// run whenever the app is "Started" | ||
ProcessLifecycleOwner.get().lifecycle.addObserver(updatotron) | ||
|
||
// Add the following lines if you want a default alert dialog to handle the displayStates | ||
// and allow the user to jump out to the Play Store to get updates. | ||
val upgradeDialog = DefaultUpgradeDialog(updatotron.displayStateFlow, packageName) | ||
registerActivityLifecycleCallbacks(upgradeDialog) | ||
} | ||
} | ||
|
||
object MockURLFetcher : URLFetcher { | ||
override fun getData(url: URL): String? { | ||
return """ | ||
{ | ||
"ios" : { | ||
"minimumVersion": "1.1", | ||
"blockedVersions": ["1.2.0", "1.2.1", "@301"], | ||
"latestTestVersion": "1.4.2@400" | ||
}, | ||
"android" : { | ||
"minimumVersion": "1.1", | ||
"blockedVersions": ["1.2.0", "1.2.1", "@301"], | ||
"latestTestVersion": "1.4.2@400" | ||
}, | ||
"serverForceVersionFailure": false, | ||
"serverMaintenance": false | ||
} | ||
""" | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
.../versioncheckkotlinsample/MainActivity.kt → ...eamclock/updatotronsample/MainActivity.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
62 changes: 0 additions & 62 deletions
62
app/src/main/java/com/steamclock/versioncheckkotlinsample/App.kt
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
<resources> | ||
<string name="app_name">Version Check Kotlin</string> | ||
<string name="app_name">Updatotron Example</string> | ||
</resources> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 0 additions & 17 deletions
17
app/src/test/java/com/steamclock/versioncheckkotlinsample/ExampleUnitTest.kt
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
include ':versioncheckkotlin' | ||
include ':updatotron' | ||
include ':app' | ||
rootProject.name = "Version Check Kotlin" | ||
rootProject.name = "Updatotron" |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
...ncheckkotlin/src/main/AndroidManifest.xml → updatotron/src/main/AndroidManifest.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
package="com.steamclock.versioncheckkotlin"> | ||
package="com.steamclock.updatotron"> | ||
|
||
</manifest> |
6 changes: 3 additions & 3 deletions
6
.../versioncheckkotlin/VersionCheckConfig.kt → .../java/com/steamclock/updatotron/Config.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
updatotron/src/main/java/com/steamclock/updatotron/UpdatotronException.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package com.steamclock.updatotron | ||
|
||
import java.lang.Exception | ||
|
||
sealed class UpdatotronException(message: String? = null, cause: Throwable? = null): Exception(message, cause) { | ||
class InvalidVersionString(cause: Exception? = null): UpdatotronException("Invalid version string", cause) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
...ncheckkotlin/interfaces/PackageDetails.kt → ...k/updatotron/interfaces/PackageDetails.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...rsioncheckkotlin/interfaces/URLFetcher.kt → ...clock/updatotron/interfaces/URLFetcher.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 4 additions & 4 deletions
8
...kotlin/interfaces/VersionDataConverter.kt → ...totron/interfaces/VersionDataConverter.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...versioncheckkotlin/models/DisplayState.kt → ...amclock/updatotron/models/DisplayState.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.