|
|
|
|
@ -12,6 +12,7 @@ import android.view.ViewGroup |
|
|
|
|
import android.widget.Toast |
|
|
|
|
import androidx.core.content.FileProvider |
|
|
|
|
import androidx.recyclerview.widget.LinearLayoutManager |
|
|
|
|
import com.google.android.play.core.review.ReviewManagerFactory |
|
|
|
|
import io.realm.Realm |
|
|
|
|
import kotlinx.android.synthetic.main.fragment_settings.* |
|
|
|
|
import net.pokeranalytics.android.BuildConfig |
|
|
|
|
@ -27,7 +28,6 @@ import net.pokeranalytics.android.ui.adapter.RowRepresentableAdapter |
|
|
|
|
import net.pokeranalytics.android.ui.adapter.RowRepresentableDelegate |
|
|
|
|
import net.pokeranalytics.android.ui.adapter.StaticRowRepresentableDataSource |
|
|
|
|
import net.pokeranalytics.android.ui.extensions.openContactMail |
|
|
|
|
import net.pokeranalytics.android.ui.extensions.openPlayStorePage |
|
|
|
|
import net.pokeranalytics.android.ui.extensions.openUrl |
|
|
|
|
import net.pokeranalytics.android.ui.fragment.components.RealmFragment |
|
|
|
|
import net.pokeranalytics.android.ui.modules.bankroll.BankrollActivity |
|
|
|
|
@ -146,7 +146,7 @@ class SettingsFragment : RealmFragment(), RowRepresentableDelegate, StaticRowRep |
|
|
|
|
this.openPlaystoreAccount() |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
SettingRow.RATE_APP -> parentActivity?.openPlayStorePage() |
|
|
|
|
SettingRow.RATE_APP -> showReviewManager() |
|
|
|
|
SettingRow.CONTACT_US -> parentActivity?.openContactMail(R.string.contact) |
|
|
|
|
SettingRow.BUG_REPORT -> parentActivity?.openContactMail(R.string.bug_report_subject, Realm.getDefaultInstance().path) |
|
|
|
|
SettingRow.CURRENCY -> CurrenciesActivity.newInstanceForResult(this@SettingsFragment, RequestCode.CURRENCY.value) |
|
|
|
|
@ -172,6 +172,25 @@ class SettingsFragment : RealmFragment(), RowRepresentableDelegate, StaticRowRep |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private fun showReviewManager() { |
|
|
|
|
|
|
|
|
|
val manager = ReviewManagerFactory.create(requireContext()) |
|
|
|
|
val request = manager.requestReviewFlow() |
|
|
|
|
request.addOnCompleteListener { request -> |
|
|
|
|
if (request.isSuccessful) { |
|
|
|
|
// We got the ReviewInfo object |
|
|
|
|
val reviewInfo = request.result |
|
|
|
|
val flow = manager.launchReviewFlow(requireActivity(), reviewInfo) |
|
|
|
|
flow.addOnCompleteListener { |
|
|
|
|
// completed |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
// There was some problem, continue regardless of the result. |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
override fun onRowValueChanged(value: Any?, row: RowRepresentable) { |
|
|
|
|
when (row) { |
|
|
|
|
SettingRow.STOP_NOTIFICATION -> { |
|
|
|
|
|