Skip to content

Commit

Permalink
Feature/54 ad consent (#57)
Browse files Browse the repository at this point in the history
* #55: Update dependencies (libs, gradle, kotlin)

* #55: Update memory from gradle in gradle.properties

* #54: Modules for Consent & Ads -> AdView cannot be found

* #54: Consent & Ad Module started

* #54: Finished Consent & Start Settings

* #42: Implement Settings Activity options (except remove Ads)

* #54: Implemented Consent Flows

* #54: Added Remove Ads option (untested)

* #54: Update UnitTests

* #54: Renamed module to libAds

* #54: Lower Gradle Memory for Travis CI

* #54: Cleanup & Localised Settings screen

* #54: Add --info to build task to get more output of error

* #54: Update build tools version to 29.0.0 for Travis

* #54: Removed --info (too much for travis to handle)

* #54: Add licence for Build Tools 29.0.0 to Travis script

* #54: Clean up Lint & Compiler warnings

* #54: Update Dagger to 2.23.1

* #54: Refactored Ads & Consent Dagger modules

* #54: Experiment with kapt{ correctErrorTypes = true }

* #54: Trying to let Travis show the actual error

* Revert "#54: Trying to let Travis show the actual error"

This reverts commit c8189d6.

* #54: More trial & errorring

* #54: Doh

* $54: Remove deps on Consent pt 1

* #54: Add deps from App to Consent pt2

* #54: Remove ConsentComponent pt3

* #54: New ConsentModule pt4

* #54: Fuck pt5

* #54: Removed StoreCurrentConsent -> included in Ask Consent

* #54: Add Fetch consent back to Ads module pt6

* #54: Fixed Settings layout & Donations
  • Loading branch information
Entreco authored Jul 10, 2019
1 parent 65a0ab7 commit 05f0da1
Show file tree
Hide file tree
Showing 209 changed files with 2,053 additions and 882 deletions.
6 changes: 3 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ cache:
env:
global:
- ANDROID_API=28
- ANDROID_BUILD_TOOLS=28.0.3
- ANDROID_BUILD_TOOLS=29.0.0
- ADB_INSTALL_TIMEOUT=5
- secure: UH6Td9+MFk1nsYYMKN9t6/XcMmSZtB+L4sWMUmYBMaK1Q6YnGCnyHmU5RWkP+9a3AiZQ+n9XK+9TV+azMxJzyOoPMEzvBYtienvI1ZwTg+gqVOsMGG8T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otJgY76IEJG2gSnb2SSI94VuXCI/39DLxXoTF1knixdaFJOO2QvBU2b8eZKrU4w1+rUrSfIMnBdn27hdqs+uKYNuJIwtMMCcrFtZmZnKjXcBwjgQdm51gWuMiJN5S8xM8turo23jL2Cak7rXn8RUmLHbhu3Jpl8iQzQOPFm1zmkg=
Expand Down Expand Up @@ -40,7 +40,7 @@ before_install:
- openssl aes-256-cbc -K $encrypted_60401f83f63b_key -iv $encrypted_60401f83f63b_iv -in android/DartsScorecard/app/google-services.json.enc -out android/DartsScorecard/app/google-services.json -d

- mkdir "$ANDROID_HOME/licenses" || true
- echo -e "\nd56f5187479451eabf01fb78af6dfcb131a6481e" > "$ANDROID_HOME/licenses/android-sdk-license"
- echo -e "\nd56f5187479451eabf01fb78af6dfcb131a6481e\n24333f8a63b6825ea9c5514f83c2829b004d1fee" > "$ANDROID_HOME/licenses/android-sdk-license"
- echo -e "\n84831b9409646a918e30573bab4c9c91346d8abd" > "$ANDROID_HOME/licenses/android-sdk-preview-license"
- echo -e "\n601085b94cd77f0b54ff86406957099ebe79c4d6" > "$ANDROID_HOME/licenses/android-googletv-license"
- echo -e "\n33b6a2b64607f11b759f320ef9dff4ae5c47d97a" > "$ANDROID_HOME/licenses/google-gdk-license"
Expand All @@ -50,7 +50,7 @@ before_install:
- chmod +x gradlew
- ./gradlew dependencies || true
script:
- ./gradlew clean bundle -PdisablePreDex --stacktrace
- ./gradlew clean :app:bundle -PdisablePreDex --stacktrace
after_success:
- ./gradlew jacocoFullReport coveralls
before_deploy:
Expand Down
4 changes: 3 additions & 1 deletion android/DartsScorecard/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ dependencies {
implementation project(':domain')
implementation project(':data')
implementation project(':libLog')
implementation project(':libConsent')
implementation project(':libAds')

// Annotation Processing
kapt "com.google.dagger:dagger-compiler:$daggerVersion"
Expand All @@ -53,11 +55,11 @@ dependencies {
implementation "com.google.android.material:material:$material"
implementation "androidx.appcompat:appcompat:$xSupport"
implementation "androidx.constraintlayout:constraintlayout:$xConstraint"
implementation "com.google.firebase:firebase-ads:$fbAds"
implementation "com.google.firebase:firebase-core:$fbCore"
implementation "com.google.firebase:firebase-firestore:$fbStore"
implementation "com.google.firebase:firebase-config:$fbConfig"
implementation "com.google.firebase:firebase-database:$fbDatabase"
implementation "com.google.firebase:firebase-ads:$fbAds"
implementation "androidx.room:room-runtime:$room"
implementation "androidx.lifecycle:lifecycle-extensions:$lifecycle"
implementation "com.google.code.gson:gson:$gson"
Expand Down
6 changes: 3 additions & 3 deletions android/DartsScorecard/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,6 @@
<!-- Required for GMS icm targetting 28 (Pie) -->
<uses-library android:name="org.apache.http.legacy" android:required="false"/>

<!-- Required per Admob v17.0.0 -->
<meta-data android:name="com.google.android.gms.ads.APPLICATION_ID" android:value="ca-app-pub-3793327349392749~1846337901"/>

<activity
android:name=".splash.SplashActivity"
android:noHistory="true"
Expand Down Expand Up @@ -62,6 +59,9 @@
<activity
android:name=".beta.BetaActivity"
android:parentActivityName=".launch.LaunchActivity" />
<activity
android:name=".settings.SettingsActivity"
android:parentActivityName=".launch.LaunchActivity" />
<activity
android:name=".faq.WtfActivity"
android:parentActivityName=".launch.LaunchActivity"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package nl.entreco.dartsscorecard

import android.app.Application
import android.os.StrictMode
import com.google.android.gms.ads.MobileAds
import com.squareup.leakcanary.LeakCanary
import nl.entreco.dartsscorecard.di.application.AppComponent
import nl.entreco.dartsscorecard.di.application.AppModule
Expand All @@ -23,7 +22,6 @@ class App : Application() {
initDagger()
initStrictMode()
initLeakCanary()
initAdMob()
}

private fun initDagger() {
Expand All @@ -48,10 +46,4 @@ class App : Application() {
if (LeakCanary.isInAnalyzerProcess(this)) return
LeakCanary.install(this)
}

private fun initAdMob() {
Thread {
MobileAds.initialize(this, resources.getString(R.string.app_id))
}.start()
}
}

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class ArchiveJobService : JobService() {
.setContentTitle(getString(R.string.archive_notif_title))
.setSmallIcon(R.drawable.ic_stat_name)
.setColor(Color.parseColor(NOTIF_COLOR))
.setBadgeIconType(R.mipmap.ic_launcher_foreground)
.setBadgeIconType(NotificationCompat.BADGE_ICON_SMALL)
.setLocalOnly(true)
.setWhen(System.currentTimeMillis())
.setUsesChronometer(true)
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import android.content.Intent
import android.net.Uri
import androidx.appcompat.app.AlertDialog
import nl.entreco.dartsscorecard.R
import nl.entreco.dartsscorecard.di.viewmodel.ActivityScope
import nl.entreco.shared.scopes.ActivityScope
import nl.entreco.domain.model.players.Team
import nl.entreco.domain.repository.RatingPrefRepository
import javax.inject.Inject
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package nl.entreco.dartsscorecard.base

import android.app.Activity
import android.content.SharedPreferences
import androidx.annotation.StyleRes
import nl.entreco.dartsscorecard.R
import javax.inject.Inject

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ abstract class SwipeToDeleteCallback(context: Context) : ItemTouchHelper.SimpleC
private val background = ColorDrawable()
private val backgroundColor = Color.parseColor("#D9534F") // Pale red

override fun onChildDraw(canvas: Canvas, recyclerView: androidx.recyclerview.widget.RecyclerView, viewHolder: androidx.recyclerview.widget.RecyclerView.ViewHolder, dX: Float, dY: Float, actionState: Int, isCurrentlyActive: Boolean) {
override fun onChildDraw(canvas: Canvas, recyclerView: RecyclerView, viewHolder: RecyclerView.ViewHolder, dX: Float, dY: Float, actionState: Int, isCurrentlyActive: Boolean) {
val itemView = viewHolder.itemView
val itemHeight = itemView.bottom - itemView.top
background.color = backgroundColor
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import android.view.LayoutInflater
/**
* Created by Entreco on 31/12/2017.
*/
abstract class TestableAdapter<T : androidx.recyclerview.widget.RecyclerView.ViewHolder?> : androidx.recyclerview.widget.RecyclerView.Adapter<T>() {
abstract class TestableAdapter<T : RecyclerView.ViewHolder?> : RecyclerView.Adapter<T>() {

protected class LazyInflater(context: Context) {
val inflater: LayoutInflater by lazy { LayoutInflater.from(context) }
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package nl.entreco.dartsscorecard.base.widget

import android.content.Context
import androidx.recyclerview.widget.RecyclerView
import android.util.AttributeSet

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
package nl.entreco.dartsscorecard.base.widget

import android.content.Context
import androidx.databinding.Bindable
import androidx.viewpager.widget.ViewPager
import android.util.AttributeSet
import androidx.viewpager.widget.ViewPager

/**
* Created by entreco on 24/03/2018.
*/
class WrapContentViewPager(context: Context, attrs: AttributeSet?) : androidx.viewpager.widget.ViewPager(context, attrs) {
class WrapContentViewPager(context: Context, attrs: AttributeSet?) : ViewPager(context, attrs) {
override fun onMeasure(widthMeasureSpec: Int, heightMeasureSpec: Int) {
val hms = getChildAt(0)?.let {child ->
val hms = getChildAt(0)?.let { child ->
child.measure(widthMeasureSpec, MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED))
MeasureSpec.makeMeasureSpec(child.measuredHeight, MeasureSpec.EXACTLY)
MeasureSpec.makeMeasureSpec(child.measuredHeight, MeasureSpec.EXACTLY)
}
super.onMeasure(widthMeasureSpec, hms ?: heightMeasureSpec)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import android.view.Menu
import android.view.MenuItem
import androidx.appcompat.widget.Toolbar
import androidx.databinding.DataBindingUtil
import androidx.lifecycle.Lifecycle
import androidx.recyclerview.widget.DefaultItemAnimator
import androidx.recyclerview.widget.GridLayoutManager
import com.google.android.material.snackbar.Snackbar
Expand Down Expand Up @@ -70,9 +69,7 @@ class BetaActivity : ViewModelActivity(), DonateCallback, BetaAnimator.Swapper {
return super.onCreateOptionsMenu(menu)
}

override fun lifeCycle(): Lifecycle {
return lifecycle
}
override fun lifeCycle() = lifecycle

override fun onSwapToolbar(showDetails: Boolean, title: String) {
if (showDetails) {
Expand Down Expand Up @@ -148,7 +145,7 @@ class BetaActivity : ViewModelActivity(), DonateCallback, BetaAnimator.Swapper {
}

@JvmStatic
fun donate(activity: BetaActivity, sender: IntentSender) {
fun donate(activity: Activity, sender: IntentSender) {
activity.startIntentSenderForResult(sender,
REQ_CODE_DONATE,
Intent(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package nl.entreco.dartsscorecard.beta
import com.google.android.material.appbar.AppBarLayout
import com.google.android.material.bottomsheet.BottomSheetBehavior
import android.view.View
import kotlinx.android.synthetic.main.include_beta_detail.view.*
import kotlinx.android.synthetic.main.include_beta_detail.view.voteFab
import nl.entreco.dartsscorecard.databinding.ActivityBetaBinding
import kotlin.math.abs
import kotlin.math.max
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ class DonateViewModel @Inject constructor(
internal var requiresConsumption = AtomicBoolean(true)
val donations = ObservableArrayList<Donation>()
val loading = ObservableBoolean(false)
val canRemoveAds = ObservableBoolean(false)

fun onDonate(donation: Donation) {
loading.set(true)
Expand Down Expand Up @@ -101,6 +102,7 @@ class DonateViewModel @Inject constructor(

private fun onFetchDonationsSuccess(): (FetchDonationsResponse) -> Unit = { result ->
requiresConsumption.set(result.needToBeConsumed)
canRemoveAds.set(!result.needToBeConsumed)
donations.clear()
donations.addAll(result.donations)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,18 @@ import nl.entreco.dartsscorecard.di.service.ServiceComponent
import nl.entreco.dartsscorecard.di.service.ServiceModule
import nl.entreco.dartsscorecard.di.viewmodel.ViewModelComponent
import nl.entreco.dartsscorecard.di.viewmodel.ViewModelModule
import nl.entreco.libads.AdModule
import nl.entreco.libconsent.di.ConsentModule
import nl.entreco.shared.scopes.ApplicationScope

/**
* Created by Entreco on 14/11/2017.
*/
@ApplicationScope
@Component(modules = [(AppModule::class)])
@Component(modules = [AppModule::class, AdModule::class, ConsentModule::class])
interface AppComponent {
fun inject(app: App)

fun plus(sub: ViewModelModule): ViewModelComponent
fun plus(sub: ServiceModule): ServiceComponent
}
Loading

0 comments on commit 05f0da1

Please sign in to comment.