portal_platform 0.4.0
portal_platform: ^0.4.0 copied to clipboard
Shared auth, API client, session, config, deep-link routing, and offline-first sync for Portal apps.
0.4.0 #
-
portalAppIconFor:portal_travelnow maps toIcons.luggage_outlinedinstead of the generic app fallback. -
Raised the
portal_ui_coreconstraint to^0.4.0(the published 0.3.0 the old>=0.3.0 <0.4.0pointed 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 newPortalAuthController.passwordError/emailError(cleared as the field is edited);errorMessagestays the banner for what no field owns. NewPortalAuthConfig.testServerUrl(optional, also on.ofandportalLoginPage): withshowTestServer, 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. NewstartOnCodeStepopens 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. -
PortalSettingsPageis 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,settingsRouteandportalSettingsChildrenall still work (the child routes remain as deep-link targets;settingsRoutenow only names the change-password push). -
syncQueuedToast,syncPushedToast,syncRejectedToastandsyncEvictedToast(new, exported): the four toastsportalInstallSyncFeedbackraises, as plainPortalToastDatabuilders. Behaviour is unchanged — the installer now callsAppToast.presentwith 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_failSessionExpiredsigned 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.ApiClientnow tracks_localOnly(set onstartLocalOnlySession, seeded from the cached user oninit, cleared by a real sign-in/logout/server switch) and short-circuits_authorizeWithRetry/postStreamwith anApiException(codeLOCAL_ONLY_SESSION) before ever sending — callers already treat a thrownApiExceptionas offline (serve cache, queue the write). -
PortalAuthController.continueWithoutAccountno longer asks "Encrypt your data on this device?" when the caller passed noonLocalOnlySessionStarted— only an app with its own entity-persistence seam reads that choice, so asking elsewhere offered a prompt nothing honoured. -
PortalAppRoot.shouldGuardRoute(new, nullablebool Function(String route)): wiresPortalDeviceSecurityGateand 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 — noObx, no gate. -
usePortalUrlStrategy()(new, inportal_platform.dart): call once beforerunAppso 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 asGetPagechildren, for an app wiring a nested GetX route tree instead of a plain Navigator stack. Mount it under the same path given to the newPortalSettingsPage.settingsRoute(nullableString) — non-null, every row'sonTapbecomesGet.toNamedagainst that route instead of an unnamedMaterialPageRoutepush; null (the default) keeps today's push behaviour exactly, so an existing caller is unaffected.PortalSettingsSegmentcarries the route segment names (appearance,assistant,apps,about,account,change-password) both this helper andsettingsRoute'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 tofallbackRouteexactly as before. -
PortalSettingsPagenests the infrequent groups behind their own pages: Appearance, Assistant, Portal apps and About are now one coalesced nav card of rows, each pushing aPortalSettingsSubPage; Account is its own separate card/page. The constructor is unchanged —include/orderstill take the samePortalSettingsGroupvalues, just rendered through a row instead of inline. The defaultorderalso 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 ownorderpicks up the new layout. -
PortalSettingsSubPage(new): the chrome a pushed settings page shares with the hub — same background tone,PortalAppBar, and list padding. -
PortalPasswordResetViewnow builds onportal_ui_core'sPortalAppBar,PortalTextFieldandPortalButtoninstead of rawAppBar/TextFormField/FilledButton— presentation only, same fields, validation and API calls. The password fields usePortalTextField.obscureTogglefor the show/hide eye. -
PortalAuthConfig.of(identity): builds a config from aportal_ui_corePortalAppIdentityso an app states its icon/name/tagline once.identity.logoisn't forwarded —appIconImageis an asset path, not anImageProvider— pass it on the plain constructor if needed. Needsportal_ui_core0.3.0 (PortalAppIdentity); the constraint is raised to match. -
PortalSettingsSection.slot(new, defaults toPortalSettingsGroup.custom): a section can render right after a named group's own content instead of only in thecustomslot. -
PortalSettingsPage.header(new): given, the page is just itsListViewwithheaderfirst — noScaffold/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. -
PortalSettingsPagerebuilt as the grouped kit page: inset sections fromportal_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. Needsportal_ui_core0.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
paletteswhile the controller holds no id. assistantSection(new) draws the app's AI settings inline in the Assistant slot.aiSectionis 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. sectionBuildernow wraps onlysections; its default is a kit header over the children as given.
- Profile is an account cell that opens an Edit name sheet; signed out,
-
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 ofshowPortalUpdateDialog, shared with the Install / Update sheet. -
portalCanInstallAppsreads Flutter'sdefaultTargetPlatformrather thanPlatform.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. -
PortalDeviceSecurityLockViewgains optionalpinMode(force the PIN form off web, for the design kit),noScreenLock+onOpenSettings(lead with "set a screen lock" and open the phone's settings) andonForgotPin(Forgot PIN? under the PIN field).DeviceSecurityController.unlockErrorcarries a failed biometric check, shown under the message;PortalDeviceSecurityStringsgets optionalnoScreenLockSubtitle,openSettingsButton,forgotPinButton.
0.1.1 #
- Source moved to the public
portal_packagesrepository;repository:link now resolves.