Skip to content

PAM Native 1.42.0

Choose a tag to compare

@DavidWilliamBalbino DavidWilliamBalbino released this 15 Oct 00:22
· 625 commits to main since this release

PAM Native 1.42.0 adds media-library thumbnails, file existence checks, raw drag drivers, accessibility selection, keyboard tap persistence on scroll views and lists, per-route error boundaries, a native "new contact" form, multi-button alerts with permission rationale, and failure callbacks in place of exceptions across several system modules. Protocol: properties 537 (accessibilitySelected) and 538 (keyboardShouldPersistTaps), append-only. The other additions are new module methods and need no protocol change. Existing calls behave as before.

Media library

  • Every MediaAsset now has a thumbnailUri, the source to use for a grid cell.
    • Android: the typed images/video MediaStore URI. Image decodes it at the view size from the platform thumbnail cache, and videos show a frame.
    • iOS: the phasset:// source, drawn at the view size. Videos show their poster frame.
  • MediaLibrary::thumbnail($assetId, $maxPx, $done, $failure) writes a JPEG and returns its file:// URI.
    • The longer edge is at most $maxPx (clamped to 32-1024), and video frames are supported.
    • The image is decoded at that size: Android 10+ uses loadThumbnail, older versions use a sampled decode or getScaledFrameAtTime, and iOS uses PhotoKit.
    • Thumbnails go into a bounded disk cache: 24 MiB or 600 files, least recently used first, trimmed to 75%. The cache key includes the asset's modification date.
  • assets(..., failure:) and albums(..., $failure) pass native failures, such as a missing permission, to the closure instead of throwing.
  • refreshLimitedSelection(fn (bool $limited) => ...) reopens the system selection when photo access is limited: iOS 14+ presents the limited library picker, and Android 14+ requests the visual media permissions again.

Files

  • New Files::exists($path, fn (bool $exists) => ...).
  • New Files::find(), which returns ?FileReference.
  • Files::stat() no longer throws when the file is missing. It calls the optional missing closure instead; other failures go to failure.

Gestures

  • Drag::driveRaw() drives a property from the raw finger translation, before bounds and rubber band are applied, and extrapolates past its points.
  • driveUnbounded() makes every drive() behave the same way.

Accessibility

  • accessibilitySelected / Element::accessibilitySelected() reports selection to TalkBack (AccessibilityNodeInfo.isSelected) and VoiceOver (.selected trait) without changing the visual selected state.

Keyboard

  • keyboardShouldPersistTaps works on ScrollView, FlatList, SectionList and VirtualizedList, as in React Native, through the new KeyboardPersistTaps enum:
    • never: a tap dismisses the keyboard and is consumed.
    • handled: the keyboard is dismissed only when no child handles the tap.
    • always: taps never dismiss the keyboard.
    • React Native's boolean values are also accepted.
  • Without the attribute, the current behaviour stays: a tap never closes the keyboard, and nothing extra is installed.

Navigation

  • Error boundaries per route through PendingRoute::errorBoundary() and Router::errorBoundary(), plus a global default with Route::errorBoundary().
  • When a stack route throws while being created, mounted or rendered, the boundary renders a fallback in its place, and the other routes keep working.
  • $retry() renders the route again, and the error is reported once as non-fatal.

System

  • Contacts::openNewContactForm(fn (bool $created), $failure) opens the system editor: Android ACTION_INSERT, iOS CNContactViewController. It needs no contacts permission.
  • Share::text() gains $failure, and $opened now fires only after the sheet has actually been presented.
  • Alert::choose() shows 1-3 AlertButtons with the styles Default, Cancel and Destructive, and returns the index of the pressed button.
  • Permission rationale:
    • New Permissions::shouldShowRationale().
    • requestKind(..., rationale: new PermissionRationale(...)) first explains a repeated request in a native alert.
  • Permissions::status()/requestKind() and Caches::usage()/clear() accept a $failure closure.

Validation of candidate

  • PHP SDK: the full suite passes with the new tests, and PHPStan level 9 reports nothing on the new sources. tests/mbstring_polyfill.php still differs from the local PHP 8.4.24 ext-mbstring; this host difference was already present in 1.40 and 1.41.
  • Rust: 235 tests pass (80 CLI, 142 engine, 13 protocol), and fmt and clippy are clean.
  • Android: JVM unit tests and lintDebug pass.
  • Instrumented tests on the API 36 emulator: 75/75 passed (media thumbnail/thumbnailUri, renderer accessibility with accessibilitySelected, contacts, native capabilities).
  • Exact-candidate native and native-ui community first-run gates passed on the API 36 emulator (isolated dev port 39142).
  • The Linux CLI, the Android renderer, the PHP SDK archives and the plugin AAR pass deterministic rebuilds and package budgets.

Known limits

  • The iOS sources were written on Linux and were neither compiled nor tested; the Mac checklist is in docs/ios-parity.md (1.42.0 sections).
  • These were not exercised by hand on Android: the actual contact editor, Alert::choose, the rationale dialog, keyboardShouldPersistTaps taps and the Android 14 selection picker. They are covered by JVM and PHP tests only.
  • The embedded camera changes (pinchZoom, maxZoom, zoomResetRevision, ready with min/max zoom, doubleTap/doubleTapFlip) belong to the pushinbr/pam-native-media plugin and ship as its own 0.6.0, not in this release.