Skip to content

Commit

Permalink
Merge pull request #1325 from dashpay/dashpay-voting
Browse files Browse the repository at this point in the history
feat(dashpay): merge voting features and v11.0.3
  • Loading branch information
HashEngineering authored Nov 14, 2024
2 parents a659621 + da9f0eb commit 384deb9
Show file tree
Hide file tree
Showing 201 changed files with 7,102 additions and 1,275 deletions.
3 changes: 2 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ buildscript {
kotlin_version = '1.9.23'
coroutinesVersion = '1.6.4'
ok_http_version = '4.9.1'
dashjVersion = '21.1.1'
dashjVersion = '21.1.2'
dppVersion = "1.3.1-SNAPSHOT"
hiltVersion = '2.51'
hiltCompilerVersion = '1.2.0'
hiltWorkVersion = '1.0.0'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ object AnalyticsConstants {
const val SETTINGS = "more_settings"
const val TOOLS = "more_tools"
const val CONTACT_SUPPORT = "more_contact_support"
const val INVITE = "more_invite"
const val USERNAME_VOTING = "more_username_voting"
const val UPDATE_PROFILE = "more_user_updated_profile"
}

object Security {
Expand Down Expand Up @@ -80,9 +83,12 @@ object AnalyticsConstants {
const val RESCAN_BLOCKCHAIN_DISMISS = "settings_rescan_blockchain_dismiss"
const val ABOUT = "settings_about"
const val ABOUT_SUPPORT = "settings_about_contact_support"
const val COINJOIN = "settings_coinjoin"
}

object SendReceive {
const val SEND_TX = "send_tx" // also include amount sent
const val SEND_TX_CONTACT = "send_tx_to_contact" // also include amount sent
const val SCAN_TO_SEND = "send_scan_to_send"
const val SEND_TO_ADDRESS = "send_to_address"
const val SHOW_QR_CODE = "receive_show_qr_code"
Expand All @@ -108,6 +114,8 @@ object AnalyticsConstants {
object Home {
const val NAV_HOME = "bottom_nav_home"
const val NAV_MORE = "bottom_nav_more"
const val NAV_CONTACTS = "bottom_nav_contacts"
const val NAV_EXPLORE = "bottom_nav_explore"
const val SHORTCUT_SECURE_WALLET = "shortcut_secure_wallet"
const val SHORTCUT_SCAN_TO_PAY = "shortcut_scan_to_pay"
const val SHORTCUT_SEND_TO_ADDRESS = "shortcut_send_to_address"
Expand All @@ -120,6 +128,8 @@ object AnalyticsConstants {
const val TRANSACTION_FILTER = "home_transaction_filter"
const val SEND_RECEIVE_BUTTON = "bottom_nav_payments"
const val NO_ADDRESS_COPIED = "shortcut_send_no_address_copied"
const val AVATAR = "home_avatar"
const val NOTIFICATIONS = "home_notifications"
}

object Invites {
Expand Down Expand Up @@ -148,20 +158,26 @@ object AnalyticsConstants {

object UsersContacts {
const val CREATE_USERNAME = "create_username"
const val JOIN_DASHPAY = "start_btn_join_dashpay"
const val CREATE_USERNAME_CONFIRM = "start_username_btn_confirm"
const val CREATE_USERNAME_SUCCESS = "start_username_created_success"
const val CREATE_USERNAME_INVITE_SUCCESS = "start_username_created_success_from_invitation"
const val CREATE_USERNAME_ERROR = "start_username_created_fail"
const val CREATE_USERNAME_TRYAGAIN = "start_username_btn_try_again"
const val SEARCH_CONTACTS = "contacts_search"
const val SEARCH_DASH_NETWORK = "contacts_search_dash_network"
const val SEARCH_USER_ICON = "contacts_search_user_icon"
const val SEND_REQUEST = "contacts_send_request"
const val ACCEPT_REQUEST = "contacts_accept_request"
const val SEARCH_USER_ICON = "contacts_btn_add_contact"
const val SEND_REQUEST = "contacts_request_sent"
const val ACCEPT_REQUEST = "contacts_request_accepted"
const val NOTIFICATIONS_HOME_SCREEN = "notifications_home_screen"
const val NOTIFICATIONS_ACCEPT_REQUEST = "notifications_accept_contact_request"
const val NOTIFICATIONS_CONTACT_DETAILS = "notifications_contact_details"
const val PROFILE_EDIT_MORE = "profile_edit_from_more"
const val PROFILE_EDIT_HOME = "profile_edit_from_home"
const val PROFILE_CHANGE_NAME = "profile_change_display_name"
const val PROFILE_NAME_LENGTH = "profile_display_name_length"
const val PROFILE_CHANGE_ABOUT_ME = "profile_change_about_me"
const val PROFILE_ABOUT_ME_LENGTH = "profile_about_me_length"
const val PROFILE_CHANGE_PICTURE = "profile_change_picture"
const val PROFILE_CHANGE_PICTURE_GRAVATAR = "profile_change_picture_gravatar"
const val PROFILE_CHANGE_PICTURE_PUBLIC_URL = "profile_change_picture_public_url"
const val PROFILE_CHANGE_PICTURE_CAMERA = "profile_change_picture_camera_photo"
Expand Down Expand Up @@ -389,10 +405,21 @@ object AnalyticsConstants {
}

object CoinJoinPrivacy {
const val COINJOIN_START_MIXING = "settings_coinjoin_btn_start_mixing"
const val COINJOIN_STOP_MIXING = "settings_coinjoin_btn_stop_mixing"
const val USERNAME_PRIVACY_BTN_CONTINUE = "username_privacy_btn_continue"
const val USERNAME_PRIVACY_WIFI_BTN_CONTINUE = "username_privacy_wifi_btn_continue"
const val USERNAME_PRIVACY_WIFI_BTN_CANCEL = "username_privacy_wifi_btn_cancel"
const val USERNAME_PRIVACY_CONFIRMATION_BTN_CONFIRM = "username_privacy_confirmation_btn_confirm"
const val USERNAME_PRIVACY_CONFIRMATION_BTN_CANCEL = "username_privacy_confirmation_btn_cancel"
}

object UsernameVoting {
const val BLOCK = "username_voting_btn_block"
const val DETAILS = "username_voting_details_open"
const val VOTE = "username_voting_details_btn_vote"
const val VOTE_SUCCESS = "username_voting_details_btn_vote_success"
const val VOTE_ERROR = "username_voting_details_btn_vote_fail"
const val VOTE_CANCEL = "username_voting_details_btn_vote_fail"
}
}
98 changes: 98 additions & 0 deletions common/src/main/java/org/dash/wallet/common/ui/ResourcesExt.kt
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,12 @@

package org.dash.wallet.common.ui

import android.content.Context
import android.graphics.Color
import android.graphics.drawable.GradientDrawable
import android.graphics.drawable.RippleDrawable
import android.view.View
import android.widget.Button
import androidx.annotation.StyleRes
import androidx.core.content.res.ResourcesCompat
import org.dash.wallet.common.R
Expand All @@ -41,3 +46,96 @@ fun View.setRoundedRippleBackground(@StyleRes style: Int?) {
)
}
}

fun View.applyStyle(@StyleRes style: Int?) {
style?.let {
context.theme.applyStyle(style, true)
}
}

//fun View.setRoundedRippleBackgroundButtonStyle1(@StyleRes style: Int?) {
// style?.let {
// val theme = this.resources.newTheme().apply { applyStyle(style, true) }
//
// // Extract the cornerRadius attribute
//// val cornerRadiusAttr = intArrayOf(R.attr.cornerRadius)
//// val cornerRadiusArray = theme.obtainStyledAttributes(cornerRadiusAttr)
//// val cornerRadius = cornerRadiusArray.getDimension(0, 0f) // Default to 0 if not set
//// cornerRadiusArray.recycle()
// val cornerRadius = 7.dpToPx(context).toFloat()
//
// // Extract the titleTextColor attribute
// val titleTextColorAttr = intArrayOf(R.attr.titleTextColor)
// val textColorArray = theme.obtainStyledAttributes(titleTextColorAttr)
// val titleTextColor = textColorArray.getColor(0, Color.BLACK) // Default to black if not set
// textColorArray.recycle()
//
// // Apply cornerRadius and titleTextColor as needed (e.g., to a button)
// val drawable = ResourcesCompat.getDrawable(
// this.resources,
// R.drawable.rounded_ripple_background,
// theme
// )
//
// // Assuming rounded_ripple_background is a shape drawable that supports corner radius
// if (drawable is RippleDrawable) {
// // For the mask
// val maskDrawable = drawable.findDrawableByLayerId(android.R.id.mask) as? GradientDrawable
// maskDrawable?.cornerRadius = cornerRadius
//
// // For the content shape (background)
// val contentDrawable = drawable.getDrawable(0) as? GradientDrawable
// contentDrawable?.cornerRadius = cornerRadius
// }
//
// // Apply drawable as background and set titleTextColor
// this.background = drawable
// (this as? Button)?.setTextColor(titleTextColor)
// }
//}
//
fun View.setRoundedRippleBackgroundButtonStyle(@StyleRes style: Int?, defaultCornerRadius: Int = 7) {
style?.let {
val theme = this.resources.newTheme().apply { applyStyle(style, true) }
val defaultCornerRadius = defaultCornerRadius.dpToPx(this.context)

// Resolve the cornerRadius and rippleColor attributes from the applied style
val attrs = intArrayOf(
R.attr.backgroundColor,
R.attr.titleTextColor
)

val typedArray = theme.obtainStyledAttributes(style, attrs)

// Extract the attributes from the typed array
val backgroundColor = typedArray.getColor(0, Color.TRANSPARENT)
val titleTextColor = typedArray.getColor(1, Color.BLACK) // Default to black if not set
typedArray.recycle()

// Apply the ripple drawable from your XML
val rippleDrawable = ResourcesCompat.getDrawable(
this.resources,
R.drawable.rounded_ripple_background, // Your ripple drawable
theme
) as? RippleDrawable

rippleDrawable?.let { rd ->

// Modify the background color, corner radius, and stroke in the ripple's shape
val contentDrawable = rd.getDrawable(1) as? GradientDrawable
contentDrawable?.apply {
setColor(backgroundColor)
cornerRadius = defaultCornerRadius.dpToPx(context).toFloat()
}

// Set the ripple drawable as the background
this.background = rd
}
(this as? Button)?.setTextColor(titleTextColor)
}
}

// Utility function to convert dp to px for stroke width
fun Int.dpToPx(context: Context): Int {
return (this * context.resources.displayMetrics.density).toInt()
}
Original file line number Diff line number Diff line change
Expand Up @@ -64,3 +64,8 @@ fun Fragment.deepLinkNavigate(destination: DeepLinkDestination) {
fun Fragment.goBack() {
findNavController().popBackStack()
}

fun Fragment.onUserInteraction() {
requireActivity().onUserInteraction()
//(requireActivity().application as AutoLogoutTimerHandler).resetAutoLogoutTimer()
}
9 changes: 9 additions & 0 deletions common/src/main/res/drawable/ic_x.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="11dp"
android:height="12dp"
android:viewportWidth="11"
android:viewportHeight="12">
<path
android:pathData="M0.891,10.936C0.785,10.83 0.715,10.707 0.682,10.567C0.648,10.428 0.648,10.288 0.682,10.148C0.715,10.009 0.783,9.888 0.885,9.787L4.668,5.997L0.885,2.214C0.783,2.117 0.715,1.998 0.682,1.858C0.652,1.715 0.652,1.573 0.682,1.433C0.715,1.293 0.785,1.171 0.891,1.065C0.993,0.959 1.113,0.889 1.253,0.855C1.397,0.822 1.539,0.822 1.678,0.855C1.822,0.889 1.945,0.957 2.046,1.059L5.83,4.842L9.613,1.059C9.714,0.957 9.835,0.889 9.975,0.855C10.114,0.822 10.254,0.822 10.394,0.855C10.533,0.889 10.656,0.961 10.762,1.071C10.868,1.173 10.937,1.293 10.971,1.433C11.009,1.573 11.009,1.712 10.971,1.852C10.937,1.992 10.87,2.112 10.768,2.214L6.991,5.997L10.768,9.787C10.87,9.888 10.937,10.009 10.971,10.148C11.005,10.288 11.005,10.428 10.971,10.567C10.937,10.707 10.868,10.83 10.762,10.936C10.656,11.041 10.533,11.111 10.394,11.145C10.254,11.179 10.114,11.179 9.975,11.145C9.835,11.111 9.714,11.043 9.613,10.942L5.83,7.159L2.046,10.942C1.945,11.043 1.824,11.111 1.685,11.145C1.545,11.179 1.403,11.179 1.259,11.145C1.12,11.111 0.997,11.041 0.891,10.936Z"
android:fillColor="#B0B6BC"/>
</vector>
5 changes: 5 additions & 0 deletions common/src/main/res/values-de/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
<string name="dash_address">Dash Adresse</string>
<string name="username">Nutzername</string>
<string name="balance">Guthaben:</string>
<string name="nothing_here">Hier gibt es nichts</string>

<!-- Local Currency List: GGP -->
<string name="currency_GGP">Guernsey Pfund</string>
<!-- Local Currency List: JEP -->
Expand Down Expand Up @@ -61,6 +63,8 @@
<string name="verify">Verifizieren</string>
<string name="receive_enter_amount_button">Betrag festsetzen</string>
<string name="account_create">Konto erstellen</string>
<string name="submit">Einreichen</string>

<!-- Design system UI elements -->
<string name="search_hint">Suchen</string>
<string name="permission_allow">Erlauben</string>
Expand All @@ -77,6 +81,7 @@
<string name="select_currency">Währung auswählen</string>
<string name="send_coins_error_dusty_send">Der Betrag ist zu klein zum Senden</string>
<string name="send_coins_error_insufficient_money">Guthaben nicht ausreichend</string>
<string name="send_coins_error_insufficient_mixed_money">Gemixtes Guthaben nicht ausreichend. Warte bis das CoinJoin-Mixen abgeschlossen ist oder deaktiviere dieses Feature in den Einstellungen, um die Transaktion abzuschließen.</string>
<string name="syncing">Synchronisiere</string>
<string name="no_connection">Keine Internetverbindung</string>
<string name="rate_not_available">Nicht verfügbar</string>
Expand Down
5 changes: 5 additions & 0 deletions common/src/main/res/values-el/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
<string name="dash_address">Διεύθυνση Dash</string>
<string name="username">Όνομα Χρήστη:</string>
<string name="balance">Υπόλοιπο:</string>
<string name="nothing_here">Τίποτα εδώ</string>

<!-- Local Currency List: GGP -->
<string name="currency_GGP">Γκέρνσεϊ Λίρα</string>
<!-- Local Currency List: JEP -->
Expand Down Expand Up @@ -61,6 +63,8 @@
<string name="verify">Επιβεβαίωση</string>
<string name="receive_enter_amount_button">Καθορίστε το ποσό</string>
<string name="account_create">Δημιουργία λογαριασμού</string>
<string name="submit">Υποβολή</string>

<!-- Design system UI elements -->
<string name="search_hint">Αναζήτηση</string>
<string name="permission_allow">Επιτρέπετε</string>
Expand All @@ -77,6 +81,7 @@
<string name="select_currency">Επιλέξτε Νόμισμα</string>
<string name="send_coins_error_dusty_send">Το ποσό είναι πολύ μικρό για να σταλθεί</string>
<string name="send_coins_error_insufficient_money">Ανεπαρκή χρήματα</string>
<string name="send_coins_error_insufficient_mixed_money">Ανεπαρκή μικτά κεφάλαια. Περιμένετε να ολοκληρωθεί η ανάμειξη του CoinJoin ή απενεργοποιήστε αυτή τη λειτουργία στις ρυθμίσεις για να ολοκληρώσετε αυτή τη συναλλαγή.</string>
<string name="syncing">Συγχρονισμός</string>
<string name="no_connection">Χωρίς σύνδεση στο διαδίκτυο</string>
<string name="rate_not_available">Μη διαθέσιμο</string>
Expand Down
5 changes: 5 additions & 0 deletions common/src/main/res/values-es/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
<string name="dash_address">Dirección de Dash</string>
<string name="username">Nombre de usuario</string>
<string name="balance">Balance:</string>
<string name="nothing_here">No hay nada aquí</string>

<!-- Local Currency List: GGP -->
<string name="currency_GGP">Libra de Guernsey</string>
<!-- Local Currency List: JEP -->
Expand Down Expand Up @@ -61,6 +63,8 @@
<string name="verify">Verificar</string>
<string name="receive_enter_amount_button">Especificar Monto</string>
<string name="account_create">Crear una cuenta</string>
<string name="submit">Entregar</string>

<!-- Design system UI elements -->
<string name="search_hint">Buscar</string>
<string name="permission_allow">Permitir</string>
Expand All @@ -77,6 +81,7 @@
<string name="select_currency">Selecciona el tipo de moneda</string>
<string name="send_coins_error_dusty_send">La cantidad es demasiado pequeña para ser enviada</string>
<string name="send_coins_error_insufficient_money">Fondos insuficientes</string>
<string name="send_coins_error_insufficient_mixed_money">Fondos mixtos insuficientes. Espera a que finalice la mezcla de CoinJoin o desactiva esta función en la configuración para completar esta transacción.</string>
<string name="syncing">Sincronizando</string>
<string name="no_connection">No hay conexión a internet</string>
<string name="rate_not_available">No disponible</string>
Expand Down
6 changes: 6 additions & 0 deletions common/src/main/res/values-fa/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,10 @@
<string name="login_error_title">ورود به حساب %s شما ناموفق بود</string>
<string name="login_error_message">در هنگام تلاش برای ورود به حساب %s شما، خطایی روی داد. </string>
<string name="dash_address">نشانی دش</string>
<string name="username">نام کاربری</string>
<string name="balance">موجودی: </string>
<string name="nothing_here">چیزی اینجا نیست</string>

<!-- Local Currency List: GGP -->
<string name="currency_GGP">گرنزی پاوند</string>
<!-- Local Currency List: JEP -->
Expand Down Expand Up @@ -60,6 +63,8 @@
<string name="verify">تائید</string>
<string name="receive_enter_amount_button">مبلغ را مشخص کنید</string>
<string name="account_create">ایجاد حساب</string>
<string name="submit">ثبت</string>

<!-- Design system UI elements -->
<string name="search_hint">جستجو</string>
<string name="permission_allow">اجازه می‌دهم</string>
Expand All @@ -76,6 +81,7 @@
<string name="select_currency">واحد پول‌تان را انتخاب کنید</string>
<string name="send_coins_error_dusty_send">مبلغ مورد نظر، بیش از حد کم است</string>
<string name="send_coins_error_insufficient_money">موجودی ناکافی</string>
<string name="send_coins_error_insufficient_mixed_money">موجودی ترکیبی کافی نیست. منتظر بمانید تا فرایند ترکیب کوین‌جوین تمام شود و یا این قابلیت را از طریق تنظیمات غیرفعال کنید تا این تراکنش صورت گیرد. </string>
<string name="syncing">در حال همزمان‌سازی</string>
<string name="no_connection">به اینترنت متصل نیستید</string>
<string name="rate_not_available">در دسترس نیست</string>
Expand Down
5 changes: 5 additions & 0 deletions common/src/main/res/values-fil/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
<string name="dash_address">Address ng Dash</string>
<string name="username">Username</string>
<string name="balance">Balanse:</string>
<string name="nothing_here">Wala dito</string>

<!-- Local Currency List: GGP -->
<string name="currency_GGP">Guernsey Pound</string>
<!-- Local Currency List: JEP -->
Expand Down Expand Up @@ -61,6 +63,8 @@
<string name="verify">Kumpirmahin</string>
<string name="receive_enter_amount_button">Tukuyin ang halaga</string>
<string name="account_create">Lumikha ng Account</string>
<string name="submit">Isumite</string>

<!-- Design system UI elements -->
<string name="search_hint">Maghanap</string>
<string name="permission_allow">Payagan</string>
Expand All @@ -77,6 +81,7 @@
<string name="select_currency">Piliin ang Pera</string>
<string name="send_coins_error_dusty_send">Ang halaga ay sobrang liit para maipadala</string>
<string name="send_coins_error_insufficient_money">Hindi sapat na pondo</string>
<string name="send_coins_error_insufficient_mixed_money">Hindi sapat na pinaghalong pondo. Hintayin ang paghahalo ng CoinJoin upang matapos o huwag paganahin ang tampok na ito sa mga setting upang makumpleto ang transaksyong ito.</string>
<string name="syncing">Nagsi-sync</string>
<string name="no_connection">Walang koneksyon sa internet</string>
<string name="rate_not_available">Hindi available</string>
Expand Down
Loading

0 comments on commit 384deb9

Please sign in to comment.