Skip to content

Commit

Permalink
Merge branch 'englehorn-dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
waynedyck committed Feb 2, 2022
2 parents 23a5524 + 2f0d5df commit c077cde
Show file tree
Hide file tree
Showing 26 changed files with 643 additions and 269 deletions.
62 changes: 34 additions & 28 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ apply plugin: "androidx.navigation.safeargs.kotlin"
apply plugin: 'com.google.firebase.crashlytics'

android {
compileSdkVersion 30
compileSdkVersion 31
defaultConfig {
applicationId "gov.wa.wsdot.android.wsdot"
minSdkVersion 21
targetSdkVersion 30
targetSdkVersion 31
versionCode 21060703
versionName "6.7.3"
vectorDrawables.useSupportLibrary = true
Expand Down Expand Up @@ -87,37 +87,41 @@ dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation"org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"

implementation 'com.google.android.material:material:1.1.0'
implementation 'androidx.activity:activity-ktx:1.1.0'
implementation 'androidx.fragment:fragment-ktx:1.2.5'
implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.2.0'
implementation 'com.google.android.material:material:1.4.0'
implementation 'androidx.activity:activity-ktx:1.4.0'
implementation 'androidx.fragment:fragment-ktx:1.4.0'
implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.4.0'

// Updating to 2.4.0 causes error. Duplicate classes found in modules.
implementation 'androidx.lifecycle:lifecycle-viewmodel-savedstate:2.2.0'

implementation 'com.google.android.gms:play-services-ads:20.2.0'
implementation 'com.google.android.gms:play-services-location:17.1.0'
implementation 'com.google.android.gms:play-services-maps:17.0.0'
implementation 'com.google.android.gms:play-services-ads:20.5.0'
implementation 'com.google.android.gms:play-services-location:19.0.1'
implementation 'com.google.android.gms:play-services-maps:18.0.2'

implementation 'com.google.firebase:firebase-core:18.0.2'
implementation 'com.google.firebase:firebase-analytics:18.0.2'
implementation 'com.google.firebase:firebase-messaging:21.0.1'
implementation 'com.google.firebase:firebase-crashlytics-ktx:17.3.1'
implementation 'com.google.firebase:firebase-core:20.0.2'
implementation 'com.google.firebase:firebase-analytics:20.0.2'
implementation 'com.google.firebase:firebase-messaging:23.0.0'
implementation 'com.google.firebase:firebase-crashlytics-ktx:18.2.6'

implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'androidx.core:core-ktx:1.3.2'
implementation 'androidx.appcompat:appcompat:1.4.0'
implementation 'androidx.core:core-ktx:1.7.0'

implementation 'androidx.preference:preference-ktx:1.1.1'

implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.7"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.5.0"

implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'androidx.constraintlayout:constraintlayout:2.1.2'

kapt "androidx.lifecycle:lifecycle-common-java8:2.2.0"
kapt "androidx.lifecycle:lifecycle-common-java8:2.4.0"
implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'

implementation "androidx.room:room-runtime:2.2.6"
kapt "androidx.room:room-compiler:2.2.6"
annotationProcessor 'androidx.room:room-compiler:2.2.6'
implementation "androidx.room:room-runtime:2.4.0"

// Updating to 2.4.1 causes app:kaptDebugKotlin error.
kapt "androidx.room:room-compiler:2.3.0"
annotationProcessor 'androidx.room:room-compiler:2.4.0'

// drag and drop list
implementation 'com.ernestoyaquello.dragdropswiperecyclerview:drag-drop-swipe-recyclerview:0.5.1'
Expand All @@ -132,7 +136,7 @@ dependencies {
kapt "com.android.databinding:compiler:3.1.4"

// Navigation - https://developer.android.com/jetpack/androidx/releases/navigation
def nav_version = "2.3.3"
def nav_version = "2.3.5"
implementation "androidx.navigation:navigation-fragment-ktx:$nav_version"
implementation "androidx.navigation:navigation-ui-ktx:$nav_version"

Expand All @@ -153,6 +157,8 @@ dependencies {

kapt "com.google.dagger:dagger-compiler:$daggerVersion"
kapt "com.google.dagger:dagger-android-processor:$daggerVersion"

// Updating to 2.28.3 causes app:kaptDebugKotlin error.
implementation "com.google.dagger:dagger:$daggerVersion"
implementation "com.google.dagger:dagger-android-support:$daggerVersion"

Expand All @@ -167,12 +173,12 @@ dependencies {
// Required -- JUnit 4 framework
testImplementation 'junit:junit:4.13.1'
// Optional -- Robolectric environment
testImplementation 'androidx.test:core:1.3.0'
androidTestImplementation 'androidx.test:core:1.3.0'
testImplementation "androidx.room:room-testing:2.2.6"
testImplementation 'androidx.test:core:1.4.0'
androidTestImplementation 'androidx.test:core:1.4.0'
testImplementation "androidx.room:room-testing:2.4.0"
androidTestImplementation "androidx.arch.core:core-testing:2.1.0"
androidTestImplementation 'androidx.test:runner:1.3.0'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
androidTestImplementation 'androidx.test:runner:1.4.0'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'

}
2 changes: 2 additions & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.WAKE_LOCK" />

Expand Down Expand Up @@ -51,6 +52,7 @@

<activity
android:name="gov.wa.wsdot.android.wsdot.ui.MainActivity"
android:exported="true"
android:label="@string/app_name"
android:launchMode="singleTask">
<intent-filter>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ class FerriesRepository @Inject constructor(

if (data != null && data.isNotEmpty()) {

if (TimeUtils.isOverXMinOld(data[0].localCacheDate, x = 15)) {
if (TimeUtils.isOverXMinOld(data[0].localCacheDate, x = 5)) {
update = true
}
} else {
Expand Down Expand Up @@ -94,7 +94,7 @@ class FerriesRepository @Inject constructor(

if (data != null) {

if (TimeUtils.isOverXMinOld(data.localCacheDate, x = 15)) {
if (TimeUtils.isOverXMinOld(data.localCacheDate, x = 5)) {
update = true
}
} else {
Expand Down Expand Up @@ -267,7 +267,7 @@ class FerriesRepository @Inject constructor(

if (data != null && data.isNotEmpty()) {

if (TimeUtils.isOverXMinOld(data[0].localCacheDate, x = 15)) {
if (TimeUtils.isOverXMinOld(data[0].localCacheDate, x = 5)) {
update = true
}
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ import android.app.NotificationManager
import android.app.PendingIntent
import android.content.Context
import android.content.Intent
import android.os.Build
import android.util.Log
import androidx.annotation.RequiresApi
import androidx.core.app.NotificationCompat
import androidx.preference.PreferenceManager
import com.google.firebase.messaging.FirebaseMessagingService
Expand Down Expand Up @@ -71,6 +73,7 @@ class MyFirebaseMessagingService : FirebaseMessagingService() {
}
}

@RequiresApi(Build.VERSION_CODES.M)
private fun getNotificationIntent(data: MutableMap<String, String>): PendingIntent {

val type = data["type"]
Expand Down Expand Up @@ -120,7 +123,7 @@ class MyFirebaseMessagingService : FirebaseMessagingService() {
}
}
return PendingIntent.getActivity(this, alertId?.toInt() ?: 0, intent,
PendingIntent.FLAG_UPDATE_CURRENT)
PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_IMMUTABLE)
}

/**
Expand Down
26 changes: 13 additions & 13 deletions app/src/main/java/gov/wa/wsdot/android/wsdot/ui/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ class MainActivity : DaggerAppCompatActivity(), NavigationView.OnNavigationItemS

private lateinit var firebaseAnalytics: FirebaseAnalytics

private lateinit var adView: AdManagerAdView
private var adView: AdManagerAdView? = null

private val adSize: AdSize
get() {
Expand Down Expand Up @@ -201,12 +201,12 @@ class MainActivity : DaggerAppCompatActivity(), NavigationView.OnNavigationItemS

adView = AdManagerAdView(this)
ad_banner_box.addView(adView)
adView.setAdSizes(adSize)
adView.adUnitId = ApiKeys.UNIT_ID
adView?.setAdSizes(adSize)
adView?.adUnitId = ApiKeys.UNIT_ID

}

override fun onCreateOptionsMenu(menu: Menu?): Boolean {
override fun onCreateOptionsMenu(menu: Menu): Boolean {
addMenuBadgeIfNeeded()
return super.onCreateOptionsMenu(menu)
}
Expand Down Expand Up @@ -592,9 +592,9 @@ class MainActivity : DaggerAppCompatActivity(), NavigationView.OnNavigationItemS
* Initialize and display ads.
* WARNING: don't call in onCreate
*/
fun enableAds(targets: Map<String, String>) {
fun enableAds(targets: Map<String, String>) {

ad_banner_box.visibility = VISIBLE
ad_banner_box?.visibility = VISIBLE

//val testDeviceIds = Arrays.asList("2531EB5FD75758B5E8BDD4669A870BF7")
//val configuration = RequestConfiguration.Builder()
Expand All @@ -604,15 +604,15 @@ class MainActivity : DaggerAppCompatActivity(), NavigationView.OnNavigationItemS
//.build()
//MobileAds.setRequestConfiguration(configuration)

adView.pause()
adView.adListener = null
adView.adListener = object : AdListener() {
adView?.pause()
adView?.adListener = null
adView?.adListener = object : AdListener() {

override fun onAdLoaded() {
super.onAdLoaded()

// report ad ID to crashlytics
val info = adView.responseInfo
val info = adView?.responseInfo
var adResponseId = "null"
if (info != null){
Log.e("Ads", info.toString())
Expand All @@ -632,7 +632,7 @@ class MainActivity : DaggerAppCompatActivity(), NavigationView.OnNavigationItemS
}

// Start loading the ad in the background.
adView.loadAd(adRequest.build())
adView?.loadAd(adRequest.build())

}

Expand All @@ -641,8 +641,8 @@ class MainActivity : DaggerAppCompatActivity(), NavigationView.OnNavigationItemS
* WARNING: don't call in onCreate
*/
fun disableAds() {
ad_banner_box.visibility = GONE
adView.pause()
ad_banner_box?.visibility = GONE
adView?.pause()
}

fun setScreenName(screenName: String) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,6 @@ class AboutFragment: DaggerFragment(), Injectable {
startActivity(browserIntent)
}

binding.heroButton.setOnClickListener {
val browserIntent = Intent(Intent.ACTION_VIEW, Uri.parse("https://www.wsdot.wa.gov/travel/highways-bridges/hov/report-violator"))
startActivity(browserIntent)
}

binding.appBugReportButton.setOnClickListener {
val emailIntent = Intent(Intent.ACTION_SEND)
emailIntent.putExtra(Intent.EXTRA_EMAIL, arrayOf("webfeedback@wsdot.wa.gov"))
Expand Down
Loading

0 comments on commit c077cde

Please sign in to comment.