Skip to main content

portal_platform 0.4.0 copy "portal_platform: ^0.4.0" to clipboard
portal_platform: ^0.4.0 copied to clipboard

PlatformAndroid

Shared auth, API client, session, config, deep-link routing, and offline-first sync for Portal apps.

0.4.0 #

  • portalAppIconFor: portal_travel now maps to Icons.luggage_outlined instead of the generic app fallback.

  • Raised the portal_ui_core constraint to ^0.4.0 (the published 0.3.0 the old >=0.3.0 <0.4.0 pointed at never shipped; pub.dev is now at 0.4.0).

  • PortalAuthView: a refused sign-in (401) is the password field's own error and a taken email on sign-up (409) is the email field's, via the new PortalAuthController.passwordError / emailError (cleared as the field is edited); errorMessage stays the banner for what no field owns. New PortalAuthConfig.testServerUrl (optional, also on .of and portalLoginPage): with showTestServer, a "Use test server" switch points the app at that URL and back (PortalAuthController.setTestServer, usingTestServer).

  • PortalPasswordResetView: after a code is sent, "You can resend in 0:42" counts down (resendAfter, default 60s), then becomes a "Resend code" button. New startOnCodeStep opens on the code step, countdown running.

  • PortalImagePickerSheet.photoBuilder (new, optional): draws each search result's picture itself instead of the cached network image, so the design kit and tests can render the sheet with no network.

  • PortalSettingsPage is one flat grouped page: Appearance, Assistant, About (Status) and Account render inline as sections instead of nav rows that push sub-pages, and Portal apps is an inline section. Sheets (name, theme, accent, haptics) are unchanged, as are the sign-out and delete-account flows. API is unchanged: order, include, slot, sections, settingsRoute and portalSettingsChildren all still work (the child routes remain as deep-link targets; settingsRoute now only names the change-password push).

  • syncQueuedToast, syncPushedToast, syncRejectedToast and syncEvictedToast (new, exported): the four toasts portalInstallSyncFeedback raises, as plain PortalToastData builders. Behaviour is unchanged — the installer now calls AppToast.present with them — but the design kit can preview the shipped copy instead of a hand-kept twin.

  • Fix: a local-only session (ApiClient.startLocalOnlySession) writes no token, so every request it made afterward still went out unauthenticated, 401'd, and _failSessionExpired signed the device-local user back out on their first authenticated read — the "Continue without an account" flow was unusable the moment it touched the network. ApiClient now tracks _localOnly (set on startLocalOnlySession, seeded from the cached user on init, cleared by a real sign-in/logout/server switch) and short-circuits _authorizeWithRetry/postStream with an ApiException (code LOCAL_ONLY_SESSION) before ever sending — callers already treat a thrown ApiException as offline (serve cache, queue the write).

  • PortalAuthController.continueWithoutAccount no longer asks "Encrypt your data on this device?" when the caller passed no onLocalOnlySessionStarted — only an app with its own entity-persistence seam reads that choice, so asking elsewhere offered a prompt nothing honoured.

  • PortalAppRoot.shouldGuardRoute (new, nullable bool Function(String route)): wires PortalDeviceSecurityGate and the route-change plumbing it needs for an app with the shared app lock, so the lock no longer forces a hand-rolled root. Null (the default) leaves every existing caller's widget tree exactly as it was — no Obx, no gate.

  • usePortalUrlStrategy() (new, in portal_platform.dart): call once before runApp so a nested GetX path (/gym/settings) shows in the browser bar as-is instead of hash-routed (/#/gym/settings). No-ops off web. Replaces the same conditional-import pattern three apps had each copied by hand.

  • portalSettingsChildren() (new): the settings sub-pages as GetPage children, for an app wiring a nested GetX route tree instead of a plain Navigator stack. Mount it under the same path given to the new PortalSettingsPage.settingsRoute (nullable String) — non-null, every row's onTap becomes Get.toNamed against that route instead of an unnamed MaterialPageRoute push; null (the default) keeps today's push behaviour exactly, so an existing caller is unaffected. PortalSettingsSegment carries the route segment names (appearance, assistant, apps, about, account, change-password) both this helper and settingsRoute's navigation use, so a consuming app builds its own full paths from its root plus these rather than hand-typing each segment.

  • The About sub-page self-probes reachability and loads the app version when not handed a snapshot (e.g. reached through portalSettingsChildren()'s own route rather than pushed from the hub), instead of staying stuck on "Checking...".

  • PortalDeepLinkAssistantView's back gesture now pops normally when there is a stack under it (canPop: Navigator.of(context).canPop()); a cold deep link (empty stack) still bounces to fallbackRoute exactly as before.

  • PortalSettingsPage nests the infrequent groups behind their own pages: Appearance, Assistant, Portal apps and About are now one coalesced nav card of rows, each pushing a PortalSettingsSubPage; Account is its own separate card/page. The constructor is unchanged — include/order still take the same PortalSettingsGroup values, just rendered through a row instead of inline. The default order also changed (custom sections now come right after Profile instead of after Appearance, and Portal apps now comes before About) — every call site that doesn't pass its own order picks up the new layout.

  • PortalSettingsSubPage (new): the chrome a pushed settings page shares with the hub — same background tone, PortalAppBar, and list padding.

  • PortalPasswordResetView now builds on portal_ui_core's PortalAppBar, PortalTextField and PortalButton instead of raw AppBar/TextFormField/FilledButton — presentation only, same fields, validation and API calls. The password fields use PortalTextField.obscureToggle for the show/hide eye.

  • PortalAuthConfig.of(identity): builds a config from a portal_ui_core PortalAppIdentity so an app states its icon/name/tagline once. identity.logo isn't forwarded — appIconImage is an asset path, not an ImageProvider — pass it on the plain constructor if needed. Needs portal_ui_core 0.3.0 (PortalAppIdentity); the constraint is raised to match.

  • PortalSettingsSection.slot (new, defaults to PortalSettingsGroup.custom): a section can render right after a named group's own content instead of only in the custom slot.

  • PortalSettingsPage.header (new): given, the page is just its ListView with header first — no Scaffold/PortalAppBar — for a caller embedding it under its own chrome. Loses the app bar's cloud-outage line; the Status group's own Mode row still reports it.

  • PortalSettingsPage rebuilt as the grouped kit page: inset sections from portal_ui_core, a tonal tile on every row, headers as written (no longer upper-cased), and Portal Cloud's outage in the bar's status line. Needs portal_ui_core 0.2.1 (PortalListAccessory.navigate(swatch:), PortalAppBar(status:)); the constraint is raised to match.

    • Profile is an account cell that opens an Edit name sheet; signed out, onSignIn (new) adds a Sign in row.
    • Appearance: Theme and Accent colour rows open sheets that apply on tap. The accent row shows the first of palettes while the controller holds no id.
    • assistantSection (new) draws the app's AI settings inline in the Assistant slot. aiSection is deprecated: it still works, as one "Assistant" row that opens the widget on its own page.
    • Status: Mode (Portal Cloud / On-device, from one readiness probe on open), App version (seven taps still open the server page) and Check for updates. This replaces the old Server and Assistant health rows.
    • The About group now holds the account block: Change password, Sign out, Delete account, under an "Account" heading. A failed delete is a retry prompt above the rows. The device-security row is no longer added here; an app that has one mounts it in its own sections.
    • sectionBuilder now wraps only sections; its default is a kit header over the children as given.
  • PortalAppsSection.grouped: the same list as a kit section, with skeleton, error (retry), empty and data states, Check again on the header, a More button and long press holding Uninstall, and Install / Update asked in a sheet that shows what is new. The default constructor is unchanged.

  • portalInstallAndReport: the install-and-snackbar tail of showPortalUpdateDialog, shared with the Install / Update sheet.

  • portalCanInstallApps reads Flutter's defaultTargetPlatform rather than Platform.isAndroid, so a widget test can render the app list.

  • PortalSettingsLabels: account, signIn, signInSubtitle, editName, theme, accentColour, mode, modeCloud, modeOnDevice, cloudUnreachable, checkForUpdates, upToDate, updateCheckFailed, more, retry, whatsNew, later. The sign out and delete account confirmations carry the new copy.

  • PortalDeviceSecurityLockView gains optional pinMode (force the PIN form off web, for the design kit), noScreenLock + onOpenSettings (lead with "set a screen lock" and open the phone's settings) and onForgotPin (Forgot PIN? under the PIN field). DeviceSecurityController.unlockError carries a failed biometric check, shown under the message; PortalDeviceSecurityStrings gets optional noScreenLockSubtitle, openSettingsButton, forgotPinButton.

0.1.1 #

  • Source moved to the public portal_packages repository; repository: link now resolves.