Skip to content

Commit

Permalink
Merge pull request #5 from armancodv/pro-version
Browse files Browse the repository at this point in the history
pro version
  • Loading branch information
armancodv authored May 8, 2021
2 parents a19128f + 817d6a1 commit 5e66c38
Show file tree
Hide file tree
Showing 7 changed files with 104 additions and 11 deletions.
13 changes: 13 additions & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,19 @@ android {
buildFeatures {
viewBinding true
}

flavorDimensions 'default'
productFlavors {
free {
dimension 'default'
applicationId "com.armanco.integral"
}
pro {
dimension 'default'
applicationId "com.armanco.integral_pro"
}
}

}

dependencies {
Expand Down
9 changes: 8 additions & 1 deletion app/src/main/java/com/armanco/integral/MainActivity.kt
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
package com.armanco.integral

import android.os.Bundle
import android.view.View
import androidx.appcompat.app.AppCompatActivity
import androidx.navigation.findNavController
import androidx.navigation.fragment.NavHostFragment
import androidx.navigation.ui.AppBarConfiguration
import androidx.navigation.ui.setupWithNavController
import com.armanco.integral.extensions.isPro
import com.google.android.gms.ads.AdRequest
import com.google.android.gms.ads.MobileAds
import dagger.hilt.android.AndroidEntryPoint
Expand All @@ -16,7 +18,8 @@ class MainActivity: AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
initAdMob()
if(!isPro) initAdMob()
else removeAdMob()
initToolbar()
}

Expand All @@ -26,6 +29,10 @@ class MainActivity: AppCompatActivity() {
adView?.loadAd(adRequest)
}

private fun removeAdMob() {
adView?.visibility = View.GONE
}

private fun initToolbar() {
val navHostFragment = supportFragmentManager.findFragmentById(R.id.nav_host_fragment) as? NavHostFragment
navHostFragment?.navController?.let { navController ->
Expand Down
11 changes: 11 additions & 0 deletions app/src/main/java/com/armanco/integral/extensions/extensions.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package com.armanco.integral.extensions

import com.armanco.integral.BuildConfig

val isPro: Boolean
get() {
return when (BuildConfig.FLAVOR) {
"pro" -> true
else -> false
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import android.os.Bundle
import android.view.View
import androidx.fragment.app.Fragment
import com.armanco.integral.R
import com.armanco.integral.extensions.isPro
import com.google.android.gms.ads.AdListener
import com.google.android.gms.ads.AdRequest
import com.google.android.gms.ads.InterstitialAd
Expand All @@ -17,7 +18,7 @@ class ImageFragment: Fragment(R.layout.fragment_image) {

override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
showInterstitialAd()
if(!isPro) showInterstitialAd()
arguments?.getInt(IMAGE_KEY)?.let { photoView?.setImageResource(it) }
}

Expand Down
59 changes: 55 additions & 4 deletions fastlane/Fastfile
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ platform :android do
)
gradle(task: "test")
gradle(
task: 'assembleRelease',
task: 'assembleFreeRelease',
properties: {
"android.injected.signing.store.file" => ENV['KEYSTORE_PATH'],
"android.injected.signing.store.password" => ENV['STORE_PASSWORD'],
Expand All @@ -37,8 +37,9 @@ platform :android do
}
)
upload_to_play_store(
package_name: 'com.armanco.integral',
track: 'production',
apk: ENV['APK_PATH'],
apk: ENV['APK_PATH_FREE'],
json_key: ENV['JSON_PATH'],
skip_upload_aab: true
)
Expand All @@ -51,7 +52,7 @@ platform :android do
)
gradle(task: "test")
gradle(
task: 'assembleRelease',
task: 'assembleFreeRelease',
properties: {
"android.injected.signing.store.file" => ENV['KEYSTORE_PATH'],
"android.injected.signing.store.password" => ENV['STORE_PASSWORD'],
Expand All @@ -60,8 +61,58 @@ platform :android do
}
)
upload_to_play_store(
package_name: 'com.armanco.integral',
track: 'internal',
apk: ENV['APK_PATH'],
apk: ENV['APK_PATH_FREE'],
json_key: ENV['JSON_PATH'],
skip_upload_aab: true
)
end


desc "Deploy a new version to the Google Play (PRO)"
lane :deploy_pro do
validate_play_store_json_key(
json_key: ENV['JSON_PATH']
)
gradle(task: "test")
gradle(
task: 'assembleProRelease',
properties: {
"android.injected.signing.store.file" => ENV['KEYSTORE_PATH'],
"android.injected.signing.store.password" => ENV['STORE_PASSWORD'],
"android.injected.signing.key.alias" => ENV['KEY_ALIAS'],
"android.injected.signing.key.password" => ENV['KEY_PASSWORD'],
}
)
upload_to_play_store(
package_name: 'com.armanco.integral_pro',
track: 'production',
apk: ENV['APK_PATH_PRO'],
json_key: ENV['JSON_PATH'],
skip_upload_aab: true
)
end

desc "Submit a new Internal Test"
lane :internal_pro do
validate_play_store_json_key(
json_key: ENV['JSON_PATH']
)
gradle(task: "test")
gradle(
task: 'assembleProRelease',
properties: {
"android.injected.signing.store.file" => ENV['KEYSTORE_PATH'],
"android.injected.signing.store.password" => ENV['STORE_PASSWORD'],
"android.injected.signing.key.alias" => ENV['KEY_ALIAS'],
"android.injected.signing.key.password" => ENV['KEY_PASSWORD'],
}
)
upload_to_play_store(
package_name: 'com.armanco.integral_pro',
track: 'internal',
apk: ENV['APK_PATH_PRO'],
json_key: ENV['JSON_PATH'],
skip_upload_aab: true
)
Expand Down
10 changes: 10 additions & 0 deletions fastlane/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,16 @@ Deploy a new version to the Google Play
fastlane android internal
```
Submit a new Internal Test
### android deploy_pro
```
fastlane android deploy_pro
```
Deploy a new version to the Google Play (PRO)
### android internal_pro
```
fastlane android internal_pro
```
Submit a new Internal Test
### android screenshots
```
fastlane android screenshots
Expand Down
10 changes: 5 additions & 5 deletions fastlane/report.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,27 +5,27 @@



<testcase classname="fastlane.lanes" name="0: default_platform" time="0.000394">
<testcase classname="fastlane.lanes" name="0: default_platform" time="0.000369">

</testcase>


<testcase classname="fastlane.lanes" name="1: validate_play_store_json_key" time="0.110202">
<testcase classname="fastlane.lanes" name="1: validate_play_store_json_key" time="0.125023">

</testcase>


<testcase classname="fastlane.lanes" name="2: test" time="3.706068">
<testcase classname="fastlane.lanes" name="2: test" time="44.471435">

</testcase>


<testcase classname="fastlane.lanes" name="3: assembleRelease" time="6.255129">
<testcase classname="fastlane.lanes" name="3: assembleProRelease" time="17.004816">

</testcase>


<testcase classname="fastlane.lanes" name="4: upload_to_play_store" time="310.313027">
<testcase classname="fastlane.lanes" name="4: upload_to_play_store" time="318.299384">

</testcase>

Expand Down

0 comments on commit 5e66c38

Please sign in to comment.