Skip to content

Commit

Permalink
added fastlane structure for fdroid
Browse files Browse the repository at this point in the history
  • Loading branch information
sal0max committed Mar 17, 2021
1 parent 33534ed commit c29f0e1
Show file tree
Hide file tree
Showing 15 changed files with 68 additions and 5 deletions.
1 change: 1 addition & 0 deletions fastlane/metadata/android/en-US/changelogs/10000.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* Initial release
1 change: 1 addition & 0 deletions fastlane/metadata/android/en-US/changelogs/10001.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* Better handling of website misbehavior, where the newest photo of the day couldn't be loaded.
1 change: 1 addition & 0 deletions fastlane/metadata/android/en-US/changelogs/10100.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* Now you can see the image description within the app.
1 change: 1 addition & 0 deletions fastlane/metadata/android/en-US/changelogs/20100.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* Uses new Muzei-API 2 :)
2 changes: 2 additions & 0 deletions fastlane/metadata/android/en-US/changelogs/20101.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
* Use Material theme as base
* Also should fix the problem of too dark text.
3 changes: 3 additions & 0 deletions fastlane/metadata/android/en-US/changelogs/20200.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
* Fixed some issues with reloading new photos. Everything should work smoothly, again. :)
* Also added support for dark/light themes in Android 10.
* Under the hood improvement: Uses the newest Muzei API v3.2.0.
2 changes: 2 additions & 0 deletions fastlane/metadata/android/en-US/changelogs/20201.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
* Fixes "about this photo" and "share" not working on Android 10+
* Minor improvements
3 changes: 3 additions & 0 deletions fastlane/metadata/android/en-US/changelogs/20300.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
* Make the App work again: switch from nationalgeographic.com to nationalgeographic.co.uk
* Implemented some tests to make it easier in the future to detect api changes
* Minor improvements
6 changes: 6 additions & 0 deletions fastlane/metadata/android/en-US/full_description.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
The National Geographic photo of the day for Muzei.
This is a plugin for the live wallpaper app Muzei by Roman Nurik. It needs Muzei to be used.

* Toggle between having always the newest photo of the day and showing random wallpapers.
* Read the entire photo description of the current photo within the app.
* Share your current photo with the world.
Binary file added fastlane/metadata/android/en-US/images/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions fastlane/metadata/android/en-US/short_description.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
The National Geographic photo of the day for Muzei.
1 change: 1 addition & 0 deletions fastlane/metadata/android/en-US/title.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
National Geographic for Muzei
51 changes: 46 additions & 5 deletions muzei-nationalgeographic/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,8 @@ android {
minSdkVersion 21
targetSdkVersion 30
// SemVer
def major = 2
def minor = 3
def patch = 0
versionCode = (major * 10000) + (minor * 100) + patch
versionName = "$major ($major.$minor.$patch)"
versionName = "2.3.0"
versionCode = 20300
archivesBaseName = "$applicationId-v$versionCode"
//
vectorDrawables.useSupportLibrary = true
Expand Down Expand Up @@ -114,3 +111,47 @@ android {
}

}

// versionCode <-> versionName /////////////////////////////////////////////////////////////////////

/**
* Checks if versionCode and versionName match.
* Needed because of F-Droid: both have to be hard-coded and can't be assigned dynamically.
* So at least check during build for them to match.
*/
task checkVersion doLast {
int versionCode = android.defaultConfig.versionCode
int correctVersionCode = generateVersionCode(android.defaultConfig.versionName)
if (versionCode != correctVersionCode)
throw new GradleException(
"versionCode and versionName don't match: " +
"versionCode should be $correctVersionCode. Is $versionCode."
)
}
assemble.dependsOn checkVersion

/**
* Checks if a fastlane changelog for the current version is present.
*/
task checkFastlaneChangelog doLast {
int versionCode = android.defaultConfig.versionCode
File changelogFile = file("$rootDir/fastlane/metadata/android/en-US/changelogs/${versionCode}.txt")
if (!changelogFile.exists())
throw new GradleException(
"Fastlane changelog missing: expecting file '$changelogFile'"
)
}
build.dependsOn checkFastlaneChangelog

/**
* Generates a versionCode based on the given semVer String.
* See e.g. https://proandroiddev.com/keep-salinity-with-your-versioncode-db2089b640b9
*
* @param semVer e.g. 1.3.1
* @return e.g. 10301 (-> 1 03 01)
*/
private static int generateVersionCode(String semVer) {
return semVer.split('\\.')
.collect { Integer.parseInt(it) }
.inject { sum, value -> sum * 100 + value }
}

0 comments on commit c29f0e1

Please sign in to comment.