From 61ce9e028473aa8ef4fa014c1b53eabee4d90b20 Mon Sep 17 00:00:00 2001 From: Janak Amarasena Date: Tue, 5 Jun 2018 23:14:40 +0530 Subject: Added donation reminder configurations to custom flavor --- app/build.gradle | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'app/build.gradle') diff --git a/app/build.gradle b/app/build.gradle index 09858cd2..fea71f6e 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -42,7 +42,7 @@ android { } } - flavorDimensions "implementation" + flavorDimensions "mode","implementation" productFlavors { production { dimension "implementation" @@ -50,6 +50,24 @@ android { insecure { dimension "implementation" } + dafualt { + dimension "mode" + } + custom { + dimension "mode" + + //Build Config Fields for default donation details + + //This is the donation URL and should be set to the relevant donation page. + buildConfigField 'String', 'donation_url', '"https://leap.se/en/about-us/donate"' + //The field to enable donations in the app. + buildConfigField 'boolean', 'enable_donation', 'true' + //The field to enable donation reminder popup in the app if enable_donation is set to 'false' this will be disabled. + buildConfigField 'boolean', 'enable_donation_reminder', 'true' + //The duration in days to trigger the donation reminder + buildConfigField 'int', 'donation_reminder_duration', '30' + + } } buildTypes { -- cgit v1.2.3 From 29d51a50b5c2c3b25c1a8b392b4c36f71b99d68e Mon Sep 17 00:00:00 2001 From: Janak Amarasena Date: Sun, 10 Jun 2018 09:50:20 +0530 Subject: Added custom package details --- app/build.gradle | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'app/build.gradle') diff --git a/app/build.gradle b/app/build.gradle index fea71f6e..d2255f42 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -55,6 +55,14 @@ android { } custom { dimension "mode" + //Change the package name as needed + applicationId "org.sample.custom" + //Set app name here + resValue "string", "app_name", "Bitmask Custom" + //Change the versionCode as needed + versionCode 1 + //Change the versionName as needed + versionName "1.0" //Build Config Fields for default donation details -- cgit v1.2.3 From 797e3e5c4050d4d9ade13453c966f5132ced9bae Mon Sep 17 00:00:00 2001 From: Janak Amarasena Date: Mon, 18 Jun 2018 00:33:53 +0530 Subject: Added custom package id validation --- app/build.gradle | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'app/build.gradle') diff --git a/app/build.gradle b/app/build.gradle index d2255f42..52ea901b 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -1,3 +1,4 @@ +import java.util.concurrent.ExecutionException import java.util.regex.Matcher import java.util.regex.Pattern @@ -366,3 +367,17 @@ def getCurrentFlavorForBetaOrRelease() { return ""; } } + +task checkApplicationIdForCustomFlavor (type: Exec ) { + def currFlavor = getCurrentFlavorForBetaOrRelease() + if(currFlavor.contains("custom")) { + android.applicationVariants.all { variant -> + def mergedFlavor = variant.mergedFlavor + if (variant.flavorName.toString().equalsIgnoreCase(currFlavor)) { + if (mergedFlavor.getApplicationId().equalsIgnoreCase("org.sample.custom")) { + throw new ExecutionException("ERROR: please change the applicationId(org.sample.custom) if you want to build a custom branded app!") + } + } + } + } +} -- cgit v1.2.3 From 308ae33ab3298ae7cbe5837a6bf15ccd63e3be2c Mon Sep 17 00:00:00 2001 From: Janak Amarasena Date: Mon, 18 Jun 2018 01:16:47 +0530 Subject: Added custom app name validation --- app/build.gradle | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'app/build.gradle') diff --git a/app/build.gradle b/app/build.gradle index 52ea901b..3eb948bb 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -3,6 +3,7 @@ import java.util.regex.Matcher import java.util.regex.Pattern apply plugin: 'com.android.application' +def appName = '' android { compileSdkVersion 27 @@ -57,9 +58,10 @@ android { custom { dimension "mode" //Change the package name as needed - applicationId "org.sample.custom" + applicationId "org.sample.customs" //Set app name here - resValue "string", "app_name", "Bitmask Custom" + appName = "Custom" + resValue "string", "app_name", appName //Change the versionCode as needed versionCode 1 //Change the versionName as needed @@ -381,3 +383,12 @@ task checkApplicationIdForCustomFlavor (type: Exec ) { } } } + +task checkAppNameForCustomFlavor (type: Exec ) { + def currFlavor = getCurrentFlavorForBetaOrRelease() + if(currFlavor.contains("custom")) { + if (appName.equalsIgnoreCase("custom")) { + throw new ExecutionException("ERROR: please change the appName(Custom) if you want to build a custom branded app!") + } + } +} \ No newline at end of file -- cgit v1.2.3 From d468147c8d7a99dbac48a68f8377444fc1a9fe30 Mon Sep 17 00:00:00 2001 From: Janak Amarasena Date: Mon, 18 Jun 2018 20:27:30 +0530 Subject: Minor updates according to received feedback --- app/build.gradle | 50 +++++++++++++++++++++++++++++++++----------------- 1 file changed, 33 insertions(+), 17 deletions(-) (limited to 'app/build.gradle') diff --git a/app/build.gradle b/app/build.gradle index 3eb948bb..5133b862 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -52,13 +52,14 @@ android { insecure { dimension "implementation" } - dafualt { + defualt { dimension "mode" } + //Configurations for custom branded app. custom { dimension "mode" //Change the package name as needed - applicationId "org.sample.customs" + applicationId "org.sample.custom" //Set app name here appName = "Custom" resValue "string", "app_name", appName @@ -370,25 +371,40 @@ def getCurrentFlavorForBetaOrRelease() { } } -task checkApplicationIdForCustomFlavor (type: Exec ) { - def currFlavor = getCurrentFlavorForBetaOrRelease() - if(currFlavor.contains("custom")) { +def getCurrentFlavor() { + Gradle gradle = getGradle() + String tskReqStr = gradle.getStartParameter().getTaskRequests().toString() + + Pattern pattern; + + if (tskReqStr.contains("assemble")) + pattern = Pattern.compile("assemble(\\w+)(Beta|Release|Debug)") + else + pattern = Pattern.compile("generate(\\w+)(Beta|Release|Debug)") + + Matcher matcher = pattern.matcher(tskReqStr) + + if (matcher.find()) + return matcher.group(1).toLowerCase() + else { + return ""; + } +} + +task checkApplicationIdForCustomFlavor(type: Exec) { + def currFlavor = getCurrentFlavor() + if (currFlavor.contains("custom")) { android.applicationVariants.all { variant -> def mergedFlavor = variant.mergedFlavor - if (variant.flavorName.toString().equalsIgnoreCase(currFlavor)) { - if (mergedFlavor.getApplicationId().equalsIgnoreCase("org.sample.custom")) { - throw new ExecutionException("ERROR: please change the applicationId(org.sample.custom) if you want to build a custom branded app!") - } - } + if (variant.flavorName.toString().equalsIgnoreCase(currFlavor) && + mergedFlavor.getApplicationId().equalsIgnoreCase("org.sample.custom")) + throw new ExecutionException("ERROR: please change the applicationId(org.sample.custom) if you want to build a custom branded app!") } } } -task checkAppNameForCustomFlavor (type: Exec ) { - def currFlavor = getCurrentFlavorForBetaOrRelease() - if(currFlavor.contains("custom")) { - if (appName.equalsIgnoreCase("custom")) { - throw new ExecutionException("ERROR: please change the appName(Custom) if you want to build a custom branded app!") - } - } +task checkAppNameForCustomFlavor(type: Exec) { + def currFlavor = getCurrentFlavor() + if (currFlavor.contains("custom") && appName.equalsIgnoreCase("custom")) + throw new ExecutionException("ERROR: please change the appName(Custom) if you want to build a custom branded app!") } \ No newline at end of file -- cgit v1.2.3 From cd1c2ec77bd06dfff3399e08bff6481c27d9baf4 Mon Sep 17 00:00:00 2001 From: Janak Amarasena Date: Thu, 21 Jun 2018 00:37:07 +0530 Subject: Minor updates according to received feedback --- app/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'app/build.gradle') diff --git a/app/build.gradle b/app/build.gradle index 5133b862..e8f8b78f 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -52,7 +52,7 @@ android { insecure { dimension "implementation" } - defualt { + normal { dimension "mode" } //Configurations for custom branded app. -- cgit v1.2.3