Skip to content

feat: complete Android permission UX for camera, location and push#101

Open
xJeffx23 wants to merge 1 commit into
ericmt-98:mainfrom
xJeffx23:feat/android-permission-ux
Open

feat: complete Android permission UX for camera, location and push#101
xJeffx23 wants to merge 1 commit into
ericmt-98:mainfrom
xJeffx23:feat/android-permission-ux

Conversation

@xJeffx23
Copy link
Copy Markdown

@xJeffx23 xJeffx23 commented May 29, 2026

Closes #78

Problem

The APK had no permission experience: features silently broke when denied, no rationale before the OS prompt,
no path to recover from permanent denial.

Changes

New files

  • src/hooks/usePermission.ts — three hooks (camera, location, push) each handling prompt / granted / denied / permanently_denied
  • src/components/PermissionGate.tsx — reusable gate: rationale screen → OS prompt → denied card → permanently-denied card
    with settings CTA → fallback slot
  • src/components/PushPermissionBanner.tsx — non-blocking inline banner for merchants; inbox remains functional at all
    push states

Modified files

  • useGeolocation.ts — check-only on mount (no auto OS dialog); rationale shown first via ExploreMap gate;
    appStateChange listener recovers state after settings
  • useQRScanner.ts — already used check-before-request; confirmed correct
  • ExploreMap.tsx — shows PermissionGate for prompt state on native before triggering OS dialog; zone-based search
    fallback when denied
  • MerchantInbox.tsxPermissionGate wraps scan area; manual QR paste fallback; appStateChange re-checks camera on
    return from settings
  • AndroidManifest.xmlPOST_NOTIFICATIONS declared; all hardware features required="false"
  • Android build files — capacitor-push-notifications wired into Gradle

Acceptance criteria

  • Denying camera does not crash the scanner → shows manual paste fallback
  • Denying location shows zone-based search fallback
  • Denying push keeps the inbox fully functional
  • APK recovers permissions from system settings (appStateChange + app-settings: on Capacitor 8)

Test plan

  • TypeScript: 0 errors (npx tsc --noEmit)
  • Production build: clean (npm run build)
  • Android — camera: rationale gate → OS dialog → denied → paste fallback
  • Android — camera: permanently denied → Ir a Ajustes → grant → auto-recovers
  • Android — location: rationale gate → OS dialog → denied → zone input
  • Android — location: permanently denied → Ir a Ajustes → grant → auto-recovers
  • Android — push: banner prompt → OS dialog → denied → inbox still loads trades
  • Android — all: adb shell pm reset-permissions com.micopay.app between runs

Dependencies

Provides the permission infrastructure for:

If there is any point for improvement, please let me know and I will fix it.🚀

(
  feat: Android permission UX for camera, location and push

  - usePermission hook: 3 hooks, 4 states each (prompt/granted/denied/permanently_denied)
  - PermissionGate component: rationale, denied, settings CTA, fallback slot
  - PushPermissionBanner: check-on-mount, inbox works without push
  - ExploreMap: rationale gate before OS dialog, zone fallback when denied
  - MerchantInbox: camera gate, manual paste fallback, appStateChange recovery
  - AndroidManifest: POST_NOTIFICATIONS + hardware features required=false
  - Wire capacitor-push-notifications into Android build)
@drips-wave
Copy link
Copy Markdown

drips-wave Bot commented May 29, 2026

@xJeffx23 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Android permissions UX for camera, location and notifications

1 participant