Merge pull request #46 from lucasnlm/remove-google-play-dependency
Remove google play dependency
This commit is contained in:
commit
a374ba1ed6
4 changed files with 1 additions and 67 deletions
|
@ -67,7 +67,6 @@ dependencies {
|
||||||
// Google
|
// Google
|
||||||
implementation "com.google.android.gms:play-services-instantapps:$versions.instantApp"
|
implementation "com.google.android.gms:play-services-instantapps:$versions.instantApp"
|
||||||
implementation "com.google.android.material:material:$versions.material"
|
implementation "com.google.android.material:material:$versions.material"
|
||||||
implementation "com.google.android.play:core:$versions.playCore"
|
|
||||||
|
|
||||||
// Dagger
|
// Dagger
|
||||||
api "com.google.dagger:dagger-android:$versions.dagger"
|
api "com.google.dagger:dagger-android:$versions.dagger"
|
||||||
|
|
|
@ -2,13 +2,10 @@ package dev.lucasnlm.antimine
|
||||||
|
|
||||||
import android.content.ActivityNotFoundException
|
import android.content.ActivityNotFoundException
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import android.content.IntentSender
|
|
||||||
import android.net.Uri
|
import android.net.Uri
|
||||||
import android.os.Build
|
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.os.Handler
|
import android.os.Handler
|
||||||
import android.text.format.DateUtils
|
import android.text.format.DateUtils
|
||||||
import android.util.Log
|
|
||||||
import android.view.Menu
|
import android.view.Menu
|
||||||
import android.view.MenuItem
|
import android.view.MenuItem
|
||||||
import android.view.View
|
import android.view.View
|
||||||
|
@ -21,9 +18,6 @@ import androidx.fragment.app.FragmentTransaction
|
||||||
import androidx.lifecycle.Observer
|
import androidx.lifecycle.Observer
|
||||||
import androidx.lifecycle.ViewModelProviders
|
import androidx.lifecycle.ViewModelProviders
|
||||||
import androidx.preference.PreferenceManager
|
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 dagger.android.support.DaggerAppCompatActivity
|
||||||
import dev.lucasnlm.antimine.about.AboutActivity
|
import dev.lucasnlm.antimine.about.AboutActivity
|
||||||
import dev.lucasnlm.antimine.common.level.models.Difficulty
|
import dev.lucasnlm.antimine.common.level.models.Difficulty
|
||||||
|
@ -91,10 +85,6 @@ class GameActivity : DaggerAppCompatActivity() {
|
||||||
bindInstantApp()
|
bindInstantApp()
|
||||||
savesRepository.setLimit(1)
|
savesRepository.setLimit(1)
|
||||||
} else {
|
} else {
|
||||||
if (Build.VERSION.SDK_INT >= 21) {
|
|
||||||
checkUpdate()
|
|
||||||
}
|
|
||||||
|
|
||||||
checkUseCount()
|
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
|
* If user change any accessibility preference, the game will restart the activity to
|
||||||
* apply these changes.
|
* apply these changes.
|
||||||
|
@ -578,7 +546,6 @@ class GameActivity : DaggerAppCompatActivity() {
|
||||||
}
|
}
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
val TAG = GameActivity::class.simpleName
|
|
||||||
const val PREFERENCE_FIRST_USE = "preference_first_use"
|
const val PREFERENCE_FIRST_USE = "preference_first_use"
|
||||||
const val PREFERENCE_USE_COUNT = "preference_use_count"
|
const val PREFERENCE_USE_COUNT = "preference_use_count"
|
||||||
const val PREFERENCE_REQUEST_RATING = "preference_request_rating"
|
const val PREFERENCE_REQUEST_RATING = "preference_request_rating"
|
||||||
|
|
|
@ -1,12 +1,9 @@
|
||||||
package dev.lucasnlm.antimine
|
package dev.lucasnlm.antimine
|
||||||
|
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import android.content.IntentSender
|
|
||||||
import android.os.Build
|
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.os.Handler
|
import android.os.Handler
|
||||||
import android.text.format.DateUtils
|
import android.text.format.DateUtils
|
||||||
import android.util.Log
|
|
||||||
import android.view.Menu
|
import android.view.Menu
|
||||||
import android.view.MenuItem
|
import android.view.MenuItem
|
||||||
import android.view.View
|
import android.view.View
|
||||||
|
@ -16,9 +13,6 @@ import androidx.fragment.app.FragmentTransaction
|
||||||
import androidx.lifecycle.Observer
|
import androidx.lifecycle.Observer
|
||||||
import androidx.lifecycle.ViewModelProviders
|
import androidx.lifecycle.ViewModelProviders
|
||||||
import androidx.preference.PreferenceManager
|
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 dagger.android.support.DaggerAppCompatActivity
|
||||||
import dev.lucasnlm.antimine.about.AboutActivity
|
import dev.lucasnlm.antimine.about.AboutActivity
|
||||||
import dev.lucasnlm.antimine.common.level.models.Difficulty
|
import dev.lucasnlm.antimine.common.level.models.Difficulty
|
||||||
|
@ -64,10 +58,6 @@ class TvGameActivity : DaggerAppCompatActivity() {
|
||||||
PreferenceManager.setDefaultValues(this, R.xml.preferences, false)
|
PreferenceManager.setDefaultValues(this, R.xml.preferences, false)
|
||||||
|
|
||||||
loadGameFragment()
|
loadGameFragment()
|
||||||
|
|
||||||
if (Build.VERSION.SDK_INT >= 21) {
|
|
||||||
checkUpdate()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun bindViewModel() = viewModel.apply {
|
private fun bindViewModel() = viewModel.apply {
|
||||||
|
@ -324,25 +314,4 @@ class TvGameActivity : DaggerAppCompatActivity() {
|
||||||
else -> { }
|
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"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,14 +21,13 @@ ext.versions = [
|
||||||
// Wear OS
|
// Wear OS
|
||||||
wear : '1.0.0',
|
wear : '1.0.0',
|
||||||
|
|
||||||
// Google Weae
|
// Google Wear
|
||||||
playWearable : '17.0.0',
|
playWearable : '17.0.0',
|
||||||
supportWearable : '2.5.0',
|
supportWearable : '2.5.0',
|
||||||
|
|
||||||
// Google
|
// Google
|
||||||
instantApp : '17.0.0',
|
instantApp : '17.0.0',
|
||||||
material : '1.1.0',
|
material : '1.1.0',
|
||||||
playCore : '1.7.1',
|
|
||||||
|
|
||||||
// Kotlin
|
// Kotlin
|
||||||
kotlin : '1.3.70',
|
kotlin : '1.3.70',
|
||||||
|
|
Loading…
Reference in a new issue