-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement Crash reporting on/off preference
- Loading branch information
1 parent
806d9e4
commit cca30cb
Showing
12 changed files
with
505 additions
and
350 deletions.
There are no files selected for viewing
85 changes: 85 additions & 0 deletions
85
app/src/main/java/dev/arkbuilders/arkmemo/ui/fragments/AboutFragment.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
package dev.arkbuilders.arkmemo.ui.fragments | ||
|
||
import android.os.Bundle | ||
import android.view.View | ||
import androidx.fragment.app.Fragment | ||
import by.kirich1409.viewbindingdelegate.viewBinding | ||
import dev.arkbuilders.arkmemo.BuildConfig | ||
import dev.arkbuilders.arkmemo.R | ||
import dev.arkbuilders.arkmemo.databinding.FragmentAboutBinding | ||
import dev.arkbuilders.arkmemo.ui.dialogs.CommonActionDialog | ||
import dev.arkbuilders.arkmemo.ui.dialogs.DonateDialog | ||
import dev.arkbuilders.arkmemo.utils.gone | ||
import dev.arkbuilders.arkmemo.utils.openLink | ||
import dev.arkbuilders.arkmemo.utils.visible | ||
|
||
open class AboutFragment : Fragment(R.layout.fragment_about) { | ||
val binding by viewBinding(FragmentAboutBinding::bind) | ||
|
||
override fun onViewCreated( | ||
view: View, | ||
savedInstanceState: Bundle?, | ||
) { | ||
super.onViewCreated(view, savedInstanceState) | ||
|
||
binding.toolbarCustom.ivBack.setOnClickListener { | ||
activity?.onBackPressedDispatcher?.onBackPressed() | ||
} | ||
binding.toolbarCustom.tvTitle.text = getString(R.string.about) | ||
binding.toolbarCustom.tvTitle.visible() | ||
|
||
binding.toolbarCustom.tvRightActionText.gone() | ||
binding.toolbarCustom.ivRightActionIcon.gone() | ||
|
||
binding.tvAppVersion.text = getString(R.string.setting_app_version, BuildConfig.VERSION_NAME) | ||
|
||
initSettingActions() | ||
} | ||
|
||
private fun initSettingActions() { | ||
binding.tvWebsite.setOnClickListener { | ||
context?.openLink("https://www.ark-builders.dev/") | ||
} | ||
|
||
binding.tvTelegram.setOnClickListener { | ||
context?.openLink("https://t.me/ark_builders") | ||
} | ||
|
||
binding.tvDiscord.setOnClickListener { | ||
context?.openLink("https://discord.gg/tPUJTxud") | ||
} | ||
|
||
binding.tvDonatePatreon.setOnClickListener { | ||
context?.openLink("https://www.patreon.com/ARKBuilders") | ||
} | ||
|
||
binding.tvDonateCoffee.setOnClickListener { | ||
context?.openLink("https://buymeacoffee.com/arkbuilders") | ||
} | ||
|
||
binding.tvDonateBtc.setOnClickListener { | ||
DonateDialog( | ||
walletAddress = "bc1qx8n9r4uwpgrhgnamt2uew53lmrxd8tuevp7lv5", | ||
title = getString(R.string.setting_donate_btc), | ||
onPositiveClick = { | ||
}, | ||
).show(childFragmentManager, CommonActionDialog.TAG) | ||
} | ||
|
||
binding.tvDonateEth.setOnClickListener { | ||
DonateDialog( | ||
walletAddress = "0x9765C5aC38175BFbd2dC7a840b63e50762B80a1b", | ||
title = getString(R.string.setting_donate_eth), | ||
onPositiveClick = { | ||
}, | ||
).show(childFragmentManager, CommonActionDialog.TAG) | ||
} | ||
|
||
binding.tvDiscoverIssues.setOnClickListener { | ||
context?.openLink("https://www.ark-builders.dev/contribute/?tab=goodFirstIssue") | ||
} | ||
|
||
binding.tvBounties.setOnClickListener { | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
app/src/main/java/dev/arkbuilders/arkmemo/ui/viewmodels/SettingsViewModel.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package dev.arkbuilders.arkmemo.ui.viewmodels | ||
|
||
import androidx.lifecycle.ViewModel | ||
import androidx.lifecycle.viewModelScope | ||
import dagger.hilt.android.lifecycle.HiltViewModel | ||
import dev.arkbuilders.arkmemo.preferences.MemoPreferences | ||
import kotlinx.coroutines.launch | ||
import javax.inject.Inject | ||
|
||
@HiltViewModel | ||
class SettingsViewModel | ||
@Inject | ||
constructor( | ||
private val memoPreferences: MemoPreferences, | ||
) : ViewModel() { | ||
fun storeCrashReportEnabled(enabled: Boolean) { | ||
viewModelScope.launch { | ||
memoPreferences.storeCrashReportEnabled(enabled) | ||
} | ||
} | ||
|
||
fun getCrashReportEnabled(): Boolean { | ||
return memoPreferences.getCrashReportEnabled() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:height="24dp" android:tint="#000000" android:viewportHeight="24" android:viewportWidth="24" android:width="24dp"> | ||
|
||
<path android:fillColor="@android:color/white" android:pathData="M20,8h-2.81c-0.45,-0.78 -1.07,-1.45 -1.82,-1.96L17,4.41 15.59,3l-2.17,2.17C12.96,5.06 12.49,5 12,5c-0.49,0 -0.96,0.06 -1.41,0.17L8.41,3 7,4.41l1.62,1.63C7.88,6.55 7.26,7.22 6.81,8L4,8v2h2.09c-0.05,0.33 -0.09,0.66 -0.09,1v1L4,12v2h2v1c0,0.34 0.04,0.67 0.09,1L4,16v2h2.81c1.04,1.79 2.97,3 5.19,3s4.15,-1.21 5.19,-3L20,18v-2h-2.09c0.05,-0.33 0.09,-0.66 0.09,-1v-1h2v-2h-2v-1c0,-0.34 -0.04,-0.67 -0.09,-1L20,10L20,8zM14,16h-4v-2h4v2zM14,12h-4v-2h4v2z"/> | ||
|
||
</vector> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:height="24dp" android:tint="#000000" android:viewportHeight="24" android:viewportWidth="24" android:width="24dp"> | ||
|
||
<path android:fillColor="@android:color/white" android:pathData="M22.7,19l-9.1,-9.1c0.9,-2.3 0.4,-5 -1.5,-6.9 -2,-2 -5,-2.4 -7.4,-1.3L9,6 6,9 1.6,4.7C0.4,7.1 0.9,10.1 2.9,12.1c1.9,1.9 4.6,2.4 6.9,1.5l9.1,9.1c0.4,0.4 1,0.4 1.4,0l2.3,-2.3c0.5,-0.4 0.5,-1.1 0.1,-1.4z"/> | ||
|
||
</vector> |
Oops, something went wrong.