5
5
6
6
package com.wireguard.android.preference
7
7
8
- import android.app.AlertDialog
9
8
import android.content.Context
10
9
import android.content.Intent
11
10
import android.net.Uri
12
11
import android.util.AttributeSet
13
12
import android.widget.Toast
14
13
import androidx.preference.Preference
14
+ import com.google.android.material.dialog.MaterialAlertDialogBuilder
15
15
import com.wireguard.android.BuildConfig
16
16
import com.wireguard.android.R
17
17
import com.wireguard.android.util.ErrorMessages
@@ -22,13 +22,15 @@ class DonatePreference(context: Context, attrs: AttributeSet?) : Preference(cont
22
22
override fun getTitle () = context.getString(R .string.donate_title)
23
23
24
24
override fun onClick () {
25
+ /* Google Play Store forbids links to our donation page. */
25
26
if (BuildConfig .IS_GOOGLE_PLAY ) {
26
- AlertDialog . Builder (context)
27
+ MaterialAlertDialogBuilder (context)
27
28
.setTitle(R .string.donate_title)
28
29
.setMessage(R .string.donate_google_play_disappointment)
29
30
.show()
30
31
return
31
32
}
33
+
32
34
val intent = Intent (Intent .ACTION_VIEW )
33
35
intent.data = Uri .parse(" https://www.wireguard.com/donations/" )
34
36
try {
@@ -37,4 +39,4 @@ class DonatePreference(context: Context, attrs: AttributeSet?) : Preference(cont
37
39
Toast .makeText(context, ErrorMessages [e], Toast .LENGTH_SHORT ).show()
38
40
}
39
41
}
40
- }
42
+ }
0 commit comments