From 2ce81f736c15a431de9c95059f84dea72c9e2556 Mon Sep 17 00:00:00 2001
From: cyberta <cyberta@riseup.net>
Date: Tue, 24 Jan 2023 01:01:02 +0100
Subject: [PATCH] specify input directory for frameit (framed images)

---
 fastlane/.env.custom                           |  1 +
 fastlane/.env.default                          |  1 +
 fastlane/Fastfile                              | 15 +++++++++++++--
 fastlane/Screengrabfile                        |  1 +
 src/README.md                                  |  7 +++++++
 src/custom/fastlane/metadata/android/README.md |  0
 src/normal/fastlane/metadata/android/README.md |  0
 7 files changed, 23 insertions(+), 2 deletions(-)
 create mode 100644 src/README.md
 create mode 100644 src/custom/fastlane/metadata/android/README.md
 create mode 100644 src/normal/fastlane/metadata/android/README.md

diff --git a/fastlane/.env.custom b/fastlane/.env.custom
index 9b65f5d41..5ec9ffd02 100644
--- a/fastlane/.env.custom
+++ b/fastlane/.env.custom
@@ -1,3 +1,4 @@
 SCREENGRAB_APP_PACKAGE_NAME="se.leap.riseupvpn"
 SCREENGRAB_APP_APK_PATH="app/build/outputs/apk/customProductionFat/debug/RiseupVPN_debug.apk"
 SCREENGRAB_TESTS_APK_PATH="app/build/outputs/apk/androidTest/customProductionFat/debug/app-custom-production-fat-debug-androidTest.apk"
+SCREENGRAB_OUTPUT_DIRECTORY="src/custom/fastlane/metadata/android"
\ No newline at end of file
diff --git a/fastlane/.env.default b/fastlane/.env.default
index bdb771ce4..1362c5f16 100644
--- a/fastlane/.env.default
+++ b/fastlane/.env.default
@@ -1,3 +1,4 @@
 SCREENGRAB_APP_PACKAGE_NAME="se.leap.bitmaskclient"
 SCREENGRAB_APP_APK_PATH="app/build/outputs/apk/normalProductionFat/debug/Bitmask_debug.apk"
 SCREENGRAB_TESTS_APK_PATH="app/build/outputs/apk/androidTest/normalProductionFat/debug/app-normal-production-fat-debug-androidTest.apk"
+SCREENGRAB_OUTPUT_DIRECTORY="src/normal/fastlane/metadata/android"
\ No newline at end of file
diff --git a/fastlane/Fastfile b/fastlane/Fastfile
index a0e259305..99d540ede 100644
--- a/fastlane/Fastfile
+++ b/fastlane/Fastfile
@@ -59,7 +59,12 @@ platform :android do
     # Prepare builds for Automatic UI Tests
     build_bitmask_for_screengrab
     capture_android_screenshots
-    frameit(white: true)
+    Dir.chdir("../src/normal/fastlane/metadata") do
+         frameit(
+             white: true,
+             path: "."
+         )
+    end
     # deliver
   end
 
@@ -67,7 +72,13 @@ platform :android do
      # Prepare builds for Automatic UI Tests
      build_custom_for_screengrab
      capture_android_screenshots
-     frameit(white: true)
+     Dir.chdir("../src/custom/fastlane/metadata") do
+         frameit(
+             white: true,
+             path: "."
+         )
+     end
+
      # deliver
    end
 
diff --git a/fastlane/Screengrabfile b/fastlane/Screengrabfile
index 8534db2a6..317583b01 100644
--- a/fastlane/Screengrabfile
+++ b/fastlane/Screengrabfile
@@ -1,6 +1,7 @@
 # remove the leading '#' to uncomment lines
 
 use_tests_in_packages(['se.leap.bitmaskclient.suite'])
+use_timestamp_suffix(false)
 
 # all locales
 # locales(['ar', 'az', 'bg', 'bn', 'br', 'ca', 'cs', 'de', 'el', 'es', 'es-AR', 'et', 'eu', 'fa-IR', 'fi', 'fr', 'gl', 'he', 'hr', 'hu', 'id', 'it', 'ja', 'my', 'nl', 'no', 'pl', 'pt-BR', 'pt-PT', 'ro', 'ru', 'tr', 'ug', 'uk', 'vi', 'zh-CN', 'zh-TW'])
diff --git a/src/README.md b/src/README.md
new file mode 100644
index 000000000..dfdcf2863
--- /dev/null
+++ b/src/README.md
@@ -0,0 +1,7 @@
+# F-Droid compatible fastlane metadata directory
+
+This source folder only contains the generated metadata for f-droid builds for both Bitmask and a custom flavored client.
+Currently neither F-Droid nor Fastlane support metadata dirs directly within build flavor dirs of a module, like 
+`/<module>/src/<buildFlavor>/fastlane/metadata/android/` (which would be preferable). 
+
+Keep an eye on this [issue](https://gitlab.com/fdroid/fdroidserver/-/issues/829) to track the state of the fastlane improvements for F-Droid.
diff --git a/src/custom/fastlane/metadata/android/README.md b/src/custom/fastlane/metadata/android/README.md
new file mode 100644
index 000000000..e69de29bb
diff --git a/src/normal/fastlane/metadata/android/README.md b/src/normal/fastlane/metadata/android/README.md
new file mode 100644
index 000000000..e69de29bb
-- 
GitLab