Skip to content

Feature: Show Active Mint and Balance in POS Screen #287

@Delgado74

Description

@Delgado74

Problem

The cashier at the point of sale (POS) cannot see which mint is currently configured without navigating to Settings. This is unnecessary friction when needing to switch mints or verify the balance before charging.

Proposed Solution

Add a discreet info bar at the top of the charge screen (ModernPOSActivity) displaying:

  • Active mint name (e.g., "Minibits")
  • Current balance in BTC (e.g., "₿0.001")

Code Changes

1. Layout: activity_modern_pos.xml

Add a LinearLayout with TextViews for mint name and balance, positioned between the top navigation bar and the amount input container:

<!-- Mint Info Bar -->
<LinearLayout
    android:id="@+id/mint_info_bar"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:background="@android:color/transparent"
    android:gravity="center"
    android:orientation="horizontal"
    android:paddingHorizontal="16dp"
    android:paddingVertical="4dp"
    app:layout_constraintTop_toBottomOf="@id/top_navigation">

    <TextView
        android:id="@+id/mint_info_name"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:fontFamily="sans-serif-medium"
        android:textColor="@color/color_bg_white"
        android:textSize="13sp" />

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginHorizontal="6dp"
        android:text="·"
        android:textColor="@color/color_bg_white"
        android:textSize="13sp" />

    <TextView
        android:id="@+id/mint_info_balance"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:textColor="@color/color_bg_white"
        android:textSize="13sp" />

</LinearLayout>

Note: Using color_bg_white ensures visibility across all themes (green, orange, obsidian, etc.) since these use colored backgrounds with white text.

2. PosUiCoordinator.kt

Declare view references (nullable properties for backwards compatibility):

private var mintInfoContainer: View? = null
private var mintInfoName: TextView? = null
private var mintInfoBalance: TextView? = null

In initializeViews(), find the views:

mintInfoContainer = activity.findViewById(R.id.mint_info_bar)
mintInfoName = activity.findViewById(R.id.mint_info_name)
mintInfoBalance = activity.findViewById(R.id.mint_info_balance)

Add function to update the indicator:

private fun updateMintIndicator() {
    if (mintInfoContainer == null || mintInfoName == null || mintInfoBalance == null) {
        return
    }

    val mintUrl = mintManager.getPreferredLightningMint()
    if (mintUrl == null) {
        mintInfoContainer?.visibility = View.GONE
        return
    }

    mintInfoContainer?.visibility = View.VISIBLE
    val displayName = mintManager.getMintDisplayName(mintUrl)
    mintInfoName?.text = displayName

    activity.lifecycleScope.launch {
        val balance = CashuWalletManager.getBalanceForMint(mintUrl)
        mintInfoBalance?.text = Amount(balance, Amount.Currency.BTC).toString()
    }
}

Call updateMintIndicator() after initializeManagers() and in reloadMintLimits().

Behavior

  1. When opening POS: Shows active mint and its balance
  2. When returning from Settings: Updates automatically (called from onResume)
  3. When switching mints: Balance refreshes with the getMintLimits call

Screenshots

Image

Additional Context

  • Original feature request: Cashier needs to see active mint without navigating to Settings
  • Alternatives considered: Temporary toast, badge on navigation bar - discarded as too intrusive or hard to read
  • This solution is visually consistent with how the mint is displayed in Settings

Feedback and suggestions welcome. We can adjust the visual design or positioning if needed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    In Progress

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions