Repository navigation
fix(lint): clear the three errors baselined in #1743 - #1744
Merged
Merged
Conversation
rememberChatPhotoPicker called getPickImagesMaxLimit() during composition with no version check. The method exists only on API 33+, or on API 30-32 with SDK extension R 2+, so an Android 12 device without the MediaProvider update threw NoSuchMethodError every time a chat opened (Bugsnag 6ac91865991833fd09984195, Samsung SM-N976V). Only call it where the system picker provides it. Elsewhere androidx falls back to a picker with no cap of its own, and the result callback already trims the selection to the remaining slots.
Int.MAX_VALUE never reached the picker, since the clamp came out to remaining anyway, but it read as no cap. Fall back to remaining directly.
CI runs :apps:flipcash:app:lintDebug, but checkDependencies defaults to false, so lint only looked at the app module. The unguarded MediaStore.getPickImagesMaxLimit() call in chat-ui (#1741) shipped because no lint run ever saw it; with checkDependencies on, lint fails on it with NewApi. Turning it on surfaces three other existing errors, which go in the baseline so the check gates new issues only: WrongConstant in AppSettingsMapper, UnspecifiedRegisterReceiverFlag in SmsOtpAutofill (the pre-34 branch, where the flag isn't available), and UnrememberedMutableState in Flippable.
- WrongConstant: AppSettingMapper passed Biometrics.TEST_AUTH across a module boundary, where lint can't see it is a valid authenticator flag. The check now goes through Biometrics.authenticationState(), and TEST_AUTH is private. - UnspecifiedRegisterReceiverFlag: SmsOtpAutofill only passed RECEIVER_EXPORTED on API 34+. ContextCompat.registerReceiver takes the flag on every version; the receiver stays exported, as SMS_RETRIEVED comes from Play services and SEND_PERMISSION still guards it. - UnrememberedMutableState: FlippableCard built a new State object on each composition when animateFlip is false. It now uses rememberUpdatedState. The three entries come out of the app's lint baseline.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stacked on #1743. Fixes the three lint errors that PR added to the baseline, and removes their entries.
AppSettingsMapper.kt:18):Biometrics.TEST_AUTHreachedcanAuthenticatefrom another module, where lint can't tell it is a valid authenticator flag. The mapper now callsBiometrics.authenticationState(biometricManager), andTEST_AUTHis private so the constant stays in one module.SmsOtpAutofill.kt:104): the export flag was only passed on API 34+.ContextCompat.registerReceivertakes it on every version. The receiver stays exported, sinceSMS_RETRIEVEDis sent by Play services, andSmsRetriever.SEND_PERMISSIONstill guards it.Flippable.kt:57): withanimateFlip = false,FlippableCardcreated a newStateobject on every composition. It now usesrememberUpdatedState(cardFace.angle).FlippableCardhas no callers in the repo, so this doesn't change any screen../gradlew :apps:flipcash:app:lintDebugreports 0 errors without the three entries.The second commit regenerates the baseline with
updateLintBaseline, now thatcheckDependenciesis on. The old one was written withdependencies="false", which lint warned about. The new one holds the library modules' existing findings too: 827 warnings and 7 hints, mostlyUnusedResources(534) andUsingMaterialAndMaterial3Libraries(169). Those warnings no longer show in the lint report.The third commit clears the one error that was left. The manifest declares
PhantomWalletCallbackActivity, but only:shared:onramp:deeplinksdepended onphantom-connect-wallet, as animplementationdependency. The class was packaged in the APK, but lint couldn't see it from the app module and reportedMissingClass. The app now depends on the library directly, with the same libsodium exclude. The baseline holds no errors now.