Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: new Nextnet block explorer #1069

Merged
merged 1 commit into from
Mar 8, 2024
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
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import com.tari.android.wallet.R
import com.tari.android.wallet.R.drawable.vector_all_settings_about_icon
import com.tari.android.wallet.R.drawable.vector_all_settings_background_service_icon
import com.tari.android.wallet.R.drawable.vector_all_settings_backup_options_icon
import com.tari.android.wallet.R.drawable.vector_all_settings_block_explorer_icon
import com.tari.android.wallet.R.drawable.vector_all_settings_bluetooth
import com.tari.android.wallet.R.drawable.vector_all_settings_bridge_configuration_icon
import com.tari.android.wallet.R.drawable.vector_all_settings_cart
Expand All @@ -20,7 +21,6 @@ import com.tari.android.wallet.R.drawable.vector_all_settings_screen_recording_i
import com.tari.android.wallet.R.drawable.vector_all_settings_select_base_node_icon
import com.tari.android.wallet.R.drawable.vector_all_settings_select_network_icon
import com.tari.android.wallet.R.drawable.vector_all_settings_select_theme_icon
import com.tari.android.wallet.R.drawable.vector_all_settings_block_explorer_icon
import com.tari.android.wallet.R.drawable.vector_all_settings_user_agreement_icon
import com.tari.android.wallet.R.drawable.vector_all_settings_visit_tari_icon
import com.tari.android.wallet.R.drawable.vector_all_settings_yat_icon
Expand All @@ -31,19 +31,19 @@ import com.tari.android.wallet.R.string.all_settings_biometrics
import com.tari.android.wallet.R.string.all_settings_bluetooth_settings
import com.tari.android.wallet.R.string.all_settings_bridge_configuration
import com.tari.android.wallet.R.string.all_settings_connect_yats
import com.tari.android.wallet.R.string.explorer_url
import com.tari.android.wallet.R.string.all_settings_contribute
import com.tari.android.wallet.R.string.all_settings_create_pin_code
import com.tari.android.wallet.R.string.all_settings_data_collection
import com.tari.android.wallet.R.string.all_settings_delete_wallet
import com.tari.android.wallet.R.string.all_settings_disclaimer
import com.tari.android.wallet.R.string.all_settings_explorer
import com.tari.android.wallet.R.string.all_settings_pin_code
import com.tari.android.wallet.R.string.all_settings_privacy_policy
import com.tari.android.wallet.R.string.all_settings_report_a_bug
import com.tari.android.wallet.R.string.all_settings_screen_recording
import com.tari.android.wallet.R.string.all_settings_secondary_settings_label
import com.tari.android.wallet.R.string.all_settings_security_label
import com.tari.android.wallet.R.string.all_settings_select_base_node
import com.tari.android.wallet.R.string.all_settings_explorer
import com.tari.android.wallet.R.string.all_settings_select_network
import com.tari.android.wallet.R.string.all_settings_select_theme
import com.tari.android.wallet.R.string.all_settings_store
Expand All @@ -56,13 +56,13 @@ import com.tari.android.wallet.R.string.back_up_wallet_backup_status_outdated
import com.tari.android.wallet.R.string.back_up_wallet_backup_status_up_to_date
import com.tari.android.wallet.R.string.check_backup_storage_status_error_title
import com.tari.android.wallet.R.string.disclaimer_url
import com.tari.android.wallet.R.string.explorer_url
import com.tari.android.wallet.R.string.github_repo_url
import com.tari.android.wallet.R.string.privacy_policy_url
import com.tari.android.wallet.R.string.tari_about_title
import com.tari.android.wallet.R.string.tari_url
import com.tari.android.wallet.R.string.ttl_store_url
import com.tari.android.wallet.R.string.user_agreement_url
import com.tari.android.wallet.R.string.all_settings_screen_recording
import com.tari.android.wallet.data.sharedPrefs.SharedPrefsRepository
import com.tari.android.wallet.event.EventBus
import com.tari.android.wallet.extension.addTo
Expand All @@ -82,14 +82,13 @@ import com.tari.android.wallet.ui.fragment.settings.allSettings.PresentationBack
import com.tari.android.wallet.ui.fragment.settings.allSettings.PresentationBackupState.BackupStateStatus.Success
import com.tari.android.wallet.ui.fragment.settings.allSettings.PresentationBackupState.BackupStateStatus.Warning
import com.tari.android.wallet.ui.fragment.settings.allSettings.backupOptions.SettingsBackupOptionViewHolderItem
import com.tari.android.wallet.ui.fragment.settings.allSettings.myProfile.MyProfileViewHolderItem
import com.tari.android.wallet.ui.fragment.settings.allSettings.row.SettingsRowStyle
import com.tari.android.wallet.ui.fragment.settings.allSettings.row.SettingsRowViewDto
import com.tari.android.wallet.ui.fragment.settings.allSettings.myProfile.MyProfileViewHolderItem
import com.tari.android.wallet.ui.fragment.settings.allSettings.title.SettingsTitleViewHolderItem
import com.tari.android.wallet.ui.fragment.settings.allSettings.version.SettingsVersionViewHolderItem
import com.tari.android.wallet.ui.fragment.settings.backup.data.BackupSettingsRepository
import com.tari.android.wallet.ui.fragment.settings.userAutorization.BiometricAuthenticationViewModel
import com.tari.android.wallet.util.DebugConfig
import com.tari.android.wallet.yat.YatAdapter
import com.tari.android.wallet.yat.YatSharedRepository
import javax.inject.Inject
Expand Down Expand Up @@ -214,7 +213,7 @@ class AllSettingsViewModel : CommonViewModel() {
DividerViewHolderItem(),
SettingsRowViewDto(resourceManager.getString(all_settings_explorer), vector_all_settings_block_explorer_icon) {
_openLink.postValue(resourceManager.getString(explorer_url))
}.takeIf { DebugConfig.isBlockExplorerEnabled },
},
SettingsTitleViewHolderItem(resourceManager.getString(all_settings_advanced_settings_label)),
SettingsRowViewDto(resourceManager.getString(all_settings_select_theme), vector_all_settings_select_theme_icon) {
navigation.postValue(AllSettingsNavigation.ToThemeSelection)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,6 @@ import com.tari.android.wallet.ui.fragment.contact_book.data.contacts.ContactDto
import com.tari.android.wallet.ui.fragment.tx.details.gif.GIFView
import com.tari.android.wallet.ui.fragment.tx.details.gif.GIFViewModel
import com.tari.android.wallet.ui.fragment.tx.details.gif.TxState
import com.tari.android.wallet.util.DebugConfig
import com.tari.android.wallet.util.WalletUtil
import java.util.Date

Expand Down Expand Up @@ -163,9 +162,7 @@ class TxDetailsFragment : CommonFragment<FragmentTxDetailsBinding, TxDetailsView
observe(cancellationReason) { setCancellationReason(it) }

observe(explorerLink) { link ->
if (DebugConfig.isBlockExplorerEnabled) {
showExplorerLink(link)
}
showExplorerLink(link)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,9 +149,8 @@ class TxDetailsViewModel : CommonViewModel() {
}

private fun generateExplorerLink(tx: Tx) {
(tx as? CompletedTx)?.txKernel?.let {
val fullLink = resourceManager.getString(R.string.explorer_kernel_url) + it.publicNonce + "/" + it.signature
_explorerLink.postValue(fullLink)
(tx as? CompletedTx)?.txKernel?.let { txKernel ->
_explorerLink.postValue(resourceManager.getString(R.string.explorer_kernel_url, txKernel.publicNonce, txKernel.signature))
}
}

Expand All @@ -173,7 +172,13 @@ class TxDetailsViewModel : CommonViewModel() {

var saveAction: () -> Boolean = { false }

val nameModule = InputModule(name, resourceManager.getString(R.string.contact_book_add_contact_first_name_hint), true, false) { saveAction.invoke() }
val nameModule =
InputModule(
value = name,
hint = resourceManager.getString(R.string.contact_book_add_contact_first_name_hint),
isFirst = true,
isEnd = false,
) { saveAction.invoke() }

val headModule = HeadModule(
resourceManager.getString(R.string.contact_book_details_edit_title),
Expand Down
2 changes: 0 additions & 2 deletions app/src/main/java/com/tari/android/wallet/util/DebugConfig.kt
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,6 @@ object DebugConfig {
private const val _useYatSandbox = false
val yatEnvironment = if (_useYatSandbox && isDebug()) YatEnvironment.SANDBOX else YatEnvironment.PRODUCTION

const val isBlockExplorerEnabled = false

// Needed for testing resetting wallet on the network changed
private const val _useStagenetNetwork = false
val useStagenetNetwork = _useStagenetNetwork && isDebug()
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
<string name="user_agreement_url">https://www.tari.com/user_agreement/</string>
<string name="privacy_policy_url">https://www.tari.com/privacy_policy/</string>
<string name="disclaimer_url">https://www.tari.com/disclaimer/</string>
<string name="explorer_url">https://explore.tari.com/</string>
<string name="explorer_kernel_url">https://explore.tari.com/kernel/</string>
<string name="explorer_url">https://explore-nextnet.tari.com/</string>
<string name="explorer_kernel_url">https://explore-nextnet.tari.com/kernel_search?nonces=%s&amp;signatures=%s</string>
<string name="tor_bridges_url">https://bridges.torproject.org/bridges</string>
<string name="tari_lab_university_url" translatable="false">https://tlu.tarilabs.com/</string>

Expand Down