From bb5422cca819d63909e1fe6dfd78c71f65208845 Mon Sep 17 00:00:00 2001 From: Sayantan Roychowdhury Date: Fri, 4 Oct 2024 12:38:07 +0530 Subject: [PATCH 1/4] feat: function to getProperty --- app/k9mail/build.gradle.kts | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/app/k9mail/build.gradle.kts b/app/k9mail/build.gradle.kts index 194da69d2b..173f6d7e7d 100644 --- a/app/k9mail/build.gradle.kts +++ b/app/k9mail/build.gradle.kts @@ -1,3 +1,5 @@ +import java.util.Properties + plugins { id(ThunderbirdPlugins.App.android) } @@ -45,6 +47,17 @@ dependencies { testImplementation(libs.robolectric) } +fun getProperty(property: String): String { + return System.getenv(property) ?: run { + val properties = Properties() + val propertiesFile = project.rootProject.file("local.properties") + if (propertiesFile.exists()) { + propertiesFile.inputStream().use { properties.load(it) } + } + properties.getProperty(property) + } ?: throw GradleException("$property not found in local.properties or CI-CD variables") +} + android { namespace = "com.fsck.k9" -- GitLab From b617c051e9255a5aa90e90c7fa95c49c1d749cd1 Mon Sep 17 00:00:00 2001 From: Sayantan Roychowdhury Date: Fri, 4 Oct 2024 12:38:58 +0530 Subject: [PATCH 2/4] refactor: get microsoft credentials from local.properties or CI-CD variables --- app/k9mail/build.gradle.kts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/k9mail/build.gradle.kts b/app/k9mail/build.gradle.kts index 173f6d7e7d..cb1e823384 100644 --- a/app/k9mail/build.gradle.kts +++ b/app/k9mail/build.gradle.kts @@ -125,11 +125,11 @@ android { "OAUTH_AOL_CLIENT_ID", "\"dj0yJmk9dUNqYXZhYWxOYkdRJmQ9WVdrOU1YQnZVRFZoY1ZrbWNHbzlNQT09JnM9Y29uc3VtZXJzZWNyZXQmc3Y9MCZ4PWIw\"", ) - buildConfigField("String", "OAUTH_MICROSOFT_CLIENT_ID", "\"e647013a-ada4-4114-b419-e43d250f99c5\"") + buildConfigField("String", "OAUTH_MICROSOFT_CLIENT_ID", "\"${getProperty("MS_CLIENT_ID")}\"") buildConfigField( "String", "OAUTH_MICROSOFT_REDIRECT_URI", - "\"msauth://com.fsck.k9/Dx8yUsuhyU3dYYba1aA16Wxu5eM%3D\"", + "\"msauth://foundation.e.mail/${getProperty("MS_REDIRECT_URI_SUFFIX")}\"", ) manifestPlaceholders["appAuthRedirectScheme"] = "foundation.e.mail" @@ -157,11 +157,11 @@ android { "OAUTH_AOL_CLIENT_ID", "\"dj0yJmk9cHYydkJkTUxHcXlYJmQ9WVdrOWVHZHhVVXN4VVV3bWNHbzlNQT09JnM9Y29uc3VtZXJzZWNyZXQmc3Y9MCZ4PTdm\"", ) - buildConfigField("String", "OAUTH_MICROSOFT_CLIENT_ID", "\"e647013a-ada4-4114-b419-e43d250f99c5\"") + buildConfigField("String", "OAUTH_MICROSOFT_CLIENT_ID", "\"${getProperty("MS_CLIENT_ID")}\"") buildConfigField( "String", "OAUTH_MICROSOFT_REDIRECT_URI", - "\"msauth://com.fsck.k9.debug/VZF2DYuLYAu4TurFd6usQB2JPts%3D\"", + "\"msauth://foundation.e.mail/${getProperty("MS_REDIRECT_URI_SUFFIX")}\"", ) manifestPlaceholders["appAuthRedirectScheme"] = "foundation.e.mail.debug" -- GitLab From 8b84a06747a870c9b24b5fdc9a1ec57db10dbf32 Mon Sep 17 00:00:00 2001 From: Sayantan Roychowdhury Date: Mon, 7 Oct 2024 07:32:54 +0000 Subject: [PATCH 3/4] Apply 2 suggestion(s) to 1 file(s) --- app/k9mail/build.gradle.kts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/k9mail/build.gradle.kts b/app/k9mail/build.gradle.kts index cb1e823384..cc463739ac 100644 --- a/app/k9mail/build.gradle.kts +++ b/app/k9mail/build.gradle.kts @@ -125,7 +125,7 @@ android { "OAUTH_AOL_CLIENT_ID", "\"dj0yJmk9dUNqYXZhYWxOYkdRJmQ9WVdrOU1YQnZVRFZoY1ZrbWNHbzlNQT09JnM9Y29uc3VtZXJzZWNyZXQmc3Y9MCZ4PWIw\"", ) - buildConfigField("String", "OAUTH_MICROSOFT_CLIENT_ID", "\"${getProperty("MS_CLIENT_ID")}\"") + buildConfigField("String", "OAUTH_MICROSOFT_CLIENT_ID", "\"${getProperty("MICROSOFT_CLIENT_ID")}\"") buildConfigField( "String", "OAUTH_MICROSOFT_REDIRECT_URI", @@ -161,7 +161,7 @@ android { buildConfigField( "String", "OAUTH_MICROSOFT_REDIRECT_URI", - "\"msauth://foundation.e.mail/${getProperty("MS_REDIRECT_URI_SUFFIX")}\"", + "\"msauth://foundation.e.mail/${getProperty("MICROSOFT_REDIRECT_URI_SUFFIX")}\"", ) manifestPlaceholders["appAuthRedirectScheme"] = "foundation.e.mail.debug" -- GitLab From 002c43ba0265625910b9ec05590cf025707d9561 Mon Sep 17 00:00:00 2001 From: Sayantan Roychowdhury Date: Mon, 7 Oct 2024 07:46:01 +0000 Subject: [PATCH 4/4] Apply 2 suggestion(s) to 1 file(s) --- app/k9mail/build.gradle.kts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/k9mail/build.gradle.kts b/app/k9mail/build.gradle.kts index cc463739ac..88d056375e 100644 --- a/app/k9mail/build.gradle.kts +++ b/app/k9mail/build.gradle.kts @@ -129,7 +129,7 @@ android { buildConfigField( "String", "OAUTH_MICROSOFT_REDIRECT_URI", - "\"msauth://foundation.e.mail/${getProperty("MS_REDIRECT_URI_SUFFIX")}\"", + "\"msauth://foundation.e.mail/${getProperty("MICROSOFT_REDIRECT_URI_SUFFIX")}\"", ) manifestPlaceholders["appAuthRedirectScheme"] = "foundation.e.mail" @@ -157,7 +157,7 @@ android { "OAUTH_AOL_CLIENT_ID", "\"dj0yJmk9cHYydkJkTUxHcXlYJmQ9WVdrOWVHZHhVVXN4VVV3bWNHbzlNQT09JnM9Y29uc3VtZXJzZWNyZXQmc3Y9MCZ4PTdm\"", ) - buildConfigField("String", "OAUTH_MICROSOFT_CLIENT_ID", "\"${getProperty("MS_CLIENT_ID")}\"") + buildConfigField("String", "OAUTH_MICROSOFT_CLIENT_ID", "\"${getProperty("MICROSOFT_CLIENT_ID")}\"") buildConfigField( "String", "OAUTH_MICROSOFT_REDIRECT_URI", -- GitLab