Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
# Changelog

## [Unreleased]

### Added

- Social networks links (Telegram, X, Discord)

### Changed

- Replaced system dialogs with new gradient style dialogs

## [1.6.0] - 2025-02-20

### Changed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ class SendTokenActivity : BaseActivity(R.layout.activity_send_token, R.string.ci
}

private fun initViews() {
binding.amount.hint = CurrencyUtil.formatGTU(BigInteger.ZERO)
binding.amount.hint = BigInteger.ZERO.toString()
binding.atDisposal.text = CurrencyUtil.formatGTU(
viewModel.sendTokenData.account?.balanceAtDisposal ?: BigInteger.ZERO
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,16 @@ class AboutActivity : BaseActivity(
binding.termsTextView.handleUrlClicks(::onUrlClicked)
binding.privacyTextView.handleUrlClicks(::onUrlClicked)

binding.telegramButton.setOnClickListener {
openSocial(TELEGRAM_LINK)
}
binding.twitterButton.setOnClickListener {
openSocial(TWITTER_LINK)
}
binding.discordButton.setOnClickListener {
openSocial(DISCORD_LINK)
}

hideActionBarBack(isVisible = true)
}

Expand All @@ -78,4 +88,15 @@ class AboutActivity : BaseActivity(
override fun loggedOut() {
// No need to show auth, there is no wallet-related logic on this screen.
}

private fun openSocial(link: String) {
val browserIntent = Intent(Intent.ACTION_VIEW, Uri.parse(link))
ContextCompat.startActivity(this, browserIntent, null)
}

companion object {
private const val TELEGRAM_LINK = "https://t.me/ConcordiumNews"
private const val TWITTER_LINK = "https://x.com/ConcordiumNet"
private const val DISCORD_LINK = "https://discord.com/invite/GpKGE2hCFx"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
package com.concordium.wallet.ui.more.dialog

import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.appcompat.app.AppCompatDialogFragment
import androidx.fragment.app.setFragmentResult
import com.concordium.wallet.R
import com.concordium.wallet.databinding.DialogClearWalletConnectBinding

class ClearWalletConnectDialog : AppCompatDialogFragment() {

override fun getTheme(): Int = R.style.CCX_Dialog

private lateinit var binding: DialogClearWalletConnectBinding

override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
): View {
binding = DialogClearWalletConnectBinding.inflate(inflater, container, false)
return binding.root
}

override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)

listOf(binding.cancelButton, binding.closeButton).forEach {
it.setOnClickListener {
setFragmentResult(
ACTION_REQUEST,
setResultBundle(false)
)
dismiss()
}
}

binding.confirmButton.setOnClickListener {
setFragmentResult(
ACTION_REQUEST,
setResultBundle(true)
)
dismiss()
}
}

companion object {
const val TAG = "ClearWalletConnectDialog"
const val ACTION_REQUEST = "clear_action"
private const val IS_CLEARING = "is_clearing"

private fun setResultBundle(isClearing: Boolean) = Bundle().apply {
putBoolean(IS_CLEARING, isClearing)
}

fun getResult(bundle: Bundle): Boolean = bundle.getBoolean(IS_CLEARING, false)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
package com.concordium.wallet.ui.more.dialog

import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.appcompat.app.AppCompatDialogFragment
import androidx.fragment.app.setFragmentResult
import com.concordium.wallet.R
import com.concordium.wallet.databinding.DialogRemoveWalletBinding

class RemoveWalletDialog : AppCompatDialogFragment() {

override fun getTheme(): Int = R.style.CCX_Dialog

private lateinit var binding: DialogRemoveWalletBinding

override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
): View {
binding = DialogRemoveWalletBinding.inflate(inflater, container, false)
return binding.root
}

override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)

listOf(binding.cancelButton, binding.closeButton).forEach {
it.setOnClickListener {
setFragmentResult(
ACTION_REQUEST,
setResultBundle(false)
)
dismiss()
}
}

binding.confirmButton.setOnClickListener {
setFragmentResult(
ACTION_REQUEST,
setResultBundle(true)
)
dismiss()
}
}

companion object {
const val TAG = "RemoveWalletDialog"
const val ACTION_REQUEST = "remove_action"
private const val IS_REMOVING = "is_removing"

private fun setResultBundle(isRemoving: Boolean) = Bundle().apply {
putBoolean(IS_REMOVING, isRemoving)
}

fun getResult(bundle: Bundle): Boolean = bundle.getBoolean(IS_REMOVING, false)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,8 @@ class ExportAccountKeysActivity : BaseActivity(
ClipData.newPlainText("key", viewModel.accountDataKeys.level0.keys.keys.signKey)
clipboardManager.setPrimaryClip(clipData)

binding.copyButton.visibility = View.INVISIBLE
binding.copyButtonTextView.text = getString(R.string.setup_wallet_seed_phrase_copied)
binding.copyButtonTextView.setCompoundDrawablesRelativeWithIntrinsicBounds(
binding.copyButton.text = getString(R.string.setup_wallet_seed_phrase_copied)
binding.copyButton.setCompoundDrawablesRelativeWithIntrinsicBounds(
ContextCompat.getDrawable(this, R.drawable.cryptox_ico_check_16),
null,
null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import com.concordium.wallet.BuildConfig
import com.concordium.wallet.R
import com.concordium.wallet.databinding.FragmentMoreOverviewBinding
import com.concordium.wallet.extension.collect
import com.concordium.wallet.extension.showSingle
import com.concordium.wallet.ui.MainViewModel
import com.concordium.wallet.ui.base.BaseActivity
import com.concordium.wallet.ui.base.BaseFragment
Expand All @@ -20,6 +21,8 @@ import com.concordium.wallet.ui.identity.identitiesoverview.IdentitiesOverviewAc
import com.concordium.wallet.ui.more.about.AboutActivity
import com.concordium.wallet.ui.more.alterpassword.AlterPasswordActivity
import com.concordium.wallet.ui.more.dev.DevActivity
import com.concordium.wallet.ui.more.dialog.ClearWalletConnectDialog
import com.concordium.wallet.ui.more.dialog.RemoveWalletDialog
import com.concordium.wallet.ui.more.export.ExportActivity
import com.concordium.wallet.ui.more.import.ImportActivity
import com.concordium.wallet.ui.more.notifications.NotificationsPreferencesActivity
Expand All @@ -32,7 +35,6 @@ import com.concordium.wallet.ui.seed.reveal.SavedSeedPhraseRevealActivity
import com.concordium.wallet.ui.seed.reveal.SavedSeedRevealActivity
import com.concordium.wallet.ui.tokens.provider.NFTActivity
import com.concordium.wallet.ui.welcome.WelcomeActivity
import com.google.android.material.dialog.MaterialAlertDialogBuilder

class MoreOverviewFragment : BaseFragment() {

Expand Down Expand Up @@ -65,6 +67,7 @@ class MoreOverviewFragment : BaseFragment() {

initializeViews()
subscribeToEvents()
initObservers()

(requireActivity() as BaseActivity).hideLeftPlus(isVisible = false)
}
Expand Down Expand Up @@ -208,7 +211,7 @@ class MoreOverviewFragment : BaseFragment() {
clearWalletConnectAndRestart()
}

binding.removeWalletLayout.setOnClickListener {
binding.eraseDataLayout.setOnClickListener {
eraseDataAndExit()
}
}
Expand All @@ -235,6 +238,33 @@ class MoreOverviewFragment : BaseFragment() {
}
}
}

private fun initObservers() {
parentFragmentManager.setFragmentResultListener(
ClearWalletConnectDialog.ACTION_REQUEST,
this
) { _, bundle ->
val isClearWalletConnect = ClearWalletConnectDialog.getResult(bundle)
if (isClearWalletConnect) {
viewModel.deleteWCDatabaseAndExit()

Toast.makeText(
requireContext(),
R.string.wallet_connect_database_cleared,
Toast.LENGTH_SHORT
).show()
}
}

parentFragmentManager.setFragmentResultListener(
RemoveWalletDialog.ACTION_REQUEST,
this
) { _, bundle ->
if (RemoveWalletDialog.getResult(bundle)) {
viewModel.onEraseContinueClicked()
}
}
}
//endregion

//region Control/UI
Expand All @@ -249,41 +279,17 @@ class MoreOverviewFragment : BaseFragment() {
}

private fun clearWalletConnectAndRestart() {
showConfirmDeleteWalletConnect()
}

private fun showConfirmDeleteWalletConnect() {
val builder = MaterialAlertDialogBuilder(requireContext())
builder.setTitle(R.string.wallet_connect_clear_data_warning_title)
builder.setMessage(getString(R.string.wallet_connect_clear_data_warning_message))
builder.setPositiveButton(getString(R.string.wallet_connect_clear_data_warning_ok)) { _, _ ->
viewModel.deleteWCDatabaseAndExit()
Toast.makeText(
requireContext(),
R.string.wallet_connect_database_cleared,
Toast.LENGTH_SHORT
).show()
}
builder.setNegativeButton(getString(R.string.wallet_connect_clear_data_warning_cancel)) { dialog, _ ->
dialog.dismiss()
}
builder.create().show()
ClearWalletConnectDialog().showSingle(
parentFragmentManager,
ClearWalletConnectDialog.TAG
)
}

private fun eraseDataAndExit() {
showConfirmEraseData()
}

private fun showConfirmEraseData() {
MaterialAlertDialogBuilder(requireContext())
.setTitle(R.string.settings_overview_erase_data_confirmation_title)
.setMessage(getString(R.string.settings_overview_erase_wallet_confirmation_message))
.setPositiveButton(getString(R.string.settings_overview_erase_data_continue)) { _, _ ->

viewModel.onEraseContinueClicked()
}
.setNegativeButton(getString(R.string.wallet_connect_clear_data_warning_cancel), null)
.show()
RemoveWalletDialog().showSingle(
parentFragmentManager,
RemoveWalletDialog.TAG
)
}

private fun gotoDevConfig() {
Expand Down
Loading