Add in-app sponsor support
This commit is contained in:
@@ -103,6 +103,11 @@ class SettingsFragment : Fragment() {
|
||||
binding.openDebugButton.setOnClickListener {
|
||||
startActivity(Intent(requireContext(), DebugActivity::class.java))
|
||||
}
|
||||
binding.startSponserButton.setOnClickListener {
|
||||
Vendor.startSponsor(requireActivity()) {
|
||||
activity.launchCustomTab("https://sekai.icu/sponsor/")
|
||||
}
|
||||
}
|
||||
lifecycleScope.launch(Dispatchers.IO) {
|
||||
reloadSettings()
|
||||
}
|
||||
|
||||
@@ -5,5 +5,5 @@ import android.app.Activity
|
||||
interface VendorInterface {
|
||||
fun checkUpdateAvailable(): Boolean
|
||||
fun checkUpdate(activity: Activity, byUser: Boolean)
|
||||
|
||||
fun startSponsor(activity: Activity, fallback: () -> Unit)
|
||||
}
|
||||
@@ -348,6 +348,53 @@
|
||||
|
||||
</com.google.android.material.card.MaterialCardView>
|
||||
|
||||
<com.google.android.material.card.MaterialCardView
|
||||
style="?attr/materialCardViewElevatedStyle"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="16dp">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:paddingStart="16dp"
|
||||
android:paddingTop="16dp"
|
||||
android:paddingEnd="16dp"
|
||||
android:paddingBottom="8dp">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/sponsor"
|
||||
android:textAppearance="?attr/textAppearanceTitleLarge">
|
||||
|
||||
</TextView>
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp"
|
||||
android:text="@string/sponsor_message" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_vertical|end"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<Button
|
||||
android:id="@+id/startSponserButton"
|
||||
style="@style/Widget.Material3.Button.TextButton"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/action_start" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</com.google.android.material.card.MaterialCardView>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
@@ -140,6 +140,10 @@
|
||||
<string name="vpn_app_type_other">Other</string>
|
||||
<string name="vpn_core_type_unknown">Unknown</string>
|
||||
<string name="no_updates_available">No updates available</string>
|
||||
|
||||
<string name="sponsor">Sponsor</string>
|
||||
<string name="sponsor_play">Sponsor via Play Store</string>
|
||||
<string name="sponsor_message">If I\'ve defended your modern life, please consider sponsoring me.</string>
|
||||
<string name="other_methods">Other methods</string>
|
||||
<string name="action_start">Start</string>
|
||||
|
||||
</resources>
|
||||
Reference in New Issue
Block a user