Skip to content

Commit

Permalink
fix(dashpay): hide all entrypoints to dashpay related features
Browse files Browse the repository at this point in the history
  • Loading branch information
HashEngineering committed Feb 22, 2024
1 parent d09b5a6 commit ce16205
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 5 deletions.
1 change: 1 addition & 0 deletions wallet/src/de/schildbach/wallet/Constants.java
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ public final class Constants {

/** Bitcoinj global context. */
public static final Context CONTEXT = new Context(NETWORK_PARAMETERS);
public static final boolean DASHPAY_DISABLED = true;

public final static class Files {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import com.google.common.base.Preconditions
import com.google.common.base.Stopwatch
import com.google.common.util.concurrent.SettableFuture
import com.google.zxing.BarcodeFormat
import de.schildbach.wallet.Constants
import de.schildbach.wallet.WalletApplication
import de.schildbach.wallet.database.dao.DashPayContactRequestDao
import de.schildbach.wallet.database.dao.DashPayProfileDao
Expand Down Expand Up @@ -1020,6 +1021,7 @@ class PlatformSynchronizationService @Inject constructor(
// this will enable notifications, since platform information has been synced
config.set(DashPayConfig.LAST_SEEN_NOTIFICATION_TIME, System.currentTimeMillis() - TimeUnit.DAYS.toMillis(7))
}
log.info("PreBlockDownload: $preDownloadBlocksFuture")
preDownloadBlocksFuture?.set(true)
preDownloadBlocks.set(false)
}
Expand Down Expand Up @@ -1062,6 +1064,10 @@ class PlatformSynchronizationService @Inject constructor(
lastPreBlockStage = PreBlockStage.None
preDownloadBlocksFuture = future
log.info("PreDownloadBlocks: starting")
if (Constants.DASHPAY_DISABLED) {
finishPreBlockDownload()
return@launch
}

// first check to see if there is a blockchain identity
if (blockchainIdentityDataDao.load() == null) {
Expand Down
5 changes: 5 additions & 0 deletions wallet/src/de/schildbach/wallet/ui/SettingsActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import androidx.core.content.ContextCompat
import androidx.core.view.isVisible
import androidx.lifecycle.lifecycleScope
import dagger.hilt.android.AndroidEntryPoint
import de.schildbach.wallet.Constants
import de.schildbach.wallet.WalletBalanceWidgetProvider
import de.schildbach.wallet.service.CoinJoinMode
import de.schildbach.wallet.service.MixingStatus
Expand Down Expand Up @@ -173,6 +174,10 @@ class SettingsActivity : LockScreenActivity() {
}
}
}

if (Constants.DASHPAY_DISABLED) {
binding.votingDashPay.isVisible = false
}
}

private fun setBatteryOptimizationText() {
Expand Down
15 changes: 10 additions & 5 deletions wallet/src/de/schildbach/wallet/ui/main/MainViewModel.kt
Original file line number Diff line number Diff line change
Expand Up @@ -678,11 +678,16 @@ class MainViewModel @Inject constructor(
suspend fun getInviteHistory() = invitationsDao.loadAll()

private fun combineLatestData(): Boolean {
val isPlatformAvailable = isPlatformAvailableData.value ?: false
val isSynced = _isBlockchainSynced.value ?: false
val noIdentityCreatedOrInProgress = (blockchainIdentity.value == null) || blockchainIdentity.value!!.creationState == BlockchainIdentityData.CreationState.NONE
val canAffordIdentityCreation = walletData.canAffordIdentityCreation()
return isSynced && isPlatformAvailable && noIdentityCreatedOrInProgress && canAffordIdentityCreation
return if (Constants.DASHPAY_DISABLED) {
false
} else {
val isPlatformAvailable = isPlatformAvailableData.value ?: false
val isSynced = _isBlockchainSynced.value ?: false
val noIdentityCreatedOrInProgress =
(blockchainIdentity.value == null) || blockchainIdentity.value!!.creationState == BlockchainIdentityData.CreationState.NONE
val canAffordIdentityCreation = walletData.canAffordIdentityCreation()
return isSynced && isPlatformAvailable && noIdentityCreatedOrInProgress && canAffordIdentityCreation
}
}

private fun startContactRequestTimer() {
Expand Down
4 changes: 4 additions & 0 deletions wallet/src/de/schildbach/wallet/ui/main/WalletActivityExt.kt
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ import androidx.navigation.fragment.NavHostFragment
import androidx.navigation.ui.NavigationUI.onNavDestinationSelected
import androidx.navigation.ui.NavigationUI.setupWithNavController
import com.google.android.material.bottomnavigation.BottomNavigationView
import de.schildbach.wallet.Constants
import de.schildbach.wallet.WalletBalanceWidgetProvider
import de.schildbach.wallet.service.CoinJoinMode
import de.schildbach.wallet_test.R
Expand Down Expand Up @@ -93,6 +94,9 @@ object WalletActivityExt {
navController.addOnDestinationChangedListener { _, _, arguments ->
navView.isVisible = arguments?.getBoolean("ShowNavBar", false) == true
}
if (Constants.DASHPAY_DISABLED) {
navView.menu.findItem(R.id.contactsFragment).isEnabled = false
}
}

fun MainActivity.checkTimeSkew(viewModel: MainViewModel) {
Expand Down
5 changes: 5 additions & 0 deletions wallet/src/de/schildbach/wallet/ui/more/MoreFragment.kt
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import androidx.navigation.NavOptions
import androidx.navigation.fragment.findNavController
import com.google.android.material.transition.MaterialFadeThrough
import dagger.hilt.android.AndroidEntryPoint
import de.schildbach.wallet.Constants
import de.schildbach.wallet.WalletApplication
import de.schildbach.wallet.database.entity.DashPayProfile
import de.schildbach.wallet.livedata.Status
Expand Down Expand Up @@ -173,6 +174,10 @@ class MoreFragment : Fragment(R.layout.fragment_more) {
}

initViewModel()

if (Constants.DASHPAY_DISABLED) {
binding.usernameVoting.isVisible = false
}
}

private fun dismissProfileError() {
Expand Down

0 comments on commit ce16205

Please sign in to comment.