-
Notifications
You must be signed in to change notification settings - Fork 225
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge release/7.79 into main (#3349)
Co-authored-by: Olivier Halligon <[email protected]> Co-authored-by: Michał Sikora <[email protected]> Co-authored-by: Philip Simpson <[email protected]> Co-authored-by: Ashita Agrawal <[email protected]> Co-authored-by: Philip Simpson <[email protected]>
- Loading branch information
1 parent
b0ce4f3
commit 1649f2e
Showing
6 changed files
with
143 additions
and
52 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,9 @@ | |
source 'https://rubygems.org' | ||
|
||
gem 'danger-dangermattic', '~> 1.2.1' | ||
gem 'fastlane', '~> 2.216' | ||
# gem 'fastlane', '~> 2.216' # FIXME: Switch back to official release once https://github.com/fastlane/fastlane/pull/28960 is merged and included in next release | ||
gem 'fastlane', git: '[email protected]:fastlane/fastlane.git', branch: 'supply/update-draft-release-status' | ||
|
||
# These lines are kept to help with testing Release Toolkit changes | ||
gem 'fastlane-plugin-wpmreleasetoolkit', '~> 12.3' | ||
# gem 'fastlane-plugin-wpmreleasetoolkit', path: '../../release-toolkit' | ||
|
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,51 @@ | ||
GIT | ||
remote: [email protected]:fastlane/fastlane.git | ||
revision: 86a97f5dd0c9779b120ccfb5090ba415913d9815 | ||
branch: supply/update-draft-release-status | ||
specs: | ||
fastlane (2.225.0) | ||
CFPropertyList (>= 2.3, < 4.0.0) | ||
addressable (>= 2.8, < 3.0.0) | ||
artifactory (~> 3.0) | ||
aws-sdk-s3 (~> 1.0) | ||
babosa (>= 1.0.3, < 2.0.0) | ||
bundler (>= 1.12.0, < 3.0.0) | ||
colored (~> 1.2) | ||
commander (~> 4.6) | ||
dotenv (>= 2.1.1, < 3.0.0) | ||
emoji_regex (>= 0.1, < 4.0) | ||
excon (>= 0.71.0, < 1.0.0) | ||
faraday (~> 1.0) | ||
faraday-cookie_jar (~> 0.0.6) | ||
faraday_middleware (~> 1.0) | ||
fastimage (>= 2.1.0, < 3.0.0) | ||
fastlane-sirp (>= 1.0.0) | ||
gh_inspector (>= 1.1.2, < 2.0.0) | ||
google-apis-androidpublisher_v3 (~> 0.3) | ||
google-apis-playcustomapp_v1 (~> 0.1) | ||
google-cloud-env (>= 1.6.0, < 2.0.0) | ||
google-cloud-storage (~> 1.31) | ||
highline (~> 2.0) | ||
http-cookie (~> 1.0.5) | ||
json (< 3.0.0) | ||
jwt (>= 2.1.0, < 3) | ||
mini_magick (>= 4.9.4, < 5.0.0) | ||
multipart-post (>= 2.0.0, < 3.0.0) | ||
naturally (~> 2.2) | ||
optparse (>= 0.1.1, < 1.0.0) | ||
plist (>= 3.1.0, < 4.0.0) | ||
rubyzip (>= 2.0.0, < 3.0.0) | ||
security (= 0.1.5) | ||
simctl (~> 1.6.3) | ||
terminal-notifier (>= 2.0.0, < 3.0.0) | ||
terminal-table (~> 3) | ||
tty-screen (>= 0.6.3, < 1.0.0) | ||
tty-spinner (>= 0.8.0, < 1.0.0) | ||
word_wrap (~> 1.0.0) | ||
xcodeproj (>= 1.13.0, < 2.0.0) | ||
xcpretty (~> 0.4.0) | ||
xcpretty-travis-formatter (>= 0.0.3, < 2.0.0) | ||
|
||
GEM | ||
remote: https://rubygems.org/ | ||
specs: | ||
|
@@ -123,48 +171,6 @@ GEM | |
faraday_middleware (1.2.1) | ||
faraday (~> 1.0) | ||
fastimage (2.3.1) | ||
fastlane (2.225.0) | ||
CFPropertyList (>= 2.3, < 4.0.0) | ||
addressable (>= 2.8, < 3.0.0) | ||
artifactory (~> 3.0) | ||
aws-sdk-s3 (~> 1.0) | ||
babosa (>= 1.0.3, < 2.0.0) | ||
bundler (>= 1.12.0, < 3.0.0) | ||
colored (~> 1.2) | ||
commander (~> 4.6) | ||
dotenv (>= 2.1.1, < 3.0.0) | ||
emoji_regex (>= 0.1, < 4.0) | ||
excon (>= 0.71.0, < 1.0.0) | ||
faraday (~> 1.0) | ||
faraday-cookie_jar (~> 0.0.6) | ||
faraday_middleware (~> 1.0) | ||
fastimage (>= 2.1.0, < 3.0.0) | ||
fastlane-sirp (>= 1.0.0) | ||
gh_inspector (>= 1.1.2, < 2.0.0) | ||
google-apis-androidpublisher_v3 (~> 0.3) | ||
google-apis-playcustomapp_v1 (~> 0.1) | ||
google-cloud-env (>= 1.6.0, < 2.0.0) | ||
google-cloud-storage (~> 1.31) | ||
highline (~> 2.0) | ||
http-cookie (~> 1.0.5) | ||
json (< 3.0.0) | ||
jwt (>= 2.1.0, < 3) | ||
mini_magick (>= 4.9.4, < 5.0.0) | ||
multipart-post (>= 2.0.0, < 3.0.0) | ||
naturally (~> 2.2) | ||
optparse (>= 0.1.1, < 1.0.0) | ||
plist (>= 3.1.0, < 4.0.0) | ||
rubyzip (>= 2.0.0, < 3.0.0) | ||
security (= 0.1.5) | ||
simctl (~> 1.6.3) | ||
terminal-notifier (>= 2.0.0, < 3.0.0) | ||
terminal-table (~> 3) | ||
tty-screen (>= 0.6.3, < 1.0.0) | ||
tty-spinner (>= 0.8.0, < 1.0.0) | ||
word_wrap (~> 1.0.0) | ||
xcodeproj (>= 1.13.0, < 2.0.0) | ||
xcpretty (~> 0.3.0) | ||
xcpretty-travis-formatter (>= 0.0.3, < 2.0.0) | ||
fastlane-plugin-wpmreleasetoolkit (12.3.4) | ||
activesupport (>= 6.1.7.1) | ||
buildkit (~> 1.5) | ||
|
@@ -288,7 +294,7 @@ GEM | |
uber (< 0.2.0) | ||
retriable (3.1.2) | ||
rexml (3.3.9) | ||
rouge (2.0.7) | ||
rouge (3.28.0) | ||
rubocop (1.68.0) | ||
json (~> 2.3) | ||
language_server-protocol (>= 3.17.0) | ||
|
@@ -339,8 +345,8 @@ GEM | |
colored2 (~> 3.1) | ||
nanaimo (~> 0.4.0) | ||
rexml (>= 3.3.6, < 4.0) | ||
xcpretty (0.3.0) | ||
rouge (~> 2.0.7) | ||
xcpretty (0.4.0) | ||
rouge (~> 3.28.0) | ||
xcpretty-travis-formatter (1.0.1) | ||
xcpretty (~> 0.2, >= 0.0.7) | ||
|
||
|
@@ -355,7 +361,7 @@ PLATFORMS | |
|
||
DEPENDENCIES | ||
danger-dangermattic (~> 1.2.1) | ||
fastlane (~> 2.216) | ||
fastlane! | ||
fastlane-plugin-wpmreleasetoolkit (~> 12.3) | ||
|
||
BUNDLED WITH | ||
|
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
43 changes: 43 additions & 0 deletions
43
modules/services/utils/src/main/java/au/com/shiftyjelly/pocketcasts/utils/BitmapUtil.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,43 @@ | ||
package au.com.shiftyjelly.pocketcasts.utils | ||
|
||
import android.graphics.Bitmap | ||
import android.graphics.Color | ||
import android.graphics.Paint | ||
import androidx.annotation.ColorInt | ||
import androidx.core.graphics.applyCanvas | ||
import kotlin.math.abs | ||
import kotlin.math.roundToInt | ||
|
||
fun Bitmap.fitToAspectRatio( | ||
aspectRatio: Float, | ||
@ColorInt backgroundColor: Int = Color.BLACK, | ||
bitmapConfig: Bitmap.Config = Bitmap.Config.ARGB_8888, | ||
): Bitmap { | ||
val (newWidth, newHeight) = calculateNearestSize(width, height, aspectRatio) | ||
return Bitmap.createBitmap(newWidth, newHeight, bitmapConfig).applyCanvas { | ||
val paint = Paint().apply { | ||
isDither = true | ||
color = backgroundColor | ||
} | ||
drawRect(0f, 0f, width.toFloat(), height.toFloat(), paint) | ||
drawBitmap( | ||
this@fitToAspectRatio, | ||
abs(width - this@fitToAspectRatio.width).toFloat() / 2, | ||
abs(height - this@fitToAspectRatio.height).toFloat() / 2, | ||
null, | ||
) | ||
} | ||
} | ||
|
||
internal fun calculateNearestSize( | ||
width: Int, | ||
height: Int, | ||
aspectRatio: Float, | ||
): Pair<Int, Int> { | ||
check(aspectRatio > 0) { "Aspect ratio must be a positive number: $aspectRatio" } | ||
return when (width.toFloat() / height) { | ||
aspectRatio -> width to height | ||
in 0f..aspectRatio -> (height * aspectRatio).roundToInt() to height | ||
else -> width to (width / aspectRatio).roundToInt() | ||
} | ||
} |
38 changes: 38 additions & 0 deletions
38
modules/services/utils/src/test/java/au/com/shiftyjelly/pocketcasts/utils/BitmapUtilTest.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,38 @@ | ||
package au.com.shiftyjelly.pocketcasts.utils | ||
|
||
import org.junit.Assert.assertEquals | ||
import org.junit.Test | ||
|
||
class BitmapUtilTest { | ||
@Test | ||
fun `fail for zero aspect ratio`() { | ||
try { | ||
calculateNearestSize(0, 0, aspectRatio = 0f) | ||
} catch (e: IllegalStateException) { | ||
assertEquals("Aspect ratio must be a positive number: 0.0", e.message) | ||
} | ||
} | ||
|
||
@Test | ||
fun `fail for negative aspect ratio`() { | ||
try { | ||
calculateNearestSize(0, 0, aspectRatio = -1f) | ||
} catch (e: IllegalStateException) { | ||
assertEquals("Aspect ratio must be a positive number: -1.0", e.message) | ||
} | ||
} | ||
|
||
@Test | ||
fun `calculate to fit horizontally`() { | ||
val size = calculateNearestSize(width = 100, height = 200, aspectRatio = 9f / 16) | ||
|
||
assertEquals(113 to 200, size) | ||
} | ||
|
||
@Test | ||
fun `calculate to fit vertically`() { | ||
val size = calculateNearestSize(width = 200, height = 100, aspectRatio = 9f / 16) | ||
|
||
assertEquals(200 to 356, size) | ||
} | ||
} |
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,2 +1,2 @@ | ||
versionName=7.79-rc-1 | ||
versionCode=9293 | ||
versionName=7.79-rc-2 | ||
versionCode=9295 |