Skip to content

Commit

Permalink
Fix a crash into PreferenceFragment
Browse files Browse the repository at this point in the history
  • Loading branch information
benoitletondor committed Jul 9, 2019
1 parent cdb713e commit 9b72060
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
4 changes: 2 additions & 2 deletions Android/EasyBudget/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ android {
applicationId "com.benoitletondor.easybudgetapp"
minSdkVersion 21
targetSdkVersion 29
versionCode 62
versionName "2.0.9"
versionCode 63
versionName "2.0.10"
vectorDrawables.useSupportLibrary = true
}
buildTypes {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ class PreferencesFragment : PreferenceFragmentCompat() {
filter.addAction(INTENT_IAB_STATUS_CHANGED)
filter.addAction(USER_GONE_PREMIUM_INTENT)
receiver = object : BroadcastReceiver() {
override fun onReceive(context: Context, intent: Intent) {
override fun onReceive(appContext: Context, intent: Intent) {
if (SelectCurrencyFragment.CURRENCY_SELECTED_INTENT == intent.action && selectCurrencyDialog != null) {
findPreference<Preference>(resources.getString(R.string.setting_category_currency_change_button_key))?.let { currencyPreference ->
setCurrencyPreferenceTitle(currencyPreference)
Expand All @@ -316,11 +316,13 @@ class PreferencesFragment : PreferenceFragmentCompat() {
}

} else if (USER_GONE_PREMIUM_INTENT == intent.action) {
AlertDialog.Builder(context)
.setTitle(R.string.iab_purchase_success_title)
.setMessage(R.string.iab_purchase_success_message)
.setPositiveButton(R.string.ok) { dialog, _ -> dialog.dismiss() }
.show()
context?.let { context ->
AlertDialog.Builder(context)
.setTitle(R.string.iab_purchase_success_title)
.setMessage(R.string.iab_purchase_success_message)
.setPositiveButton(R.string.ok) { dialog, _ -> dialog.dismiss() }
.show()
}

refreshPremiumPreference()
}
Expand Down

0 comments on commit 9b72060

Please sign in to comment.