Merge pull request #46 from lucasnlm/remove-google-play-dependency

Remove google play dependency
This commit is contained in:
Lucas Nunes 2020-04-07 20:25:33 -03:00 committed by GitHub
commit a374ba1ed6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 1 additions and 67 deletions

View file

@ -67,7 +67,6 @@ dependencies {
// Google
implementation "com.google.android.gms:play-services-instantapps:$versions.instantApp"
implementation "com.google.android.material:material:$versions.material"
implementation "com.google.android.play:core:$versions.playCore"
// Dagger
api "com.google.dagger:dagger-android:$versions.dagger"

View file

@ -2,13 +2,10 @@ package dev.lucasnlm.antimine
import android.content.ActivityNotFoundException
import android.content.Intent
import android.content.IntentSender
import android.net.Uri
import android.os.Build
import android.os.Bundle
import android.os.Handler
import android.text.format.DateUtils
import android.util.Log
import android.view.Menu
import android.view.MenuItem
import android.view.View
@ -21,9 +18,6 @@ import androidx.fragment.app.FragmentTransaction
import androidx.lifecycle.Observer
import androidx.lifecycle.ViewModelProviders
import androidx.preference.PreferenceManager
import com.google.android.play.core.appupdate.AppUpdateManagerFactory
import com.google.android.play.core.install.model.AppUpdateType
import com.google.android.play.core.install.model.UpdateAvailability
import dagger.android.support.DaggerAppCompatActivity
import dev.lucasnlm.antimine.about.AboutActivity
import dev.lucasnlm.antimine.common.level.models.Difficulty
@ -91,10 +85,6 @@ class GameActivity : DaggerAppCompatActivity() {
bindInstantApp()
savesRepository.setLimit(1)
} else {
if (Build.VERSION.SDK_INT >= 21) {
checkUpdate()
}
checkUseCount()
}
}
@ -504,28 +494,6 @@ class GameActivity : DaggerAppCompatActivity() {
}
}
/**
* Call Google API to request update.
*/
private fun checkUpdate() {
val appUpdateManager = AppUpdateManagerFactory.create(this)
val appUpdateInfoTask = appUpdateManager.appUpdateInfo
appUpdateInfoTask.addOnSuccessListener { info ->
if (info.updateAvailability() == UpdateAvailability.UPDATE_AVAILABLE &&
info.isUpdateTypeAllowed(AppUpdateType.FLEXIBLE)
) {
try {
appUpdateManager.startUpdateFlowForResult(
info, AppUpdateType.FLEXIBLE, this, 1
)
} catch (e: IntentSender.SendIntentException) {
Log.e(TAG, "Fail to request update.")
}
}
}
}
/**
* If user change any accessibility preference, the game will restart the activity to
* apply these changes.
@ -578,7 +546,6 @@ class GameActivity : DaggerAppCompatActivity() {
}
companion object {
val TAG = GameActivity::class.simpleName
const val PREFERENCE_FIRST_USE = "preference_first_use"
const val PREFERENCE_USE_COUNT = "preference_use_count"
const val PREFERENCE_REQUEST_RATING = "preference_request_rating"

View file

@ -1,12 +1,9 @@
package dev.lucasnlm.antimine
import android.content.Intent
import android.content.IntentSender
import android.os.Build
import android.os.Bundle
import android.os.Handler
import android.text.format.DateUtils
import android.util.Log
import android.view.Menu
import android.view.MenuItem
import android.view.View
@ -16,9 +13,6 @@ import androidx.fragment.app.FragmentTransaction
import androidx.lifecycle.Observer
import androidx.lifecycle.ViewModelProviders
import androidx.preference.PreferenceManager
import com.google.android.play.core.appupdate.AppUpdateManagerFactory
import com.google.android.play.core.install.model.AppUpdateType
import com.google.android.play.core.install.model.UpdateAvailability
import dagger.android.support.DaggerAppCompatActivity
import dev.lucasnlm.antimine.about.AboutActivity
import dev.lucasnlm.antimine.common.level.models.Difficulty
@ -64,10 +58,6 @@ class TvGameActivity : DaggerAppCompatActivity() {
PreferenceManager.setDefaultValues(this, R.xml.preferences, false)
loadGameFragment()
if (Build.VERSION.SDK_INT >= 21) {
checkUpdate()
}
}
private fun bindViewModel() = viewModel.apply {
@ -324,25 +314,4 @@ class TvGameActivity : DaggerAppCompatActivity() {
else -> { }
}
}
private fun checkUpdate() {
val appUpdateManager = AppUpdateManagerFactory.create(this)
val appUpdateInfoTask = appUpdateManager.appUpdateInfo
appUpdateInfoTask.addOnSuccessListener { info ->
if (info.updateAvailability() == UpdateAvailability.UPDATE_AVAILABLE &&
info.isUpdateTypeAllowed(AppUpdateType.FLEXIBLE)) {
try {
appUpdateManager.startUpdateFlowForResult(
info, AppUpdateType.FLEXIBLE, this, 1)
} catch (e: IntentSender.SendIntentException) {
Log.e(TAG, "Fail to request update.")
}
}
}
}
companion object {
const val TAG = "GameActivity"
}
}

View file

@ -21,14 +21,13 @@ ext.versions = [
// Wear OS
wear : '1.0.0',
// Google Weae
// Google Wear
playWearable : '17.0.0',
supportWearable : '2.5.0',
// Google
instantApp : '17.0.0',
material : '1.1.0',
playCore : '1.7.1',
// Kotlin
kotlin : '1.3.70',