Skip to content

Commit

Permalink
chore: cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
HashEngineering committed Sep 29, 2024
1 parent 48576be commit ae22d1c
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 78 deletions.
44 changes: 17 additions & 27 deletions wallet/res/layout/block_username_request_view.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?><!--
~ Copyright 2023 Dash Core Group.
~ Copyright 2024 Dash Core Group.
~
~ This program is free software: you can redistribute it and/or modify
~ it under the terms of the GNU General Public License as published by
Expand All @@ -25,16 +25,6 @@
android:background="?attr/selectableItemBackground"
tools:context="de.schildbach.wallet.ui.username.adapters.UsernameRequestViewHolder">

<!-- <View-->
<!-- android:id="@+id/bullet"-->
<!-- android:layout_width="3dp"-->
<!-- android:layout_height="3dp"-->
<!-- android:background="@color/content_primary"-->
<!-- android:layout_marginStart="15dp"-->
<!-- app:layout_constraintStart_toStartOf="parent"-->
<!-- app:layout_constraintTop_toTopOf="parent"-->
<!-- app:layout_constraintBottom_toBottomOf="parent" />-->

<TextView
android:id="@+id/block_description"
style="@style/Overline"
Expand All @@ -57,23 +47,23 @@
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
>
<ImageView
android:id="@+id/block_icon"
android:layout_width="28dp"
android:layout_height="20dp"
android:src="@drawable/ic_red_circle_minus"
android:layout_marginEnd="3dp"
android:padding="3dp"
app:layout_constraintTop_toBottomOf="@id/date_registered"
app:layout_constraintStart_toStartOf="@id/date_registered"
app:layout_constraintBottom_toBottomOf="parent" />
<ImageView
android:id="@+id/block_icon"
android:layout_width="28dp"
android:layout_height="20dp"
android:src="@drawable/ic_red_circle_minus"
android:layout_marginEnd="3dp"
android:padding="3dp"
app:layout_constraintTop_toBottomOf="@id/date_registered"
app:layout_constraintStart_toStartOf="@id/date_registered"
app:layout_constraintBottom_toBottomOf="parent" />

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="6dp"
android:text="@string/block"
style="@style/Body2.Medium.Red"
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="6dp"
android:text="@string/block"
style="@style/Body2.Medium.Red"
/>

</LinearLayout>
Expand Down
10 changes: 0 additions & 10 deletions wallet/res/layout/username_request_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,6 @@
android:background="?attr/selectableItemBackground"
tools:context="de.schildbach.wallet.ui.username.adapters.UsernameRequestViewHolder">

<!-- <View-->
<!-- android:id="@+id/bullet"-->
<!-- android:layout_width="3dp"-->
<!-- android:layout_height="3dp"-->
<!-- android:background="@color/content_primary"-->
<!-- android:layout_marginStart="15dp"-->
<!-- app:layout_constraintStart_toStartOf="parent"-->
<!-- app:layout_constraintTop_toTopOf="parent"-->
<!-- app:layout_constraintBottom_toBottomOf="parent" />-->

<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,6 @@ interface ImportedMasternodeKeyDao {
@Update
suspend fun update(importedMasternodeKey: ImportedMasternodeKey)

// @Query("UPDATE username_votes SET votes = votes + :votesAmount, isApproved = 1 WHERE requestId IN (:requestIds)")
// suspend fun voteForRequest(requestIds: List<String>, votesAmount: Int)

@Query("SELECT * FROM imported_masternode_keys")
suspend fun getAll(): List<ImportedMasternodeKey>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2023 Dash Core Group.
* Copyright 2024 Dash Core Group.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand All @@ -26,12 +26,6 @@ interface UsernameVoteDao {
@Insert(onConflict = OnConflictStrategy.REPLACE)
suspend fun insert(usernameVote: UsernameVote)

@Update
suspend fun update(usernameVote: UsernameVote)

// @Query("UPDATE username_votes SET votes = votes + :votesAmount, isApproved = 1 WHERE requestId IN (:requestIds)")
// suspend fun voteForRequest(requestIds: List<String>, votesAmount: Int)

@Query("SELECT * FROM username_votes WHERE username = :username")
suspend fun getVotes(username: String): List<UsernameVote>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1080,11 +1080,9 @@ class PlatformSynchronizationService @Inject constructor(
usernameRequestDao.insert(usernameRequest)
} else {
// voting is complete
//if (name != blockchainIdentityDataDao.loadBase().username) {
usernameRequestDao.remove(
UsernameRequest.getRequestId(identifier.toString(), name)
)
//}
usernameRequestDao.remove(
UsernameRequest.getRequestId(identifier.toString(), name)
)
}
}
} catch(e: Exception) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,10 @@ class UsernameRequestsFragment : Fragment(R.layout.fragment_username_requests) {
super.onViewCreated(view, savedInstanceState)

val binding = this.binding
binding.toolbar.setOnClickListener {
viewModel.prepopulateList()
}
// TODO: remove when development is complete
// binding.toolbar.setOnClickListener {
// viewModel.prepopulateList()
// }

binding.toolbar.setNavigationOnClickListener { findNavController().popBackStack() }
binding.filterBtn.setOnClickListener {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,30 +121,11 @@ class UsernameRequestsViewModel @Inject constructor(
private val masternodeListManager: SimplifiedMasternodeListManager
get() = walletDataProvider.wallet!!.context.masternodeListManager

// TODO: remove this
private val _addedKeys = MutableStateFlow(listOf<ECKey>())
// val masternodes: Flow<List<Masternode>> = _addedKeys.map {
// val masternodesForKeys = arrayListOf<Masternode>()
// it.forEach { key ->
// val entries = masternodeListManager.listAtChainTip.getMasternodesByVotingKey(KeyId.fromBytes(key.pubKeyHash))
// masternodesForKeys.addAll(entries)
// }
// masternodesForKeys
// }

private val _masternodes = MutableStateFlow<List<ImportedMasternodeKey>>(listOf())
val masternodes: StateFlow<List<ImportedMasternodeKey>>// = importedMasternodeKeyDao.observeAll()
val masternodes: StateFlow<List<ImportedMasternodeKey>>
get() = _masternodes
// .onEach {
// val masternodesForKeys = arrayListOf<Masternode>()
// it.forEach { key ->
// val entries = masternodeListManager.listAtChainTip.getMasternodesByVotingKey(KeyId.fromBytes(key.pubKeyHash))
// masternodesForKeys.addAll(entries)
// }
// masternodesForKeys
// }
// .launchIn(viewModelScope)
// }

private val currentImportedKeys = listOf<ImportedMasternodeKey>()
private val currentMasternodeKeyUsage = listOf<AuthenticationKeyUsage>()

Expand Down Expand Up @@ -185,8 +166,6 @@ class UsernameRequestsViewModel @Inject constructor(
val allKeys = arrayListOf<ImportedMasternodeKey>()
allKeys.addAll(importedKeyList)

//val authenticationGroupExtension = walletDataProvider.wallet!!.getKeyChainExtension(AuthenticationGroupExtension.EXTENSION_ID) as AuthenticationGroupExtension

usage.forEach {
if ((it.type == AuthenticationKeyChain.KeyChainType.MASTERNODE_VOTING ||
it.type == AuthenticationKeyChain.KeyChainType.MASTERNODE_OWNER) &&
Expand Down Expand Up @@ -396,6 +375,7 @@ class UsernameRequestsViewModel @Inject constructor(
}

private var nameCount = 1
// TODO: remove this when development is completed.
fun prepopulateList() {
nameCount++
val now = System.currentTimeMillis()// / 1000
Expand Down

0 comments on commit ae22d1c

Please sign in to comment.