Skip to content

Commit

Permalink
Merge branch 'master' into feature-topup
Browse files Browse the repository at this point in the history
  • Loading branch information
HashEngineering authored Jan 15, 2025
2 parents df2d5bd + 45d9743 commit 95a0935
Show file tree
Hide file tree
Showing 43 changed files with 1,257 additions and 760 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/manual_distribution.yml
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ jobs:
GC_STORAGE_SERVICE_ACCOUNT_KEY_JSON: ${{secrets.GC_STORAGE_SERVICE_ACCOUNT_KEY_JSON}}

- name: Test
run: bundle exec fastlane test flavor:"${{ github.event.inputs.flavor }}" type:"${{ github.event.inputs.type }}" versioncode:"${{ env.build_number }}" storepass:"${{ secrets.SIGNING_STORE_PASS }}"
run: bundle exec fastlane test flavor:"" type:"debug"

- name: Build and Firebase Distribution
run: bundle exec fastlane build_distribute flavor:"${{ github.event.inputs.flavor }}" type:"${{ github.event.inputs.type }}" versioncode:"${{ env.build_number }}" storepass:"${{ secrets.SIGNING_STORE_PASS }}" comment:"${{ github.event.inputs.taskID }}" appid:"${{ env.firebase_app_id }}" testgroup:"qa"
82 changes: 0 additions & 82 deletions common/src/main/res/values/styles.xml
Original file line number Diff line number Diff line change
Expand Up @@ -961,87 +961,6 @@
<item name="android:theme">@style/PrimaryButtonTheme.Large.LightBlue</item>
</style>

<style name="VoteButtonTheme">
<item name="cornerRadius">7dp</item>
<item name="titleTextColor">@color/white</item>
<item name="backgroundColor">@color/content_primary</item>
<item name="strokeColor">@color/content_primary</item>
<item name="rippleColor">@color/ripple_light</item>
<item name="disabledBackgroundColor">@color/disabled_button_bg</item>
</style>

<style name="VoteButton" parent="Widget.AppCompat.Button.Borderless">
<item name="fontFamily">@font/inter_semibold</item>
<item name="android:textColor">@color/button_text</item>
<item name="android:background">@drawable/rounded_ripple_background</item>
<item name="android:theme">@style/VoteButtonTheme</item>
<item name="android:textSize">12sp</item>
<item name="android:textAllCaps">false</item>
<item name="android:paddingStart">8dp</item>
<item name="android:paddingEnd">8dp</item>
<item name="android:paddingTop">4dp</item>
<item name="android:paddingBottom">4dp</item>
<item name="android:minHeight">40dp</item>
</style>

<style name="Button.Vote" parent="Widget.AppCompat.Button.Borderless">
<item name="fontFamily">@font/inter_semibold</item>
<item name="android:textColor">@color/button_text</item>
<item name="android:background">@drawable/rounded_ripple_background</item>
<item name="android:theme">@style/VoteButtonTheme</item>
<item name="android:textSize">12sp</item>
<item name="android:textAllCaps">false</item>
<item name="android:paddingStart">8dp</item>
<item name="android:paddingEnd">8dp</item>
<item name="android:paddingTop">4dp</item>
<item name="android:paddingBottom">4dp</item>
<item name="android:minHeight">40dp</item>
</style>

<style name="VoteButton.LightBlue">
<item name="backgroundColor">@color/dash_blue_0.05</item>
<item name="strokeColor">@android:color/transparent</item>
<item name="titleTextColor">@color/dash_blue</item>
<item name="rippleColor">@color/button_ripple_color</item>
</style>

<style name="Button.Vote.LightBlue">
<item name="android:theme">@style/VoteButton.LightBlue</item>
</style>

<style name="VoteButton.LightRed">
<item name="backgroundColor">@color/red_0.05</item>
<item name="strokeColor">@android:color/transparent</item>
<item name="titleTextColor">@color/red</item>
<item name="rippleColor">@color/button_ripple_color</item>
</style>

<style name="Button.Vote.LightRed">
<item name="android:theme">@style/VoteButton.LightRed</item>
</style>

<style name="VoteButton.Blue">
<item name="backgroundColor">@color/dash_blue</item>
<item name="strokeColor">@android:color/transparent</item>
<item name="titleTextColor">@color/dash_white</item>
<item name="rippleColor">@color/button_ripple_color</item>
</style>

<style name="Button.Vote.Blue">
<item name="android:theme">@style/VoteButton.Blue</item>
</style>

<style name="VoteButton.Red">
<item name="backgroundColor">@color/red</item>
<item name="strokeColor">@android:color/transparent</item>
<item name="titleTextColor">@color/dash_white</item>
<item name="rippleColor">@color/button_ripple_color</item>
</style>

<style name="Button.Vote.Red">
<item name="android:theme">@style/VoteButton.Red</item>
</style>

<style name="Button.Primary.Small">
<item name="android:textSize">13sp</item>
<item name="android:minHeight">30dp</item>
Expand All @@ -1064,7 +983,6 @@
<item name="android:theme">@style/PrimaryButtonTheme.Small.Round</item>
</style>


<style name="Button.Primary.ExtraSmall">
<item name="android:theme">@style/PrimaryButtonTheme.ExtraSmall</item>
<item name="android:textSize">11sp</item>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ package org.dash.wallet.integrations.coinbase.model

import android.os.Parcelable
import com.google.gson.Gson
import kotlinx.parcelize.IgnoredOnParcel
import kotlinx.parcelize.Parcelize
import org.dash.wallet.integrations.coinbase.CoinbaseConstants

enum class CoinbaseErrorType {
NONE,
Expand Down Expand Up @@ -58,4 +60,7 @@ data class CoinbaseErrorResponse(
data class Error(
val id: String? = null,
val message: String? = null
) : Parcelable
) : Parcelable {
@IgnoredOnParcel
val isInvalidRequest = id == CoinbaseConstants.ERROR_ID_INVALID_REQUEST
}
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ interface CoinBaseRepositoryInt {
suspend fun sendFundsToWallet(
sendTransactionToWalletParams: SendTransactionToWalletParams,
api2FATokenVersion: String?
): ResponseResource<SendTransactionToWalletResponse?>
): SendTransactionToWalletResponse?
suspend fun swapTrade(tradesRequest: TradesRequest): ResponseResource<SwapTradeUIModel>
suspend fun commitSwapTrade(buyOrderId: String): ResponseResource<SwapTradeUIModel>
suspend fun completeCoinbaseAuthentication(authorizationCode: String): Boolean
Expand Down Expand Up @@ -211,9 +211,9 @@ class CoinBaseRepository @Inject constructor(
override suspend fun sendFundsToWallet(
sendTransactionToWalletParams: SendTransactionToWalletParams,
api2FATokenVersion: String?
) = safeApiCall {
): SendTransactionToWalletResponse? {
val userAccountId = config.get(CoinbaseConfig.USER_ACCOUNT_ID) ?: ""
servicesApi.sendCoinsToWallet(
return servicesApi.sendCoinsToWallet(
accountId = userAccountId,
sendTransactionToWalletParams = sendTransactionToWalletParams,
api2FATokenVersion = api2FATokenVersion
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ import androidx.core.widget.doOnTextChanged
import androidx.fragment.app.Fragment
import androidx.fragment.app.viewModels
import androidx.navigation.fragment.findNavController
import androidx.navigation.fragment.navArgs
import dagger.hilt.android.AndroidEntryPoint
import org.dash.wallet.common.ui.LockScreenAware
import org.dash.wallet.common.util.Constants
import org.dash.wallet.common.ui.dialogs.AdaptiveDialog
import org.dash.wallet.common.ui.enter_amount.NumericKeyboardView
import org.dash.wallet.common.ui.setRoundedBackground
Expand All @@ -47,32 +47,31 @@ import org.dash.wallet.integrations.coinbase.viewmodels.TransactionState

@AndroidEntryPoint
class EnterTwoFaCodeFragment : Fragment(R.layout.enter_two_fa_code_fragment), LockScreenAware {

private val binding by viewBinding(EnterTwoFaCodeFragmentBinding::bind)
private val args by navArgs<EnterTwoFaCodeFragmentArgs>()
private val viewModel by viewModels<EnterTwoFaCodeViewModel>()
private lateinit var loadingDialog: AdaptiveDialog
private var onBackPressedCallback: OnBackPressedCallback? = null

override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
handleBackPress()
val params = arguments?.let { EnterTwoFaCodeFragmentArgs.fromBundle(it).transactionParams }
viewModel.sendInitialTransactionToSMSTwoFactorAuth(params?.params)
viewModel.sendInitialTransactionToSMSTwoFactorAuth(args.transactionParams.params)

binding.verifyBtn.setOnClickListener {
viewModel.verifyUserAndCompleteTransaction(params?.params, binding.enterCodeField.text.toString())
viewModel.verifyUserAndCompleteTransaction(binding.enterCodeField.text.toString())
}
binding.keyboardView.onKeyboardActionListener = keyboardActionListener

viewModel.loadingState.observe(viewLifecycleOwner) {
setLoadingState(it)
}

viewModel.transactionState.observe(viewLifecycleOwner){ state ->
params?.let { setTransactionState(it.type, state) }
viewModel.transactionState.observe(viewLifecycleOwner) { state ->
setTransactionState(args.transactionParams.type, state)
}

viewModel.twoFaErrorState.observe(viewLifecycleOwner){
viewModel.twoFaErrorState.observe(viewLifecycleOwner) {
binding.enterCodeField.setRoundedBackground(org.dash.wallet.common.R.style.InputErrorBackground)
binding.incorrectCodeGroup.isVisible = true
binding.enterCodeDetails.isVisible = false
Expand All @@ -93,21 +92,21 @@ class EnterTwoFaCodeFragment : Fragment(R.layout.enter_two_fa_code_fragment), Lo
val intent = Intent(ACTION_VIEW)
intent.data = Uri.parse(helpUrl)
startActivity(intent)
}catch (e: ActivityNotFoundException){
}catch (e: ActivityNotFoundException) {
Toast.makeText(requireActivity(), helpUrl, Toast.LENGTH_SHORT).show()
}
}

private fun setTransactionState(transactionType: TransactionType, state: TransactionState) {
if (state.isTransactionSuccessful){
when(transactionType){
if (state.isTransactionSuccessful) {
when(transactionType) {
TransactionType.BuyDash -> showTransactionStateDialog(CoinBaseResultDialog.Type.DEPOSIT_SUCCESS)
TransactionType.BuySwap -> showTransactionStateDialog(CoinBaseResultDialog.Type.CONVERSION_SUCCESS)
TransactionType.TransferDash -> showTransactionStateDialog(CoinBaseResultDialog.Type.TRANSFER_DASH_SUCCESS)
else -> {}
}
} else {
when(transactionType){
when(transactionType) {
TransactionType.BuyDash -> showTransactionStateDialog(CoinBaseResultDialog.Type.DEPOSIT_ERROR, state.responseMessage)
TransactionType.BuySwap -> showTransactionStateDialog(CoinBaseResultDialog.Type.TRANSFER_DASH_ERROR, state.responseMessage)
TransactionType.TransferDash -> showTransactionStateDialog(CoinBaseResultDialog.Type.TRANSFER_DASH_ERROR, state.responseMessage)
Expand All @@ -117,7 +116,7 @@ class EnterTwoFaCodeFragment : Fragment(R.layout.enter_two_fa_code_fragment), Lo
}

private fun setLoadingState(showLoading: Boolean) {
if (showLoading){
if (showLoading) {
showProgressDialog()
} else {
hideProgressDialog()
Expand All @@ -127,7 +126,7 @@ class EnterTwoFaCodeFragment : Fragment(R.layout.enter_two_fa_code_fragment), Lo
private val keyboardActionListener = object : NumericKeyboardView.OnKeyboardActionListener {
var value = StringBuilder()

fun refreshValue(){
fun refreshValue() {
value.clear()
value.append(binding.enterCodeField.text.toString())
}
Expand All @@ -140,9 +139,9 @@ class EnterTwoFaCodeFragment : Fragment(R.layout.enter_two_fa_code_fragment), Lo

override fun onBack(longClick: Boolean) {
refreshValue()
if (longClick){
if (longClick) {
value.clear()
} else if (value.isNotEmpty()){
} else if (value.isNotEmpty()) {
value.deleteCharAt(value.length - 1)
}
applyNewValue(value.toString())
Expand All @@ -168,16 +167,16 @@ class EnterTwoFaCodeFragment : Fragment(R.layout.enter_two_fa_code_fragment), Lo
}
}

private fun showProgressDialog(){
if (::loadingDialog.isInitialized && loadingDialog.dialog?.isShowing == true){
private fun showProgressDialog() {
if (::loadingDialog.isInitialized && loadingDialog.dialog?.isShowing == true) {
loadingDialog.dismissAllowingStateLoss()
}
loadingDialog = AdaptiveDialog.progress(getString(R.string.loading))
loadingDialog.show(parentFragmentManager, tag)
}

private fun hideProgressDialog(){
if (loadingDialog.isAdded){
private fun hideProgressDialog() {
if (loadingDialog.isAdded) {
loadingDialog.dismissAllowingStateLoss()
}
}
Expand All @@ -189,13 +188,12 @@ class EnterTwoFaCodeFragment : Fragment(R.layout.enter_two_fa_code_fragment), Lo
object : CoinBaseResultDialog.CoinBaseResultDialogButtonsClickListener {
override fun onPositiveButtonClick(type: CoinBaseResultDialog.Type) {
when (type) {
CoinBaseResultDialog.Type.TRANSFER_DASH_ERROR , CoinBaseResultDialog.Type.DEPOSIT_ERROR-> {
CoinBaseResultDialog.Type.TRANSFER_DASH_ERROR, CoinBaseResultDialog.Type.DEPOSIT_ERROR -> {
viewModel.logRetry(type)
viewModel.isRetryingTransfer(true)
dismiss()
binding.enterCodeField.text?.clear()
}
CoinBaseResultDialog.Type.CONVERSION_ERROR-> {
CoinBaseResultDialog.Type.CONVERSION_ERROR -> {
viewModel.logRetry(type)
dismiss()
findNavController().popBackStack()
Expand Down
Loading

0 comments on commit 95a0935

Please sign in to comment.