Skip to content

Commit

Permalink
Merge pull request #428 from mysteriumnetwork/bugfix/Fix_filter_dropping
Browse files Browse the repository at this point in the history
Fix bug with wrong filter id
  • Loading branch information
ArtemHryhorovGeniusee authored Jul 15, 2021
2 parents 8b08113 + 577a588 commit 762c00b
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 18 deletions.
2 changes: 2 additions & 0 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,8 @@ dependencies {
//Google
implementation 'com.google.android.play:core:1.10.0'
implementation "com.google.android.play:core-ktx:1.8.1"
implementation 'com.google.android.gms:play-services-safetynet:17.0.1'
implementation 'com.google.android.gms:play-services-base:17.6.0'
implementation "com.google.android.material:material:1.3.0-alpha01"

//Koin
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,13 @@ package updated.mysterium.vpn.common.extensions
import android.content.Context
import android.content.res.Configuration
import android.content.res.Configuration.UI_MODE_NIGHT_YES
import com.google.android.gms.common.GoogleApiAvailability

fun Context.isDarkThemeOn(): Boolean {
return resources.configuration.uiMode and Configuration.UI_MODE_NIGHT_MASK == UI_MODE_NIGHT_YES
}

fun Context.isGooglePlayAvailable(): Boolean {
val googlePlayResult = GoogleApiAvailability.getInstance().isGooglePlayServicesAvailable(this)
return googlePlayResult == com.google.android.gms.common.ConnectionResult.SUCCESS
}
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,8 @@ class HomeSelectionActivity : BaseActivity() {
binding.loader.visibility = View.INVISIBLE
binding.filterCardView.visibility = View.VISIBLE
binding.countriesCardView.visibility = View.VISIBLE
showFilteredList(filtersAdapter.selectedItem?.filterId ?: 0)
val savedFilterId = viewModel.getPreviousFilterId()
showFilteredList(savedFilterId)
}
}
viewModel.connectionState.observe(this, {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import updated.mysterium.vpn.App
import updated.mysterium.vpn.analitics.AnalyticEvent
import updated.mysterium.vpn.analitics.AnalyticWrapper
import updated.mysterium.vpn.common.animation.OnAnimationCompletedListener
import updated.mysterium.vpn.common.extensions.isGooglePlayAvailable
import updated.mysterium.vpn.common.network.NetworkUtil
import updated.mysterium.vpn.model.manual.connect.ConnectionState
import updated.mysterium.vpn.model.pushy.PushyTopic
Expand Down Expand Up @@ -131,27 +132,31 @@ class SplashActivity : BaseActivity() {
}

private fun checkForGoogleMarketUpdates() {
try {
if (BuildConfig.DEBUG) {
startLoading()
} else {
appUpdateManager.appUpdateInfo.addOnSuccessListener {
if (it.updateAvailability() == UpdateAvailability.UPDATE_AVAILABLE) {
showNewVersionAvailablePopUp()
} else {
if (this.isGooglePlayAvailable()) {
try {
if (BuildConfig.DEBUG) {
startLoading()
} else {
appUpdateManager.appUpdateInfo.addOnSuccessListener {
if (it.updateAvailability() == UpdateAvailability.UPDATE_AVAILABLE) {
showNewVersionAvailablePopUp()
} else {
startLoading()
}
}
appUpdateManager.appUpdateInfo.addOnFailureListener {
// User does not has Google Play Store
startLoading()
}
}
appUpdateManager.appUpdateInfo.addOnFailureListener {
// User does not has Google Play Store
startLoading()
}
} catch (exception: Exception) {
// Some kind of exception may occur due to the lack of a Play Store
// or for some other similar reason. Since this is not critical for
// the app flow, just let the user go further
Log.e(TAG, exception.localizedMessage ?: exception.toString())
startLoading()
}
} catch (exception: Exception) {
// Some kind of exception may occur due to the lack of a Play Store
// or for some other similar reason. Since this is not critical for
// the app flow, just let the user go further
Log.e(TAG, exception.localizedMessage ?: exception.toString())
} else {
startLoading()
}
}
Expand Down

0 comments on commit 762c00b

Please sign in to comment.