From 231a6ed84dbd036d1b2c720f8848b47a5765810c Mon Sep 17 00:00:00 2001 From: Quentin Date: Wed, 18 Feb 2026 17:56:13 -0600 Subject: [PATCH 1/3] fix: reset QR sheet on invalid state; bump AGP 9.0.1, Kotlin 2.2.10, Gradle 9.2.1 --- .../java/com/kingpaging/qwelcome/ui/CustomerIntakeScreen.kt | 6 ++++++ gradle/libs.versions.toml | 4 ++-- gradle/wrapper/gradle-wrapper.properties | 4 ++-- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/com/kingpaging/qwelcome/ui/CustomerIntakeScreen.kt b/app/src/main/java/com/kingpaging/qwelcome/ui/CustomerIntakeScreen.kt index 255d84f..8c82c16 100644 --- a/app/src/main/java/com/kingpaging/qwelcome/ui/CustomerIntakeScreen.kt +++ b/app/src/main/java/com/kingpaging/qwelcome/ui/CustomerIntakeScreen.kt @@ -145,6 +145,12 @@ fun CustomerIntakeScreen( uiState.passwordError == null } + // Reset sheet state when QR conditions become invalid, so the sheet + // doesn't silently reappear once the fields become valid again. + LaunchedEffect(qrEnabled) { + if (!qrEnabled) showQrSheet = false + } + if (showQrSheet && qrEnabled) { QrCodeBottomSheet( ssid = uiState.ssid, diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index e97a362..867d8b3 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,5 +1,5 @@ [versions] -agp = "9.0.0" +agp = "9.0.1" coreKtx = "1.17.0" appcompat = "1.7.1" junit = "4.13.2" @@ -9,7 +9,7 @@ espressoCore = "3.7.0" # Includes collectAsStateWithLifecycle and other improvements lifecycle = "2.10.0" activityCompose = "1.12.2" -kotlin = "2.0.21" +kotlin = "2.2.10" composeBom = "2026.01.00" datastorePreferences = "1.2.0" splashscreen = "1.2.0" diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index a527887..dcee245 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,8 +1,8 @@ #Sun Jan 25 02:20:49 CST 2026 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionSha256Sum=a17ddd85a26b6a7f5ddb71ff8b05fc5104c0202c6e64782429790c933686c806 -distributionUrl=https\://services.gradle.org/distributions/gradle-9.1.0-bin.zip +distributionSha256Sum=72f44c9f8ebcb1af43838f45ee5c4aa9c5444898b3468ab3f4af7b6076c5bc3f +distributionUrl=https\://services.gradle.org/distributions/gradle-9.2.1-bin.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME From 0da85b540915a3de8185ca1329a885001a686dc6 Mon Sep 17 00:00:00 2001 From: Quentin Date: Wed, 18 Feb 2026 18:01:00 -0600 Subject: [PATCH 2/3] docs: add Phase 0 fix/feature PR requirement to release guide --- docs/RELEASE_GUIDE.md | 41 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 40 insertions(+), 1 deletion(-) diff --git a/docs/RELEASE_GUIDE.md b/docs/RELEASE_GUIDE.md index 03edc92..d7866a7 100644 --- a/docs/RELEASE_GUIDE.md +++ b/docs/RELEASE_GUIDE.md @@ -30,10 +30,37 @@ ## Full Release Workflow +### Phase 0 — Merge All Pending Fix / Feature PRs First + +> **This step must happen before creating the release branch.** The release branch is a snapshot of `master` at the point it is cut. Any bug fix or feature that should be included in the release must already be on `master` before you proceed. + +**Required order of operations:** + +1. **Fix / feature work** lives on its own branch (`fix/` or `feature/`). +2. **Open a PR** from that branch → `master`. Fill in the body, get CI green, get approval. +3. **Merge the PR** into `master`. +4. **Pull `master` locally** (`git pull origin master`) to incorporate the merged commits. +5. **Only then** proceed to Phase 1 to create the release branch. + +```powershell +# Confirm master is fully up to date before cutting the release branch +git checkout master +git pull origin master + +# Verify all expected fix/feature commits are present +git log --oneline -10 +``` + +> **Why?** If you create the release branch before merging a fix PR, that fix is absent from the +> release unless you manually cherry-pick or re-merge — both of which are error-prone. Always +> let `master` converge first. + +--- + ### Phase 1 — Prepare the Release Branch ```powershell -# 1. Make sure you are on master and up to date +# 1. Make sure you are on master and up to date (repeat git pull if needed after Phase 0) git checkout master git pull origin master @@ -263,6 +290,18 @@ For an AI agent performing a release, here is the exact sequence of operations. **The agent handles everything — no manual steps required.** ```text +# ── Phase 0: Land all fix/feature PRs into master first ────────────────────── +0a. For each pending fix/feature: + a. git checkout -b fix/ (or feature/) from master + b. Commit the changes + c. git push -u origin HEAD + d. Create PR → master via API/MCP tools + e. Wait for CI green + approval + f. Merge the PR on GitHub +0b. git checkout master && git pull origin master + # Confirm all expected commits are present: git log --oneline -10 +# ───────────────────────────────────────────────────────────────────────────── + 1. git checkout master && git pull origin master 2. git fetch --tags 3. $LAST_TAG = git describe --tags --abbrev=0 --match "v*" From 11d63e46f461474d38728f3db6ac3215a75786ca Mon Sep 17 00:00:00 2001 From: Quentin Date: Wed, 18 Feb 2026 18:24:09 -0600 Subject: [PATCH 3/3] refactor: move QR sheet state management to ViewModel and update UI state handling --- .../qwelcome/ui/CustomerIntakeScreen.kt | 30 ++++--------------- .../qwelcome/ui/CustomerIntakeUiState.kt | 15 ++++++++++ .../viewmodel/CustomerIntakeViewModel.kt | 24 ++++++++++++--- 3 files changed, 41 insertions(+), 28 deletions(-) diff --git a/app/src/main/java/com/kingpaging/qwelcome/ui/CustomerIntakeScreen.kt b/app/src/main/java/com/kingpaging/qwelcome/ui/CustomerIntakeScreen.kt index 8c82c16..0d0d10e 100644 --- a/app/src/main/java/com/kingpaging/qwelcome/ui/CustomerIntakeScreen.kt +++ b/app/src/main/java/com/kingpaging/qwelcome/ui/CustomerIntakeScreen.kt @@ -95,7 +95,6 @@ fun CustomerIntakeScreen( val templateUiState by templateListViewModel.uiState.collectAsStateWithLifecycle() // Use rememberSaveable so rotation/process death doesn't reset these var passwordVisible by rememberSaveable { mutableStateOf(false) } - var showQrSheet by rememberSaveable { mutableStateOf(false) } // Dropdown state is transient - use remember so it collapses on rotation var templateDropdownExpanded by remember { mutableStateOf(false) } // Copy success feedback - brief visual confirmation (ChatGPT feedback: animate meaning) @@ -132,31 +131,14 @@ fun CustomerIntakeScreen( } } - // QR Code Bottom Sheet - // For open networks, only SSID is required - // For secured networks, both SSID and valid password are required - val qrEnabled = if (uiState.isOpenNetwork) { - uiState.ssid.isNotBlank() && uiState.ssidError == null - } else { - uiState.ssid.isNotBlank() && - uiState.ssidError == null && - uiState.password.isNotBlank() && - uiState.password.length >= WifiQrGenerator.MIN_PASSWORD_LENGTH && - uiState.passwordError == null - } - - // Reset sheet state when QR conditions become invalid, so the sheet - // doesn't silently reappear once the fields become valid again. - LaunchedEffect(qrEnabled) { - if (!qrEnabled) showQrSheet = false - } - - if (showQrSheet && qrEnabled) { + // QR Code Bottom Sheet — showQrSheet and qrEnabled live in the ViewModel + // so the auto-reset (qrEnabled → false clears the sheet) is testable. + if (uiState.showQrSheet) { QrCodeBottomSheet( ssid = uiState.ssid, password = uiState.password, isOpenNetwork = uiState.isOpenNetwork, - onDismiss = { showQrSheet = false } + onDismiss = { customerIntakeViewModel.setShowQrSheet(false) } ) } @@ -246,10 +228,10 @@ fun CustomerIntakeScreen( QrCodeSection( uiState = uiState, - enabled = qrEnabled, + enabled = uiState.qrEnabled, onShowQrClick = { hapticFeedback() - showQrSheet = true + customerIntakeViewModel.setShowQrSheet(true) } ) } diff --git a/app/src/main/java/com/kingpaging/qwelcome/ui/CustomerIntakeUiState.kt b/app/src/main/java/com/kingpaging/qwelcome/ui/CustomerIntakeUiState.kt index 8b67f79..e53896d 100644 --- a/app/src/main/java/com/kingpaging/qwelcome/ui/CustomerIntakeUiState.kt +++ b/app/src/main/java/com/kingpaging/qwelcome/ui/CustomerIntakeUiState.kt @@ -2,6 +2,7 @@ package com.kingpaging.qwelcome.ui import com.kingpaging.qwelcome.data.CustomerData import com.kingpaging.qwelcome.util.StringUtils +import com.kingpaging.qwelcome.util.WifiQrGenerator /** * UI state for the Customer Intake form. @@ -26,8 +27,22 @@ data class CustomerIntakeUiState( val accountNumberError: String? = null, /** When true, password validation is skipped (for open/guest networks) */ val isOpenNetwork: Boolean = false, + /** Whether the QR code bottom sheet is currently shown */ + val showQrSheet: Boolean = false, ) { + /** True when the WiFi fields are valid enough to generate a QR code. */ + val qrEnabled: Boolean + get() = if (isOpenNetwork) { + ssid.isNotBlank() && ssidError == null + } else { + ssid.isNotBlank() && + ssidError == null && + password.isNotBlank() && + password.length >= WifiQrGenerator.MIN_PASSWORD_LENGTH && + passwordError == null + } + /** * Returns true if all form fields pass validation (no errors present). * diff --git a/app/src/main/java/com/kingpaging/qwelcome/viewmodel/CustomerIntakeViewModel.kt b/app/src/main/java/com/kingpaging/qwelcome/viewmodel/CustomerIntakeViewModel.kt index 26d37ad..f87dbcb 100644 --- a/app/src/main/java/com/kingpaging/qwelcome/viewmodel/CustomerIntakeViewModel.kt +++ b/app/src/main/java/com/kingpaging/qwelcome/viewmodel/CustomerIntakeViewModel.kt @@ -123,6 +123,22 @@ class CustomerIntakeViewModel( // Track last action time for rate limiting private var lastActionTime: Long = 0L + /** + * Wraps [MutableStateFlow.update] with an automatic guard: + * if the resulting state has [CustomerIntakeUiState.showQrSheet] true + * but [CustomerIntakeUiState.qrEnabled] false, the sheet flag is cleared. + */ + private inline fun updateState(transform: (CustomerIntakeUiState) -> CustomerIntakeUiState) { + _uiState.update { current -> + val next = transform(current) + if (next.showQrSheet && !next.qrEnabled) next.copy(showQrSheet = false) else next + } + } + + fun setShowQrSheet(show: Boolean) { + updateState { it.copy(showQrSheet = show) } + } + fun onPause() { savedStateHandle[KEY_BACKGROUND_TIMESTAMP] = timeProvider.elapsedRealtime() } @@ -158,7 +174,7 @@ class CustomerIntakeViewModel( fun onSsidChanged(ssid: String) { // Real-time validation for SSID byte length (WiFi spec: max 32 bytes UTF-8) val error = if (ssid.isEmpty()) null else getWifiErrorMessage(WifiQrGenerator.validateSsid(ssid)) - _uiState.update { it.copy(ssid = ssid, ssidError = error) } + updateState { it.copy(ssid = ssid, ssidError = error) } } fun onPasswordChanged(password: String) { @@ -171,7 +187,7 @@ class CustomerIntakeViewModel( ) else -> getWifiErrorMessage(WifiQrGenerator.validatePassword(password)) } - _uiState.update { it.copy(password = password, passwordError = error) } + updateState { it.copy(password = password, passwordError = error) } } fun onAccountNumberChanged(accountNumber: String) { @@ -183,7 +199,7 @@ class CustomerIntakeViewModel( * and the password field is cleared/disabled (for guest networks without passwords). */ fun onOpenNetworkChanged(isOpen: Boolean) { - _uiState.update { state -> + updateState { state -> state.copy( isOpenNetwork = isOpen, // Clear password and error when switching to open network @@ -293,7 +309,7 @@ class CustomerIntakeViewModel( val accountNumberError = if (currentState.accountNumber.isBlank()) resourceProvider.getString(R.string.error_account_empty) else null // Batch all error updates into a single state change to minimize recompositions - _uiState.update { state -> + updateState { state -> state.copy( customerNameError = customerNameError, customerPhoneError = customerPhoneError,