ecency/vision-mobile
Tentang
Ecency Mobile - reimagined social blogging, contribute and get rewarded (for Android and iOS)
Pengembangan web dan aplikasiYang dapat Anda lakukan
- 202 delivery_pending (images) and 409 in_progress (all three) are "paid, not ready": asked for again with the same key after the server's retry_after (2 to 60 s), at most 12 times, then left to "Check again". RN treats both as a failure and, for assist and images, forgets the key.
- A refusal ends the intent: 400, 402, 429 and 503 charge nothing, the 500s the server names (generation_failed, transcription_failed, server_error) are refunded or unpaid, 422 is charged and says so. 401 and 403 keep the intent ("Sign in again, then check again"). Dictation keeps the clip and its key after 402 and 429, as RN ("Try again").
- Account binding: an intent names its owner, the request uses the owner's session, and nothing is sent while another account is signed in ("This belongs to @owner"). A result is only written into the editor while the editor's owner is signed in (applyAiResult, insertAiImage, insertDictation). The stored intent stays for the owner's return.
- Fake-data and test runs never reach these endpoints: DemoAuthServices answers them with synthetic prices, balance and results; iOS fake-data runs use DemoDictationRecorder (no microphone).
Pertumbuhan bintang terukur
- dalam 24 jam
- 0
- dalam 7 hari
- 0
- dalam 15 hari
- 0
- dalam 1 bulan
- Mengumpulkan riwayat
Perubahan bersih pada periode yang tumpang tindih, bukan total harian. Pengukuran yang belum tersedia dibiarkan kosong. Bintang menunjukkan perhatian, bukan kualitas.
README.md
AsliEcency mobile
The Ecency app for iOS and Android (4.x): SwiftUI on iOS, Jetpack Compose on Android, over a shared Kotlin Multiplatform core. It ships to both stores as the update of the React Native 3.x app (app.esteem.mobile.ios, app.esteem.mobile.android), reading the RN app's stored accounts, keys and settings in place (below, "In-place upgrade from RN 3.x").
The React Native app was removed from this repository in #3627; its last state is the rn-3.x-final tag (git checkout rn-3.x-final). Where this README says "RN", it means that app, which the native one matches feature for feature.
Layout
shared/ Kotlin Multiplatform core (Android + iOS), package com.ecency.core
androidApp/ Jetpack Compose app
iosApp/ SwiftUI app; project.yml is the source, the .xcodeproj is generated
build-logic/ Gradle build tools (the localization generator)
src/config/locales/ The translations (Crowdin syncs this path; the l10n generator reads it)
scripts/ Simulator, emulator, icon and release helpers
tools/ Golden fixture generators, run by hand (tools/README.md)
docs/ Release builds, design notes, brand sources (docs/brand)
Requirements
- JDK 17+, Android SDK 37.2 (
local.propertieswithsdk.dir=..., not committed) - Xcode 26+ and XcodeGen (
brew install xcodegen); Xcode 27.1+ for the iPhone Duo simulator
Build and test
# Everything on the Kotlin side: shared tests (Android host + iOS simulator), Android unit/UI tests, lint
./gradlew check
# Android app
./gradlew :androidApp:assembleDebug
# The shared framework for arm64 Apple targets (devices, Apple silicon simulators, the App Store archive). Run it
# after shared changes: Kotlin/Native 2.3.10 crashes there on a 5-flow combine (a suspend lambda of 5 parameters)
# while the JVM and iosX64 builds pass; NativeCompilerGuardTest keeps those out
./gradlew :shared:linkDebugFrameworkIosSimulatorArm64 :shared:linkReleaseFrameworkIosArm64
# iOS app and its tests (unit + UI)
cd iosApp && xcodegen generate
xcodebuild test -project EcencySpike.xcodeproj -scheme EcencyApp \
-destination 'platform=iOS Simulator,name=<your simulator>'
Run on a simulator or emulator
scripts/ios-sim.sh # build, install and launch on the "Ecency Spike" iOS simulator (created on first run)
scripts/ios-sim.sh --test # unit + UI tests on that simulator
scripts/ios-sim.sh --shot out.png # launch, then screenshot (for UI comparisons)
ECENCY_SIM_NAME="Ecency Duo" ECENCY_SIM_DEVICE="iPhone Duo" scripts/ios-sim.sh # iPhone Duo (Xcode 27.1+)
scripts/android-emu.sh # build, install, launch, print launch time
scripts/android-emu.sh --shot out.png
android-emu.sh uses a connected device, or boots the AVD named by ECENCY_AVD (default Ecency_Spike_API_34).
Versioning
The app version lives in gradle/libs.versions.toml (appVersion, currently 4.0.1) and in iosApp/project.yml (MARKETING_VERSION). Tests fail if the apps and the core disagree. Android versionCode follows RN: major * 10000 + minor * 100 + patch locally (40001 for 4.0.1; RN 3.5.11 is 30511), and in store builds the build number, which CI sets to the Unix time exactly as the RN workflows did (about 1.79 billion in 2026), so every upload is above every RN store build. iOS CFBundleVersion is the build number (CI: the Unix time, as RN; 1 locally). VersionTest checks the Android rule. Details: docs/release-builds.md.
Release pipeline
The GitHub Actions build the apps with the RN app's secrets, signing and store targets (docs/release-builds.md has the secrets table and the details):
- Pull request:
test.yml("Lint & Unit Tests") runs:build-logic:test :shared:testAndroidHostTest :androidApp:testDebugUnitTest :androidApp:lintDebugon Linux unless the pull request changes only docs (the locale files count:src/config/locales, the native strings are generated from them), and passes without running otherwise. No app builds on pull requests. - Push to
developmenttouching the app (shared,androidApp,iosApp,build-logic, the Gradle files,scripts) orsrc/config/locales:build-android.yml(unit tests, secrets intolocal.properties, RN'sgoogle-services.json, R8 bundle signed with the RN upload key, the release launch check on an emulator, Play alpha track, mapping to Play and, in a job of its own, to Sentry) andbuild-ios.yml(secrets, RN'sGoogleService-Info.plist, RN certificate and profiles, archive, export, the release launch check on a simulator for manual runs, upload with RN's Apple ID and app-specific password, dSYMs to Sentry in a job of its own). Sentry uploads needSENTRY_AUTH_TOKENand are skipped without it. Build numbers are the Unix time, as RN. - By hand: both build workflows (track, notes, upload choice, build number) and
e2e-android.yml(the Android device tests on an emulator; also on thee2e-testlabel). - A published GitHub release of the app (
X.Y.Z, after the update prefix):release-apk.ymlattaches Google Play's universal APK of that version (Ecency-X.Y.Z.apkand its.sha256), signed with the key Play installs carry, for devices without Google Play (docs/release-builds.md, "APK for devices without Google Play"). By hand it only fetches and checks unless asked to attach.
Release setup: the builds read NATIVE_PIN_KEY_SHA256 and NATIVE_DEFAULT_PIN_SHA256 (and optionally NATIVE_SENTRY_DSN) as repository secrets, besides the RN secrets they reuse (upload keystore and alias, GOOGLE_JSON, GOOGLE_PLIST, RN's three iOS profiles) and one new iOS profile, WIDGET_PROVISIONING_PROFILE, for the widget extension app.esteem.mobile.ios.widgets (required: the iOS build fails without it; its App ID and profile are the only new ones, see docs/release-builds.md "Widget extension"). Otherwise native needs no new store records, App IDs, profiles, IAP products, ePoints package verification or Firebase apps. No RN build is uploaded after the first native one.
Privacy manifest
App Review refuses an iOS build whose code calls one of Apple's "required reason" APIs without declaring it in the bundle's PrivacyInfo.xcprivacy. The app's manifest is iosApp/EcencyApp/PrivacyInfo.xcprivacy (RN had ios/PrivacyInfo.xcprivacy): no tracking, no tracking domains, and three categories, each with the reason that matches the code. The Kotlin core is linked into the app statically, so the app's manifest covers it too.
- User defaults:
CA92.1(the app's own settings) and1C8F.1(the App Group suite shared with the widgets,WidgetStore). - File timestamps:
C617.1(dates of files in the app's container and App Group: the shared items' folders,SharePlatform, and the Kotlin/Native runtime and kotlinx-io, which callstatandgetattrlist; the lint requires this category for the app even if the Swift use goes away). - System boot time:
35F9.1(the time between two events in the app: how long a tap on post text lasted,PostTextView).
The share, widget and notification service extensions use none of these APIs, so they carry no manifest. Sentry ships its own manifest, and so does Firebase. Collected data types are declared in App Store Connect's privacy labels, as RN did; the manifest leaves them empty.
build-logic PrivacyManifestTest reads each bundle's sources and fails if code uses a category its manifest does not declare with these reasons, or if a manifest declares a category no code uses. iOS PrivacyManifestBundleTests checks that the build puts the file in the app bundle.
Tests are required
Every change lands with tests:
- Shared logic:
shared/src/commonTest, runs on Android host and iOS. Hive serialization and signing must have golden vectors generated from@ecency/sdk. - Android UI: Compose tests under
androidApp/src/test(Robolectric, no emulator needed). - Android device:
androidApp/src/androidTestfor what Robolectric cannot do (Android Keystore),./gradlew :androidApp:connectedDebugAndroidTest. - iOS:
EcencyAppTests(XCTest) andEcencyAppUITests(XCUITest). - Test data uses throwaway keys and dummy values only.
- Android Compose tests that wait on background work use
ComposeTestRule.await(ComposeAwait.kt): it runs the main looper each round and has no 10 s wall-clock cap (SliceFlowsTest). The flow tests' ownuntilhelpers wait through it too: their 10 s wall-clock loops failed under load (a full run beside an iOS build,Gaps3FlowsTest.theSpotlightButtonOpensItsLinkAndGoesAway). - Scaling tests (
LinearScaling): every "stays linear" check bills the measuring thread's CPU time (JVMThreadMXBean, Kotlin/NativeCLOCK_THREAD_CPUTIME_ID), keeps the fastest run of each size across up to five attempts, and only uses wall time as a hang guard. A quadratic still fails (an ancestor walk inDom.insertNode: exponent 2.37 to 2.47). - Golden files: regenerating a generator under
tools/goldenortools/render(or, from thern-3.x-finaltag, one of those that ran the RN app's source; tools/README.md) reproduces its committed file, except the values that are random by design and checked by recovery or decryption instead (the SDK's randomised signatures inGoldenVectors.kt,AuthGoldenVectors.ktandEditorGoldenVectors.kt, crypto-js salts inAuthGoldenVectors.ktandLegacyFixtures.kt).
Mutation checks
A new guard (a lint, an invariant test, a regression test) is checked before it is trusted: weaken or remove the code it protects, see a test fail, then restore the code. A guard that stays green when the behaviour it covers is gone does not guard anything.
App layer
shared/src/commonMain/kotlin/com/ecency/core/app is the presentation layer both UIs sit on: state holders with immutable state, so Compose and SwiftUI only draw and forward taps. Create one AppEnvironment per process and get every model from it.
val env = AppEnvironment.create(AndroidKeystoreSecureStore(context), debugKeyImport = BuildConfig.DEBUG)
env.session.start() // reads the current account from the vault
val feed = env.feedModel(FeedSource.Ranked(RankedSort.TRENDING)) // or HOT, CREATED, tag, community, FeedSource.Account(...)
feed.start(); feed.refresh(); feed.loadMore(); feed.retry()
feed.refreshAndWait() // suspend: refresh, then return when it finished (pull to refresh)
val state by feed.state.collectAsState() // FeedState(items: List<PostCard>, isLoading, isRefreshing, isLoadingMore, endReached, error, loaded, pages)
val post = env.postModel("alice", "hello-world") // PostState(post, card, body: List<Block>?, comments: List<CommentItem>, ...)
env.votes.vote("alice", "hello-world", 10000) // optimistic; VoteState.statuses[key] while in flight or failed
val reply = env.replyModel(rootKey, parentPost); reply.setText("..."); reply.send() // one per parent, app-wide
when (val r = LinkRouter.route(target)) { is Route.Post -> ...; is Route.ExternalBrowser -> ...; ... }
model.close() // when the screen goes away (not for env.session / env.votes / reply models)
Rules every model follows:
- State lives in a
StateFlowand changes only on the main dispatcher. Actions (start,refresh,loadMore,retry,vote,send) return at once; failures land in the state as anAppError(kind, message, retryable). The suspend entry points are SessionModel's logins,switchTo,logout,logoutAllandsignOut,@Throws(EcencyException, CancellationException); their failures areAppExceptionwhoseerroris theAppError. - Post bodies, card summaries and card images are computed on
AppDispatchers.render, never on the main thread (tests check every renderer call). Bodies are cached per post andlast_update(200 entries), so reopening a post does not re-render it. - Body images: blocks keep render-helper's
<img src>(i.ecency.com/p/<hash>?format=match&mode=fit, no width, the full file). The apps loadImageProxy.bodyVariant(src, widthPx, avif)instead: the entry of web's srcset a phone browser picks for the same image, byte for byte, so it is one the CDN keeps warm. The width is the smallest of 320, 600, 800, 1024, 1280 that covers the image's column width in device pixels (layout width x density; a grid tile's own width), 1280 when none does. The gallery viewer zooms up to 5x, so it loads the full file through the proxy (src), not a sized variant, and decodes it for that zoom (5x the screen, never past the file's own size), not the screen width: Android within Coil'smaxBitmapSize(4096 px a side), iOS withinImageLoader.maxDecodeArea(24 megapixels). Static rasters (.jpg,.png,.webp, which web wraps in<picture>) come as AVIF (iOS, and Android 12+ unless the device was found not to decode it, see Image formats; each switching to the WebP of the same size once an AVIF fails to load or decode) or WebP (older Android); gifs, files without a raster extension and an author's own/p/URLs keep web's<img>srcset, format=match. Other image servers and routes (/u/,/WxH/) keep their URLs (the proxy picks/u/and format=match formats by the request's Accept, see Image formats); share, copy and save in the gallery keep the original URL. The proxy never upscales, so the natural size, and with it the layout, is unchanged. Measured on a 1.37 MB PNG: the full URL 1,373,797 bytes (2.5 s cold, 0.42 s warm), the 1280 AVIF 20,927 bytes (0.80 s cold, 0.12 s warm). Tests: sharedBodyImageVariantTest, AndroidPostBodyTest(requested URLs, API 30 WebP, AVIF fallback, gallery), iOSImagePipelineTests(requested URLs, AVIF fallback, gallery, zoom decode size). - Image formats: every request to Ecency's image proxies (
i.ecency.com,images.ecency.com,img.ecency.com) names the formats the app decodes in its Accept header (ImageAccept, issue #3686), as a browser does. The proxy answers format=match and/u/URLs (avatars, covers, gifs, files without a raster extension) by that header, and the CDN keeps one copy per Accept group, counting only bare list items. iOS (17+) and Android 12+ sendimage/avif,image/webp,*/*, Android 9 to 11image/webp,*/*; an Android 12+ device that cannot decode AVIF (some can not, although their version should; their images stayed blank, issue #3772) sendsimage/webp,*/*too: the app decodes a small AVIF of its own (res/raw/avif_probe.avif, 64 x 64) on the first image request and names AVIF only when that worked (AvifProbe), keeping the answer per system build (Build.FINGERPRINT); it marks the decode before it starts, so a decoder crash counts as no AVIF on the next launch (AvifProbeTest); body images ask for AVIF only once the probe found it decoding, in this process or a past launch on this system build (AvifProbe.saved), and WebP before any answer, so a URL naming AVIF never reaches a device whose decoder may crash on it (PostBodyTest.aColdStartAfterAProbeThatNeverFinishedRequestsTheWebpSizeFirst); an AVIF that fails to load still falls back per image; Android 7 and 8 send none and get the source format, as before: there the app decodes only GIF animations, and the proxy answers an animated source in animated WebP (it cannot write animated AVIF). iOS plays an animated WebP at its own frame times, each frame for its own delay (UIImage shows frames for equal times, so a frame is repeated over equal slots; GIFs too). Before this the apps sent no such header and got source files (measured on the proxy: an avatar 16 KB as PNG, 1.8 KB as AVIF; an animated post image 308 KB as GIF, 124 KB as WebP). Saving to the gallery, share sheets and push attachments keep fetching the source format (RichPushattaches only the types it names: JPEG, PNG, GIF, WebP and HEIC, so an AVIF answer would drop the push's image). Tests: sharedImageAcceptTest, AndroidImageLoadingTest(Coil over the app's OkHttp client, by API level and probe;aDeviceThatCannotDecodeAvifAsksForWebP),PostBodyTest.aDeviceKnownNotToDecodeAvifRequestsTheWebpSizeFirst, iOSImagePipelineTests(the request's Accept, animated WebP frame times). PostBodyRendereris the seam for body rendering.InterimPostBodyRenderer(markdown, parse, finish, blocks, image proxy, without render-helper's DOM transforms, so no chips) is temporary; the swap to the render-helper port is the one line inPostBodyRenderer.default.- Votes:
env.localVotesoverrides what the API returned, so a vote shows on every feed card and post header at once and is rolled back everywhere on failure. The payout moves with it as RN's (voteCacheUtils): the vote sheet's estimate (env.votePreview(), kept byVoteModelfor that account) is added for an upvote, subtracted for a downvote (never below zero) and an unvote takes the reader's share of the server's payout off (LocalVote.estimate,LocalVotes.payoutDelta); once the server holds the vote (the reader's rshares are the estimate's, or none after an unvote) its payout is shown as it is, so fresh data is not counted twice, and the model that stored that data retires the estimate (LocalVotes.retireConfirmed), so a later change of the vote from another client shows the server's payout instead of the spent estimate. A card another screen still holds from before the vote then shows that older payout until it reloads. A vote made before the estimate was read, on a post already paid out, or on one that declined rewards (max_accepted_payoutzero; RN added it there too) leaves the payout alone. Light wave rows carry noactive_votes, so there the vote, like its count, stays added after a refetch until the session changes. A retry after a network failure (votes.retry) resends the same signed transaction; "identical vote" counts as success. Whose vote a post holds comes from its read (see "Bridge v2 reads and votes" under Feed, posts and reading):Post.voteOf(account)andPost.knowsVoteOf(account). When the read does not know the reader's vote (a node without bridge v2 whose voter list stops at 1000 rows, or a v1 row with rshares 0 and no percent, which a weightless vote of an account with little HP and a removed vote both give; RN shows such a vote as none), the post screen asks the chain for that one vote in the background, once per load (database_api.list_votes, SDK getEntryVote,HiveApi.ownVote), and shows a vote whose percent is not zero as voted (PostModel.resolveUnknownVote; feed cards show an unknown vote as none). Such a vote is marked as read from the chain (LocalVote.fromChain, already in the count), so any post screen, also one opened later, asks again on each load and takes it back when the chain removed it or the read knows the vote itself; a vote made on the device is never one. Tests:VoteAndReplyTest.aVoteWithoutPayoutWeightShowsAsVotedOnThePost,aVoteBeyondTheV1CapIsLookedUpOnTheChain. Only the cards and comments whose vote changed are rebuilt; every other item keeps its instance, so UIs redraw one row. - Session changes (sign-in, sign-out, wipe) clear local votes, vote statuses and reply drafts; a vote still in flight finishes on chain but its result (success or rollback) is ignored, so the previous account's vote never reappears. Feed and post models that were loaded refresh themselves in place for the new observer, so screens stay where they are. What else an account leaving tears down: see Prompts and account changes.
- Paging:
FeedState.pagescounts loaded pages, including a page of nothing but duplicates; UIs key their "near the end" check on it so such a page does not stall infinite scroll. The feed ends when a node answers with the cursor it was given or after 3 pages in a row that added nothing, so a misbehaving node cannot page forever. - Long discussions: the first 12 comments are rendered and shown before the rest (first load only; a reload keeps the old list until the new one is complete). The body cache holds 1000 entries (a post and each comment are one entry each).
- Replies: the first
sendfixes the permlink; the draft is kept until a success, so a retry resends the same transaction (and an edit after a failure keeps the permlink: it creates or edits, never posts twice). An edited resend whose earlier attempt did create the comment goes out without comment_options (write-once on chain). Reply models belong to the environment, one per parent: a send keeps running when the post screen goes away, the draft is there again when the user comes back, andclose()from a screen is a no-op. A successful send drops the model from the environment, so the next composer for that parent is a fresh, empty model (UIs close the sheet onsent). After success the reply shows at the top of the post's comments (CommentItem.isLocal) until the API indexes it, marked "sending to the chain" (CommentItem.isSending) until the chain itself holds it: the post screen asksdatabase_api.find_commentsevery 3 s for up to 75 s after the last reply that started sending, so each reply gets its own time, without ever cancelling a pull to refresh (PostModel.watchSending,PostRepository.confirmLocalComment), so a reply that landed shows as posted within a block or two instead of waiting for hivemind (live test: over 75 s;VoteAndReplyTest.aReplyOnChainStopsSayingSendingBeforeHivemindHasIt). - Sign-in: see Login and accounts.
LinkRouter.routevalidates every target again withSafeTarget: only http(s) opens a browser, only allowlisted https players open the video sheet,hive://andecency://areRoute.AppLinkand go toAuthLinkModel.handle(see App shell, Links).- Perf:
PerfMarks.mark(PerfEvent.POST_OPEN_TAP)logsEcencyPerf <event> <millis since process start>(Android logcat tagEcencyPerf; iOS os_log subsystemapp.esteem.mobile.ios, categoryperf, plus an os_signpost event). Both platforms mark the same events the same way:app_start: the first line of the app's own entry point, before any UI (AndroidApplication.onCreate, iOS the@mainApp'sinit). Its value is how long the system took from process start to the app's code.first_frame: the first frame of the app's UI, whatever screen it is (Android: the root's first draw; iOS: the root's first appearance, marked after the run loop turn that commits it).feed_first_content(first card drawn,markOnce),post_open_tap(card tap),post_body_drawn(first body block drawn); the models markfeed_first_pageandpost_body_ready(data, not pixels).- Compare platforms on these names only;
app_startis not a frame, and launch time as the OS sees it (am start -WTotalTime, Instruments) is a separate number.
From Swift (no SKIE: observe with watch, which delivers the current state at once and then every change on the main thread; keep the returned Closeable and close it with the view):
import EcencyCore
let env = try AppEnvironment.companion.create(store: KeychainSecureStore(), debugKeyImport: true)
env.session.start()
@MainActor final class FeedViewModel: ObservableObject {
@Published var state: FeedState
private let model: FeedModel
private var watcher: Closeable?
init(env: AppEnvironment, sort: RankedSort) {
model = env.feedModel(source: FeedSourceRanked(sort: sort, tag: ""))
state = model.current
watcher = model.watch { [weak self] s in self?.state = s }
model.start()
}
func refresh() { model.refresh() }
func onAppear(_ card: PostCard) { if card == state.items.last { model.loadMore() } }
deinit { watcher?.close(); model.close() }
}
// Post screen
let post = env.postModel(author: "alice", permlink: "hello-world")
PerfMarks.shared.mark(event: PerfEvent.shared.POST_OPEN_TAP)
let w = post.watch { s in /* s.card, s.body (nil while rendering), s.comments, s.error, s.commentsError */ }
post.start()
post.setCommentSort(sort: .votes)
// Votes and replies
env.votes.vote(author: "alice", permlink: "hello-world", weight: 10000)
env.votes.retry(author: "alice", permlink: "hello-world")
let reply = env.replyModel(root: PostKey(author: "alice", permlink: "hello-world"), parent: postState.post!)
reply.setText(text: "Nice")
reply.send()
// Sign-in
do {
_ = try await env.session.loginWithKey(username: name, secret: passwordOrWif)
} catch {
let appError = ((error as NSError).userInfo["KotlinException"] as? AppException)?.error
// appError?.kind == .auth / .notFound / .invalidInput / .network, appError?.message
}
// Links
switch LinkRouter.shared.route(target: target) {
case let r as RoutePost: open(r.author, r.permlink)
case let r as RouteProfile: openProfile(r.author)
case let r as RouteFeed: openFeed(r.source, r.title)
case let r as RouteExternalBrowser: present(SFSafariViewController(url: URL(string: r.url)!), animated: true)
case let r as RouteVideoPlayer: playVideo(r.embedUrl)
default: break // RouteAppLink, RouteUnsupported
}
Tests (commonTest/.../app, Android host and iOS; SliceFixesTest holds the session, reply lifetime, write-once options, partial update, paging and progressive comment cases): TestApp wires a fake transport, an in-memory vault, distinct test dispatchers for main and render (a tracking dispatcher proves rendering ran on it) and a fixed clock. They cover paging, refresh, errors and retry, card data, render caching per last update, optimistic votes and rollback (their payout too: VotePayoutTest, Android SliceFlowsTest, iOS VotePayoutTests), retry resending the same transaction, reply draft reuse and local comments on top, session import validation (wrong key, unknown account, bad input, release builds) and malicious link targets.
iOS app (SwiftUI)
iosApp/EcencyApp/App wires the shared layer into SwiftUI (AppContainer owns the AppEnvironment, navigation path, sheets and alerts; Observed<S> mirrors any StateModel and closes it with the view); iosApp/EcencyApp/Screens holds the feed (trending / hot / new, pull to refresh, infinite scroll), post (header, body blocks and comments in one lazy stack, pinned action bar), vote weight sheet, reply composer, sign-in, Safari and video sheets. Lists identify rows by post key (ForEach(..., id: \.key); FeedPaging compares keys too), never by the Kotlin data class itself: hashing whole cards and comment block trees ran on the main thread and a vote replaced the row instead of updating it. Pull to refresh awaits the shared refreshAndWait(). Reply drafts are the environment's (one per parent), so a send outlives the post screen. The unit test host (XCTestConfigurationFilePath set) shows an empty root and builds no environment, so no live feed or image fetch runs during unit tests. Tap routing goes through NavDecision.from(LinkRouter.route(...)); the video sheet's WKWebView has no script handlers, opens no windows and cancels every navigation off the embed host (VideoEmbedPolicy).
Debug launch arguments (ignored in Release):
xcrun simctl launch <udid> app.esteem.mobile.ios -fakeData YES # offline synthetic fixtures (UI tests use this)
xcrun simctl launch <udid> app.esteem.mobile.ios -openPost author/permlink # push a post at launch (screenshots, perf)
xcrun simctl launch <udid> app.esteem.mobile.ios -openPost a/p -scrollToComments YES # once, when the comments load
xcrun simctl launch <udid> app.esteem.mobile.ios -rendererDemo YES # the renderer demo post
xcrun simctl launch <udid> app.esteem.mobile.ios -startTab WALLET -openDrawer YES # shell screenshots
Perf marks from the UI: app_start (App init), first_frame (root first appearance), feed_first_content (first card on screen), post_open_tap (card tap), post_body_drawn (first body block on screen); see App layer for the definitions. Read them with xcrun simctl spawn <udid> log stream --predicate 'subsystem == "app.esteem.mobile.ios" AND category == "perf"'.
A Release build needs the build secrets (see Secure storage). For a local compile check only, append dummy values with their SHA-256 to local.properties, build -configuration Release -sdk iphonesimulator ARCHS=x86_64, then remove them again; never ship such a build.
Android app
androidApp/src/main/kotlin/com/ecency/app/ui draws the app layer with Compose: home with TRENDING / HOT / NEW tabs, tag, community and profile feeds (same FeedList), the post screen (header, body via postBody and comments in one LazyColumn, action bar, vote weight sheet, reply composer), sign-in, Custom Tabs for external links and a video sheet for allowlisted embeds. Layout and colors follow the RN app (src/components/postCard, src/screens/post, theme tokens in ui/Theme.kt); dark mode follows the system.
- Navigation is the shared
NavState(see App shell) held byui/Navigation.kt'sNavigator. Each pushed entry keeps its models and list state, so going back restores the scroll position; models close when the entry is popped. TheNavigatorlives inNavigationViewModel: rotation and other configuration changes keep the stack, its models and scroll positions; the models close inonClearedwhen the activity finishes; the screen list is written to theSavedStateHandle, so a process killed in the background reopens on the same screens (models are created again). Sign-in and sign-out keep the stack (a reader who signs in to vote stays on the post; the models refresh in place); only a wipe returns to the Feed tab. - Reply sheet: the draft is the app-wide model of its parent, so closing the sheet or leaving the post keeps it; while a send runs the sheet cannot be swiped, tapped or backed away. Body images open a pager (
GallerySheet), not the browser. The vote sheet starts at the last weight used for that kind of entry (#3779, RN upvotePopoverpostUpvotePercent,commentUpvotePercent,waveUpvotePercent): sharedenv.voteWeightskeeps one weight for posts, one for comments (any reply,PostCard.isComment) and the waves weight, each 100 % until a vote of its kind, in the shared preferences; the single weight builds up to 4.0.0 kept for posts and comments seeds both (adoptEarlier, which never overwrites a kept weight, so the old key stays). Its layout (both apps, sharedVoteSheetState): an Up / Down toggle with the$estimate, the weight, a slider with 25/50/75 ticks, presets 25/50/75/100 and one vote button whose label follows the direction; the toggle keeps the weight (one remembered weight for both directions, as RN), and the voting power shows under it when the account has a manabar. The sheet is as tall as its content and scrolls at the largest text sizes. - Sheets scroll (#3715, #3720): with the keyboard up, a larger font or a short window a sheet's last controls must stay reachable. Every
ModalBottomSheet(fromui/Windows.kt) draws its content in a column withverticalScroll(rememberScrollState())(imePadding()inside it when the sheet has a field), and opens at full height (rememberModalBottomSheetState(skipPartiallyExpanded = true)) when its controls sit low. A list inside that scroll is bounded: a plain column of rows, or aLazyColumn/LazyVerticalGridwith a finiteheightIn(max = ...), never an unbounded lazy list. A sheet that is one list (reactors, members, pinned messages) can be that bounded lazy list itself. A sheet that fills the window (the wave composer) cannot useweightfor its growing field: a weighted child of a Column gets the leftover height as fixed constraints, so a minimum on it never holds and the field shrinks to nothing. The composer'sFillColumn(fillMaxHeight()beforeverticalScroll) gives the field the height the other rows leave, never less than 120 dp, and scrolls past that. build-logicSheetScrollLintTestfails on a sheet whose content (or an app composable it calls, two levels deep) holds noverticalScroll,LazyColumnorLazyVerticalGrid. It fails closed: comments are blanked first, brackets that never close fail the scan, a sheet opened inside the content (or inside a composable it calls) is not the content's scroll, and a name defined in several files counts only as the calling file defines it; the sheets of a fixed height by design (the video player, the image viewer) are listed with a reason inandroidApp/sheet-scroll-allowed.txt, and an entry that names no fixed sheet fails too. A new or changed sheet gets a Robolectric test onw360dp-h400dpthat scrolls to its last control withawaitScrolledTo, taps it and asserts what the tap did. - Rows get their vote state per card (
voteInFlight(votes, key)), and the root's actions are remembered, so a vote recomposes only its own card (SliceFlowsTest).compose-stability.confdeclares the shared state classes stable. - The video sheet's WebView loads only allowlisted https players (
SafeTarget.embed: every host render-helper accepts on any path needs its player path, from render-helper's embed URL shapes; a host without a rule is refused, and a test keeps every allowlisted host covered; a refused http(s) iframe shows as a link to its page instead of a hole) withReferer: https://ecency.com/(YouTube shows error 153 without one); every frame, main or sub, stays on the embed's own host over https, with or withoutwww.(SafeTarget.samePlayerHost, so youtube.com/embed redirecting to www.youtube.com plays). One shared rule decides on both apps (SafeTarget.playerNavigationAllowed, used by AndroidPlayerWebViewand iOSVideoEmbedPolicy): it reads the URL with the WHATWG parser, as the web view does, and refuses any URL with userinfo, a backslash or a control or space character. A Skatehive IPFS video (render-helper turns that iframe into a<video>tag) opens only as/ipfs/<cid>(letters, digits,-and_, with or without a trailing slash) or a video file directly in that folder (.mp4,.m4v,.mov,.mkv,.webm,.ogv,.ogg), its frames stay on that exact host and file, and it plays with page script off (SafeTarget.playerAllowsScript). It is never loaded as the page: Android, whose WebView does not askshouldOverrideUrlLoadingfor a POST, plays it in an app-made page with one<video>element on the file's origin (mediaFilePage, the source escaped), and iOS refuses any navigation of such a sheet that is not a GET (VideoEmbedPolicy.allows(request:embed:)); an IPFS path deeper than that no longer makes a video block; popups, file and content access are off, there are no JavaScript bridges, third-party cookies are refused, and cookies, storage and cache are cleared when the sheet closes. Debug check:adb shell am start -n app.esteem.mobile.android/com.ecency.app.MainActivity --es video https://www.youtube.com/embed/<id>. adb shell am start -n app.esteem.mobile.android/com.ecency.app.MainActivity --ez demo trueopens the renderer demo post instead.- Baseline Profile (#3702): release builds ship one for a cold start, the home feed, a post and Waves, generated by
baselineprofile/on a device and committed underandroidApp/src/release/generated/baselineProfiles;profileinstallerinstalls it where Play did not. The app exposes its Compose test tags as resource ids for those journeys. Generating and measuring: docs/release-builds.md, "Baseline Profile". - Perf:
adb logcat -s EcencyPerfshowsapp_start,first_frame,feed_first_page,feed_first_content,post_open_tap,post_body_ready,post_body_drawn(definitions under App layer). Measure on a release build: debuggable builds render post bodies about 20 times slower. - Release build check with throwaway secrets (never real values):
export ECENCY_PIN_KEY=release-check-dummy ECENCY_DEFAULT_PIN=1111
export ECENCY_PIN_KEY_SHA256=$(printf %s "$ECENCY_PIN_KEY" | shasum -a 256 | cut -d' ' -f1)
export ECENCY_DEFAULT_PIN_SHA256=$(printf %s "$ECENCY_DEFAULT_PIN" | shasum -a 256 | cut -d' ' -f1)
./gradlew :androidApp:assembleRelease # unsigned APK; signing config is not part of this check
Tests: SliceFlowsTest (sign-in keeps the post, a reply send outlives the post, drafts survive, gallery, last vote weight, one card recomposed per vote, saved back stack, player rules and Referer) and RecreationTest (activity recreation keeps the stack and its models, finishing closes them). AppFlowsTest (Robolectric) drives the main flows against a scripted node: feed, opening a post with comments, tabs, error and retry, vote while signed out, debug sign-in with a wrong key, a signed-in vote, and a reply that fails and is retried with the same transaction. Robolectric never runs draw callbacks, so the draw-time perf marks are checked on the emulator.
App shell
The RN shell (src/navigation, components/bottomTabBar, components/sideMenu, components/header) on both platforms, with the navigation model in the core (shared/.../core/app/Navigation.kt, SideMenu.kt, Shell.kt):
RouteNamelists every RN route (routeNames.tsSCREENS and MODALS, plus the QR and accounts sheets) with its feature title, whether it is built and whether it needs an account. Unbuilt routes openAppScreen.Pending, the one "Coming soon" screen that names the feature; building a route adds a typedAppScreenand flipsbuilt.pushGatedsends signed-out users to the login screen for routes that need an account (RNshowLoginAlert).NavStateis a value: selected tab, screens pushed above the tabs (RN's main stack, which covers the tab bar) and whether the side menu is open. Back closes the menu, then pops, then returns to the Feed tab (RNbackBehavior="initialRoute"); at the Feed root the system takes it.NavEntryis the deep link entry (an optional tab, whose stack is cleared, then screens), built fromLinkRouterresults.encode/decodesave it: Android in theSavedStateHandle, iOS inUserDefaults(AppContainer.swift). The menu is never restored open.- Tabs as RN: Feed, Waves, Chats, Wallet, Notifications, icons only. Chats, Wallet and Notifications show RN's sign-in prompt while signed out; signed in, the Chats tab is the channel list (see Chats). The header on every tab: avatar pill (opens the side menu), name and @user (reputation) or "Login to customize your feed", then the same trailing buttons in the same order on every tab (
AppTab.headerButtons,TabHeaderButton): QR scan, search and, signed in, perks (RN's boost button, opens Perks). Feed has RN's create button (editor, or login).BadgeModelfeeds the notification and chat badges. - Side menu as RN (
sideMenuItems.ts): signed in Profile, Bookmarks, Drafts, Communities, Explore, then QR Scan, Refer & Earn, Docs, Settings, Logout below one divider; signed out Add Account, QR Scan, Docs, Settings. The header shows display name, @user and voting power (SDKcalculateVPMana, fetched fresh on open). Add Account opens the accounts sheet when other accounts are on the device, else login. Logout asks first and callsSessionModel.signOut. Footerv<version>, <build>. - Settings: see the Settings section (Manage Authorities and Delete Account: see "Login and accounts"). The side menu header opens the account switcher; the drawer's Logout signs the current account out and switches to the next saved one (
SessionModel.signOut); logout-all stays in the switcher. - Links:
AuthLinkModeltakes ecency://, hive:// and ecency.com /auth and /signup first; ecency.com posts, profiles and feeds (ContentLinks) open throughNavState.open(entry, loggedIn), gated, on top of the open tab (Android intent filters withonNewIntent, a launch link handled once; iOSonOpenURL). A link that arrives while locked opens behind the lock, and a cold-start link waits until the accounts were read before the login gate applies. iOS takes links at the scene root (outside the lock gate), so links delivered while the PIN pad shows are kept. Android uses the RN app's ecency.com path patterns withautoVerify, verified through ecency.com/.well-known/assetlinks.json, which lists the RN app idapp.esteem.mobile.androidand its signing certificate (see "In-place upgrade from RN 3.x"). Any account change (sign-out, switch, a logout that moved to the next account, a link login as someone else) keeps the tab and public screens and drops gated ones (afterAccountChange); a wipe returns to the Feed tab. A link or notification whose screen needs an account, opened signed out, opens the login screen (Android) or sheet (iOS) and waits inNavState.afterLogin: the account change that signs someone in (afterAccountChange(signedIn = true), either platform's account change hook) takes the login screen away and opens the entry as it would have opened signed in, for whichever account signed in on that login (it is that account's own screen). The login closing with nobody signed in drops it (dropAfterLogin, the same hook that drops a share link's waiting text), as do a sign-out and a reset, and a later link replaces it (a link without a tab waits with only its screens not opened yet, so the public ones before the gated one open once; also the iOS wide window shortcut that pushes a single screen:NotificationTests.testALaterLinkOnAWideWindowDropsTheChatLinkWaitingForTheSignIn); it is never saved with the navigation (encode), so a restored app has none. Android pops the login screen after a sign-in only while it is still on top. Tests: sharedNavigationTest.aGatedDeepLinkOpensWhereItWasGoingAfterSignInandaPendingGatedLinkGoesWithoutASignIn, AndroidLoginFlowsTest.aChatLink*, iOSChatUITests.testAChatLinkOpensTheConversationandtestAChatLinkWhoseLoginWasClosedOpensNothingLater. Link and key notices use the shared toast channel. - Body links:
hive://andecency://links in a post go toAuthLinkModel.handle(Route.AppLink), so a sign link asks first, as from another app. hiveuripushes: the payload'shiveUri(hive or ecency scheme only) goes to the same link model; never for a push addressed to another signed-in account.- App links: bare
/trending,/hot(the global ranked feed),/wavesand/waves/*open (Android manifest; routing inContentLinks)./chatsopens the Chats tab and/chats/<channel id>that conversation on it (#3753, a difference from RN, which had no chat link): ecency.com links only (with or withoutwww.), and only a Mattermost channel id (26 lowercase letters and digits); any other id opens in the browser (ContentLinks.browserFallback). It needs an account, so signed out the login screen comes first (NavState.open) and the conversation opens after the sign-in (NavState.afterLogin, see "Links"). Tapped in content (a chat message) a chat link opens the conversation on top of the open tab (contentEntry). iOS gets these paths once ecency.com'sapple-app-site-associationlists them (vision-web#2206). Tests: sharedContentLinksChatsTest, AndroidAppLinksTest.chatLinksOpenTheApp, iOSChatUITests.testAChatLinkOpensTheConversation(demo channelofftopicdemochannel0000001). - iOS saves the navigation from the container (not a view, which is gone while locked) and restores it at launch only when it is under 30 minutes old (Android: saved state after process death; RN restores nothing).
- Global UI:
UiMessages(toasts and in-app banners from shared code, one of each at a time),ConnectivityModel(fed byConnectivityManagerandNWPathMonitor; RN's "No connection!" strip at the bottom). Error boundary: screen setup runs guarded (Guardedon Android,ShellErrorViewon iOS) and shows RN's "Something went wrong / Try again?"; neither Compose nor SwiftUI can catch an exception thrown while rendering. - Portrait only on phones (iOS: a large display such as iPhone Duo's inner one turns too, see iPhone Duo; Android: a tablet turns, see Android tablets). Nothing of the shell is composed while the app is locked; on iOS the lock window stays above the side menu and every sheet.
- Differences from RN: RN's
<Header>flags gave Feed and Wallet QR, every tab but Chats search and only Feed the boost button; here every tab has the Feed's three (owner request); Docs and other web links open the system in-app browser rather than RN's WebView screen; the Feed tab keeps the guest filters (TRENDING, HOT, NEW); iOS keeps login as a sheet and the segmented feed filter; tab icons are Material (Android) and SF Symbols (iOS) stand-ins for RN's icon fonts, Waves uses RN's wavy dash; there is no edge swipe to open the menu. - Tests:
NavigationTest,ShellTest(shared),ShellFlowsTest(Android),ShellTestsandShellUITests(iOS).
iPhone Duo
Apps built with the iOS 27 SDK resize on iPhone Duo: the window changes when the device folds or unfolds,
and the inner display gives any shape (its poses ignore the supported orientations). Builds with the iOS 27.1 SDK go
edge to edge, with the system bars laid out vertically on the right. Apple's checklist:
https://developer.apple.com/iphone-duo/prepare/ (Xcode 27 also exports its app-resizability agent skill:
xcrun agent skills export).
- Orientation (
OrientationPolicy, Viewport.swift), from the display's shape: portrait on a tall display (every iPhone, about 2:1, unchanged), any orientation but upside down on a near-square one (both iPhone Duo displays, about 1.4:1). Re-read whenever the window scene's geometry changes (a fold or unfold). Not from the display's size: while the app is portrait only, iOS boxes it on the unfolded inner display and reports that display as a phone-sized 469 x 669 pt screen, so a size rule (portrait on the outer display only) stayed boxed after every unfold. Layout reads the space it has, never the device's orientation or idiom. - Nothing sizes itself from the main screen. The window's size is
\.viewportSize(Viewport.swift, measured at the root and updated on every resize): card image cap, drawer width, profile cover decode width. Pixel sizes use the display's scale (\.displayScale, orcontext.environment.displayScalein representables): body image URLs, image decoding, text chips. Screen recording is the window scene'ssceneCaptureState(onSceneCaptureChange). ResizabilityTestsfails on anyUIScreen.main, device orientation or idiom in the app sources, and checks that the viewport follows a window resized like a fold.UIRequiresFullScreenstays in project.yml: iOS 27 ignores it and resizes anyway (TN3192), and removing it changes older iOS versions.- Simulator: create one with
ECENCY_SIM_DEVICE="iPhone Duo"(ios-sim.shpicks the runtime that runs it). Device Hub replaced Simulator.app in Xcode 27. Screenshots need the screen:ECENCY_SIM_DISPLAY=primary(outer, the default) orprimary-1(inner). - The shell is the system TabView and the root's navigation bar (
TabsRoot, ShellRoot.swift), so iOS places them: a bottom tab bar and a top bar on a phone, one column on the trailing edge on iPhone Duo. Tabs show icons only (RN; Waves is RN's wavy dash drawn into a template image) and carry their old ids (tab-feed...) on the icon image and the tab bar item (TabBarTagger); the bar reads badges itself ("Notifications, 3 items"). - Two panes (
NavState.pane,pushIn,fitTo,menuBesideListin the core; PaneViews.swift): on a window at least 840 pt wide (the inner display held sideways, not upright at 669 pt) every tab shows two columns. Nothing open: the user menu beside the list. A tap in the list (a post, a wave's thread, a chat, an asset's details): the list and what it opened, the menu closed; the next tap in the list replaces it (Mail,pushIn(fromList = true)), and anything else opened while the pane shows (a profile, voters, another post, a sheet's choice) goes on in the pane with its own back. The screens under the pane's top stay alive, hidden, so back finds them as they were (scroll, narration). The pane's menu button or the account button brings the menu back, the pane's screen kept behind it; the account button takes it away again. The side menu's places (cover), the editor, settings, search and wallet screens cover the window. A fold moves the pane under the pushed screens (the same screen in front) and an unfold moves it back; the saved navigation keeps the pane as pushed screens. A screen in the pane shares the app's bar with the list, so its title and bar items go throughscreenTitleandscreenBarItem(PaneViews.swift): the navigation bar on a phone, the pane's header beside a list (the title in the middle, the actions at the trailing end).PanesTest(core) andTwoPaneUITests(skips on a phone-sized window; run it on the Duo simulator unfolded and held sideways). - Pane screens (PaneViews.swift):
\.isInPaneis true for a screen shown in the pane; it never hides the app's bar and draws no header of its own (a chat puts its title and chips in the pane's header).\.isPaneTopis false for a pane screen kept under the one on top, which then puts nothing in the pane's header.screenBarItemadds its item withtransformPreference, so a screen that sets a title and actions keeps both. Only the selected tab draws its pane. - App Store screenshots:
scripts/duo-screenshots.sh inner|outer <folder>launches six screens on the synthetic data and saves the display's own size, which is App Store Connect's iPhone Duo size (outer 1398 x 2034 px, inner 2853 x 2007 px sideways or 2007 x 2853 upright), without an alpha channel. Fold or unfold in Device Hub first; the script never switches displays. - CI: release builds run on GitHub's
xcode-27image with Xcode 27.1 (build-ios.yml), whose iOS 27.1 SDK is what lets iPhone Duo lay the app out edge to edge with the vertical bars. - Bar items carry a title with their icon (
Label(title, appIcon:).labelStyle(.iconOnly)): a phone's bar draws the icon, iPhone Duo's vertical bar can show the title.ResizabilityTests.testBarButtonsCarryATitleWithTheirIconfails on a toolbar orscreenBarItembutton whose label is an icon image alone; the account button's avatar is an image on purpose (a bar draws a Label's icon as a template). - Sheets open at their content's height (#3728): the scrolling part is a
FittedSheetScrolland the root has.fittedDetents(), which adds what sits around the scroller (a navigation bar, a pinned footer) to the content's height, all measured in one layout pass; taller content scrolls, up to the full sheet. Content that fills whatever it is given (a List, a Form, a text editor, a web view, a chart) takes[.large]. No sheet uses the.mediumdetent, which left an empty band under short content (SheetDetentLintTests). The vote and media source sheets keep their own measured height. - Sheets never stop at medium only (
testNoSheetStopsAtMediumOnly): on the inner display held sideways (about 670 pt high) a medium sheet is about 330 pt, so every sheet can be pulled to the window's height; a measured height detent fits its content and stays. - The share extension, widgets and notification service follow the same rule as the app (
testTheExtensionsNeverSizeFromTheScreen). - A list in the pane gets no default row margins (it is away from the window's edge): its rows set them with
paneRowInsets()(asset details' history), or their own insets (the wallet's asset cards). - Links in chat messages and link cards open in the app when they are a post, profile or tag on ecency.com or another
Hive frontend (
ContentLinks.entry, render-helper's frontend list), anything else in the browser.
Android tablets
Issue #3772. 4.0 locked the activity to portrait in the manifest, so a tablet held sideways showed the app as a phone
sized box between two strips of wallpaper (RN locked an Android tablet held sideways at launch to landscape,
useInitApplication.tsx). Now:
- Orientation (
DisplayOrientation): the manifest names none;MainActivityasks for portrait when the display's smallest side is under 600 dp (a phone) and leaves a larger one free (a tablet, an unfolded foldable). The display's, not the window's (its largest window,maximumWindowMetrics, from API 30; its real size before): a tablet in split screen stays a tablet. Read on every create: a resize, a fold or another display changes the screen size, which recreates the activity (the manifest handles only locale and layout direction itself), andNavigationViewModelkeeps the stack across it. A phone held sideways at launch is recreated once by its portrait request; the link that launched the app waits for the accounts inNavigationViewModel.openWhenAccountsRead, so it opens all the same. Android 16 ignores an orientation lock on large screens for apps targeting API 36 anyway. - Two panes on a window at least
NavState.PANES_MIN_WIDTH(840) dp wide, the same shared rules as iOS (iPhone Duo above):Navigator.fitreads the window's width before the root draws and callsfitTowhen it crosses the line;pushFromList(a tab's own list: post cards, waves, chats, wallet assets, notification rows),pushandpushGated(anything else: goes on in the pane while one shows) andcover(the side menu's places) go throughNavState.pushIn.PanedRoot(EcencyApp.kt) draws the tabs as Material's navigation rail on the leading edge (TabRail: the same tabs, icons, badges, names andbottomTab:tags as the bottom bar, which a wide window does not show), then the side menu as a column beside the list while nothing is open (SideMenuColumn, no scrim), else the list (402 to 440 dp,paneListWidth, as iOS) and the pane. The account button brings the menu back over the pane and takes it away again. Only the pane's top screen is drawn; the ones under it keep their models and list positions in theirStackEntry, so back finds them as they were. A pane screen's own back arrow pops the pane (Navigator.popwith nothing pushed), the first one giving its place back to the menu; system back pops the stack, then the pane. Covering screens (editor, settings, search, wallet actions, login) push over the whole window and the panes are there again after them. A turn or resize that moves the screen in front between the stack and the pane shows it there at once, without a page transition, so one screen's models are never drawn twice; that snap is used up by the change it was asked for, also with page transitions off, so the next push still animates (aTurnWithPageTransitionsOffLeavesNoSnapForTheNextPush). The menu beside the list takes the drawer's width (which grows with the font) but leaves the list at least 360 dp, so its account header fits at the narrowest two pane window with large text (largeTextAtTheNarrowestTwoPaneWindowLeavesTheListItsRoom). A navigation restored after process death is judged as the saved stack (gated screens for the account that saved them only) before it goes back beside the list, so a public post stays. - Readable width: every pushed or pane screen is drawn in a centred column of at most 720 dp (
ReadableWidth), so a tablet held upright (one column, about 800 dp) or a covering screen sideways keeps short lines; a phone is unchanged. The QR scanner and Explore's web pages keep the whole window. A screen sizes its content from the space it is given (BoxWithConstraints), never the screen's width: a profile's waves in the pane lay out, and ask the image proxy for sizes, for the pane (ProfileFlowsTest.aProfileInThePaneLaysItsWavesOutForThePanesWidth); only whole-window surfaces (the gallery's zoom decode, the drawer's cap, the toast) read the window. - Tests: Android
TabletPanesFlowsTest(onw1280dp-h800dp: the rail and no bottom bar, the menu beside the feed, a tapped post beside the list and the next tap replacing it, the post's author (quick profile, full profile) going on in the pane and back returning, back on the pane's first screen bringing the menu back, settings covering and back showing the panes, a narrower window putting the pane on the stack and a wider one moving it back with the post drawn once, a pane screen's models kept across that and closed when the list replaces it, a restored public post staying in the pane signed out, a sign-out emptying the pane, the account button doing nothing while the menu shows beside an empty pane; a phone keeps one column and the bottom bar),TabletActivityTest(the activity's request on a phone and a tablet, a launch link opening after a phone held sideways was recreated),DisplayOrientationTest(the manifest, the 600 dp rule); the sharedPanesTestcoversNavState.
Foreground refresh
Parity: RN read a screen's data again whenever the app came back to the foreground: useFeedQuery invalidated the feed screen's tab queries on every AppState change to active (enableFetchOnAppState, the home feed only; every loaded page is refetched in place; no "new posts" pill, no scroll to top), walletScreen and assetDetailsScreen refetched the portfolio and the history, applicationContainer read the unread count and the account. React Query's refetchOnWindowFocus is off (only points and the leaderboard opt in), the default staleTime is 60 s, Waves poll every minute while focused. RN had no minimum time away. The point: a screen opened after some hours shows fresh data without a pull down.
- The clock:
env.freshness(Freshness) times every trip to the background on the app lock's monotonic clock (AppLockModel.onBackgroundandonForeground, which both apps already call). Only a trip of at leastFreshness.STALE_AFTER_MILLIS, 10 minutes, makes data stale; a quick look at another app reads nothing again (a difference from RN, which had no threshold). A model stamps its data when it begins reading it (stamp()) and asksisStale(stamp); a return the screen hears of before the lock does counts too. - Screens on show: the apps call the model's
start()when the screen appears and again on every return to the foreground (AndroidOnShow, aLifecycleStartEffect; iOS.onReturnToForeground,willEnterForegroundNotification).start()loads the first time, refreshes quietly after a long trip, and otherwise does nothing: feeds (FeedModel: home tabs, tag, community and profile posts), the profile header (ProfileModel), asset details (AssetDetailsModel, with the portfolio). A screen not on show (another home tab, a screen below in the Android stack) stays stale and refreshes when shown; iOS views kept below the top of a navigation stack hear the return too and refresh then. - Models that know they are on screen listen to
Freshness.staleReturns: the wallet while a screen holds it (visible), a Waves list while active (the minute's refetch runs at once, and again when the list comes back on screen), notifications ononForegroundand when the lock opens. - Quietly: no skeleton and no pull to refresh spinner; the list stays until the new one replaces it at once. Feeds read again as many pages as were loaded, at most 3 (
FeedModel.MAX_QUIET_PAGES; RN refetches every page of the infinite query, one after another), pages filtered down to nothing included; a feed scrolled further keeps every row it shows that the fresh pages did not bring back (rows an earlier quiet refresh brought included), after them in its order (muted authors and NSFW filtered as shown), and pages on from where it was, its pager told which posts the fresh pages showed so a later page never moves one (FeedPager.markSeen); a feed read to its end is not kept that way, as it may go on further now (ForegroundRefreshTest.aQuietRefreshReadsAtMostThreePagesAndKeepsTheRest,aQuietRefreshOfAFeedReadToItsEndPagesOnFromTheFreshRead, #3704, #3707), and a feed left with nothing to show reads on no further than a first load does, notifications too (within RN's 10 page window), asset details as many history rows as were shown; Waves merge the first page on top as their refetch does. A failure keeps what is shown and says nothing; the next show tries again. - Scroll: new cards on top never move the card being read. Android's lazy lists keep their first visible item by key, and a list at its very top shows the new cards (
NewCardsOnTop). The iOS feed list keeps the card at the top of the screen where it was (CardFramesfollows the drawn cards' positions; when new cards went in above, the content moves by as much as that card did,ScrollMomentum.shift) and stays at the top when it was there. Profile post lists and the other lists keep their offset, as in RN. iOS keeps the home feeds of the signed-in account's 3 most recently opened filters (HomeFeeds.kept); others, and every other account's, go with their models and load fresh when opened again (ShellTests.testOnlyTheRecentHomeFeedsOfTheAccountAreKept, #3704).
Tests: shared ForegroundRefreshTest (the rule; feeds, wallet, notifications, profile), WalletModelsTest.assetDetailsShownAfterALongTripReloadAsManyRowsQuietly, WavesModelsTest.theListOnScreenRefetchesAtOnceOnALongReturnOnly; Android ForegroundRefreshFlowsTest (home feed, scroll anchoring, wallet, through the activity's lifecycle); iOS ForegroundRefreshTests (feed list, scroll anchoring, wallet).
Prompts and account changes
Root prompts
- One order for the prompts that open by themselves (
app/RootPrompts.kt,RootPromptRule,RootPromptsModel,env.rootPrompts): a notice about an account's keys, the update prompt, an announcement, the email digest offer, in that order. The prompt on screen stays until it is answered (an update that arrives while the digest sheet is open waits). Nothing shows while the app is locked or before the welcome screen is done (each app's root reports the latter withenv.setWelcomeDone, closed until it does), over any PIN pad (the confirmation before the keys or a link, the settings flows), over the keys screen (BackupKeysModelcounts itself inenv.keysScreensfrom its start until it shuts) or under the "sign in again" prompt of a reset secure storage; the prompt that was showing comes back afterwards. Both apps draw onlyRootPromptState.prompt(AndroidShellPrompts,DigestSheetHost; iOSShellPromptsHost,DigestSheetHost). - The store rating prompt is the system's own: it is only asked for when the app is in front, unlocked, past the welcome screen and no root prompt is pending; otherwise the one request stays unspent (
RootPromptsModel.mayAskForRating). So a first publish that opens the digest offer does not also ask for a rating. - Out of RC (
RcOfferModel,env.rcOffer): any broadcast refused for lack of resource credits (vote, reblog, cross post, follow, mute, comment, wave, post) raises one app-wide offer instead of its toast or alert, as RNui.rcOffer: "Top up RC with Points" (REDEEMrc_topup), "Boost account", Cancel. Matched with RN'sRC_SHORTFALLover the whole error chain. The same rule (ChainRefusal.RESOURCE_CREDITS) makes the error's kind, so the kind and the offer agree whether the key, HiveSigner or HiveAuth signed; "bandwidth" alone is not a shortfall, and a node error opens the offer only when its classified refusal is Resource Credits (RC text in itsdatanever beats the refusal its message names). Android draws it inShellPrompts, iOS in theAuthOverlaywindow (above every sheet, below the lock). - Feature spotlight (
SpotlightModel):/private-api/spotlights(cached an hour), mobile and audience filter, per-account dismissal (spotlight.dismissed.<id>_<account>, wiped with the account marks), highest weight then earliest start, texts in the app language. Heads the first home feed tab. An answer that lands after the feed showed still heads it for a reader at the top: on Android the feed's header row is never less than a pixel high (FeedHeaderRow), so the list anchors on it and it grows in place, as RN's list header does; before this the list kept its first card in place and the spotlight grew above the screen (Gaps3FlowsTest.aSpotlightArrivingAfterTheFeedTakesItsTap). The button dismisses and follows the announcement's safe link rules (see Update prompt and announcements). Difference from RN: the spotlight button follows only https or ecency.com links. - Walkthrough dot (
WalkthroughModel): RN's red dot on the feed filter bar's "+" while signed in, until first used; device-wide, imported from RNwalkthrough.walkthroughMap. - Tests:
RootPromptsTest.
Account changes and teardown
- Logout, logout-all and the wipe share one teardown,
AppEnvironment.accountsLeft, in this order: push (the leaving rows are written topush.pendingReleaseat once, their requests run in the background), the in-memory session state (forgetSessionState, every part cleared on its own), then the local drafts (LocalDrafts.clear/clearAll, waited for at most 5 s; a delete that is still running finishes by itself). Each step is guarded, so one that throws or never answers does not skip the next, and the whole runs non-cancellable because the vault has already changed. The vault removes an account before the steps that can still fail (choosing the next account, turning the lock off): after such a failure the vault is asked which accounts are really gone, those are torn down, and the error is thrown afterwards. - The draft clear first marks the accounts as gone (
LocalDrafts.departed; all of them for a wipe or logout-all), and from then onLocalDrafts.save, the one writer of drafts, reply drafts, recovery copies and pending publishes, refuses them until that account signs in again: the editor or reply sheet the platform closes on the session event that follows flushes its text into nothing, and the editor does not show "Could not store the draft on this device" when the save was refused because the account left. Writes and clears take turns, so a write that got in first is deleted by the clear. The wave composer keeps its text in memory only. Not done: a draft delete that failed or timed out is not retried at the next start (the push release is). - The teardown also covers what the media area stores: the unanswered paid requests (AI assist, AI image, dictation) live in the account's local store and go with it, and
LocalDraftsrefuses to write them again for an account that left; the leaving accounts' dictation clips are deleted (DictationClips: a clip's file name starts with a tag for its owner, the first 8 bytes of the SHA-256 of the account name, so no name is on a path; another account's waiting clip and its paid request stay, and its retry uses the same idempotency key; clips without a tag, from an earlier build, go on any departure; a wipe removes all); a dictation sheet still open for an account that left deletes its clip on the session change and keeps none when it closes; a video upload model lets its file and upload place go as soon as its owner left, also with its editor still open. The shared camera folder (AndroidcacheDir/camera) is emptied by a wipe only: one account's logout leaves it, another account may be mid-capture, and each capture is deleted by whoever holds it. - Navigation: editor and drafts screens need an account, so
NavState.afterAccountChangedrops them with their dialogs and sheets on every switch, sign-out or link login; banners go withUiMessages.clear, the notification rows withNotificationsModel.forgetAccount. A tapped push that waited behind the lock is judged against the account signed in when it opens: one addressed to another account opens public targets only (a post, a profile, a tag), never the editor. A navigation saved before process death (Android saved state, iOS saved navigation) records its owner, andNavState.restoredForkeeps gated screens only for that account; a saved navigation without an owner loses them. - Tests: shared
Wave3IntegrationTest,DictationModelTest,VideoUploadModelTest; AndroidWave3NavigationTestandNotificationFlowsTest; iOSShellTests.
Update prompt and announcements
Follows RN applicationContainer._compareAndPromptForUpdate with providers/github, utils/parseVersionNumber.ts; providers/queries/announcementsQueries.ts, utils/announcementAction.ts, the announcementsMeta reducer. Shared UpdateModel, UpdateLinks, AnnouncementsModel in app/ShellPrompts.kt.
Update prompt
- Source: RN uses no update library and no remote config; it reads the latest GitHub release of the app's repository (
GET https://api.github.com/repos/ecency/vision-mobile/releases/latest,tag_name). Same call here - Decision: at app start, skipped while "Remind Later" was tapped under 48 hours ago; asks when
parseVersionNumber(tag) > parseVersionNumber(app version); any failure is silent - Prompt: "Update available v", "Using latest version of Ecency gives you the best experience", "Remind Later" (stores the time), "Update Now" (stores nothing, so the next start asks again until the app is updated)
- "Update Now" target by installer, as RN, for the app id: Android
market://details?id=app.esteem.mobile.androidfor a Play install (the Play web listing when nothing takesmarket://), else the GitHub releases page (which carries the APK for devices without Google Play, see Release pipeline); iOS the App Store page for an App Store install, else the releases page - Difference from RN: the prompt has no header image.
Differences from RN: on iOS the store page comes from Apple's lookup by bundle id (itunes.apple.com/lookup?bundleId=app.esteem.mobile.ios) at the tap (RN hard-codes the listing's numeric id 1451896376, which is this app's too and could replace the lookup); the answer must be an https page on apps.apple.com, else the releases page opens. A tag counts only when it is the build's tag prefix followed by plain X.Y.Z: v4.1.0, 4.1, 4.1.0-beta or anything else is ignored (RN reads any tag with parseInt).
Release setup: the source is a build setting, ecency.updateReleasesUrl and ecency.updateTagPrefix in local.properties (Android also ECENCY_UPDATE_RELEASES_URL, ECENCY_UPDATE_TAG_PREFIX), read by UpdateSource.of; only an https api.github.com/repos/... URL is taken. The default is RN's: ecency/vision-mobile releases with no prefix. Since native 4.x is the update of the RN app, that default is right: a plain 4.x.y release prompts RN 3.x users to update (to native) and native users on older 4.x, and there are no further RN releases to confuse it. A prefix or another repository is only needed if RN 3.x releases continue in parallel.
Announcements
GET /private-api/announcementswithout a token, cached for an hour (SDKstaleTime)Skipped on the first launch of a new version (the welcome screen's turn); runs again when the welcome was accepted and on every account change
The first announcement that is not a proposal prompt (
proposal_ids); nothing when that one needs a signed-in user (auth) and there is noneMemory per announcement and account (
<id>_<account or guest>): not shown again once its button was used, and not within 48 hours after "Later" or after it was closedShown 3 s after it was chosen: title, description, "Later" and the announcement's button text
Button: RN's rule (a link starting with
https://as it is, anything else as a path onhttps://ecency.com), the server'sopssigning blob never read, then marked as processedUntrusted payload: rows without an id or without text are dropped; texts lose control and bidi override characters and are capped (title 200, description 2000, button 60); a link over 2048 characters or with a control character is no link. A link is either absolute, starting with
https://, or a path starting with exactly one/, which getshttps://ecency.comin front. Anything else is dropped and the button only closes the prompt: RN prefixes any text withhttps://ecency.com, which turns.evil.example/xintohttps://ecency.com.evil.example/x. Absolute links are not limited to Ecency's hosts (RN does not limit them either, and announcements link to partner pages); they open in the system's in-app browser (Custom Tabs, SFSafariViewController), never in the app; a page there that redirects to an app link (ecency://,hive://) is handled like any web page doing so, and the link handler's own confirmations are the guard. The link must passSafeTarget.httpUrlas https and then opens either an in-app content screen (ContentLinks: post, profile, tag, community, waves) or the in-app browser. It never goes through the auth link handler, so an announcement cannot start a sign-in, a signature, a transfer or a signup (RN hands the URL to its general link processor). The memory lives inPrefs(announcements.meta, the newest 50 entries).Account rules: a prompt belongs to the account it was chosen for; an account change closes it without marking it and the choice runs again for the new account; a prompt chosen during the 3 s for an account that left is not shown (the account change cancels the pending prompt, and the account is checked again when the 3 s end: two guards,
aPromptChosenForOneAccountIsNotShownToTheNext); the update prompt goes first when both are due (see Root prompts).Debug: Android
--ez demoAuth true --ez demoAnnouncement true/--ez demoUpdate true; iOS-fakeData YES -demoAnnouncement YES/-demoUpdate YES.Tests: shared
ShellPromptsTest(with the delete cases); AndroidGapsFlowsTest; iOSShellPromptsUITests(EcencyAppUITests/ShellPromptsUITests.swift).
Hive core and golden vectors
shared/src/commonMain/kotlin/com/ecency/core/hive serializes and signs Hive transactions (vote, comment, comment_options, custom_json, transfer, delete_comment and metadata-only account_update2; the wallet operations of WalletOperations.kt with limit_order_create2; the posting authority account_update; update_proposal_votes, account_witness_vote, account_witness_proxy, create_proposal, update_proposal and remove_proposal in GovernanceOperations.kt). GoldenVectors.kt pins it to the existing stack (WalletGoldenVectors, PlatformGoldenVectors, GrantGoldenVectors and LinkOpGoldenVectors the rest, from dhive's bytes and the SDK's ids):
- serialized bytes come from hived itself (
condenser_api.get_transaction_hex) and must hash to the@ecency/sdktransaction id; - signatures must equal the SDK's deterministic (RFC 6979) signature byte for byte, and the SDK's own randomised signatures must recover to the signer;
- master-password key derivation must match the SDK for every role;
- every transaction those vector files pin (
GoldenVectors,WalletGoldenVectors,PlatformGoldenVectors,LinkOpGoldenVectors,GrantGoldenVectors) is serialized again by Hive's own@hiveio/wax(hived's protocol code, run offline in Node bytools/golden/generate-wax.mjs, never in the apps):WaxGoldenVectorTestwants the Kotlin bytes, transaction id and digest equal to wax's, and wax equal to the SDK's, so a vector the SDK got wrong cannot pin the app to it (#3613). wax 2.0.2 agrees with the SDK on all 69. Rerun it whenever an SDK vector file changes.
Regenerate after adding an operation (from the repository root, after npm ci --prefix tools; tools/README.md):
node tools/golden/generate.mjs shared/src/commonTest/kotlin/com/ecency/core/hive/GoldenVectors.kt
All keys in the vectors derive from public throwaway seeds and control no funds.
Why a Kotlin port and not Hive's wax C++ core: docs/wax-assessment.md.
Data layer
shared/src/commonMain/kotlin/com/ecency/core/api reads Hive and broadcasts votes and comments, mirroring the RPC calls @ecency/sdk makes for the RN app. Create one EcencyApi and share it:
val ecency = EcencyApi() // HiveNodes.DEFAULT over Ktor (OkHttp / Darwin)
// Feeds: bridge.get_ranked_posts / bridge.get_account_posts, bridge order kept
val pager = ecency.feeds.pager(FeedSource.Ranked(RankedSort.TRENDING, tag = "hive-125125"), observer = user)
pager.loadMore() // next page, duplicates dropped; pager.isEndReached
ecency.feeds.page(FeedSource.Account("alice", AccountPostsSort.FEED), cursor, observer) // "friends" feed
FeedSource.myCommunities() // the app's communities tab (needs an observer)
// Post and comments: bridge.get_post / bridge.get_discussion, cached for 60 s
ecency.posts.getPost("alice", "hello-world", observer = user) // null if it does not exist
val d = ecency.posts.getDiscussion("alice", "hello-world", user, CommentSort.TRENDING, botAuthors)
d.threads // top-level comments (pinned reply first), each with replies flattened to level 3
d.threadFrom(key) // "more replies" below a cut node
// Accounts: condenser_api.get_accounts / bridge.get_profile
ecency.accounts.getAccount("alice"); ecency.accounts.getProfile("alice")
// Broadcast (posting key): vote, reply (+ comment_options for payout type / beneficiaries)
ecency.broadcaster.vote(user, "alice", "hello-world", 10000, postingKey)
val draft = Comments.reply(user, parent.author, parent.permlink, body, parent.metadata.tags, nowMillis)
ecency.broadcaster.comment(draft, postingKey)
ecency.posts.addLocalComment(rootKey, localPost) // on top until the bridge indexes it (5 min max)
ecency.posts.addLocalPost(newPost) // a new post: leads its author's blog and posts lists the same way
Retrying a broadcast: on BroadcastException.Network the transaction may have landed. Retry with e.pending.send(), or call the same vote(...) / comment(draft) again with the same arguments or the SAME draft: the same signed transaction is re-sent (Hive dedupes it), and once it is too close to expiry it is re-signed only after the chain said it did not land (transaction_status_api.find_transaction; a reply is also looked up with database_api.find_comments; an "identical vote" answer after a re-sign counts as success). When the chain cannot tell yet, nothing is re-signed and BroadcastException.Network.undecided asks the user to check their wallet (see Node failover). Never build a new draft to retry a reply: it gets a new permlink and can post twice. Reply permlinks follow the app's re-<author>-<date>t<time>z shape but are zero-padded and UTC (the app's unpadded form collides, e.g. Jan 11 and Nov 1).
From Swift, every data-layer entry point is @Throws(EcencyException, CancellationException), so failures arrive as thrown errors whose userInfo["KotlinException"] is the Kotlin exception (EcencyAppTests/DataLayerErrorTests.swift). Bad input (blank reply, malformed key, out-of-range vote weight) is an InvalidInputException or BroadcastException.InvalidOperation, never a crash.
Errors: reads throw HiveApiException subclasses (RpcErrorException, AllNodesFailedException with one failure per attempt, ...); broadcasts throw BroadcastException (DuplicateVote, InsufficientResourceCredits, MissingAuthority, CommentTooSoon, PaidOut, Network, Rejected).
Node failover
The same rules as @ecency/sdk 2.4.26 (hive-tx callRPC, callRPCBroadcast, NodeHealthTracker) with the RN app's settings (10 s read timeout, everything else the SDK default). NodeFailoverTest, HiveRpcClientTest.
Pool:
HiveNodeSettings.start()(both apps call it at launch) puts the saved server (settings.server, RNsettings.server) in front of the built-inSERVER_LISTat once, then replaces the list withhttps://ecency.com/public-nodes.json(hived, else the body as a list; the built-in list when unreadable). A saved server already in the list keeps its place. Non-http(s) entries never enter the pool, a saved one included. The built-in list ends with techcoderx.com and hiveapi.actifit.io, as SDK 2.9.6 lists them: until 2026-11 they were blocked for servingposting_json_metadatastripped, and they serve it whole again. A saved, picked or RN-imported server must also pass the published list's rule (HiveNodes.userServer: https, no user or password); an unsafe saved value reads as none (the default pool). Demo runs keep their offline node.Order: every call orders the pool by health. Unhealthy nodes go to the back (never out): rate limited (a 429's
Retry-After, else 10 s doubling to 60 s while 429s keep coming), 3 failures in a row within 30 s, an API cooling down on the node (2 failures of that API within 30 s, or one answer the caller's validator rejected: 60 s, not lifted by a success), or a head block more than 30 behind the median seen in the last 2 minutes. Healthy nodes are ranked by an EWMA of their round trips once they have 3 fresh samples (pool order until then); one ordering a minute puts a node not sampled for a minute first, so a recovered node climbs back. "Sticky" is by measurement: the node that keeps answering fast stays first.Reads: up to 6 attempts (SDK
retry5), each on the healthiest node not yet tried; when all were tried a second round starts (a pool of one node is asked again). No new attempt after 2 x the timeout (20 s); 50 to 100 ms between attempts. A node measured on a method gets min(10 s, max(2 s, 4 x its EWMA for that method)); an explicittimeoutMillisis exact. Fail over on network errors, timeouts, HTTP 429/5xx, a proxy's non-RPC 4xx page, a body that is not a JSON-RPC reply to the request,validaterejecting the answer (get_accountsmust be a list), and node-level JSON-RPC errors (-32603, -32601, -32000..-32099, sick -32602). Any other JSON-RPC error is an answer and is thrown at once, never retried.Broadcasts:
condenser_api.broadcast_transaction, TaPoS 3 blocks behind head, 60 s expiration, 15 s per attempt, health-ordered, each node at most once (no second round), never after a chain rejection. Every node gets the SAME signed transaction, so Hive dedupes it by id; "Duplicate transaction" is success. Failures where the request never reached a node (connection refused, DNS, HTTP 429) fail over freely; after one where it may have (a timeout, HTTP 5xx or a gateway error, a body that is not a reply, any other network error) only until expiration minus 20 s, and that uncertain failure is what is thrown: a proxy can answer 502 or 504 after hived took the transaction, so such a send is looked up on chain before anything is signed again. Broadcasts give no latency samples.Retrying after an uncertain send never broadcasts twice (key accounts: the app signs, so it can re-send the same transaction). A retry re-sends the same signed transaction while it can still be accepted. After an uncertain attempt (a timeout, a broken connection), a later node's rejection other than "Duplicate transaction" (a lagging node's TaPoS assert, say) is no verdict: the send stays uncertain. A new transaction is signed only after the chain said the earlier one did not land, both when the earlier one is past its failover window and when a resend is answered "expired" or with a TaPoS error:
transaction_status_api.find_transactionmust answerexpired_irreversible(only that is final, as in hive-txcheckStatus).within_mempool/within_*_block, or a reply found withdatabase_api.find_comments, is success with the earlier id. Anything else signs and sends nothing: the send fails withBroadcastException.Network(undecided = true)("This may already have gone through. Please check your wallet or history before trying again."; a retry asks the chain again). It ends asBroadcastException.Unconfirmed("Could not confirm whether this went through... start it again only if it is not there", not retryable, the action then never sends again for an hour) only once the transaction can no longer be valid by the chain's own clock:too_old, or the chain's head time past its expiration plus 10 minutes. The device clock never decides it.BroadcastTest.HiveSigner and HiveAuth accounts are signed elsewhere: a retry there is a new signed request, as in RN; the guarantee above does not reach them.
What counts as a retry:
SigningModel.broadcast(user, ops, authority, actionId)names one user action (an id made once when the user confirms, e.g.env.idempotencyKey()); the key is account, action id and operations, and only a call with that key resumes it, however late. A second, deliberate transfer of the same amount is its own transaction. Hive links (hive://sign/...) get one id per link; the debug demo transfer makes one per tap. A key account's broadcast without an action id is refused (BroadcastException.InvalidOperation) unless every operation is repeat-safe (RepeatSafeOps: vote, comment, comment_options, delete_comment, account_update(2), posting-only follow/reblog/community/notify/ecency_notify/polls custom_json). Those are keyed by their operations, and only for them does a key long past its transaction's expiration start a new transaction.Restart journal (see Wallet, Restart journal): pending and undecided sends are held in memory, and a small journal per account keeps the undecided ones across a restart (tx id, expiration, action id, account; no signature, key or operation body). It is written when a send turns uncertain, removed when it settles, and resolved with
find_transactionat the next launch, so a retry after a restart does not send an undecided transfer a second time unseen.Broadcast deviations from the SDK (deliberate, all safe because the same signed transaction is re-sent): the SDK fails over only on pre-connection errors, HTTP 429/5xx, an unparseable body and (within the window) a timeout; it throws at once on a 200 with neither result nor error, a reply with the wrong id, and other network errors such as a connection broken mid-request. Native fails over on those too, inside the expiration window and as an uncertain send (as are 5xx and unparseable bodies, which the SDK counts as never sent). So native fails over more often than RN, never with a different transaction, and the window keeps a later node from answering "expired" for a transaction an earlier one took. A cancellation the HTTP engine raises by itself (not the caller's) is a network error like any other.
Settings (
SettingsModel.selectServer, see Settings):env.hiveNodes.servers()(the picker's list, RN useGetServersQuery),check(server)andselect(server, list):get_dynamic_global_propertieson that node alone within 5 s, alive when its chain time is less than 15 s behind the device (ServerCheck.OK,UNREACHABLE,STALEfor RN's three toasts); on OK it is saved and the pool becomes the server followed by the rest of the list. Differences from RN: RN also re-runscheckClient, which can replace the fetched list with the built-in one, and on a stale server leaves its spinner on. RN's savedsettings.serveris imported once (see Settings).The published list must give https nodes without user info (any port); a 429's
Retry-Aftercounts for at most a day; a reply'sjsonrpcmust be the string "2.0" and itsidthe number sent. The tracker's state is behind a platform lock (ReentrantLock / NSLock).A missing post is asked again elsewhere (SDK 2.9.0
verifyPostOnAlternateNode, #3712): on the post screen (PostRepository.getPostVerified, as the SDK checks its post page only), a read whose node answers null or hivemind's "does not exist" assert asks other nodes for v1bridge.get_postbefore the post is "not found", since a lagging node answers a post made seconds ago that way. Only nodes healthy for the bridge when their turn comes, healthiest first, at most three (the SDK asks every node at random), so a deleted post costs a bounded wait; what they answer counts for their health as any read does (HiveRpcClient.askCounted: a 429 cools the node). The post when one has it (another post in an answer does not stop the check); not found when another node answered without it (null, another post, or "does not exist", "not found" or "unknown account" from a node that is not broken: "Method not found" or an internal error is a failure) or the pool has no other node; a failed read when no other node answered (each failed, refused the request, or was cooling), except that a post published here a moment ago then shows its local copy, whatever the other nodes failed with, never kept as the post. Feeds, link cards and the editor take the one answer. The SDK double-checks a null only: hivemind answers a missing post with the assert, so native checks that answer too. A deleted post is "not found" too: every node answers it with-31999 "Invalid parameters"and the reason as the error's wholedatastring ("Post a/b was deleted 1 time(s)"), which the message check alone missed, so it showed "Something went wrong" with a Retry that never worked (Sentry ECENCY-MOBILE-3R3); the same words as an assert message count too (the web app's check), never inside an assert's details, which echo the request (HiveApi.isNotFound).PostDoubleCheckTest.Bridge v2 fallback (SDK
callRPCWithFallback,HiveRpcClient.callWithFallback): a read of a method only some nodes serve yet (the bridge*_v2reads,bridge.list_votes) asks for it first. A node that answers hivemind's exactunknown methodassert for it (code -32602,Assert Exception:unknown method: bridge_apiget_post_v2in the message or the assertion, never a substring: hivemind echoes params into its asserts) is asked for the v1 method at once, on the same node, within what is left of the same attempt, and marked for 30 minutes as lacking the whole family; a marked node is asked for v1 straight away. That answer is not a failure: no failover, nothing recorded against the node. Latency and node health are filed under the method that answered, so a failingdatabase_apifallback never cools the node's bridge (aFailingFallbackIsChargedToTheApiThatAnswered). The node-level error rule follows the SDK too:Assert Exception:errors are the request's answer whatever their code (hivemind echoes params, so "internal" in a permlink must not fail over), except the fixed node capability asserts (Could not find API,Could not find method,Supported by hivemindat the start of the message), which fail over.HiveRpcClientTest.aPostReadAsksV2ThenV1OnTheSameNodeAndRemembersIt,aNodeMarkedWithoutV2IsAskedForItAgainAfterHalfAnHour,anEchoedAssertIsTheRequestsAnswerNotTheNodes,PostNormalizeGoldenTest.fallbackAndErrorClassifierMatchTheSdk. Test transports are nodes without v2 unless a test serves it (FakeTransport,TestNode); the demo transports (DemoHiveTransport, iOSFakeHiveTransport) serve v2.Not ported: hedged reads (off by default in the SDK and in RN), the server-side read-through proxy (Node only),
callREST(native makes no REST node calls).Every attempt is bounded by the client's own timeout: OkHttp's read/write timeouts are disabled and NSURLSession's are set to 60 s, so they never fire first. Cancelling the calling coroutine (an outer
withTimeoutincluded) cancels the HTTP request and is reported as cancellation, not as a node failure, and nothing is recorded against the node.Response bodies over 32 MB, or nested deeper than 256 levels, are treated as a node failure; json_metadata nested that deep reads as empty. (kotlinx-serialization parses recursively, so a few thousand brackets on chain would otherwise overflow the stack.)
Tests
All tests run against a fake RpcTransport (commonTest/.../api/FakeTransport.kt) with synthetic fixtures. Broadcast tests replay the golden-vector chain state, so the asserted request bytes carry the SDK's own signatures. One optional read-only smoke test hits real nodes (Android host only, never broadcasts):
ECENCY_LIVE_TEST=1 ./gradlew :shared:testAndroidHostTest --tests '*LiveSmokeTest*'
Live write tests sign in to two test accounts and write to the real chain through the app's own models and screens: publish, edit, reply, vote, reblog, bookmark, delete, transfer, power up, drafts, follow, notifications, sign out of one of two accounts. They spend resource credits and post public test content, so they never run in CI and only run on purpose. The passwords live outside the repo in ~/.config/ecency-native-test/credentials (ECENCY_TEST_USERNAME, ECENCY_TEST_PASSWORD, ECENCY_TEST_PEER, ECENCY_TEST_PEER_PASSWORD); without that file every test skips itself. Every step is checked against the chain afterwards.
ECENCY_LIVE_WRITE=1 ./gradlew :shared:testAndroidHostTest --tests '*LiveWriteTest.publishReplyVoteAndTransferOnChain*' -i
ECENCY_LIVE_LIFECYCLE="<author>/<post> <peer>/<reply>" ./gradlew :shared:testAndroidHostTest --tests '*LiveWriteTest.editReblog*' -i
ECENCY_LIVE_MISC=1 ./gradlew :shared:testAndroidHostTest --tests '*LiveWriteTest.draftsFollow*' -i
ECENCY_LIVE_LOGOUT=1 ./gradlew :shared:testAndroidHostTest --tests '*LiveWriteTest.signOutOfOne*' -i
ECENCY_LIVE_VOTED="<author>/<post the peer voted with little HP>" ./gradlew :shared:testAndroidHostTest --tests '*LiveWriteTest.aWeightless*' -i
iOS has the same through the real UI (EcencyAppUITests/LiveChainUITests, skipped unless the accounts are passed as TEST_RUNNER_LIVE_A_USER, TEST_RUNNER_LIVE_A_PASS, TEST_RUNNER_LIVE_B_USER and TEST_RUNNER_LIVE_B_PASS, read from the same file at run time; each test is one step run by hand).
Transport and timeouts
- Transport bound:
KtorAuthHttpitself gives up after 30 s (EcencyTimeoutException), which covers every caller: the token exchange, HiveSigner's API, the private API, search, waves, translation, polls, the Pro and bad actors lists. A sign-in whose token exchange timed out is not retried: the error shows and the button is back after one bound. Uploads keep their stall watchdog. - Timeouts: every private API call (
EcencyPrivateApi.post: drafts, schedules, snippets, gallery, support settings, bookmarks, favourites, notifications) gives up after 30 s with anEcencyHttpExceptionof status 0, since the Android HTTP client has no read, write or call timeout; a write that timed out may have reached the server and callers treat it like any lost answer. The quests call has the same bound. An image upload try has no flat limit: it gives up when no further byte went out and no answer came for 60 s (ImageUploader.STALL_MILLIS), at most 10 minutes a try on Android (on iOS the session's 120 s resource timeout ends a try first), and is retried like RN's timeout (RN: a flat 120 s). As in RN, a draft or schedule add is not idempotent: when its answer is lost to a timeout the server may have stored it, and saving again can store a second one. - User agent: the build's user agent goes only to the first-party hosts,
ClientIdentity.FIRST_PARTY_HOSTS: ecency.com and hivesigner.com, each with all of its subdomains (not a list of exact hosts, because the app calls several and the API and image hosts are build settings under ecency.com), https on the default port only. HiveSigner's API is on the list because sign-in goes through it. HiveSigner's pages in the in-app web view (login, signing) are not given the header: a web view's user agent would go to every host the page loads from and to every redirect, so the web view keeps the system's own. That covers every first-party host the app calls: the private API, search, the token endpoint and waves on ecency.com, images.ecency.com and i.ecency.com, translate.ecency.com and poll.ecency.com. Every other host reached throughKtorAuthHttp(3Speak's embed API, the bad actors list on GitHub) gets no user agent from the app, so the platform's default; another port, a look-alike domain, or a URL with userinfo, a backslash or a control character is never first-party.KtorAuthHttpfollows no redirect (a 3xx is an error), so the header is never re-sent to a host an Ecency answer names; the image upload client follows none either. The Hive RPC, image upload and websocket clients never set one. - Failed connections: a request that never got an answer (no route, DNS, a connect timeout the engine raises, a connection lost: the platform's own IOException, Java or Darwin; the call's own time limit stays
EcencyTimeoutException) leavesKtorAuthHttp.sendasofSendFailuremakes it, status 0 "network error" with the cause kept, so every caller sees a lost connection and quiet reads report nothing (they were reported as unknown errors: Sentry ECENCY-MOBILE-3JM;KtorAuthHttpTest.aConnectionThatFailsIsANetworkError). - Redirects (
EcencyHttpException.ofSendFailure,isRedirect): the transport follows none; the refusal keeps its status (3xx) through every caller, never becoming status 0 "network error" (search and signup carry it in their own errors), the token exchange does not retry it, a tus upload ends on it at once (as on any definite 4xx other than 404, 408, 409, 423, 429 and 460), and the user reads "The server sent an unexpected redirect..." (AppError.UNEXPECTED_REDIRECT).KtorAuthHttpTest(GET, HEAD and POST for 301, 302, 307 and 308). - Android demo runs (
--ez demoAuth true, debug builds only) are offline for Hive too:DemoHiveTransportanswers the read calls from synthetic fixtures and refuses everything else, broadcasts included, so the seeded accounts (which exist on no chain) never reach a real node as an observer. The demo chain holds one transaction (DemoWallet.DEMO_TX_ID, the demo transfer from spike-alice to spike-bob, in an irreversible block), whichfind_transactionandget_transactionanswer so a HiveAuth confirmation that names it passes; any other transaction stays unknown. iOS keeps its ownFakeHiveTransport. Avatars and other images still come from the image host.
Preferences
- Preferences (
Prefs): new keys are<area>.<camelCaseName>(push.enabled,push.typesOff,push.pendingRelease,content.showImages,editor.defaultRewardType,rating.*,digest.firstPublishOffered.<user>); the older keys keep RN's names (customTabs.mainTabs,nsfw).tts_settingsis not read since Listen replaced text to speech, and new keys must not reuse it. "Show Images" applies to notification rows and feed card images. - "Show Images" (
content.showImages) off holds back feed card images, post body images, similar entries and the image viewer behind a "Tap to load image" placeholder, one image per tap for the session (see "Feed, posts and reading").
Markdown (remarkable port)
shared/src/commonMain/kotlin/com/ecency/core/render/markdown is a pure Kotlin port of remarkable 2.0.1 plus the parts of Autolinker 3.16.2 its linkify plugin uses, configured exactly as @ecency/render-helper configures it. Markdown.render(src) must be byte-identical to the JS output; JS is only the offline oracle.
Two generators, both from the pinned packages in tools/render (npm ci there first):
cd tools/render
node generate-markdown-data.mjs # Entities.kt + AutolinkerData.kt (entity table, TLDs, URL character classes)
node generate-markdown-fixtures.mjs # commonTest/.../markdown/MarkdownFixtures.kt (golden cases + 200 KB document hash)
Rerun both after bumping remarkable, autolinker or render-helper. Fixture inputs are synthetic only. MarkdownTest compares every case exactly; known differences go in its allowedDeviations with a reason (none at present).
Post HTML: DOM and sanitizer
shared/src/commonMain/kotlin/com/ecency/core/render/dom and .../render/sanitize port the HTML layer of @ecency/render-helper 2.5.59 to pure Kotlin: the xmldom 0.9.12 text/html parser and serializer (a small mutable DOM the post transforms run on), the htmlparser2 + dom-serializer repair path render-helper takes when xmldom rejects a body, and sanitizeHtml (xss 1.0.15 with render-helper's whitelist and hooks). RenderBodyParser mirrors the parse step of markdownToHTML, including its fallbacks.
Golden fixtures come from the JS packages themselves (synthetic inputs only, plus seeded random combinations):
cd tools/render && npm ci
node generate-dom-fixtures.mjs ../../shared/src/commonTest/kotlin/com/ecency/core/render/dom
# entity tables used by the port (only when the oracle packages change)
node generate-entity-tables.mjs ../../shared/src/commonMain/kotlin/com/ecency/core/render/dom/EntityTables.kt
For a local fuzzing run, raise the random case counts (keep each run under about 5,000 cases or the JVM fixture class gets too large) and regenerate the committed set afterwards:
RANDOM_COUNT=1500 SOUP_COUNT=3000 SOUP_LEN=80 EXTRA_FUZZ=2000 SEED=99 node generate-dom-fixtures.mjs ../../shared/src/commonTest/kotlin/com/ecency/core/render/dom
Deliberate deviations from the oracle
Everything above is compared byte for byte; the only exceptions are listed in code with a reason, and the tests fail if a listed case stops differing:
- Iframe host allow list (security): now upstream. Until 2.5.42 the port alone dropped an iframe
srcoutside the embed allow list and authorsandboxtokens beyondiframe()'s grants. render-helper 2.5.45 (#1919) enforces both in its own sanitizer on every path, gives a refused srciframe()'s spelling one more try (EmbedSrc.canonicalEmbedSrc) and drops an iframe left without a src; the port does the same, soDomGoldenTest.securityDeviationsandTransformDeviations.securityare empty (the mechanism stays for the next one). - Very deep nesting (robustness). Past a few thousand nested elements dom-serializer overflows the V8 stack and render-helper falls back to sanitize-only output; the Kotlin repair is iterative and returns the repaired, fully closed body (
DomGoldenTest.deepNestingPastTheJsStackIsRepaired).
URLs and IDNA
render/url/WebUrl is the WHATWG URL parser used everywhere in the renderer, the embed allow list included. Its host step (Idna) ports the IDNA code of the Node that produces the goldens (Ada: UTS 46 mapping, NFC, Punycode, CheckBidi and CheckJoiners as Ada applies them) over Ada's own tables:
cd tools/render
node generate-idna-tables.mjs ../../shared/src/commonMain/kotlin/com/ecency/core/render/url/IdnaTables.kt # when Node's Ada version changes
node generate-url-fixtures.mjs ../../shared/src/commonTest/kotlin/com/ecency/core/render/url/UrlFixtures.kt
Post HTML to blocks
render/blocks/BlockBuilder.kt turns the final post HTML into the native block model (mapping in docs/post-rendering.md). Test inputs and the demo post are real render-helper output for synthetic markdown:
cd tools/render && npm ci
node generate-block-inputs.mjs # commonTest/.../blocks/BlockInputs.kt (+ expected words), SampleHtmlWords.kt and commonMain/.../blocks/SampleHtml.kt
node block-words.mjs corpus # local only: expected words for the corpus (htmlparser2 oracle)
With the local corpus in tools/render/corpus/expected.jsonl, ./gradlew :shared:testAndroidHostTest --tests '*BlockCorpusTest' reports crashes, text loss, unhandled tags and classes, and timing.
Post link cards
A link to another Hive post on a line of its own (Block.PostPreview) is a card with the linked post's title, the start of its text, its thumbnail and @author; a tap opens the post (#3705). RN read the linked post whenever the linking post's links_meta had no full entry (linkPreview.tsx), the website always (its oEmbed endpoint); native reads it always, so what the linking post claims about another one shows, unverified, only until that read lands.
env.postLinkCards(PostLinkCards) reads the linked post (bridge.get_post) when its card is first shown, at most 3 at once, and keeps the card for the session. Title and summary are the feed card's (PostBodyRenderer.summary), the thumbnail the feed card's image at 192 px (PostLinkCards.THUMB_PX). A missing or muted post (Post.isMuted) or one without a title endsisPlain: the plain card (author and permlink), never the linking post's text, and it is not read again; an invalid link is never read; a failed read is read again the next time the card shows. What the reader decides later applies at once: an author they mute gets the plain card and gets the read card back when unmuted (AppEvent.AuthorUnmuted), and an NSFW post's thumbnail shows only while the NSFW setting is "Always show".- Until the read lands the card shows the linking post's
links_metatext for that link (LinksMeta.cards, intoPostPreview.cardwhile the blocks are built): the entry needs a title and a URL that parses to a valid author and permlink; the title is cut to 256 characters and the summary to 150. Its image is never used (any author writes anything there: it could be an NSFW post's cover). - The card is at least the thumbnail's height, so a read card grows only by the lines it adds. The thumbnail follows "Show images". Android draws it in
PostPreviewCard(LocalPostLinkCards, provided inEcencyApp), iOS inPostLinkCardView(\.postLinkCards, fromRootView, its sheet too); a body without the provider (previews) draws the plain card or thelinks_metatext. - Fake data: the demo post
@spike-alice/fake-post-linkslinks two fixture posts (DemoHiveTransport, iOSFakeHiveTransport). - Tests:
PostLinkCardsTest(shared),PostLinkCardTest(Android),PostLinkCardUITests(iOS).
Render pipeline
shared/src/commonMain/kotlin/com/ecency/core/render reproduces @ecency/render-helper 2.5.59 end to end in pure Kotlin (JS is only the offline oracle):
RenderHelper(proxyBase)is the entry point:renderPostBody(body | Entry, forApp, parentDomain, seoContext, options),postBodySummary(body | Entry, length, platform),catchPostImage(Entry | body, width, height, fast),getEntryImageRawUrl,getEntryCardImageRawUrlandsimpleMarkdownToHTML. The app'srenderPostBody(post, true, false)plussetProxyBase(imageServer)becomesRenderHelper(imageServer).renderPostBody(post.body, forApp = true).methods/holds the transforms (traverse, a, img, iframe, text, linkify, clean-reply, markdown-to-html), the helpers and the regex constants. Per-element regexes go throughJsRegex, which translates the JS source so the JVM and Kotlin/Native engines match JS (.,$,\s, ASCII-only/i); hot and whole-body patterns are hand-written scanners (Scanners,Linkify,CatchPostImage).- The app should call
renderPostBodySafe(never throws on content; a failure or a blank result for a non-blank body shows the body as escaped text). Renders are CPU-bound and pathological bodies take seconds, so always render off the main thread. - Robustness: as render-helper 2.5.45 (#1920), a run of adjacent tags and mentions is linked in one pass, and past
Traverse.MAX_DEPTH(2,000) levels a subtree is reduced to its text instead of being walked; seePathologicalRenderTest. - Shared JS semantics (whitespace, trim, toLowerCase, URI coding, parseInt, number formatting, UTF-8) live in one place,
render/js/Js.kt. - Threading: a
RenderHelperholds only its immutableImageProxy. Each call builds its own document and state, regexes are compiled once and immutable, and there is no render cache, so one instance can serve concurrent background renders.traverseis iterative, so deeply nested bodies cannot overflow a thread stack.
Golden fixtures (synthetic inputs covering every provider and option combination, plus seeded random bodies stored as hashes):
cd tools/render
node generate-transform-fixtures.mjs ../../shared/src/commonTest/kotlin/com/ecency/core/render/transform
node generate-fixtures.mjs ../../shared/src/commonTest/kotlin/com/ecency/core/render/RenderFixtures.kt
TransformGoldenTest compares every case exactly; deviations go in TransformDeviations with a reason (none since 2.5.45), and securityDeviationsStillDiffer fails if a listed case starts matching the oracle. For a local fuzzing run use SEED=... RANDOM_COUNT=... node generate-transform-fixtures.mjs ... and regenerate the committed set afterwards.
Corpus run (local only: the posts are other people's content and corpus/ is gitignored):
cd tools/render
node corpus.mjs fetch 500 # or copy an existing posts.jsonl into corpus/
node corpus.mjs render # expected.jsonl from the same oracle
cd ../.. && ./gradlew :shared:testAndroidHostTest --tests 'com.ecency.core.render.RenderCorpusTest'
RenderCorpusTest (JVM only, skipped without the files) prints exact-match counts for html, summary and image plus renderPostBody timings, and writes mismatch details to shared/build/render-corpus-report.txt.
Speak voice posts (json_metadata.speak): the body's audio markup is removed as in RN and a native player row (ExoPlayer / AVPlayer, waveform seek, one player at a time) is drawn under the body; see docs/post-rendering.md.
Updating the oracle: bump tools/render/package.json, npm install, diff the two package sources (the source maps carry them: npm pack @ecency/render-helper@<v>), port the change, rerun every generate-*.mjs that reads the package (fixtures, transform, dom, markdown, markdown-data, proxy, block-inputs, block-words.mjs), add golden inputs for the new rule (new ones go in their own object so the seeded random cases keep their names), then refetch and rerun the corpus. The rule inventory per version is in docs/post-rendering.md.
In-place upgrade from RN 3.x
Native 4.x ships as an update of the RN store app: same ids, same store records, same signing, so users and testers update in place and keep their accounts, PIN and settings.
| Android | iOS | |
|---|---|---|
| App id | app.esteem.mobile.android (Kotlin namespace and packages stay com.ecency.*) |
app.esteem.mobile.ios |
| Name | Ecency | Ecency |
| Extensions | share app.esteem.mobile.ios.eshare, notification service app.esteem.mobile.ios.ImageNotifi, App Group group.com.ecency.eshare (RN ios/*/*.entitlements) |
Both extensions use RN's ids and profiles: EcencyShare is app.esteem.mobile.ios.eshare (App Group group.com.ecency.eshare, also on the app; PROVISIONING_PROFILE_SPECIFIER: $(ECENCY_SHARE_PROFILE)), EcencyNotificationService is app.esteem.mobile.ios.ImageNotifi ($(ECENCY_NSE_PROFILE), built with ECENCY_PUSH_EXTENSION); the release workflow installs all three RN profiles.
Links and sharing: the app handles RN's App Link paths, including /trending, /hot, /waves, /waves/* and /purchase, and Android has the share targets (SEND, SEND_MULTIPLE). They sit in the same activity as the identity changes (Custom Tabs and browser <queries>, the browser fallback for pages no screen claims).
What the update carries over, checked against RN 3.5.11 (@react-native-async-storage/async-storage 2.2.0, RN 0.79.5):
- RN data, read by
AsyncStorageReaderand imported once (see "Importing accounts from the RN app"). Android: the SQLite databasedatabases/RKStorage, tablecatalystLocalStorage (key TEXT PRIMARY KEY, value TEXT NOT NULL), the async-storage default (RN does not setAsyncStorage_useNextStorage, so the newer Room database is not used); RN opens it with write-ahead logging, which the reader handles while RN's rows may still sit inRKStorage-wal. iOS:Library/Application Support/app.esteem.mobile.ios/RCTAsyncLocalStorage_V1/manifest.json, values over 1024 characters as null there and in a file named md5(key); checked on a simulator holding a real RN 3.5.11 install:persist:root,userandREACT_QUERY_OFFLINE_CACHEare files817e01df...,ee11cbb1...,b6fc4091..., the other keys inline. An RN install never opened since async-storage moved its folder out ofDocumentsis read fromDocuments/RCTAsyncLocalStorage_V1(or the olderRNCAsyncLocalStorage_V1,RCTAsyncLocalStorage) instead. RN copiesDocumentsinto Application Support without deleting the old copy, so those folders can still hold old RN secrets: every RN folder other than the live one is deleted whole together with the secrets (LegacyCleanup.scrub: after the import mark and in the PIN wipe;AsyncStorageReader.forApp,LegacyStorage.hasStaleCopies). Tests with that layout:AsyncStorageReaderTest(Android, shared iOS). - Push: the same Firebase apps (RN's
google-services.jsonandGoogleService-Info.plist; CI decodes the existingGOOGLE_JSONandGOOGLE_PLISTsecrets), so Firebase's installation id and the FCM token in the app's data stay valid; the app registers the token with Ecency again at start, as RN did. The notification permission belongs to the app id: Android'sPOST_NOTIFICATIONSgrant (RN declared it through notifee and Firebase) and iOS's authorization stay. Pushes keep landing in Firebase'sfcm_fallback_notification_channel, the channel RN's pushes used, so a user's sound and importance settings for it survive (nodefault_notification_channel_idon purpose, see the manifest). RN's media channel (RNVIDEO_SESSION_NOTIFICATION) was deleted by RN whenever playback stopped, so there is nothing to keep there. - Links: the same app id, so ecency.com's
assetlinks.json(RN's signing certificate) already verifies the Android App Links and theapple-app-site-associationalready lists the iOS app;ecency://andhive://stay registered on both platforms. RN's oldesteem://scheme stays registered on iOS only, as RN iOS registered it, and is read asecency://; Android does not register it. - Backups:
allowBackup=falseas RN; the RN AsyncStorage folder on iOS is excluded from backups by RN. - Keychain (iOS): RN kept no secrets in the Keychain (no keychain library); native uses the service
app.esteem.mobile.ios.securein the app's default access group, which no RN item uses (Firebase's own items stay untouched).wipeIfFreshInstallonly ever clears that service, and an update from RN has nothing there. - Debug builds use the release id too, with no
applicationIdSuffix: a suffix would give the app another data folder (Android) or bundle id folder (iOS), so it could never exercise the real RN import. A debug build installs over an RN build only when both are signed with the same key (on Android RN's debug keystore differs from Gradle's default, so a debug build does not replace an RN store or dev build there). - Devices: the shared simulator and emulator have RN 3.5.11 installed under these ids. Installing native on the simulator replaces the RN app in place (its data stays) and a normal launch imports and then scrubs the RN secrets there; UI tests run with
-fakeData, and the unit test host never builds the environment, so neither touches RN data. On the emulator the RN build is signed with another key, so the debug install fails (scripts/android-emu.shsays why) unless the RN app is removed, which deletes its data. The old preview appcom.ecency.mobilecan be deleted freely.
Rollback to RN is not supported: the RN secrets are scrubbed right after the import with no grace period, and a user who goes back signs in again. Play never offers a lower versionCode and the App Store has no downgrade, so this only happens through an RN build uploaded later with a higher number, a sideloaded APK or an older TestFlight build. RN then finds its storage without user, sc_accounts, auth, the PINs and the accounts' local keys: no usable accounts and no PIN, but its settings in persist:root (theme, language, currency, servers and the rest), drafts and caches are still there. Native's data stays beside it unread: on Android the vault (ecency.secure preferences under a Keystore key) and the ecency.prefs, ecency.ui, ecency.push preferences; on iOS the Keychain service app.esteem.mobile.ios.secure and the UserDefaults (including the install mark). Updating to native again finds that vault as it was and its "imported" mark, so nothing is imported again: accounts signed in under RN in between are scrubbed from RN's storage without being imported (sign in again), and the native PIN is the one from before the rollback.
Importing accounts from the RN app
shared/src/commonMain/kotlin/com/ecency/core/legacy reads what the RN app stored so users stay signed in (3.x to 4.0.0):
AsyncStorageReader(Android: SQLiteRKStorage; iOS:RCTAsyncLocalStorage_V1manifest plus md5-named files)LegacyImporterdecrypts the PIN frompersist:rootwith the build'sPIN_KEY, then each account's secrets fromuser(crypto-js passphrase AES with the app's stamp) with the app PIN,DEFAULT_PINor the old unlock PIN, and validates every key. An app PIN that does not decrypt isPinUnavailableonly when some account then has a field none of the other PINs open; auserentry that is not an object is skipped (and kept in the RN storage), not fatal to the others
Fixtures come from the RN app's own src/utils/crypto.ts with dummy secrets, so they regenerate from the root of a checkout of the rn-3.x-final tag, where the app is under native/:
node --experimental-strip-types --no-warnings native/tools/legacy/generate-fixtures.mjs \
native/shared/src/commonTest/kotlin/com/ecency/core/legacy/LegacyFixtures.kt
The real PIN_KEY and DEFAULT_PIN are build secrets. They must come from local, untracked config or CI secrets, never from this repo (see "RN build secrets in native builds").
Secure storage
shared/src/commonMain/kotlin/com/ecency/core/secure keeps account secrets once they leave the RN app's storage.
SecureStore: put, get, delete, list and wipe small secrets by entry name, pluswithLockfor read-modify-write. Every failure is aSecureStoreException(KeyInvalidated,Corrupted,Unavailable,InvalidArgument), including caller mistakes, because Swift only sees declared exceptions and any other Kotlin exception terminates the app. Calls block on platform I/O; UI code usesKeyVaultAsync(suspend functions onDispatchers.IO, async in Swift).- Android,
AndroidKeystoreSecureStore: AES-256-GCM under a non-exportable Android Keystore key, ciphertext in a private SharedPreferences file, entry name bound as GCM associated data. One process-wide lock per store name covers the alias check, the "never mint a key next to existing ciphertext" check, key creation and every read and write, so separate instances cannot race. If the key is gone while ciphertext remains (restore onto a new device, Keystore reset) calls throwKeyInvalidated;UnrecoverableKeyExceptionisUnavailablebecause it is not always permanent. Nothing wipes automatically.KeyVaultreports the lost key from whichever call met it first (WatchedSecureStore,KeyVault.onKeyInvalidated) andStorageResetModel(env.storageReset) opens a blocking prompt, "Secure storage was reset on this device. Sign in again.", in a window above the lock cover, the PIN pad and every sheet (no back, no tap outside; no root prompt opens under it). Only its confirmation wipes: the same path as "forgot PIN" (PinLock.wipeAll,resetAfterWipe), thenAppEvent.SignInAgainopens the login screen. A wipe the store refused keeps the prompt with an error for another try.UnavailableandCorruptednever open it. Tests:StorageResetModelTest,LockFlowsTest. - iOS,
KeychainSecureStore: onekSecClassGenericPassworditem per entry, service<bundle id>.secure,kSecAttrAccessibleAfterFirstUnlockThisDeviceOnly, never synchronizable, one process-wide lock per service. Keychain items survive an uninstall, so the app must callwipeIfFreshInstall()at launch before reading the vault (a UserDefaults mark, which an uninstall removes and an update from the RN app keeps). iOS calls it at launch (AppContainer.make) with a protected data flag; before the first unlock after a restart (protected data unavailable) UserDefaults can read as empty, so the check stays pending: every read, write, delete and listing of the store first runs it once protected data is available and fails closed (Unavailable) until then, and the app runs it as soon as it can (ProtectedDataFlag.watch,runPendingInstallCheck). The launch reading can say "unavailable" on a phone that is already unlocked (a prewarmed launch), and iOS then posts noprotectedDataDidBecomeAvailableNotification, soUIApplication.isProtectedDataAvailableis read again whenever the app becomes active or comes to the foreground, and on the main thread before each store call made there; once the check ran, the session's and the lock's starts that failed closed meanwhile restart by themselves, each once and each on its own, whenever its storage error shows up with the store open, an error still on its way when the store opened included (StorageRecovery,ProtectedDataFlag.storageOpened), with no Retry needed (KeychainSecureStoreTests.testALaunchThatReadUnavailableOpensTheStoreWhenTheAppBecomesActive). So a previous install's items never reach the lock screen or the session, even when the device is unlocked later in the same process; the mark is set only after the wipe (KeychainSecureStoreTests.testPendingInstallCheckBlocksTheVaultUntilProtectedDataIsAvailable). The Keychain has no separate device key to lose: this store reports every failure asUnavailableand neverKeyInvalidated, so iOS has no "sign in again" prompt (it would be dead UI) and never wipes on a storage error. A session or lock start the Keychain refused while the store was open (status -25308 before the first unlock, a prewarmed launch) runs again once when the app is active, each once and whenever that failure arrives; only the first start of each after launch counts (LaunchStarts), never a later storage failure such as a sign in (StorageRecovery,KeychainSecureStoreTests; #3701, #3706). The send journal the store refused at launch is read at the next activation (SendJournal.startagain; one asked while the launch read is still in flight reads once more if that read fails, never in a loop:WalletDeltaFixesTest.aStartDuringAnInFlightReadThatFailsReadsOnceMore,aStartDuringAFailingReadRetriesOnceNotForever), and push registers every account at the next foreground when it could not list them.
- Android,
KeyVault: accounts on top of aSecureStore, one entry per username with auth type, posting, active and memo keys (never the owner key, never the master password: see "What the app stores"), access token and HiveAuth key, token and expiry, plus the current account, PIN lock flag and migration mark.VaultAccount.toString()is redacted. Invalid usernames read as absent and are rejected on save withInvalidArgument; an unreadable account is skipped byaccounts()and listed byunreadableUsernames(); unreadable meta reads as defaults;remove()clears the current account before deleting.LegacyMigration.run(vault, storage, pinKey, defaultPin): RN accounts into the vault, once, then the RN secrets out of the RN storage. Both apps pass aLegacyMigrationSource(RN storage,PIN_KEY,DEFAULT_PIN) toAppEnvironment.create, andAppLockModel.start()runs the migration to completion before it reads the lock state, so the first launch after the update never opens unlocked. RN storage that cannot be read is retried on the next launch.- Every field is decrypted with the app PIN, then DEFAULT_PIN, then the user's old PIN from
application.encUnlockPin(the RN app leaves secrets under all three). - Accounts are keyed by username and an account already in the vault is never overwritten. Every migrated account is read back before the "imported" mark is written, and the mark is the last vault write: a run killed at any write completes on the next launch, a finished run never repeats.
- Only provably absent RN storage counts as done. Storage that exists but cannot be read (
StorageUnreadable), a wrongPIN_KEY(PinUnavailable), malformed data or a failed read-back changes nothing and is retried later. - The editor's unsaved RN drafts come along once, with the settings import (
LegacyEditorDrafts,SettingsModel.importLegacy): RN autosaves into the persisted reduxcache.draftsCollectioninpersist:root, the new post underDEFAULT_USER_DRAFT_ID_<username>and an opened server draft under its id, kept 7 days. Unexpired ones with text become the account'sLocalDrafts.NEW_POSTordraft(id)slot (title, body, comma tags, updated, description, thumbnail, reward) unless that slot already holds something. Dropped: the poll and beneficiaries in the draft's meta, reply autosaves (replyCache), ids with a/(wave and reply autosaves of RN builds that never ran its migration 14, such as<author>/ecency.waves), and RN's olddraftkey (storage.tssetDraftPost), which nothing in RN 3.x writes any more. Tests:LegacyEditorDraftsTest,SettingsModelTest.rnEditorDraftsComeWithTheSettingsImport. - A failure a retry cannot fix (
PinUnavailable: the build'sPIN_KEYdoes not open this data;Malformed) is not silent:AppLockModelcounts it in the prefs (legacy.importFailures,legacy.importFailureKind), writes a warning line (AppLog: logcat tagEcency, iOS NSLog; kind and count only), leaves a crash reporter breadcrumb (legacy, "RN import failed", kind, attempts, abandoned), emitsAppEvent.LegacyImportFailed(kind, attempts, abandoned), and tells the user once "We could not bring over your accounts from the previous version of the app. Please log in again." After 3 such launches (IMPORT_ATTEMPTS) it stops counting and reporting, but nothing is marked done or deleted: no screen asks the user to give those accounts up, so the RN data stays and every launch still tries it silently (a later build that opens it imports it). Unreadable storage and failed read-backs stay silent retries. Test:AppLockModelTest.anRnImportTheBuildCannotOpenIsToldOnceThenGivenUp. - After the mark,
LegacyCleanup.scrubdeletesuser,sc_accounts,auth(unsalted PIN hash) and, insidepersist:root, the encrypted PINs and each account'slocalcopy of its keys. Settings and drafts stay. A failed cleanup is retried on the next run. An RN entry the vault did not take whole stays, with itssc_accountsentry, itslocalcopies and the two PINs (LegacyMigrationmustKeep): a field that did not decrypt or validate, an account without a credential the vault takes, and an owner key without its master password (the vault never stores owner keys). The kept names are recorded in the vault (legacy.kept), on the first run before the mark, so a run killed at any write either repeats the import or knows them. Every later run reads the RN data again and deletes nothing while it cannot be read, nor whilelegacy.keptorlegacy.removedcannot be read (both stay for the next run); a kept entry that now reads (a build with the rightDEFAULT_PIN, say) is written into the vault and read back first, and its RN copy goes only once the vault holds its keys (a failed write keeps it). RN accounts that were not kept are not imported again (removed accounts stay removed). Signing an account out in the app (AccountManager.remove,logoutAll, throughLegacyMigration.forgetbefore the vault entry goes) records its name inlegacy.removedand deletes its RN entries at once (LegacyCleanup.forget: itsuserandsc_accountsentries andlocalcopies, as RN's own logout deleted them; the PINs stay for other kept entries). Every run skips those names, so a kept entry whose keys differed from the vault's is not imported again and its RN copy goes at the next cleanup; either step alone is enough. Whenlegacy.removedcannot be read (corrupted, or not at that moment), the name goes tolegacy.removed.pendinginstead, which every run reads with it (#3609): the sign-out goes ahead, a run does nothing while either list is unreadable, and once they read the name is skipped. Only when no list can be written and the RN entry cannot be deleted does the sign-out fail and remove nothing. Tests:LegacyMigrationTest,AppLockModelTest.aSignedOutAccountWhoseRnEntryWasKeptIsNotImportedAgain. RN'ssc_accountsrefresh token andexpireDate(plain JSON,Date.toString()) come along into the account's session entry (auth.session.<username>), soAccountManager.refreshSessionrenews migrated sessions.
- Every field is decrypted with the app PIN, then DEFAULT_PIN, then the user's old PIN from
Keys are not PIN-encrypted again inside the vault
The RN app encrypted keys with the PIN because AsyncStorage had no other protection. In the native app the device key (Keystore, Keychain) is the at-rest protection, and the PIN stays an app lock (see "App lock (PIN)"). The app does not add a PIN layer on top:
- A PIN is 4 to 6 digits. Anyone who already got past the Keystore or Keychain can try all PINs offline in seconds, and a WIF checksum tells them when they hit, so the extra layer adds almost no strength.
- It costs real UX and failure modes: every PIN change re-encrypts every key, a forgotten PIN loses every key, and the RN build secrets would stay permanent dependencies instead of one-time migration inputs.
- Stronger options exist when wanted: biometric or device-credential bound keys (
setUserAuthenticationRequired,kSecAccessControlUserPresence) for the active key, enforced by the hardware rather than by our code. Active or owner signing behind biometrics stays optional.
App lock (PIN)
secure/PinLock is the RN app's PIN lock without the RN weaknesses; app/AppLockModel drives both UIs.
val lock = env.pinLock // blocking; the model calls it on AppDispatchers.io
lock.setPin("1234") // first PIN only, turns the lock on (4 digits, else InvalidArgument)
lock.verify(pin) // PinCheck.Success | Wrong(failures, remaining) | Wiped | NoPin | BiometricChanged
lock.changePin(old, new); lock.disable(pin); lock.setBiometricEnabled(pin, on) { binder.bind() } // each checks the PIN like verify
lock.unlockWithBiometric(binding) // after the platform prompt succeeded
lock.wipeAll() // "forgot PIN"
env.appLock.biometricBinder = ... // set by each app before start()
env.appLock.start(); onBackground(); onForeground(); enterDigit(d); deleteDigit(); forgotPin()
env.appLock.biometricSucceeded(binding); biometricInvalidated(); consumeAutoBiometric()
env.appLock.startEnable() / startDisable() / startChange() / startBiometric(on) / cancel()
- Verifier: PBKDF2-HMAC-SHA256 through the platform (CommonCrypto
CCKeyDerivationPBKDFon iOS,SecretKeyFactoryPBKDF2WithHmacSHA256on Android 8+; common Kotlin over kotlincrypto SHA-256 on Android 7 and in JVM host tests; RFC 7914 and hashlib vectors pass on every implementation and a cross-check compares them), 16-byte random salt, 100,000 rounds stored with the hash, constant-time compare, entrypin.verifier. The PIN itself is never stored or logged. With only 10,000 possible PINs the hash cannot stop an offline search of a stolen verifier; the device key of the store and the counter are the protection. - Counter (
pin.failures): written before the PIN is checked and reset only by a correct PIN or a biometric unlock, so killing the app mid-check or restarting it never gives attempts back. A missing or unreadable counter next to a verifier counts as tampering and leaves one attempt.MAX_ATTEMPTS= 3, as RN: the third wrong PIN in a row (in any flow: unlock, change, turn off, biometric toggle) wipes the vault, marks the RN migration done so no RN copy comes back, deletes the RN copies of the secrets (LegacyCleanup.scrub; the next start retries one that failed), clears session, votes and cached posts, and emitsAppEvent.DataWipedthenSessionChanged(null); the UIs return to the signed-out app with a notice. A wipe that failed (store unavailable) is finished before any later check. - Wipe: the "migration done" mark is written even when the wipe failed part way (Android: ciphertext cleared, Keystore key delete failed; the key delete is best effort), so RN data, including the RN PIN, is never imported again. A wipe leaves no name behind:
AccountPrefs, run byresetAfterWipebefore its event, removes the preferences that name an account or what it read (digest.firstPublishOffered.<user>,waves.onboarding.<user>,translate-dismissed:<post>;Prefs.keys()lists them). Device settings without a name stay (the rating counters,waves.voteWeightPercent). Android also clears the signup challenge's own WebView profile (cookies, web storage, then the profile itself when no view uses it) when the register screen leaves and on a wipe (TurnstileBridge.clearProfile). Tests:AppLockModelTest,RegisterFlowsTest,LockFlowsTest. - On or off: the stored verifier alone decides. Unreadable vault meta never turns the lock off (fails closed). A verifier entry that exists but cannot be read or decoded keeps the lock on too: no PIN matches it, wrong PINs count as usual, biometrics do not unlock (biometric unlock goes off), and "forgot PIN" (a wipe) is the way out, the same stance as an unreadable counter. A PIN change verifies the current PIN once and keeps only a "verified" flag (never the PIN) through the new-PIN steps; a relock ends it.
AppLockModel.start()runs once per process (the environment outlives activities and scenes): Android rotation or any activity recreation calls it again and nothing changes, an unlocked app stays unlocked and no biometric prompt fires. Only a start that failed (lock cover with Retry) runs again.- Lock: at start when the lock is on and any account is stored on the device (signed in or not), and when the app was in the background for 60 s or more (RN
_startPinCodeTimer), timed on a monotonic clock that counts sleep (AndroidelapsedRealtime, DarwinCLOCK_MONOTONIC_RAW); a clock that went backwards locks. The relock prompt is set synchronously from memory (content is hidden in the same frame) and the failure count is refreshed afterwards. A settings flow's result that lands after a relock never replaces the lock prompt, and no second PIN check starts while one is running. Nothing private is composed until the lock state is read or while locked. - Screenshots, recording and the app switcher while the lock is on:
- Android 13+: the app is left out of the recents thumbnail (
setRecentsScreenshotEnabled(false)); screenshots and screen recording stay allowed, as in the RN app. - Android 7 to 12: there is no recents-only switch, so
FLAG_SECUREis set while the lock is on (cleared when it goes off). It also blocks screenshots and screen recording of the app. Setting it only when the app leaves is not enough: a recents gesture takes the thumbnail while the app is still in front. - iOS: the lock screen, the settings PIN flows, lock notices and the app switcher cover live in their own
UIWindowat.alert + 1, above every sheet, Safari view and alert of the app window. The cover goes up synchronously onUIScene.willDeactivateNotification(before the snapshot) and comes down on activation only after the model decided, so a relock goes straight from cover to PIN pad. Screenshots and screen recording are not blocked (iOS has no supported switch for it). The cover is the app theme's background with its lock icon in the theme's icon color (light, dark, Increase Contrast), resolved from the lock window's traits, which follow the in-app theme choice (AppContainer.lockWindowStyle). Android draws no cover of its own: the recents thumbnail is left out or blank (above), and its lock cover (LockCover) is on the theme background. Test:LockOverlayTests.testThePrivacyCoverTakesTheAppTheme.
- Android 13+: the app is left out of the recents thumbnail (
- Biometrics (Android
BiometricPromptwithBIOMETRIC_STRONG, iOSLAContext.deviceOwnerAuthenticationWithBiometrics, no passcode fallback): on the lock screen and on the PIN confirmation before something sensitive (verifyPin: the keys screen, a key or sign-in proof for another app; RN's PINCODE screen runs its biometric prompt for both), never in a settings flow (turn off, change, biometric toggle), only when turned on with the PIN. Success unlocks and resets the counter like a correct PIN; failure or cancel leaves the PIN pad and the counter as they were; an exhausted counter wipes instead of unlocking. The prompt starts by itself once per lock (cold start, relock), never again after a wrong PIN or a cancel. - PIN with biometrics (
AppLockModel.startEnable(biometricAvailable)): with a strong biometric enrolled (iOSLAContextbiometrics, AndroidBIOMETRIC_STRONG), turning the lock on offers biometrics first (biometricOffer, "Use PIN instead" leads to the plain setup). After the platform prompt succeeds the user sets a backing PIN ("Set a PIN to back up biometric unlock"); once it is confirmed, biometric unlock is bound to the biometrics enrolled then through the existingBiometricBinder(Android Keystore key invalidated by enrollment, iOS domain state), so the lock screen starts with biometrics. Nothing is bound before the PIN; the three-wrong-PINs wipe is unchanged; nothing enrolled at bind time leaves the PIN lock on with RN's "could not be turned on" notice. No biometrics: straight to the PIN setup. The keys screen's "Set PIN" goes through the same offer. A binder that throws after the PIN is set leaves the lock on with the notice; a pad that replaces a pending PIN confirmation answers its caller false. Debug: iOS-demoBiometrics YES, Android--ez demoBiometrics true(fake data / demo auth only). - Enrollment changes: turning biometric unlock on binds it (
BiometricBinder, called only after the PIN was right). Android creates a Keystore key withsetUserAuthenticationRequired(true)andsetInvalidatedByBiometricEnrollment(true)and runs the prompt with aCryptoObjectover it; iOS storesevaluatedPolicyDomainStateand compares it after each prompt. An invalidated key or a different domain state turns biometric unlock off (PinCheck.BiometricChanged), shows a notice and asks for the PIN; the user can turn it on again. A pending wipe still wins over any biometric result. - Signing out the last account turns the lock off, as RN's logout does.
- Migration: the RN unlock PIN (
application.encUnlockPin, elseapplication.pin, decrypted withPIN_KEYexactly as_verifyPinCodedoes) becomes the verifier when RN hadisPinCodeOpenon, so users keep their PIN. Without a usable 4-digit PIN the lock stays off,LegacyMigrationReport.pinLockDroppedis true and the app shows a one-time notice asking to set a PIN again. RN'sapplication.isBiometricEnabledcarries over unbound: biometrics are not offered until the first correct PIN binds them to the biometrics enrolled then. - Debug only: Android
adb shell am start -n app.esteem.mobile.android/com.ecency.app.MainActivity --ez lockDemo true; iOS-fakeData YES -lockDemo YES(-keepFakeStore YESkeeps that store across launches,-lockTimeoutSeconds 0relocks on every return). Both seed a throwaway account with PIN 1234. The Androiddemoextra (renderer demo, which skips the app and its lock) is honoured in debug builds only. - Errors: a storage failure during a PIN or biometric check shows on the PIN pad itself (
AppLockState.promptError), since no alert can show while locked; the next check clears it. Outside a PIN pad it is an alert. - Android biometric key: only a
KeyPermanentlyInvalidatedExceptionor a missing key when preparing the prompt turns biometric unlock off (with a notice, PIN asked). Other Keystore failures (UnrecoverableKeyException, otherInvalidKeyExceptions) may be transient: the PIN is asked this time and the setting stays on. Whether biometrics are available is read again on every resume. - iOS overlay: while a PIN pad shows, the overlay's view is
accessibilityViewIsModal, and when it hides the key window goes back to the window that had it. - Accessibility: Dynamic Type on the iOS PIN screen (
scaledFont,@ScaledMetricdots); errors and the digit count are announced (iOSUIAccessibilityannouncements, Android live regions).
Tests: PinLockTest, Pbkdf2Test, AppLockModelTest, the PIN cases of LegacyMigrationTest / LegacyImporterTest (shared), LockFlowsTest and LockPlatformTest (Robolectric: clock provider, FLAG_SECURE policy), Pbkdf2DeviceTest (instrumented), PinLockKeychainTests and LockOverlayTests (XCTest) and LockUITests (XCUITest).
Threat model
- Protected: a copied app data directory, a device backup or a restore onto another device (
allowBackup=false, the secure store and RN storage excluded from Android 12+ device transfer, Keystore keys andThisDeviceOnlyitems do not travel), other apps (sandbox), iCloud Keychain sync, secrets in logs, crash reports or build logs (redactedtoString, entry names are never secrets, build secrets never become Xcode build settings). - Not protected: a rooted or jailbroken device with the app running (it can also roll the stored attempt counter back), malware with the user's unlocked session, someone holding the unlocked phone (the app lock is the only barrier there), a compromised build.
PIN_KEYandDEFAULT_PINare not real secrets against anyone with the RN or native binary; both are extractable. They only have to stay out of this public repo and out of logs.
RN build secrets in native builds
PIN_KEY and DEFAULT_PIN are the RN app's values (.env, repository secrets PIN_KEY and DEFAULT_PIN). Both apps read them at build time from the untracked local.properties, parsed the same way on both sides (raw text after the first =, trimmed, no escapes):
ecency.pinKey=...
ecency.pinKeySha256=<sha-256 hex of the value>
ecency.defaultPin=...
ecency.defaultPinSha256=<sha-256 hex of the value>
- Android (
BuildConfig.PIN_KEY,BuildConfig.DEFAULT_PIN) also takesECENCY_PIN_KEY,ECENCY_PIN_KEY_SHA256,ECENCY_DEFAULT_PIN,ECENCY_DEFAULT_PIN_SHA256from the environment, which wins over the file. - iOS (
BuildSecrets.pinKey,.defaultPin) reads the file only: the "Build secrets" phase (iosApp/scripts/build-secrets.sh) writes them as byte arrays into the gitignorediosApp/Generated/BuildSecrets.generated.swift. They are never build settings, so xcodebuild cannot print them; a Debug build with canary values had zero hits in its output and its.xcactivitylog. Do not export these names in the shell that runs xcodebuild, since Xcode imports the environment into build settings. - CI: write those lines into
local.propertiesfrom the secrets in a step of their own (printfwith${{ secrets.* }}, noset -x), then build. - Debug builds fall back to dummies. Every other build type or configuration (any non-debuggable Android variant, any Xcode configuration other than
Debug) fails before packaging unless both values are set and match their SHA-256, so a missing, truncated or wrong value cannot ship.
Device tests
The host tests use an in-memory store (commonTest/.../secure/InMemorySecureStore.kt) and an in-memory RN storage (commonTest/.../legacy/MapLegacyStorage.kt). The real Keystore and Keychain need a device:
./gradlew :androidApp:connectedDebugAndroidTest # emulator or device attached (scripts/android-emu.sh boots one)
scripts/ios-sim.sh --test # XCTest in the app host, then:
xcrun xcresulttool get test-results summary --path "$(ls -td build/ios-dd/Logs/Test/*.xcresult | head -1)"
ios-sim.sh signs ad hoc ("Sign to Run Locally"): the simulator Keychain refuses unsigned apps with -34018.
ios-sim.sh --test runs StoreKitSessionTests on its own before the full run. A test process buys from the local StoreKit test session only when the session's configuration was on the simulator before the process started, and a test first puts it there by opening an SKTestSession; a process started before that (the first run on a freshly erased simulator) gets its products from the session but sends every purchase to the real App Store, which asks to sign in and never answers, whatever the test waits (#3638). The tests that buy check this once per process with one purchase straight through StoreKit (PurchaseTests.requireSessionPurchases) and fail at once with that reason. Running xcodebuild test by hand on a fresh simulator: run -only-testing:EcencyAppTests/StoreKitSessionTests first.
Authentication core
shared/src/commonMain/kotlin/com/ecency/core/auth ports the RN app's sign-in, session and signing logic (no UI). Golden vectors come from the RN stack (@ecency/sdk, crypto-js, hive-uri, operations.json, Node's URL); regenerate from a checkout of the rn-3.x-final tag with node native/tools/golden/generate-auth.mjs native/shared/src/commonTest/kotlin/com/ecency/core/auth/AuthGoldenVectors.kt. Nothing in the tests talks to the network.
KeyLogin: username plus master password or WIF, classified againstget_accountskey auths (ChainAuthorities,RpcChainAccounts). Auth type and stored keys follow RNauth.ts; stricter on memo-only keys (MemoKeyOnly), malformed WIFs (InvalidKey), and it keeps every role a key matched. Typed failures areAuthException. A master password is only an input: the posting, active and memo keys it derives are kept when the chain has them, the password and the owner key are not; a secret that only gives the owner key is refused (OwnerKeyOnly).AccountManageroverAccountStore(VaultAccountStore: theKeyVaultplus anauth.session.<user>entry for refresh token and expiry): key, HiveSigner code, web/authcode, auth-transfer and HiveAuth logins, switch, remove, logout,hasAnyAccount()(counts unreadable entries too; the app lock applies while it is true), RN's refresh rule (refreshSession; unlike RN, a key account whose token expired signs itself a new session when it has no refresh token or the refresh failed, instead of keeping a dead token; the RN import marks key accounts without an RN refresh token expired so their first renewal does that; an expired token whose refresh and fresh signing got no answer, a 5xx or a 429 is kept without the "session expired" prompt, which only a refusal raises, as for a refused call below) andensureKeySessionfor key accounts without a token. Links never plant credentials: auth-transfer tokens are redeemed at the token endpoint and web codes must be signed for, and exchange to, the link's account; a stored key account keeps its keys and only takes the new token (storedAccountlets the UI confirm first).A token renewal never writes after a removal (RN
storage/authWriteGuard). Every vault write and every removal run underAccountManager's mutex, and a session is never written for an account that is gone (saveSessionrefuses, it never creates the entry).removeandlogoutAllbump removal marks when they finish, and the PIN wipe bumps them before it removes anything (PinLock.beforeWipe) and again after (resetAfterWipe), as RN'swithAuthRemoval.refreshSessionandensureKeySessiontake the mark before their first suspension and write, under the mutex, only when it has not moved, returning null otherwise. So a renewal answered after a sign-out followed by a sign-in of the same account never writes the old token lineage over the new session, and a failed renewal of an account that just left never raises "session expired". Listen's renewals go through the same path (see "Listen"). Test:AccountManagerTest(the renewal is held open withFakeAuthHttp.beforeAnswerwhile the account leaves).Ecency session:
HiveSignerMessages.codesigns the HiveSigner-style code locally (byte-identical JSON to RN, timestamp printed like JS),EcencyTokenApiexchanges codes and refresh tokens at/auth-api/hs-token-refreshwith RN's retries,EcencyPrivateApiattachescodeto private API calls.Ecency session renewal (#3611): a private API call (
EcencyPrivateApi.post,postMultipart,relay) answered 401 asksAccountManager.renewAfterRejectionfor a new token and is sent once more with it; a 401 is refused before anything is done, so the resend is safe (paid calls keep their idempotency key). The renewal ignores the stored expiry (the server refused the token): the refresh token is exchanged, and a key account whose refresh token is refused too, or that has none, signs a fresh code. A call that finds a newer token than the one refused uses it without another exchange, unless its account signed out meanwhile (the removal mark moved): a call of a session that left is never sent again with the next one. A second 401 sends the new token once more after 3 s (the API answers 401 when its own node read fails too); a third 401, or no new token, goes back to the caller ("sign in again", see the refused session rule below); never a loop.AccountManagerruns one renewal at a time, this one and the start'srefreshSessionalike, so the refresh token is never spent twice; each takes the removal mark before its first suspension. Purchases (PurchaseApi) keep their own path and are not resent.A refused session the renewal cannot fix (not RN, which never looked at a 401): no new token (no refresh token and not a key account, the exchange refused, no usable key) or the new token refused again gives the session up (
EcencyCodeProvider.sessionRefused). The private API checks a code against the account's posting keys read from a Hive node and answers 401 when that read fails too, so a renewed token refused once is sent once more after 3 s (REFUSED_AGAIN_RETRY_MILLIS; three sends at most), and a key account whose own posting key is still on chain (or whose keys could not be read) is not asked to sign in again (refusalUnconfirmed: its session is one it signed itself; that token is then held for 10 minutes,UNCONFIRMED_HOLD_MILLIS, so further refused calls go back at once without renewing, waiting or resending, and the same token works again as soon as the API can check it; a key that left the chain still prompts; nothing more is sent for an account that signed out during the wait; Sentry 11-08, the prompt came twice as the app came back from iOS's icon notice). Only a final refusal does: a renewal that could not be tried to the end (the exchange gave no answer, a 5xx or a 429, or a key account's fresh code could not be sent) throwsSessionRenewalUnavailable, and the call's 401 goes back with nothing recorded and no prompt, so the next refused call renews again.AccountManagerremembers the token it gave up with and callsonSessionRefusedonce for it, unless the account signed out meanwhile (the call's removal mark moved);SessionModel.sessionRefusedthen raises the same "session expired" prompt as the start (expiredSession, Verify / sign in again) while that account is still the signed-in one. Further 401s with that token neither renew again nor ask again; a new sign-in or renewal stores another token. The call's 401 comes back marked (HttpResult.sessionRefused) and is thrown as aSessionRefusedException(HttpResult.failure), which maps toErrorKind.AUTHwith the session-expired copy, an expected warning without an error code; a quiet background read refused that way is not reported at all. Any other 401 (the image host's/hs, a public endpoint, a renewal that could not be tried to the end) is an ordinary failure: reported, with the generic copy and its code. The AI API's 5xx (AiServerError) are reported too rather than read as a lost connection. Why the renewal failed goes to Sentry as a quiet warning atauth.renewToken(SessionRenewalFailed: "no refresh token", "refresh exchange answered HTTP 400", "not a key account", "renewed token refused again", never a token). Test:SessionRefusalTest.HiveSigner:
HiveSigner.authorizeUrl,parseCallback,hotSignUrl,parseSignResult(only navigations to the redirect URI or HiveSigner's own success page count),HiveSignerApi(token broadcast,me). The native apps keep RN's app idecency.appand the loopback redirecthttp://127.0.0.1:3000/auth(HiveSignerConfig.RN), read off the navigation in an in-app WebView, so no new HiveSigner registration is needed.HiveAuth:
HiveAuthClient(auth and sign requests overHasSocket, Ktor websockets in production), crypto-js compatibleCryptoJsCipher,has://links, relay expiry, reattach after a dropped socket. A connection lost after the sign request reached the relay, a second drop or a failed reattach isCONNECTION_LOST: wallet sends count it as undecided (followed up on chain, never offered again) and everywhere else it says "This may already have gone through" with no retry.NOT_CONNECTEDis a socket that never opened, or a sign in that lost its connection (nothing was signed, so it is retryable); its report names the cause type (never its message) (#3701, #3706). A send on a socket the relay closed while nothing read it (the client could not know) fails before anything reached the relay, or whose reader already saw it end (a send there could be buffered and never arrive): the socket is dropped and the request sent once on a fresh one (KtorHasSocketFactoryturns a send on an outgoing side already closed, by a transport failure too, into that closed-channel failure; any other send failure may have reached the relay and is not sent again) (aRequestOnASocketWhoseReaderEndedOpensAFreshOne) (HiveAuthTest.aRequestOnASocketTheRelayClosedWhileIdleOpensAFreshOne, #3703).Links:
HiveUri(hive-uri port),HiveUriTx.format(RN getFormattedTx),AuthLinks.parseforecency://auth-transfer|auth-request|login|transfer,hive://andecency://sign/, and ecency.com/authand/signup;callbackUrlmatchesURLSearchParams.set.Signing:
OperationAuthority(SDK map, RN hive-uri rule, HiveAuth key type),TempActiveKey(single use, 60 s, bound to the account it was entered for),SigningRouter(key, HiveSigner token or page, HiveAuth, auth upgrade throughSigningBackends; one upgrade sheet per account and authority). Owner operations are always refused, from links and in the app: no owner key is stored, andSigningRouterends an owner operation before any key or prompt. Every callback a link carries passesAuthLinks.isAcceptableCallbackin the parser.Authority recovery: the posting authority grant (the editor's schedule prompt, the quick post recovery) needs the active authority. A posting-only account gets the upgrade sheet and its key must reach the account's active threshold; a master password account signs with its stored active key without a prompt; a HiveSigner account gets a prompt and its token is never used for it. Test:
AuthorityRecoveryTest.Link operations (#3635): of the 34 operations
hive://andecency://signlinks accept, account creation and claims, recovery and witness keys (account_create,create_claimed_account,claim_account,change_recovery_account,witness_update,witness_set_properties) are refused for every account type before any prompt (the dApp bridge's rule);account_updateand anaccount_update2carrying any key field (owner, active, posting, memo_key) are refused too, so a link never changes keys. Every other one has a serializer, so key accounts sign them on the device: metadata-onlyaccount_update2,create_proposal,update_proposal(with its one extension,update_proposal_end_date),remove_proposalandlimit_order_create2joined the wallet and governance ones (LinkOpGoldenVectors, fromtools/golden/generate-link-ops.mjs). For a key account the confirmation lists the operation as the serializer's own JSON (OperationJson.encode(decode(op))), which is exactly what is signed: a field the chain does not know is not shown, "1 HBD" shows as "1.000 HBD", and JSON the binary form cannot carry (an unknown extension, anexchange_ratewith extra fields, unsorted proposal ids) is refused as not supported. The dApp browser does the same for a key account: its confirmation and the signature both use the serializer's own JSON (DappBrowserModel.askBroadcast). A date must be a real calendar date that fits the chain's 32-bit time (ChainTime.signable: no Feb 31, nothing before 1970 or after 2106-02-07), checked when the operation is built, so it is refused before any confirmation. Multi-operation links stay refused (RN).
Login and accounts
Sign-in, accounts, signing prompts and auth links on both apps, over the shared auth core. Shared models (shared/src/commonMain/kotlin/com/ecency/core/app): SessionModel (login, accounts, Ecency session), SigningModel (every broadcast, through SigningRouter), AuthLinkModel (hive://, ecency://, ecency.com links), AuthServices (token endpoint, HiveSigner API, HiveAuth relay; offline() refuses everything, DemoAuthServices answers offline for debug fake-data runs). UI: Android ui/LoginScreen.kt, ui/AuthUi.kt, ui/AuthWeb.kt; iOS Screens/LoginViews.swift, Screens/AccountViews.swift, Screens/AuthOverlay.swift.
env.session.loginWithKey(username, passwordOrWif) // suspend; AppException with RN copy ("Invalid credentials, please check and try again")
env.session.loginWithHiveSignerCode(code) // the code HiveSigner's page hands to http://127.0.0.1:3000/auth
env.session.startHiveAuth(username); cancelHiveAuth() // state.hiveAuth: INITIATING, WAITING (link + expiry), LOGGING_IN, SUCCESS, FAILED
env.session.switchTo(name); logout(name); logoutAll() // state.accounts (current marked), state.switchingTo
env.signing.broadcast(username, opsJson) // key, HiveSigner token / page, HiveAuth wallet, auth upgrade
env.authLinks.handle(url) // true when it was an auth link; state.prompt, confirm(), decline()
- Login (RN screens/login): username plus master password or any private key, RN copy and validation (both fields at least 2 characters), errors in RN's "Login Failed" alert. Memo-only keys are refused with their own message (RN failed later at the token exchange). An owner key is refused too ("This is the owner key. Ecency never stores or uses the owner key: sign in with your master password, or with your posting or active key."); RN has no string for this, since it signs in with an owner key and stores it.
- Key input (RN #3600), the same at sign-in, on the auth upgrade sheet and at the keys screen's import: every key or password goes through
KeyInput.secret(auth/KeyInput.kt). Its edges lose whitespace (newlines, NBSP and the other no-break spaces) and invisible format characters (zero-width space, joiners, word joiner, byte order mark, soft hyphen, direction marks); usernames lose the same edges. Inside, characters are dropped only when the result then has a checksum: a WIF, a public key, or a generated master password ("P" + WIF). A password the user chose keeps its interior as typed, since Hive derives keys from the exact string and spaces are legal in it. A pasted public key (STM...) says "This is your public key. Paste the private key (starts with 5) or your master password." everywhere; on the upgrade sheet a private key of another role says which one it is and which is needed, and a WIF shaped key with a bad checksum is "Invalid private key or password", never a master password. An import changes only the keys it brings (a key account that imports a full master password becomes a master password account): the token, the session's refresh token and expiry, the HiveAuth key, token and expiry, and the sign-in method (HiveSigner, HiveAuth) stay (RN #3600 items 2 and 3, which RN loses). Tests:KeyInputTest,AccountManagerTest,SigningModelTest,BackupKeysModelTest(shared),LoginFlowsTest,KeysFlowsTest(Android),LoginTests(iOS). - HiveSigner: the authorize page (app
ecency.app, loopback redirect) in an in-app web view (Android WebView with cookies and storage cleared before and after, iOSWKWebViewwith a non-persistent store).HiveSignerPage.decideloads only https on hivesigner.com, reads the redirect URI without loading it, and cancels everything else; no script bridges, no popups. Hot signing uses the same view. - HiveAuth (RN hiveAuthModal): the wallet request as a QR code (zxing on Android, CoreImage on iOS) plus "Open wallet app" (
has://,waves://; opened by itself once per relay request, never again on a remount, rotation or relock (openWalletin model state), "Hive authentication app not installed" when nothing takes it), a countdown to the relay's expiry, cancel abandons the request. Deliberate difference: RN shows no QR code; the QR lets a wallet on another device approve. - Ecency session: every login exchanges a code for tokens (
AccountManager); at start the current account's session is refreshed (RN_refreshAccessToken), a key account without a token signs a fresh code, and on foreground a session expiring within a day is refreshed. A refused refresh after expiry, or an expired HiveAuth key, shows RN's "Your session has expired" alert with Verify (login prefilled) or Cancel. - Post-login hooks:
env.postLoginHooks(RN usePostLogin). RN's hook prefetches nothing beyond subscribed communities; the data layer has no subscriptions API, so the list is empty. - Accounts: the switcher (RN accountsBottomSheet) lists every account with its sign-in method and a check on the current one; tap switches (votes, drafts and the held active key of the previous account are dropped, feeds reload in place via
SessionChanged); the logout icon asks RN's "Are you sure you want to logout?"; "Log out of all accounts" (not in RN) removes everything. Logging out the current account moves to the next one, as RN. - App lock and PIN after login: RN does not ask for a PIN after login (it stores its default PIN silently; the lock is opt-in in settings), so neither do the native apps. The lock applies while any account remains (
hasAnyAccount) and goes off with the last account.AppLockModel.verifyPin(PinPurpose.VERIFY) asks for the PIN before a key or a sign-in proof leaves the app and before the keys screen, like RN's PINCODE-with-callback. - Signing: votes and replies go through
SigningRouter(key accounts sign locally and a retry resends the same transaction viaHiveBroadcaster.broadcastIdempotent; HiveSigner accounts post with their token and sign anything stronger on HiveSigner's page; HiveAuth accounts wait for the wallet, posting through the token when ecency.app has posting authority; a wallet'ssign_ackcounts only oncetransaction_status_api.find_transactionshows its transaction id in a reversible or irreversible block (the mempool is not enough) andcondenser_api.get_transactionshows the operations that were sent (names and fields read through the operation serializer, the app's own posting authorityaccount_updateincluded; an operation it does not know is compared as JSON with null fields read as absent, since the chain answers"owner": nullfor a field left out;SigningModel.sameOperations); a node without the status API is asked for the transaction alone. Asked 10 times 3 s apart; a transaction with other operations, or none readable by then, means the send ends as "could not confirm, check your wallet" (BroadcastException.Unconfirmed) and nothing is sent again; RN reports success on the relay's word). A vote is signed by the account signed in when it was tapped and is dropped if the session changed before it started. Auth upgrade sheet (RN copy): active key or master password, checked against the chain ("Key does not match account's active authority"), held 60 s for one signature of that account only; or HiveSigner / HiveAuth. Owner operations are never signed in the app and always refused from links. A cancelled prompt rolls a vote back without an error. - Link safety: a link never changes keys:
account_update, which always carries a memo key, is refused, and so is anaccount_update2setting owner, active, posting or the memo key (HiveUriTx.format); account creation and claims, recovery and witness key changes (OperationAuthority.ACCOUNT_CONTROLandOperationAuthority.WITNESS_KEYS, the dApp bridge's rule too) are refused for every account type; key accounts are refused, before any prompt, hive:// operations the app cannot serialize (callbacknot_supported); links wait while the app is locked; an open question of any kind (a signature, a sign-in proof, a posting key question, a refusal the user has not closed) that a second link replaces is dropped without an answer: only the user's own decline answers (user_cancelled), and an answer would tell the requester whether the account is on this device and which one is current; a request from content or a page never hears a decline either; a link during a running request is answeredbusy; callback answers queue so none is lost (they open back to back: with two requesters, the second app comes up right after the first); a link still waiting for the unlock is cancelled when another arrives (an external app then hearsuser_cancelled, a link from content or a page hears nothing); links never route while the lock state is unknown (also after a failed lock start); anecency://transferwhosefromis another account is refused (account_mismatch); sign-in proofs use the posting key only (use_hivesignerotherwise). - Privacy (Android): FLAG_SECURE on every Android version while the keys screen (Manage Authorities) is drawn, where the keys themselves are, through the end of its exit animation (the screen holds it while composed; its dialogs are
SecureOntoo;KeysFlowsTest.theWindowStaysSecureUntilTheLeavingKeysScreenIsGone), on top of the lock's recents rule; login, sign up, the auth upgrade sheet and HiveSigner's pages hide what is typed and stay capturable, so people can screenshot a problem to report it (LoginPrivacyTest,LoginFlowsTest.authUpgradeSheetChecksTheKeyAgainstTheChain); settings and PIN confirmation pads render in their own dialog window above any sheet; a copied private key is cleared after 2 minutes if the clipboard still holds a key clip of ours (only its label, the app's ownecency.private-key, is checked, never its text, so another app's clip is never cleared and there is no "pasted from your clipboard" notice; the delayed check holds no key). Clearing needs API 28, so below it a private key is not offered for copying (the screen shows it for reading, with a note). A copy leaves a mark in the app's preferences until the clip was checked: when the process died before the timer (a fresh start or a restore alike), or the timer ran while the clipboard was hidden, the next time the window has focus (onWindowFocusChanged) clears the clip if it is still ours. Android 10+ lets only a focused app read the clipboard, so the check waits for focus and the mark goes only once the clipboard was read (no clip at all counts as checked); a timer of this process that still waits keeps its clip for the rest of its 2 minutes, so a dialog closing over the copy does not clear it early (KeyClipboardTest,KeyClipboardActivityTest). A key copied before leaving the app stays until the app has focus again or it is replaced. The activity is portrait only on a phone (see Android tablets). iOS: the secret field has no password content type, so iCloud Keychain does not offer to save a master password or key. - Links: Android intent filters (
ecency,hive, andhttps://ecency.com/signup|purchasewithautoVerify; not/auth, the website's HiveSigner login callback, which stays in the browser, #3655), iOS URL types (ecency,hive). Every link is confirmed first: sign links andecency://transfershow the operation, its fields and the key it uses; auth-transfer says what happens to an account already here (a key account keeps its keys, a HiveSigner or HiveAuth one is replaced by the HiveSigner session);ecency://loginhands over no key (see the difference from RN below);ecency://auth-requestanswers with a sign-in proof, never a key; an ecency.com/auth?username&codelink reaching the app another way checks the code (7 days, right account) before "Easy Login";/signupopens the register screen with the link's referral, username and email (see "Welcome and terms, register"). Callback answers carry RN's payload (status,error,id,code,request_id, andmessageon theecency://loginrefusal). Verified Android links use the RN app's existing ecency.comassetlinks.jsonentry. iOS universal links: the app has RN's associated domainsapplinks:ecency.comandapplinks:alpha.ecency.com(notecency.page.link: Firebase Dynamic Links is shut down), andonContinueUserActivity(NSUserActivityTypeBrowsingWeb)passes an https page on those hosts (UniversalLinks.url(of:)) to the sameAppContainer.handle(url:)as every other link; the paths are whatever ecency.com'sapple-app-site-associationlists for the RN app id (UniversalLinkTests). Both platforms are handed every listed path (the live AASA lists/@*,/*/@*/*,/hot,/trending,/created,/wavesand their subpaths), so a first-party https page no screen claims (ContentLinks.entryis null) opens in the in-app browser (ContentLinks.browserFallback: SFSafariViewController sheet, Custom Tab) instead of bringing the app forward with nothing on screen; whenentrylearns more paths (bare/hotand the others), those stop falling back./@user/<page>for the web's profile pages (render-helperSECTION_LIST,rss,rss.xml,insights...) opens the profile and is never looked up as a post; a second segment that is no Hive permlink falls back to the browser (ContentLinksFallbackTest, AndroidLinkEntryTest, iOSShellTests). Android never hands such a page to the system as a bare VIEW: the app is the verified App Link handler for ecency.com, so Android would route it straight back tohandleLink, which would fall back again, in a loop (for example/@alice/Some.Thing,/@user/a/b,/hot/a/b).openInCustomTab, for every caller, pins the tab to a Custom Tabs browser (CustomTabsClient.getPackageName, visible through the manifest'sCustomTabsServicequery), or without one sends the page to the default browser app through a browser-only selector (ACTION_MAIN+CATEGORY_APP_BROWSER, never this app, no chooser on every link), and only when no browser app resolves opens a chooser that leaves the app out (EXTRA_EXCLUDE_COMPONENTS);LinkEntryTestchecks all three intents. Device check owed: the pinned tab and the chooser on a phone with the verified App Links. - Differences from RN (
ecency://login, RNhooks/useLinkProcessor.tsx_handleEcencyLoginDeeplink): RN hands the stored posting key to the app that asked. Here no key ever leaves the app: a login link from another app shows "Posting key not shared" (the app named by its callback scheme as an app outside Ecency, told to sign in with HiveSigner or HiveAuth), and once the user closed that, the app hearsstatus=error,error=not_supportedand a fixed Englishmessagesaying the same (Waves shows it). The answer is the same whatever accounts are on the device, so it tells the requester nothing about them, and nothing is read for it. A login link from content (a post body, a chat, a web page in the dApp browser, a push) is refused and answers nothing. A website signs in withecency://auth-request(an audience-bound proof, no key). - Welcome (RN welcome): shown on the first launch and again after each update, as RN (see "Welcome and terms, register").
- Keys (RN backupKeysScreen, "Manage Authorities"): see "Backup keys".
- Logged-out browsing stays: vote and reply open the login screen.
Hooks for the shell (side menu): Android AccountSwitcherSheet(env, host, onAddAccount, onDismiss), LogoutConfirmDialog(...), BackupKeysScreen via Screen.BackupKeys, and AuthOverlays(env, host, onOpenLogin) mounted once at the root; iOS app.sheet = .accounts, .backupKeys, .login, app.logout(name), app.logoutAll(), with AuthOverlay (its own window at .alert, under the lock window) attached by RootView.
Debug launch options (fake data only, nothing on the network): iOS -fakeData YES plus -seedAccounts YES, -openScreen login|hiveauth|accounts|backupKeys, -demoSigning upgrade, -openLink <url>, -seedActive YES (seeded accounts get their active key too), -showWelcome YES; Android --ez demoAuth true (offline token endpoint and relay), --ez seedAccounts true (only together with demoAuth), --ez acceptTerms true, --es openScreen login|hiveauth|accounts, --es demoSigning upgrade. Fake accounts derive their keys from a public throwaway password.
Tests: shared SessionModelTest, SigningModelTest, AuthLinkModelTest, HiveSignerPageTest (fake token endpoint and HiveAuth relay in AuthFakes.kt); Android LoginFlowsTest (Robolectric: form validation and errors, HiveAuth QR, switcher and logout confirm, upgrade sheet, sign confirm and owner refusal, login link refusal, welcome, keys warning, VIEW intents); iOS LoginTests and LoginUITests.
Backup keys ("Manage Authorities")
RN screens/backupKeysScreen (screen and importPrivateKeyModal), its one entry point (settingsContainer BACKUP_PRIVATE_KEYS) and getUpdatedUserKeys in providers/hive/auth.ts. Shared app/BackupKeysModel.kt, AccountManager.importKeys; Android ui/KeysScreen.kt; iOS Screens/KeysViews.swift.
Screen behaviour (RN parity)
- Entry: Settings, "Manage Authorities" (signed in only)
- Gate, lock on: the PIN pad first (RN
PINCODEwithnavigateTo), with the biometric prompt when biometric unlock is on (RN_processBiometric) - Gate, lock off: "Warning",
settings.keys_warning, Cancel or Set PIN; after the new PIN was set the keys show at once (RN navigates on); a cancelled PIN flow shows the warning again. This is RN's behaviour, kept on purpose: with the lock off, whoever holds the unlocked phone can choose a PIN and then see the keys; the PIN only protects them from then on - Four rows in RN's order (owner, active, posting, memo), label " Key (Public)" or "(Private)", one line value with the copy button (RN
TextBoxWithCopy), toast "Key copied to clipboard" - Public value: the account's first key of the role on chain (
key_auths[0][0],memo_key) - Button per row: "Reveal Private" / "Reveal Public" for a role with a stored private key, "Import Private" for one without
- Import modal: "Enter Password or Private Key", description, "Master password or Private Key" field, Sign. The secret is checked against the account's
get_accountsrow read at that moment: a private key is accepted for each role where its public key is one of the role'skey_authswith a weight that reaches the role'sweight_thresholdby itself (or is thememo_key); a master password is accepted when at least one of its posting, active and memo keys passes that test, and then stores exactly the ones that passed; the password and the owner key are not stored (RN stores the password and all four derived keys). An owner key is refused. Failure alert "Keys Import Failed" withauth.invalid_credentialsandlogin.login_failed_body; a key that is on the account but cannot sign alone gets its own sentence - RN derives nothing on this screen: it decrypts what the device stored at sign-in (a master password login stored the password and all four keys). The native vault holds posting, active and memo only, so the owner row shows the public key with "Public only. Ecency never stores the owner key." in place of RN's "Import Private", and has nothing to reveal
Native rules on top (BackupKeysModel)
- The keys belong to the account signed in when the screen opened. Every action (reveal, copy, import) checks that it is still that account and that the app is unlocked;
AccountManager.importKeyschecks the current account again inside the vault lock. - The screen closes, and the private keys leave memory and state first, when the app locks, leaves the foreground (
AppEvent.Backgrounded, emitted byAppLockModel.onBackground), the account changes or the data is wiped.KeysPhase.CLOSEDtells the UI to leave. - The route is never part of saved navigation; the model keeps private keys in fields that no
toStringprints (KeyRow,KeyCopy, state); nothing is logged; the typed import secret is handed over once and not kept. "Dropped from memory" means the references are dropped: keys are immutable strings on both runtimes and cannot be overwritten in place, so their bytes stay in the process heap until the garbage collector (Android) or the allocator (iOS) reuses the memory. - Owner key and master password: never stored (see "What the app stores"). The owner row is public only and cannot be imported; an owner key typed into the import of another row is refused with its own sentence.
- Auth type: an imported key never changes how the account signed in. A posting-key account that imports its active or memo key is still a posting-key account that holds one more key; only a master password that gave both the posting and the active key turns a key account into a master-password account (the type names how the account signed in; no password is kept). What an account may do is read from the keys it holds:
VaultAccount.signsWithPostingKey(image upload signing). - Key weights: a key whose weight is below its role's threshold (or whose weight or threshold is zero or less) is refused in all three places a key is taken: at sign-in, at import, and in the auth upgrade sheet (
SigningModel.submitUpgradeKey, which callsKeyLogin.keyMatchesRole; nothing is held for such a key). The message is "This key cannot sign for the account on its own...". An unreadable threshold or weight counts as 1. - Android: a rotation or any other configuration change keeps the screen (
AppHost.isChangingConfigurations); only a real stop closes it. A revealed private key is drawn but replaced, for accessibility services, by ", private key shown" (password()semantics), as on iOS. - Copy: a public key is an ordinary copy. A revealed private key first shows a warning (not in RN) and then goes to the key clipboard: Android
KeyClipboard(sensitive clip, cleared after 2 minutes), iOSKeyPasteboard(local only, 2 minute expiry). - Screenshots: Android FLAG_SECURE while the screen is on top, and its dialogs are secure windows. iOS has no public switch: key values are drawn in
ScreenShield, inside the canvas view UIKit uses for secure text entry (_UITextLayoutCanvasView), which captures leave out. It fails closed: when a secure field has no subview of that class, nothing is drawn there, and the sheet shows a value only while its box is pressed and held (HoldToShowValue; debug-keysNoShield YESruns that path). In both modes values are hidden whileUIScreen.isCaptured(recording, mirroring), and a screenshot (userDidTakeScreenshotNotification) turns every revealed private key back to its public key and shows a warning to delete the screenshot.KeysTestschecks the container's class on the running iOS, the fail-closed path (no label anywhere, nothing drawn) and that the shielded label is laid out and drawn in-process; the simulator screenshot taken byKeysUITestsshows the rows with empty value boxes. - App switcher: Android FLAG_SECURE. iOS: the sheet puts its own cover over itself at
willResignActive(before the system's snapshot) and takes it off atdidBecomeActive; the lock window's cover is not enough here, since it only exists once the app has locked. The sheet is also closed when the app reaches the background.
What the app stores
- The most the app stores for an account is its active private key, with the posting and memo keys. It never stores the owner private key and never stores the master password.
VaultAccounthas no field for either, so no code path can write one, and the vault writes noownerKeyormasterPasswordentry. The vault holds no owner key and no master password. - Sign-in or import with a master password: the posting, active and memo keys are derived, each is checked against the account's authorities (on the account, and able to sign alone by weight and threshold), the ones that pass are stored, and the password and the derived owner key are let go when the check returns (a derived owner key never appears in a master sign-in's result, and a stored key is never replaced by a derived one). The Ecency session code is signed with the least powerful key that works: the posting key, else the active key, at sign-in and in
ensureKeySession(RN signs it with the owner key).authTypeisMASTER_PASSWORD: it only names how the account signed in, and such an account is stored and treated exactly like a key account holding those keys. Nothing reads a stored password (there is none to read). - Sign-in or import with an owner key alone is refused with a clear message; a key that is the owner key and also the active or posting key is kept for that other role. A master password whose posting, active and memo keys are no longer the account's (only the owner key still matches) is refused the same way.
- Owner operations are never signed in the app, from links or from screens.
- Entries of earlier builds:
KeyVault.dropRetiredSecrets()runs at every app start, before the lock state is read. It rewrites any entry that still has an owner key or a master password without them, keeps posting, active and memo keys, tokens and the auth type as they are, does nothing to a clean vault, and leaves an entry it cannot read or write alone without stopping at it: the entries after it are still cleaned, and that one is tried again at the next start. Only a lost device key ends the pass. Reading an old entry before the cleaning never returns either secret. - An old entry with a master password and without one of the three keys: the missing keys are derived from the password, offline, in the same single write that drops it, before the password goes (the vault is protected by the device key, not by the PIN, so this needs no unlock). They are not checked against the chain at that moment: a derived key that is no longer on the account behaves like any stale key, the chain refuses the signature and the user signs in again. This is the same state RN left such an account in.
- RN import (
LegacyMigration): the RN master password and owner key are read only to derive missing keys and to name the auth type; neither is written to the vault. An RN account whose only credential is an owner key (no token, no other key) is skipped and its owner signs in again; one that also has a token or another key is imported without the owner key. A posting, active or memo key that is the owner key RN also stored is not imported, and the account is told (LegacyMigrationReport.ownerKeyDropped, the notice below). RN often signs in with one key that is both owner and posting and stores it as the posting key with the owner key empty, so only the chain can tell: right after the import (and at later starts until a read succeeds) the app reads each imported account's authorities (AccountNoticesModel.checkOwnerKeys, names waiting inaccounts.ownerKeyCheck); a stored key on the owner authority is removed then, with the notice below. A key is removed only when two nodes on different hosts agree on the account's owner keys (ChainAccounts.confirmedAuthorities, asked one by one without failover, healthiest first); when they disagree, or a second node cannot be reached, the key stays and the next start asks again. - An account left with a token and no key (an old owner-key sign-in) stays signed in to Ecency; the keys screen's import adds a posting or active key.
- Notices (
app/AccountNotices.kt, an alert with OK on both apps, shown with the unlocked app, first among the root prompts, see "Prompts and account changes"):- when the cleaning or the RN import leaves a key account with no posting and no active key: "Sign in again as @name", saying that the owner key and the master password are no longer kept and pointing to a new sign-in or to Manage Authorities. Shown once: the account's name waits in the device preferences (
accounts.noSigningKeyNotice) until the notice was dismissed, so a start that ended before the user saw it shows it at the next one; it is dropped when the account signs in again, leaves the device, or the device is wiped. An RN account that had nothing but an owner key is not imported at all, so there is no account left to name: its owner finds the app signed out. This notice applies to key accounts only. - when a stored posting, active or memo key turns out to be on the owner authority (the RN import, its chain check, or the keys screen's authorities read; two nodes must agree before a key is removed): the key is removed from the vault and "@name's key is also its owner key, so the app does not keep it. Sign in with HiveSigner or HiveAuth, or give the posting and active roles their own keys." is shown once (remembered in
accounts.ownerKeyNoticeuntil dismissed; dropped when the account signs in again, leaves the device, or the device is wiped). An account left with no key stays on the device, so the notice has an account to name. - when the RN import kept an account back (no key it can use: an owner key only, or none it could decrypt;
LegacyMigrationReport.skipped): "Log in again as @name" with OK and Log in, which opens the login screen with the name filled in (AccountNoticesModel.notImported,logIn). Named once (accounts.notImportedTold, written before the account list is read so a failed read loses nothing); not seen yet, it comes back at the next start (accounts.notImportedNotice); dropped when that account signs in; a wipe clears both lists. - after a master password sign-in that gave fewer than posting and active: which role the password no longer matches, what is stored, and what the app cannot do until that key is imported.
- "posting key is required to perform this transaction" (RN's sentence) is followed by "Add it under Settings, Manage Authorities (Import Private), or sign in again with it."
- A name whose vault entry could not be read stays on the pending list for the next start; an account list that could not be read drops no notice; there is one notice of a kind per account; a tap answers the notice it was shown for (by id). A HiveSigner or HiveAuth sign-in voids the "no signing key" notice, and a key entry that holds neither a posting nor an active key becomes a HiveSigner account on a HiveSigner sign-in (its memo key stays).
- when the cleaning or the RN import leaves a key account with no posting and no active key: "Sign in again as @name", saying that the owner key and the master password are no longer kept and pointing to a new sign-in or to Manage Authorities. Shown once: the account's name waits in the device preferences (
- A typed key that is the account's owner key and also its active or posting key (one key for several roles) is refused at sign-in and at the keys screen's import with "This key is also this account's owner key... sign in with HiveSigner or HiveAuth, or give your active and posting roles keys of their own", and nothing is stored (
AuthException.KeySharedWithOwner). A stored key the chain shows on the owner authority is removed when the app reads the account's authorities (see the notice above). A stored key is removed only after two nodes on different hosts agree on the account's owner keys (ChainAccounts.confirmedAuthorities); a read that fails, fewer than two answers, or nodes that disagree remove nothing.confirmedAuthoritiesasks the nodes healthiest first (NodeHealthTracker.orderedNodes), so nodes the pool knows to be down do not hold the user up. The keys screen still shows the red line on the keys screen for as long as the chain shows the shared key, asking to give that role a key of its own.
Differences from RN
- RN stores the master password and the owner key, signs in with an owner key, and offers "Import Private" on the owner row; none of that here.
- A private key is copied only after a warning, into an expiring clipboard (RN copies at once into the plain clipboard).
- A HiveSigner or HiveAuth account keeps its sign-in method and its tokens after an import. RN's
getUpdatedUserKeysmeans to (_prevAuthType), but reads the auth type from the wrong object, so there the account turns into a key account, and it also overwrites the stored access token with an empty one. - A private key is stored for every role it matches on chain (RN: only the last matched role), the same rule as the native key login.
- The account's auth type is kept on import (RN switches it to the imported key's type; see "Auth type" above).
- A key below its role's threshold is refused (see "Key weights"); RN stores it and every broadcast then fails on chain.
- Without the node the public value falls back to what the stored private key derives to (RN shows the cached account).
- iOS shows the screen as a sheet and the import as an alert with a secure field.
Tests: shared BackupKeysModelTest (gate, biometrics, rows, copy, import and what it keeps, closing, account binding), KeyLoginTest (weights and thresholds), AuthorityRecoveryTest; Android KeysFlowsTest, LoginPrivacyTest (FLAG_SECURE); iOS KeysTests, KeysUITests. The row's "revealed" flag does not need role in privateKeys, because toggle never marks a role without a stored key.
Welcome and terms, register
RN screens/welcome, navigation/appNavigator.tsx (when it shows), screens/register (registerScreen, registerAccountModal, turnstileWebView), utils/usernameValidation.ts, constants/exchangeAccounts.ts, SDK signUp and lookupAccountsQueryOptions, utils/deepLinkParser.ts (signup links). Shared app/Welcome.kt, UsernameRules.kt, RegisterModel.kt (with TurnstilePage), api/ecency/OnboardingApi.kt; Android ui/RegisterScreen.kt; iOS Screens/RegisterViews.swift.
Behaviour (RN parity)
- Welcome shows when no app version was stored or the stored one is older (first launch and after each update),
parseVersionNumbercompared; "Get started!" needs the terms box and stores the version and the acceptance; after an update the box starts ticked (WelcomeGate). An older stored version shows it again. Copy and "Read Here!" (terms page) as RN - Welcome mascot: RN's
love_mascot.png(Android drawable-nodpi from @3x, iOS asset catalog 1x/2x/3x), right aligned, 45% wide, 227 high, 0.7 opacity - Register form: "Pick a username", email, "Referred user (Optional)", the terms line, Continue, "Already have an account? Login Here"
- Username: lowercased as typed; RN's rules in RN's order (3 to 16, dot separated segments of 3+, starts with a letter, letters, digits and single hyphens, no trailing hyphen, no underscore), then the exchange look-alike check and the
uid+ digits check, each with RN's message; then, 500 ms after the last keystroke,condenser_api.lookup_accounts [name, 50]and "Username already exists, try a different one" when the name is in the answer. A stale lookup answer never judges a newer name - Offline the name is not accepted (no message, as RN); a failed lookup shows "Error / An error occurred"
- Email: RN's pattern; referral: empty, or an account the same lookup finds
- Continue is disabled as RN, and checks the rules again on tap, before the backend
- "Get Hive Account": the name and email, the free card with the Turnstile challenge and "Register Free" (disabled until a token arrived), "Registering Your Account...", then "Registration Successful / Check your email for instruction" with Continue (back to the app, mail app opened). A captcha token counts only while these options are open
- Free signup:
POST /private-api/account-create {username, email, referral, captcha_token}, no account token. Failure copy as RN: 500register.500_error; a backendcodethroughregister.error_codes, else the backend's message; anything else "An error occurred"; always under "Fail!", and a new challenge afterwards - Turnstile:
https://ecency.com/embed/turnstilein a web view whose top document may only be ecency.com or challenges.cloudflare.com, sub-frames free (RN_shouldStartLoad); bridge messagesverify/expire/error; a failed page load shows "Failed to load the page / Retry" without asking for a new challenge - Entry points: "Sign up now!" and the header button on the login screen ("Sign up",
register.title, plain weight so the filled LOGIN stays the one primary action; RN says "JOIN NOW"), "Create a new account" in the account switcher, andecency://signup/ecency.com/signuplinks (referral, username and email prefilled and validated like typed values)
Welcome art (#3636)
- Each of the three points has RN's line icon beside it (
_renderInfo: SimpleLineIcons "question", "emotsmile", "people"), drawn as the app's own outlined icons (WelcomeArt.LINE_ICONS:HELP,SMILE,GROUP, see "Icons") in the text blue, 30 dp / pt, in both themes. - RN's launch animation (
screens/launch, a Lottie file) covers the screen for its first 3.55 s (RN'ssetTimeout(..., 3550)): the Ecency mark drawn in the brand blue on the page colour, 150 dp / pt, centered. Native draws RN's own shapes with no animation library:tools/welcome/launch_reveal_to_kotlin.pyturns RN's file intoLaunchRevealData.kt(the mark, its two parts and the three stroke paths, in the 500 x 500 composition), andLaunchRevealholds RN's timing and easing (a wide sweep around the mark that fades, then each part of the mark filled by a stroke traced along its path, seen only through that part) and gives each stroke's trimmed length and opacity for a time. AndroidLaunchRevealOverlay(Compose Canvas,PathMeasure.getSegment), iOSLaunchRevealOverlay(Canvas in a TimelineView,trimmedPath). It takes the touches under it while it shows, as RN's overlay did, and is hidden from TalkBack and VoiceOver (with-fakeDataiOS exposes it aswelcome-launchfor the UI tests). Only at full motion: Reduce Motion (iOS) and "Remove animations" (Android, animator duration scale 0) skip it, so the screen shows at once. - The shapes are generated, never edited by hand: the script's header has the two commands (RN's file from the
rn-3.x-finaltag, then the conversion).
Paid account: when the store offers 999accounts, the register screen's paid card has RN's buy button ("Buy Account - {price}"); a /purchase?type=account link opens the screen with the paid card only (purchaseOnly). The purchase itself follows "In-app purchases". Differences from RN, which sold names the chain already had (owner report 2026-11-27): a link's name opens the paid card only once lookup_accounts says it is free (a taken one stays in the form with "username exists"), and the buy button asks the chain once more right before the store sheet, so a name taken meanwhile is not charged; without the chain's answer nothing is bought, and a node answering anything but a list of names is no answer (CommunityApi.lookupAccounts fails over). The link's card never opens again over one the reader opened with Continue, and it opens for "Claim Paid Account" when an earlier purchase turns up after the name check (the store is read at start, asynchronously), once, never again after the reader closed it (neither path opens a card the reader closed). "Claim Paid Account" (an earlier purchase already paid for) skips the check: it is never charged again and its own account may exist by now. It is claim only (PurchaseService.buy(claimOnly = true)): when the store no longer holds an earlier purchase to deliver (Ecency took it meanwhile, or the state was stale) nothing opens and the tap goes the checked way (PurchaseOutcome.NothingToClaim) (PurchasesTest.aPurchaseLinkWithATakenNameNeverOpensThePaidCard, aPurchaseLinksNameTypedAwayAndBackIsCheckedBeforeTheCard, aNameTakenBeforeTheBuyIsNotCharged, withoutTheChainsAnswerTheBuyDoesNotStart, aMalformedLookupAnswerIsNoAnswer, claimingAnEarlierPaidAccountIsNotStoppedByItsOwnName, anEarlierPurchaseFoundAfterTheNameCheckOpensTheClaimCard, aClaimWithNothingLeftToClaimTakesTheCheckedWay, aClaimOnlyBuyNeverOpensTheStore, aClaimCardClosedDuringTheNameCheckStaysClosed).
How it is built
UsernameRulesand the email pattern are pinned to RN's own functions:node --no-warnings native/tools/golden/generate-signup.mjs native/shared/src/commonTest/kotlin/com/ecency/core/app/SignupGoldens.kt(from the root of a checkout of thern-3.x-finaltag, where the app is undernative/) (from the RN root; 118 names, 48 addresses, 17 version strings).- The signup request is sent once per tap and never retried: a second tap while one runs does nothing, a lost answer is a failure the user sees, and every failure drops the single use captcha token.
- A bridge message counts only from the main frame while the web view's own document is the embed page, and only in RN's three shapes; a token is a short string without white space. Android provides
ReactNativeWebView(the name the hosted page posts to) through an origin-bound message listener (WebViewCompat.addWebMessageListener,https://ecency.comonly, androidx.webkit 1.12.1, a Java library), so Cloudflare's frames never see the object; on a WebView older than version 83 it falls back to a JavaScript interface, which every frame can reach, and only the top document check and the token's shape filter there. iOS maps the name onto one script message handler, injected into the main frame only. - Web data: iOS runs the challenge in a non-persistent data store. Android runs it in its own WebView profile (
signup-challenge) where the WebView supports profiles; on older WebViews it shares the app's one cookie jar with HiveSigner's pages and the video players (the challenge then counts as an auth view, so a closing player does not wipe cookies under it). - Debug fake-data runs set
env.captchaStandIn, so a demo never loads the hosted page; the demo services answer the signup with an empty 200 and create nothing. - The register screen's saved navigation holds only the referral (a public account name). A link's username and email wait in memory (
env.signupPrefill) and are taken once. A link's referral is taken only when it is a well-formed account name.
Differences from RN
- RN's header shows a "LOGIN" button that does nothing; it is left out ("Login Here" below does it).
- RN shows the avatar of a taken username inside the field; here only the message shows.
- A stale lookup answer never judges a newer name (RN applies whichever answer arrives last).
- The availability lookup is not cached (the SDK caches each name forever in the session, so a name taken meanwhile still reads as free there).
- A link's referral is taken only when it is a well-formed account name.
- iOS shows the register screen as a sheet, like login.
Tests: shared SignupTest (23: the four golden sets, welcome gate, form, link prefill, signup request and failures, captcha, Turnstile rules), LaunchRevealTest (timing, easing, shapes, motion levels, line icons); Android RegisterFlowsTest, WelcomeFlowsTest (icons beside the points, the animation's 3.55 s, skipped with animations off or reduced); iOS OnboardingUITests (file of the same name), TurnstileRulesTests (in EcencyAppTests/KeysTests.swift), WelcomeUITests (icons, the animation covering the screen then gone, skipped under -reduceMotion YES).
Refer & Earn
RN screens/referScreen, SDK getReferralsInfiniteQueryOptions and getReferralsStatsQueryOptions, convertReferral. Shared app/ReferModel.kt; Android ui/ReferScreen.kt; iOS ReferScreen in Screens/RegisterViews.swift.
Behaviour (RN parity)
- Entry: side menu "Refer & Earn" (signed in)
- "Earned Points" = rewarded x 100, "Pending Points" = (total - rewarded) x 100 from
GET /private-api/referrals/<user>/stats - "Refer": the share sheet with
https://ecency.com/signup?referral=<user> - List from
GET /private-api/referrals/<user>, next pages bymax_id= the last row's id, loaded near the end; pull to refresh; footer spinner; "Refer your loved ones today and earn free points" when empty - Row:
$$(blue once rewarded; RN's popover text "Referral points rewarded" / "Referral reward pending" shows as a toast), avatar, name, date in the device locale, "Delegate HP"; a tap on the row opens the quick profile - "Delegate HP" opens the delegation form with the referred account as the delegatee, as RN opens the transfer screen in delegation mode (
AppScreen.of(TRANSFER, account), #3633)
Rules: both requests are public GETs (no token, as RN's no-token list). The list belongs to the account signed in when it loaded: an account change empties it and loads the new account's, a late answer for the previous account is dropped (the reload cancels the running page, the account change cancels it, and the answer is checked against the account), and the UIs draw rows only while ReferState.account is the signed-in account. A page that brings no new row ends the list.
Differences from RN: a failed list shows the error with "Try again?" (RN shows the empty hint); without the stats the points read 0 and the list still shows.
Tests: shared ReferModelTest (11, including aLateAnswerAfterSigningOutNeverShows); iOS OnboardingUITests.testReferShowsPointsRowsAndTheShareButton. Android: see the Refer case in GapsFlowsTest.
Delete account
RN screens/settings (the row, signed in only), settingsContainer._handleDeleteAccount, providers/ecency/ecency.ts deleteAccount. Shared DeleteAccountModel in app/ShellPrompts.kt, OnboardingApi.requestDelete; Android ui/ShellPrompts.kt; iOS Screens/ShellPromptsViews.swift.
What RN does: Settings, "Delete Account" opens one confirmation ("Confirm Delete", "Are you sure you want to delete account? It will erase all of your data", Cancel / Delete). Delete calls POST /private-api/request-delete {username, data: "", code} (the account's token, added by RN's API interceptor), then shows the toast "Your request for deletion is sent" and dispatches logout(): the normal sign-out of the current account. It is a request to Ecency to delete what it stores for the account; nothing is broadcast, nothing else is deleted on the device beyond what a sign-out removes, and a Hive account cannot be deleted.
- The row, the one confirmation and its copy, the request and its body, the toast, the sign-out
- The sign-out is
SessionModel.logout(<that account>), so the one teardown (AppEnvironment.accountsLeft: push release, in-memory state, local drafts) runs, and the next saved account becomes current, as RN - Rules: the request names the account that opened the confirmation and carries that account's code; it is refused when another account is signed in by the time Delete is tapped; it is sent once and never retried (a second tap while it runs does nothing), except one resend after a 401 that renewed the session (refused before anything was done); the confirmation closes on an account change, but not under a running request; a request already on its way still signs out its own account, by name, after a switch; no sign-out follows a failure.
Difference from RN: when the request fails, RN still shows "Your request for deletion is sent" and signs the user out. Here a failed request shows "Fail! Your request for deletion could not be sent. Please try again." and the account stays signed in, so nobody is told a request was sent that was not. A request that timed out counts as failed; trying again may reach the server a second time, which asks for the same thing.
Tests: shared ShellPromptsTest (delete cases); Android GapsFlowsTest; iOS ShellPromptsUITests (EcencyAppUITests/ShellPromptsUITests.swift).
Session start
SessionModel.start() is called by each app at launch and again by AppLockModel.start() after an RN migration. It never runs two reads of the vault at once: a call while a load runs asks for one more read after it, so the state always comes from the last read; one app start counts as one session for the rating rule. awaitStartFinished() suspends until no such load runs (tests use it instead of sleeping).
Feed, posts and reading
The RN reading features over the feed and post screens, shared models in shared/.../core/app and core/api, UIs in Android ui/PostMenuUi.kt, ui/ReadingScreens.kt, ui/GapsUi.kt, ImageSaver.kt and iOS Screens/PostMenu.swift, PostListsViews.swift, QuickProfileView.swift, Screens/Gaps2Views.swift, App/PhotoSaver.swift. Shared helpers: app/Recap.kt, ScrollTop.kt, PayoutDetails.kt, PostStats.kt, LinkSheet.kt, CommentThreads.kt, ImageReveals and PostBadges (in FeedFilters.kt, PostCard.kt). Copy is in UiCopy and the *Copy objects next to them (RN en-US keys in comments).
- Home feed: RN filters (
FeedFilter,FeedTabs): signed in the saved tabs (Following, Communities, Trending, Hot by default; "My Blog", "My Posts", "My Comments", "New" available), signed out Trending, Hot, New; the "+" sheet ("Customise Filters", at least 3, no maximum) saves toenv.prefs(Prefs: SharedPreferences, UserDefaults). Home and tag feeds inject Ecency promoted entries (private-api/promoted-entries) at RN's positions (4th, then every 4th, deduped, muted authors dropped) with "PROMOTED". - Cards (
PostCard): options button, "PROMOTED" / "POLL", NSFW placeholder image (NsfwMode, RNnsfw'0' show, '1' warn by default, '2' hide drops the posts; a page left with nothing to show is not the end: the feed reads on by itself at mostFeedModel.MAX_AUTO_ADVANCE, 5, more pages, as the wallet history does, then shows its empty state with "Load more", which reads on from there;FeedState.pagescounts every page read), muted hint with "Tap to reveal" (in memory, as RN; TalkBack and VoiceOver reach it as the first named action of the card's one stop, iOSCardAccessibilityAction, #3747), pin icon, cross post label, votes open Voters, reblogs open Reblogs, gift opens the transfer placeholder, avatar and name open the quick profile. - "Show Images" off holds back feed card images behind RN's "Tap to load image" placeholder, one image per tap for the session (
ImageReveals); the NSFW placeholder is never gated. - Badges: RN's Ecency source badge (the Ecency logo mark, 12 dp/pt, soft gray
#d1d5dblight /#374151dark as RN and web, labelled "Published with Ecency", no visible text) and RN's AI disclosure (json_metadata.ai_tools.media_generation || writing_edit) after the date on cards and post headers (RN's startsWith rule), and the post footer "Posted by {author} via {App} {age}" with both badges (RN's looser footer rule). - Payout popover (RN payoutDetailsContent): tapping a payout on cards, the post bar, comments and waves opens Promoted, Potential, Author, Curation, Max Accepted, Breakdown (median feed and
hbd_print_rate), Beneficiaries, Payout (momentfromNow) and the $0.02 warning. Values are in dollars as on the cards (RN converts to the chosen currency). - Post menu (
PostActionsModel, RN postOptionsModal: items, order, labels, conditions): copy link and text, share sheet, reply, reblog / undo, pin to blog (the guarded profile write path of the profile area, posting authority), community pin and mute post (env.communities, soCommunityOpsand its notes rules; moderators from the communities API'sbridge.get_community; the oneModNotesSheetasks the reason for mute and unmute), pin comment (parent re-posted withpinned_reply), cross post (CrossPostModel, subscribed communities, payout declined), edit history, bookmarks (private-api/bookmarks-addwith the session code), "Mute / Block" (ignore; the author's posts leave the lists), report (private-api/report, then mute), delete (confirm,delete_comment, the card leaves the lists and the post screen closes), promote (Redeem placeholder), translate on comments. Operations areapi/broadcast/PostActionOps(reblog, ignore, delete, pin comment, cross post, poll vote; the community ones areCommunityOps); all go throughSigningModel. - Edit (not in RN's menu: RN drew an Edit button in each own comment's footer,
post.a11y_edit): the three-dot menu of an own reply or wave offers Edit, which opens it in the editor (a reply edit,EditorKind.EDIT_REPLY); never for others' content, cross-posts or an own top post (its screen has its own Edit button). The chain takes an edit at any time, so unlike Delete it is offered however many votes or replies there are. The label is the app's "Edit" (UiCopy.EDIT). The same Edit and Delete also sit in the footer of own waves and replies, as RN drew them (PostFooter, see "Waves and Shorts"). - Screens: Voters (every vote:
bridge.list_votespages, ordatabase_api.list_votespages on a node without it, SDK getEntryVotes,HiveApi.entryVotes; RN readget_active_votes, which stops at 1000; each vote's share of the payout, REWARDS / PERCENT / TIME with RN's ascending quirk, search), Reblogs (get_reblogged_by, search, reblog / undo button), Edit history (private-api/comment-history, bodies rebuilt from diff-match-patch patches, diff view with RN's colours;core/text/DiffMatchPatchis a port of the JS package with 694 golden cases), Bot comments (top-level comments byprivate-api/public/bots, previewed by avatars in the comments header), tag screen (TOP / HOT / NEW, follow tag viafavorite-tags). - Post screen: options and edit (own posts, editor placeholder) in the header, parent post box for comments (not waves), reading bar, the Listen bar (RN replaced on-device text to speech with Listen, see "Listen"), translation banner (
TranslateModel: translate.ecency.com/detectand/translate, 43 languages, chunks of 1800, plain text in place of the body, RTL aware, dismiss per post), poll card (PollModel: json_metadata poll, poll.ecency.com results,pollscustom_json vote shown at once), "Read next" (search-api/similar, two entries), comment options and tip. - AI recap in the reading bar (RN postReadingMetadata): Words | Reading | AI "Recap" for a signed-in reader of 50 words or more;
ai-assistwithsummarizeand the speech text (10000 characters), paid as the editor's assist (one stored key per run, scoped to the post, "Check again" for a run without an answer, nothing sent without a price and a balance that covers it). The summary box translates through translate.ecency.com with a language picker. Differences: the cost shows under "Recap" (RN shows none), and a short balance is refused before sending (RN learns it from the 402). - Post tags (RN postDisplayView footer
<Tags>, tagContainer): one scrolling row of pills above "Posted by" once the body is in, also beside a translation (RN keeps its footer then). SharedPostTagsbuilds it:json_metadata.tagsread leniently, the category first when missing (exact case), each once; a tag matching RN'shive-[1-3]\d{4,6}$shows the post'scommunity_titlefor its own community, else the titlePostModellooks up (bridge.get_community, once per screen), else its name, and opens the community; any other tag opensTagResult. As RN, a lookup that finds no community makes a plain tag. The first pill is blue (white text); the rest uselightBackgroundwith the secondary text colour (AndroiddarkGray, iOSsecondary) (RN's white on$iconColoris 1.7:1, below AA); 22 high pills in 48 dp / 44 pt targets, read as "{label}, community" or "{label}, tag". - Views and stats (RN postDisplayView, postStatsModal):
POST /api/stats(a Plausible read; nothing is recorded) for the path without its category over the post's lifetime; visits as the count, Visitors / Views / Minutes, the device breakdown, PROMOTE POST toRedeem("promote", "author/permlink"). Difference: RN showsvisit_duration / 1000under "Minutes" (seconds read as milliseconds); here seconds become minutes. - Post bar tip count: the bar shows RN's tip count beside the gift (
PostTipsModel,GET /private-api/post-tips, compact, none at zero; RN prints a raw count, 0 included; unknown until a read lands, then nothing is said;PostTipsState.SHOWS_ZEROshows "0" as RN; a sent tip counts at once, confirm reads atCONFIRM_DELAY_MS(keeps the higher of server and optimistic) andFINAL_CONFIRM_MS(the server's count wins), a tip over an unknown count reads at once instead of counting one, the newest read wins). The bar has no Reply button: the comments icon (count, "View comments") scrolls to the comments header, which holds the Reply to the post (RN keeps a long press quick reply on the icon). Under the body, after "Posted by", RN's WritePostButton: the reader's avatar and an "Add a comment..." field (quick_reply.placeholder) with the reply icon, one button that opens the reply, or asks a signed-out reader to sign in (testers found the header's Reply too easy to miss; AndroidwriteReply, iOSwrite-reply). iOS's bar has RN's voters, reblogs, comments and tip too. - Comment action row: no "Reply" text button on a comment; its comments icon with the reply count is the reply button (Android
ActionsRow(commentsReply = true), a button labelled "Reply" with the count as its state; iOSreply-comment, "Reply to author" with the count as its value), so the replies caret stays on the line (a 360 dp phone at default text). At the largest text sizes the row wraps (AndroidFlowRow, iOS a thirdViewThatFitsstep that keeps count and caret together); the post's bottom bar and the comments header keep their "Reply" buttons. Android's comment sort tabs wrap too (the last one is cut at font scale 2 on a 320 dp phone otherwise). - Comment and wave rows (RN commentView, upvoteButton): a 40 point avatar and a 16 point name, the body and actions lined up with the name (iOS
CommentRow.bodyInset,WaveRowView.bodyInset: the avatar and its 10 point gap), and the card's 24 point vote chevron, growing with the text size as the card's does. The profile's comment and reply rows draw the same sizes (RN commentsTabContent renders commentView). A comment's or wave's vote count opens its voters when it has votes (RNisClickable={_totalVotes > 0}; iOSVoteCountButton,comment-voters,wave-voters); at zero it is plain text. - Reply threads: replies under a top-level comment start collapsed (RN), the chevron pill opens them; a thread holding a reply sent from this device opens by itself; a comment whose replies are not loaded opens its own thread.
- Reputation: no badge on avatars (cards, post header, comments) and no "(rep)" next to names (profile, home header, search rows, waves). The quick profile sheet keeps it.
- Vote sheet: RN's
$estimate (VoteValue, SDK votingValue HF28 and legacy rules, golden against the SDK) and RN's downvote mode (first tap switches to red, second tap votes; RN has no other confirmation). Differences from RN and the SDK: in downvote mode the footer shows the downvote power (downvote_manabar, max a quarter of the voting mana's, refilling over the same five days;Mana.downvotePowerPercent,VoteSheetState.powerText; RN showed the voting power for both), and a downvote's estimate counts the downvote mana with the voting mana when checking the vote is affordable, as hived 1.28 does (the SDK checks the voting mana only, so a downvote of an account with no voting mana read $0). Under HF28 the size of a vote does not depend on either mana, so the value is otherwise the same in both directions. The downvote max uses the effective vests with a power down taken off (as hived and this app's voting power count them; the SDK'sdownVotingPowerleaves the power down out).VoteSheetTest. - Quick profile (
QuickProfileModel): voting power ring, about, joined, followers, following, posts, resource credits, reputation, follow and favourite, "VIEW FULL PROFILE" (the profile screen). - Image viewer: pinch (1x to 5x) and double tap (1.5x) zoom, "Preview (i/n)", share, copy link, save to the "Ecency" album (Android MediaStore Pictures/Ecency, WRITE_EXTERNAL_STORAGE only up to Android 9; iOS Photos with library access for the album, add-only access saves without it; permission strings in
project.yml). Difference: RN's "copy" button shares; here share and copy are both offered. - Selecting body text (#3699, beyond RN: its renderer drew bodies with
selectable: false; web's selection popover is desktop only). On the post screen's body and its comments (not waves, previews or chat), a long press selects with the system handles; the system menu keeps Copy and gets Quote, Translate and Share (PostActions.onSelection; iOSPostTextViewwithBodySelectionAction.menu, AndroidSelectableBodyTextover a per paragraphSelectionContainer(SelectionState)withappendTextContextMenuComponents, Compose foundation 1.12 where the new text menu is on by default). The body is drawn as separate texts in a lazy list, so a selection stays within one paragraph, heading, list item, cell or code block (code keeps its indentation and scrolls sideways; iOSSelectableCodeText, AndroidCodeBlockView); the post menu's Select text (native copy,PostMenuItem.SELECT_TEXT, offered wherePostMenuContext.selectText) opens the whole body as one selectable text (SelectTextModel,BodySelection.text: blocks as plain paragraphs, list items on their lines, chips as@user/#tag) for longer ones. Copy and the actions take a chip as its@user/#tagtext (iOS maps eachChipAttachmentto its label and overrides Copy; Android's inline content carries it as alternate text). Quote: signed out asks to log in first, thenComposeReplyModel.quoteputs the selection after the reply draft of that post or comment, every line after>(a blank line as>; web prefixes only the first line), once the saved draft was read, and opens the quick reply (while that reply is being sent the quote is refused and the sheet shows the send). On iOS a press held longer than a tap selects, and letting go opens no link. Translate: the translation sheet over the whole selection (selectionTranslationModel, not the post's 200 character summary). Share: the system share sheet with the selection in quotes and the post's link. In selectable text the paragraph long press no longer copies the paragraph (Android), and a chip's long press does nothing instead of ending as a tap. iOS leaves out the system's own Share and Look Up group (Look Up, Translate, Search Web) so the menu has one Translate and one Share; its read-only text menu has no Select All. Tests: sharedSelectionActionsTest, AndroidSelectTextFlowsTest, iOSSelectTextUITestsandPostRenderTests.testASelectionAndCopyTakeChipsAsTheirLabels. - Link sheet: external links in post, comment and wave bodies ask first (RN "Link": Copy, Open in Explore, Open in System browser, Cancel). A host with non-ASCII letters shows its ASCII (punycode) form on a line under the address (
LinkSheet.display), so a look-alike of a known name is visible. "Open in Explore" (with RN's warning, its dash written as a full stop) opens an http(s) link in the dApp browser (LinkSheet.exploreScreen). - Scroll to top (
ScrollTopRule, beyond RN's look): the lists' scroll to top (feeds, profile, Waves) is the FAB's twin (AndroidFabButton/FabTokens, iOSFabButton/FabMetrics: 56 dp circle, 8 dp shadow, white glyph, 16 dp margin) at the bottom start, opposite the compose FAB, mirrored in RTL, above the system navigation bar on pushed screens (profile, tag, community, search feeds; the tabs' bar already clears it) and only fading under reduced motion. Post lists (feed, tag, community, profile) show it after scrolling up more than 5000 dp and hide it on tap (blocked for a second); iOS Waves also hides it on scroll down (hidesOnScrollDown); Android Waves keeps its own threshold (15 rows down while scrolling back up). At the tabs the vote failure snackbar sits above the FAB row. A tap while the list still flings stops the fling and goes to the top (iOS stops the deceleration first,ScrollMomentum: SwiftUI'sscrollToalone is lost under it). A tap on the tab or filter that is already selected scrolls its list to the top, as RN's TabbedPosts and TabBaronTabPress: the home filters, tag and tag result sorts, community and profile tabs, the communities tabs and the search tabs (AndroidrememberTabTap, iOSonReselect); Waves and Notifications do it too. RN's bottom tab bar never did it (a TODO inbottomTabBarView), so neither does native. Not built: the same tap on the drafts and bookmarks tabs (RN did it; iOS draws them as a segmented picker, which reports no tap on the selected segment). - In-post anchors (beyond RN, as web): ids survive exactly as render-helper's sanitizer keeps them (
idon a, span, div, p and headings when it is a name,data-idon a, which web'sMdHandlerjumps to;nameis dropped there, so it is here too).BlockBuilderputs aBlock.Anchor(ids)(drawn as nothing, zero height) right before the block that holds each one;#idhrefs (also on raw<a>without render-helper's classes) becomeLinkTarget.Anchor(id), and a post link with#id(never the#@author/permlinkcomment form) becomesLinkTarget.Anchor(id, post).BlockAnchors.jumpresolves on the post being read: the element's id or data-id (first wins), else a heading whose GitHub style slug matches (render-helper gives headings no ids, so[toc](#my-heading)written for those sites still lands), else#and#topare the top. The post screen scrolls the body's lazy row to the top of the screen (AndroidanimateScrollToItemthrough the body rows'postBlockKey, iOSScrollViewReaderon the body's block ids, both without animation under reduced motion); no screen is pushed, so back still leaves the post. Links in comments jump within the post body too (Android remembers where the body's rows start in the list,CountingListScope, for when no body row is on screen). - Profile and community headers (#3734): the header is the list's first row at its own height (no cap, no rule that starts it closed at accessibility text sizes: a tall header simply scrolls away), so there is no gap above the cover.
- Other:
BadActors(watchmen list and RN's transfer check) is ready for the wallet screens (RN uses it there only); Shorts have no entry point in RN's feed or post screens (Waves tab only), so nothing routes here. - Safety and privacy: pin to blog never merges onto a stripped node read (the profile area's guarded write path,
ProfileMetadataGuard); edit history patches are applied on the render dispatcher and refused over 300 KB of patch text; a post's language is guessed on the device first (Languages.guess: script and function words) and translate.ecency.com/detectis asked only when the guess is not the reader's language, never for muted or NSFW posts, once per post and session; the account's ignore list loads at sign-in (condenser_api.get_following"ignore") and filters feeds and promoted entries; the Listen player belongs to the post screen and plays on while scrolling. - Golden vectors:
tools/golden/generate.mjs(delete_comment, account_update2, undo reblog),generate-feedx.mjs(menu ops, pin to blog metadata, pin reply, vote values),generate-dmp.mjs(diff-match-patch). - Differences from RN: the on-device language guess is a heuristic, not RN's franc (Cyrillic and Arabic script and unsure Latin text go to
/detect), and the card translate chip is not shown; the poll's optimistic vote moves counts only (HP sums arrive with the API);Num.fixedis exact for up to 3 decimals; tipping routes to the transfer placeholder (all tips need the active key and wallet balances); another post's#idlink opens that post at its top (the saved navigation has no fragment); an unknown id does nothing (a browser stays put too);#idlinks outside a post screen (waves) do nothing; plus the per-item differences above (recap cost, minutes in stats, share and copy in the image viewer). - Debug: Android
--es openRoute VotersScreen|ReblogsScreen|EditHistoryScreen|BotCommentsModal|PostScreen --es arg author/permlink; the scroll to top shows at once with Android--ez demoScrollTop true, iOS-demoScrollTop YES(recordings, layout tests). - Bridge v2 reads and votes (ecency/vision-mobile#3671, ported from
@ecency/sdk2.5.0, the removed vote from 2.7.0): posts, feeds and discussions are read with the vote-freebridge.get_post_v2,get_ranked_posts_v2,get_account_posts_v2andget_discussion_v2(HiveApi, a node without them answers with v1; see Node failover). Every entry, of either shape, is parsed as SDKnormalizeEntrydoes (Post.fromJson(element, observer)): the raw voter list is not kept;observerVoteandobserverVoteForsay the reader's vote (v2'sobserver_vote, or the reader's row of a v1 list), and for nobody when it cannot be told: no observer, an observer missing from a list of 1000 rows or more (v1 lists are cut there; condenser lists are whole), or a row with rshares 0 and no percent. A read never relabels an entry normalized for another account. A cast vote has a non-zero percent, or without a percent non-zero rshares (ObserverVote.isCast,direction); a removed vote (percent 0,isRemoved) stays the reader's answer, as SDK 2.7.0 keeps it: no vote shown, but counted. Counts come fromstats.total_votes(a list's length only for an entry without stats whose list cannot be cut): the card count, the comment sort by votes and the delete check. The voter's share of the payout on an unvote is read againstnet_rshares, not a sum over a list that may be cut. A vote made on the device adds one to the count only when the count does not have the account yet: the read's answer when it knows, the reader's row in a v1 list or v2'sobserver_voteobject (Post.listedVoter: hivemind sends the object for any vote row, a removed vote's with percent 0; a weightless or removed vote shows as none but is counted), or a replaced vote read from the chain, carried through later changes and an unvote (LocalVote.earlierCounted; a removed vote looked up on the chain too: the lookup reports its row with percent 0, not no vote), so a weightless vote or a changed weight is never counted twice. A vote made on the device that landed keeps the account counted through later unvotes and votes (LocalVote.landedAt), as hivemind does, for reads from before it; a read shown 200 s or more after the first landing (LocalVotes.SETTLE_MILLIS: fetched 2 minutes on, as a node may lag 90 s, and the post cache keeps a read 60 s plus a read's 20 s) has the account, also one that cannot name the voter (a Waves row, a v1 list cut at 1000), and so has any read counting at least as many (LocalVote.settledCount, set byretireConfirmed: hivemind's count only grows), so a refreshed count is never added to again (aReadFromAfterTheVoteSettledHasItInItsCountWhenItCannotNameTheVoter,aRefreshedCappedReadThatCountsTheRemovedVoteGetsNothingAdded) (#3682:aVoteMadeHereStaysCountedThroughUnvotesAndRevotes,aRemovedVoteRowIsReportedAsRemovedNotAsNoVote,aVoteAfterALookedUpRemovedVoteIsNotCountedAgain). An unvote takes nothing off: hivemind keeps a removed vote intotal_votes(deliberate difference from the SDK's optimistic minus one, which a refresh would undo). Left: on a node without v2, a weight change on a post of 1000 votes or more, made over a vote cast here, shows one too many after a refresh (VoteAndReplyTest.aWeightlessVoteMadeHereIsCountedOnceOnANodeWithoutV2,aVoteChangedOverOneReadFromTheChainIsNotCountedAgain,aVoteOverOneReadFromTheChainRemembersItIsCounted,aRemovedVoteReadThroughV2StaysCounted). A vote looked up on the chain keeps its rshares (LocalVote.earlierRshares, carried through later changes), so changing it takes its share off the payout even where the read cannot see it; a vote made here first takes nothing off, as a saved read (a wave row) may not hold it (aChangedVoteTheReadCannotSeeTakesTheOldVotesShareOff); a read that knows the vote cancels a lookup still on its way (aReadThatKnowsTheVoteWinsOverALookupStillOnItsWay). A newer promoted read replaces an older one still out, and an answer read for another account is dropped (FeedxTest.anOlderPromotedAnswerNeverLandsOverANewerOne). Promoted entries carry a voter list and are read for the signed-in account (the SDK reads them for nobody and looks each vote up; native has no lookup for cards). Not ported from the web: batched own-vote lookups for cards, the 60 s hold of a just-cast vote (a vote made on the device always wins over the read here,LocalVotes) and the pending vote button while a vote is unknown. Tests:PostNormalizeGoldenTest(normalizer,isCastVote,voteDirection, the fallback and error classifier, the own-vote lookup and the voters list against the SDK's own answers:tools/golden/generate-bridge-v2.mjswritesBridgeV2Goldens.kt),VoteAndReplyTest.aVoteBeyondTheFirst1000ShowsThroughV2,FeedModelTest.aV2FeedCardCountsVotesFromStats,DiscussionTest.theVotesSortUsesTheCountOfAV2Discussion. - Tests: shared
FeedxTest(ops and pin metadata against the SDK, vote values, menu visibility per role and chain rule, delete, mute notes, report, bookmark code, feed tabs, promoted, NSFW, voters, reblogs, edit history, polls, languages, speech, formats),DiffMatchPatchTest,GoldenVectorTest,RecapModelTest,PostStatsTest,PostTagsTest,Gaps2Test(image reveals, scroll rule, payout rows, badges, link sheet, comment threads); AndroidFeedxFlowsTest,Gaps2FlowsTest(including post tags); iOSGaps2Tests,Gaps2UITests(including post tags) and an AX5 audit inAccessibilityUITests.FeedxFlowsTest.listeningGoesOnWhenTheReadingBarScrollsAwayAndStopsWithThePostScreendrives the reading bar against Robolectric's TextToSpeech shadow; the iOS player has no engine seam yet, so its ownership (PostScreenholds theSpeechPlayer) has no behavioural test.
Profile, social graph and bookmarks
RN screens/profile, follows, profileEdit, bookmarks, accountList and components/profileSummary, userAvatar, userRibbon, proBadge on both platforms, over shared models (shared/.../core/app: ProfileModel, FollowsModel, ProfileEditModel, BookmarksModel, ProMembersModel, AvatarStamps, DigestEntries.kt, ProfileWallet.kt). UI: Android ui/ProfileScreens.kt, iOS Screens/ProfileViews.swift.
env.profileModel(user, section) // section: "", "wallet", "comments", "replies", "posts" (deep link tab)
model.toggleFollow(); toggleMute(); toggleFavorite(); report() // report after the UI's confirm
model.feed(ProfileTab.BLOG) // FeedModel per tab, owned and closed by the profile model
env.followsModel(user, following, count); env.profileEditModel(); env.bookmarksModel(tab)
- Profile: cover (proxied by height, 480 px: the 160 dp header at 3x crops the sides, so the width follows the image; RN asked 640x320, which
mode=fitshrinks a wide cover into, 640x114 for the web's 2688x480 default, then stretched about 4x, #3754; the Edit Profile preview asks the same, and its picker gives the web's size hint (ProfileUiCopy.COVER_HINT, vision-web#2213); iOS decodes a cover at least six box heights wide (CoverDecode), sinceLoadedImageViewdecodes no wider than itsmaxWidthand a window-wide decode left a wide cover shorter than the box;ProfileModelTest,SocialModelsTest, AndroidProfileFlowsTest, iOSLayoutPolishUITests.testTheCoverPickerShowsItsSizeHint,ProfileTests.testAWideCoverIsDecodedTallEnoughForTheHeader), avatar, name, Pro badge,@user (rep), about, join date (device locale), website (opens https only), location, follower counts (condenser_api.get_follow_count, RNmakeCountFriendly), voting power and RC bars (SDK mana maths,rc_api.find_rc_accounts; a tap shows "Full in N hours"). Tabs as RN: own blog, posts, waves, replies; others blog, posts, waves, comments; a link's section selects its tab or replaces the last one (/wallet,/points). Comments and replies are comment rows with the actions of RN's Comment, which RN commentsTabContent draws (author, age and the options, the comment's text, then the vote button with the payout, the voters, the replies and RN's gift, CommentView_handleOnTipPress): the vote is the app's one vote (the weight sheet,env.votes), the gift opens the same tipping sheet as every other card (signed out: the login; Androidtipincomment:<key>, iOScomment-tip-<key>;ProfileFlowsTest.aCommentRowOfTheCommentsTabOffersTheTipSheet,aCommentRowOfTheCommentsTabVotesLikeAnyCard,aRowOfTheOwnRepliesTabHasTheCardActions, iOSProfileUITests.testACommentRowOfTheCommentsTabOffersTheTipSheet,testACommentRowOfTheCommentsTabHasTheVoteAndTheCardActions,testARowOfTheOwnRepliesTabHasTheVoteAndTheCardActions; RN shows the gift to signed in readers only, native keeps the gift and asks to sign in, as its other rows do; the text is the comment's summary, where RN drew the whole body); a muted comment (Post.isMuted) shows the cards' muted hint (the reason and "Tap to reveal") in place of its text until revealed, RN CommentViewhideContent, with the cards' reveal for the session (env.mutedReveals; AndroidMutedHint, iOSMutedHintButton;ProfileFlowsTest.aMutedCommentRowHidesItsTextUntilRevealed, iOSProfileUITests.testAMutedCommentRowHidesItsTextUntilRevealed); another account's Wallet tab shows its wallet read only (below), the own one opens the Wallet tab. Muted accounts show RN's muted icon instead of the tabs. - Another account's Wallet tab (RN walletView without dropdowns): unclaimed rewards as text and Wallet Details (HIVE, staked HIVE with delegated / received / net, HBD, savings HIVE and HBD, next power down), read only. Difference: the tab keeps its "Wallet" label (RN shows the estimated value there).
- Actions (signed in, someone else): Follow / Unfollow, Message (chat placeholder), email digest (opens the digest sheet, below), menu: favourites (Ecency API), Delegate (transfer placeholder), Delegate RC (below), Mute / Unmute, Report (confirm,
/private-api/report, then auto-mute). Follow ops are the SDK'scustom_jsonfollow (whatblog, ignore or empty), signed with the posting authority throughSigningModel; a cancelled prompt shows nothing, a failure RN's "Fail!" alert; one action at a time. - Delegate RC (owner request; RN's
useDelegateRcMutationhad no screen): the menu item after Delegate opens a sheet (RcDelegateModel) that sends SDK buildDelegateRcOp, acustom_jsonrcwith the posting authority (["delegate_rc",{"from","delegatees":[to],"max_rc"}], the new total; 0 removes it), so a posting-key account can delegate. It reads the account's RC (rc_api.find_rc_accounts, exact 64-bit figures,RcDelegator) and its current delegation to that account (rc_api.list_rc_direct_delegationsfrom the pair,HiveApi.rcDelegated). What can be delegated is the lower of the own maximum (max_rcminusreceived_delegated_rc: received RC cannot be passed on) and the mana refilled until now, as the chain'sdelegate_rc_evaluator; the largest new total adds what the account already delegates there. The amount is typed in billions of RC (nine decimals at most, read exactly), at least 5 billion (as web; the chain's own minimum, a third of the account creation fee in VESTS, is about 1.6 billion now), not the current amount, within that total. Delegate and, with a delegation, Remove confirm first and go throughWalletSendswith one action id (a retry resends the same transaction). Tests: sharedRcDelegationTest,DemoHiveTransportTest.theRcDelegationReadsAcceptTheSyntheticAnswers, AndroidProfileFlowsTest.delegateRcFromTheMenuSendsTheAmountInRc, iOSProfileUITests.testDelegateRcFromTheMenuChecksTheAmountAndConfirms. - Digest entry points: another profile's email button and the community "Newsletter" chip open the digest sheet (creator / community); the own profile shows the sender row (
GET /api/newsletter/sender: weekly and monthly subscribers, copy subscribe link, Manage); the end of a post offers RN's subscribe card (RN pickPostDigestTarget; shown only after a successful subscriptions lookup without that list; the dismissal is per viewer and list,digest.postPrompt.*, forgotten on wipe). - The digest offer's post count: the read before a publish is bounded at 3 s (
DigestModelTestholds the transport and checks the virtual clock, so the bound is the digest's and not the RPC client's), and an account whose read failed or timed out is not waited for again in this app run. - Models wait for the session to be read (
SessionModel.awaitLoaded), so a screen restored before the vault was read never acts as a guest; an account change reloads in place. - A post published from this device leads its author's own Blog and Posts lists until hivemind lists it (
PostRepository.addLocalPostfromEditorModel.finishPost, read byFeedModelforFeedSource.AccountBLOG and POSTS; 5 minutes at most, as local comments):bridge.get_account_postslags the chain by seconds to a minute, so the profile the app opens after a publish (as RN) showed only older posts, also after two pulls (live test). It shows in a list opened later and in one already open (AppEvent.PostChanged), is never shown twice (hivemind's copy replaces it in the list that has it; the copy stays for the other list, read apart, until its time or a delete, so a lagging answer never hides it), never on another account's lists, also stands in forbridge.get_postmeanwhile (its card opens), shows an edit made here meanwhile (an edit opened from the copy checks the chain itself,find_comments, for a title, body or json_metadata change made elsewhere (compared as parsed objects): hivemind's copy carries the block's time, the local one this device's), and goes with a delete from this device (forgetLocal). Tests:EditorModelTest.aNewPostLeadsTheAuthorsOwnListsUntilHivemindHasIt,anEditOfANewPostHivemindHasNotListedShowsTheEdit,aDeletedNewPostDoesNotStayOnTheAuthorsLists,anEditOpenedFromTheLocalCopyIsNotRefusedWhenHivemindCatchesUp,anEditStillRefusesAPostChangedElsewhere,anEditOfTheLocalCopyRefusesTagsChangedElsewhere,anEditOfTheLocalCopyRefusesOtherMetadataChangedElsewhere,anEditOfTheLocalCopyIsNotRefusedForDuplicateTagsTheChainKept,oneListThatHasTheNewPostNeverHidesItFromAnotherStillBehind,aPostPublishedWhileAPageLoadsShowsWhenThePageIsIn;DiscussionTest.aLocalPostStaysForEveryListUntilItsTimeOrADelete. - Followers / following:
get_followers/get_followingpages of 100, profiles frombridge.get_profiles, search over the loaded rows (RN). Rows open the profile. The followers screen is titled "Followers (12)" (native.follows.followers_count; RN wrote "Follower (12)" with the profile stat's label, a deliberate difference, #3704). - Edit profile: Display Name, About, Location, Website, and avatar and cover by image link, gallery, camera and (Android) files. The avatar is the centred square at 512 px (
AvatarCrop), uploaded through the editor's upload and saved at once without closing the screen (RNgoBack: false). Save broadcastsaccount_update2(posting key) exactly as the SDK'suseAccountUpdate, through the one profile write path (below):ProfileMetadata.buildPostingJsonMetadata(a byte-exact port, JS property order, JSON.stringify escaping and number formatting inJsValue) merges the edit over the on-chain metadata. An account whose profile lives only in legacyjson_metadata(the app shows it through the same fallback) starts the form and the merge from that profile, so its fields move into the posting metadata instead of vanishing. An account without an avatar writesprofile_image: null, as RN. The new profile shows at once (account cache) and every avatar URL of the account gets RN's?stamp=(AvatarCacheStamps, read byPostCard.avatarUrl). - Profile writes, one guarded path (
app/ProfileWrites.kt,api/broadcast/ProfileMetadataGuard.kt), used by the profile edit and by pin / unpin to blog: the account and hivemind'sbridge.get_profileare read again, and the write is refused ("Could not read your current profile, try again", nothing broadcast) when hivemind cannot be read, the posting metadata is not valid JSON (or nests past the parser's limit), itsprofileis not an object, or the profile holds fewer non-empty values than hivemind shows (a node that stripped the row; such a row is read once more first). An empty profile is a base only when hivemind shows nothing at all (any value of its rawmetadata.profile, the SDK'shasProfileValues). The fresh row is first read the way hivemind'sbridge.get_profilereads it, a port of the SQLhivemind_postgrest_utilities.extract_profile_metadata(hive/db/sql_scripts/postgrest/utilities/extract_profile_metadata.sql), so like is compared with like: hivemind reads the posting metadata unless it is empty, not jsonb (a NUL anywhere) or under 3 characters ({}), itsprofileor else its root, and only then the legacyjson_metadata(profileor root); name, about and location are cut raw (no trim) to 17, 157 and 27 characters plus "..." when over 20, 160 and 30, a name starting with @ is dropped, a website of 100 or fewer getshttp://unless it has a scheme (an empty one shows ashttp://, the shape Ecency web writes), images must be http(s) and at most 1024. When hivemind reads the posting metadata, the row's view must hold at least as many non-empty values as hivemind shows: count only, on purpose, because hivemind lags a write and a field match would lock the user out right after a save. When hivemind reads the legacy metadata, the view must equal what hivemind shows field by field: a node that blanks onlyposting_json_metadataleaves an old legacy profile with just as many values. One more case reads the legacy metadata although a posting row is present: some Steem-era accounts carry aposting_json_metadatathat is only the copy hived made at the hardfork, never wroteaccount_update2and kept editing withaccount_update, so hivemind has no posting row of its own for them and shows the legacy profile, the current one. When hivemind shows something that is not the posting row's fields but is exactly the legacy fields, the legacy profile is the base (legacyOverSnapshot): its profile fields win entirely (a field it lacks was deleted since the snapshot and stays deleted), its other keys win, and what only the snapshot holds beyond the profile fields (tokens, a pin, unknown keys) is kept; the edit form shows the same values. This rule is off once this process has itself written a posting profile for the account, because hivemind still showing the legacy values is then only lag. And when the app itself knew a posting row for the account (an earlier read, or the row it remembered after its own write) and the fresh one is blank, the read is refused whatever hivemind shows, since a matching legacy profile says nothing about the tokens, pin and unknown keys of the real row. A posting row a node has shown is strong knowledge and keeps refusing a blank one; one the app only broadcast itself is weak (a broadcast can be accepted and still expire or be dropped by a fork). On a blank read with a weak mark the app compares hivemind with the row it wrote: hivemind showing the written fields means the write landed and the read is a strip (refused, the mark becomes strong); hivemind showing the values from before cannot tell "did not land" from lag, so the write is refused with "try again" until 3 minutes after the broadcast (a transaction lives 60 s, hivemind follows the chain within seconds), and only then is the account treated as the legacy one it was. The edit form does not open on a read a strong mark calls stripped. A refused row never stays in the account cache. Residual risks: a snapshot-class account whose legacy profile is empty (hivemind shows nothing while the chain posting row holds old values) passes the count rule, and a write publishes those old values; and a blank read before this process has ever read the account's posting row (every read since the app started was stripped) with a legacy profile that still matches hivemind. The write starts from the posting profile, or from the legacy one (wrapped or at the root) while the posting profile has no keys; unknown keys and the wallet token list are kept (tokens cleaned of private fields, as the SDK). Signed with the posting authority (a metadata-onlyaccount_update2is a posting operation on chain). - Known limit of the profile writes: a first posting write that changes nothing hivemind shows (pin to blog on an account whose profile is still legacy only) cannot be confirmed through hivemind, so on blank reads it is refused for 3 minutes and after that the account counts as legacy again; against a node that keeps stripping the row, the next write would then start without that pin.
- Scrolling header (#3734, a deliberate difference from RN profileView, which toggled the summary, the owner's request after Instagram and X): the summary is the first row of the tab's list and scrolls away with it, one to one with the finger; nothing opens or closes by itself, so nothing jumps. The tabs are the next row and pin once they reach the top: on Android a sticky header that stops under the compact bar (back, avatar, name), which fades in over the cover as the summary goes under it (the open summary keeps its edge to edge cover;
ScrollingHeaderUi.kt); on iOS a pinned section header under the navigation bar, the user fading into the bar once the summary has gone (read from the stack's offset,reportsHeaderGone, since the lazy stack unloads the summary row). A tap on the user in the bar, a reselected tab and the scroll to top go back to the summary; reaching the top by hand shows it, a scroll up mid-list does not. A tab switch with the summary gone keeps the tabs pinned and starts the new tab at its top (iOS scrolls to a marker row of its own,profile-summary-end: the lazy stack unloads the summary row far down, and an id inside it is not found). A short tab still has a screen of rows under the summary: a filler row at the end of the list (PinFilleron both apps; AndroidScrollingHeaderUi.kt) is as tall as the rows fall short, so the tabs stay pinned. Loading rows do not count, as the first page replacing them may be shorter; during a tab switch the filler is a screen tall until the new tab's rows are laid out; on iOS it follows the window's height too. Android's empty and error rows fill the list's height; the wallet row keeps its own height, however tall. Pull to refresh starts above the summary. The state lives in the screen's stack entry (the list state), so a post opened from the profile and back keeps the position. - Mute, unmute and follow update the app-wide ignore list (
env.setAuthorMuted, RNcurrentAccount.mutes): a mute drops the author from every open feed at once, the home, tag, community and profile feeds filter by the list, search results do not (as RN). - Bookmarks: Bookmarks, Favorites and Tags tabs over
format=wrappedpaging (old plain-array answers end paging), newest first, long press to remove after RN's confirm. - Account list (
AppScreen.AccountList, e.g. poll voters): search and "time ago" rows. - Golden vectors:
account_update2, ignore and unfollow inGoldenVectors.kt(hived bytes, SDK signatures);node tools/golden/generate-profile.mjs shared/src/commonTest/kotlin/com/ecency/core/api/ProfileMetadataFixtures.ktwrites the SDK's ownbuildPostingJsonMetadataoutput for synthetic edge cases (key order, integer keys, tokens, denied keys, numbers, escapes). - Differences from RN: RN sends
{account}/{bookmarkId}objects where the SDK expects a name or id (favourite add and remove, bookmark delete); here the fields are what the SDK documents. RN unmute uses the unfollow toast and keeps the muted view until a reload; here it says "Unmute success!" and updates. RN's deep link section selects index 2 (waves) after replacing the last tab; here the replaced tab is selected. Follow paging starts from the last name of the follow list and drops the node's repeated start row. The website opens only as http(s), andSafeTarget.httpUrlrefuses any link with userinfo ([email protected]) for every tap target. A long account list is saved with its first 200 rows; a bookmark row without an id cannot be removed. The image link entry in the profile editor is an addition to RN. The avatar has no interactive crop (centre square; RN shows a crop UI). - Debug: iOS
-fakeData YES -seedAccounts YES -openLink https://ecency.com/@spike-bob,-openScreen bookmarks|editProfile; Android--es openScreen profile:<user>|follows:<user>|bookmarks|editProfile(with--ez demoAuth true --ez seedAccounts truefor the signed-in screens).DemoAuthServicesanswers the profile area's Ecency API calls with synthetic data. - Tests: shared
ProfileMetadataTest,ProfileModelTest,SocialModelsTest,DigestEntriesTest,Gaps2Test(profile wallet),DigestModelTest(plus the golden vectors); AndroidProfileFlowsTest(scrolling header:theSummaryScrollsWithTheListAndTheTabsPinUnderTheBar,aScrolledProfileIsKeptAfterAPostAndBackAndATabSwitchKeepsTheTabsPinned,aShortTabStillPinsTheTabsUnderTheBar,aSwitchToAShortTabKeepsTheTabsPinnedUnderTheBar,aWalletTallerThanTheScreenKeepsItsWholeHeight),ScrollingHeaderTest(the filler and new cards on a bare list),GapsFlowsTest,WalletFlowsTest,LoginFlowsTest; iOSProfileTests,PinFillerTests,ProfileUITests(testTheSummaryScrollsWithTheListAndTheTabsPinUnderTheBar,testATabSwitchFarDownKeepsTheTabsPinnedUnderTheBar). The profile write guard's cases are inFeedxTest(profileGuard...,pinToBlog...,unpinFromBlog...) andSocialModelsTest(edit); the guard's refusal rules, the legacy fallback, the caller's use of the guard and the ignore list updates are each covered.
Communities and search
RN screens/communities, community, communityMembers, communitySettings, communityActivities, searchResult, tagResult and the dappBrowser home, on both apps over shared models (app/CommunityService.kt, CommunityModels.kt, SearchModels.kt). UI: Android ui/CommunityScreens.kt, ui/SearchScreens.kt (one entry, CommunityAndSearchScreen); iOS Screens/CommunityViews.swift, Screens/SearchViews.swift.
- Operations:
api/broadcast/CommunityOps.ktbuilds every hivemind community op (subscribe, unsubscribe, setRole, updateProps, pinPost/unpinPost, mutePost/unmutePost, muteUser/unmuteUser, flagPost) as postingcustom_jsonidcommunity,jsonbyte-identical to@ecency/sdk(golden vectors:node --experimental-strip-types --no-warnings native/tools/golden/generate-communities.mjs native/shared/src/commonTest/kotlin/com/ecency/core/api/community/CommunityGoldenVectors.kt(from the root of a checkout of thern-3.x-finaltag, where the app is undernative/); offline, also covers the search query builder and RNpostUrlParser). Broadcast throughenv.signingonly. The post menu usesenv.communities.pinPost / mutePost / muteUser / flagPost(suspend,AppExceptionon failure, CANCELLED for a closed prompt) and theModNotesSheeton both apps for the required reason (not blank, 120 code points, as hivemind asserts;CommunityOpsrefuses anything else). On an account change the screens drop what the previous observer was told (join state) before they reload. - Reads (
api/community/CommunityApi.kt, SDK parameters):bridge.list_communities(querynullwhen empty),get_community(observer always sent, "" when none),list_all_subscriptions,list_subscribers(100 a page, nolaston the first page),account_notifications(the string id cursor back as sent),condenser_api.lookup_accounts(refused locally over 16 UTF-8 bytes),get_trending_tags(RN only uses it in the waves tag picker; data layer only). env.communities(one per app): the account's subscriptions sorted by title, a join or leave wins until hivemind agrees (a fetched community's observer context next, then the list), RN toasts ("Subscribe success!", "Leave failed!", ...), one change per community at a time, reset on account change.- Screens: Membership / Discover (top 50 by rank); community page with RN's Details card (description, stats, Join, New Post and Newsletter; the Newsletter chip opens the digest sheet, see Profile), TRENDING / HOT / NEW feeds and, for owner/admin/mod (team role, not subscription), the manage sheet; members (team then subscribers, community account dropped, sorted by role, editable per SDK
roleMap, assign any existing account withAccountLookupModel, the row patched after a successful setRole because hivemind lags; hivemind drops a setRole it does not accept without an error, soCommunityRole.setRoleRefusalapplies the rules of hivemind'scommunity_set_role(hive/db/sql_scripts/community.sql) first, in its order and wording: mods and up only, never to or above the actor's own rank, an owner's role never changes, another account must be below the actor and really change, at most 100 accounts at mod or above;get_community_contextis asked for an account that is not on the roster); settings (owner and admin edit, others read only with RN's notice, RN's required fields plus hivemind's_read_propslimits in code points: title 3 to 20 and no @ or # first, about 120, description and rules 1000, language from hivemind's list; trimmedupdateProps); activity log (50 a page, mentions tappable). Signed out the screen opens on Discover once the stored session was read (there is no Membership;CommunitiesModel.opensOnDiscover, #3704). Pull to refresh on it (both lists) and on the profile keeps its spinner until the read ended (refreshAndWait, iOS.refreshableawaits it, AndroidPullToRefreshBoxshows it; #3704). - Search: posts (search API, posts by default, RN filters sheet: author, category, tags, type, date, sort, validated like the API; a pasted post link shows that post; nothing typed shows @ecency's latest 7), people (
lookup_accounts), groups (communities by rank). The topics tab stays out, as in RN. Tag screen:#field (1 s debounce) over the tag's three feeds.AccountLookupModelis the reusable account autocomplete (editor mentions later). - Search requests (
POST {host}/search-api/search) carry the SDK's client headers and go throughenv.auth.http. That transport names the app on every call to Ecency's own hosts (see "Transport and timeouts") with the build's user agent (ECENCY_USER_AGENTorecency.userAgentinlocal.properties, see docs/release-builds.md; a generic default otherwise). - Explore: RN's dApp directory, plus HiveGrove after Rising Star, and the URL field (
Dapps, RN URL normalization). Opening a dApp or URL opens the dApp browser with the Hive signing bridge (see "Platform features"). - Navigation: typed
AppScreen.Communities,Community(name, filter),CommunityMembers,CommunitySettings(needs an account),CommunityActivities,Search,TagResult(tag, filter),Explore; tag and community links and card taps open the tag and community screens (NavEntry.feedScreen). Debug launch: Android--es openScreen route:COMMUNITY:hive-125125, iOS-openScreen route:COMMUNITY:hive-125125(any route name and argument); iOS-fakeDataanswers the community calls and search offline. - Community page: the Details card is the feed's first row and scrolls away with it, the TRENDING / HOT / NEW tabs pin under the top bar (the profile's scrolling header, #3734); its title still opens and closes it (RN CollapsibleCard). Each tab keeps its own list: another tab picked with the card gone starts at its top with the tabs pinned, even one read further down before; with the card showing, the new tab shows it where it was. Back from a post, the feed keeps its place (iOS applies the pinned start once per list). New cards on top with the tabs pinned show right under them.
- Moderation sheets: the manage sheet, set role and the mod notes of the post menu's mute and unmute share one layout, RN communityRoleEditSheet's (Android
ModerationSheet/ModerationRowinui/CommunityScreens.kt, iOSModerationSheet/ModerationRowinScreens/CommunityViews.swift): centred title, the account or post it acts on, the rows, Cancel. The notes confirm row stays disabled until a note is typed; Cancel never broadcasts. - Differences from RN: only the visible search tab loads (RN ran all three); RN closed the community Details card on any drag and opened it only by its title, here it scrolls with the feed and its title toggles it; the manage sheet has a Cancel row (RN closes it by backdrop, swipe or back only), as the set role sheet does; highlights are literal, case-insensitive matches (RN's highlighter took the text as a regex); RN's custom community tabs and the tag follow button (bookmarks area) are not here; set user title has no RN UI and no SDK builder, so none here.
- Tests: shared
CommunityOpsTest,SearchQueryTest,CommunityApiTest,CommunityModelsTest,SearchModelTest,CommunityNavigationTest; AndroidCommunityFlowsTest(Details card scrolling with the feed, tabs pinned, a tab read down before, a short feed, manage Cancel),FeedxFlowsTest(mod notes); iOSCommunityTests,CommunityUITests(a scrolled feed keeps its place after a post and back),FeedReadingUITests.testModNotesNeedANoteAndCancelCloses. The disabled notes row is covered.
Editor and publishing
RN screens/editor, components/markdownEditor, editorElements, uploadsGalleryModal, snippetsModal, beneficiarySelectionContent, pollsWizardModal, screens/drafts and utils/editor.ts, on both apps over shared code. Pure logic: shared/.../core/editor (Slug, EditorFormats, EditorMeta, EditorTags); REST: api/ecency/EditorApi.kt, ImageUpload.kt; models: app/EditorModel.kt, EditorSideModels.kt, DraftStore.kt. UI: Android ui/EditorScreens.kt, EditorPlatform.kt; iOS Screens/EditorViews.swift, App/EditorPlatform.swift.
val editor = env.editorModel(EditorArgs(EditorKind.NEW_POST)) // or AppScreen.Editor.of("hive-125125" | "author/permlink" | "reply:a/p" | "draft:<id>" | "template:<id>")
editor.start(); editor.setTitle(t); editor.setBody(text, TextSelection(start, end)); editor.setTagInput("photo ")
editor.bold(); editor.insertLink(label, url, EditorFormats.LinkType.PLAIN); editor.setPreview(true)
editor.submit() // after the UI's "Are you sure?"; state.done tells the UI where to go
editor.flush(); editor.leave()
env.uploadsModel(editor).upload(listOf(PickedImage(bytes, name, mime, w, h)), insert = true)
env.draftsModel(tab); env.snippetsModel(); env.communityPickerModel()
- Operations: a new post is
comment+comment_options(always both, as the SDK'suseCommentbuilds them for RN), a reply and every edit onecomment.json_metadatais RN'sextractMetadata+makeJsonMetadata(JS property order kept withJsValue):links,links_meta,image(thumbnail first, 10 max),image_ratios, the poll fields,type,tags,app,format; an edit merges over the post's own metadata and keeps itsapp. An edit's body is the diff-match-patch patch when it is shorter than the old body in UTF-8 bytes, else the full body. Permlinks are a port of speakingurl 14.0.1 plus RN's rules (5 words, random suffix when taken). All broadcasts go throughenv.signing. - Golden vectors (RN's own TypeScript, speakingurl and the SDK run offline; RN sources load through
tools/golden/rn-hooks.mjs, which compiles them with the app's TypeScript and stubs React Native):
# from the repository root (npm ci --prefix tools first)
node tools/golden/generate-slug-data.mjs shared/src/commonMain/kotlin/com/ecency/core/editor/SlugData.kt # when speakingurl changes
# from the root of a checkout of the rn-3.x-final tag (it runs the RN app's own sources; the app is under native/ there)
node --no-warnings native/tools/golden/generate-editor.mjs native/shared/src/commonTest/kotlin/com/ecency/core/editor/EditorGoldenVectors.kt
- Never losing text: every change is written to the local draft 300 ms later (
LocalDrafts: one private file per account and slot, the key hashed into the file name), at once when the app leaves the foreground and when the screen goes away. The navigation only saves ids, so after process death the editor screen comes back and reads its local draft. Leaving a new post saves a server draft (RN), a reply stays a local draft (shared with the quick reply sheet, whose uploaded image is saved with it asreplyImage, apart from the text, written when it is attached or removed; the reply editor and the sheet's expand put it in the body), a failed publish keeps everything. A save refused because the account left shows no "Could not store the draft on this device" error. Expand waits while an image is being picked or uploaded. - One publish, never two, and never a silent edit: the first attempt's permlink is kept in memory and in the local draft together with a hash of exactly what was sent (
PendingPublish: parent, title, body; several hashes when the same permlink went out with changed text). A retry asks the chain itself throughPendingCheck(HiveApi.content,database_api.find_comments: the chain state the node holds, not hivemind's indexer, though a node may still answer a moment behind its head, so a retry also relies onPendingPublish.canStillLand; it is the one "is this permlink on chain, and with which body" read, and the editor's permlink check, its pending publish, the reply composer and a wave's retry all use it). Only an answer that lists the comments and does not hold the post means "not on chain"; an answer without the list sends the check to the next node, and an error, or no node giving the list, stops the publish, so a permlink the nodes know as taken is never published over (a post of the same account published elsewhere moments before can still be missing from a node that answers behind its head; a pending publish of this editor is covered byPendingPublish.canStillLand) (ChainContentTest,EditorModelTest.aPermlinkCheckTheChainDidNotAnswerNeverPublishes). Notcondenser_api.get_content: the nodes serve it from hivemind now, which lags the chain and answers a missing post with an assert:- on chain with the content the editor holds: published, nothing is sent;
- on chain with content that was sent, and the editor now holds something else: the user is asked "Your post was already published. Update it, or publish this as a new post?" (
publishConflict,resolvePublishConflict). Update is onecommentwithout options; new gets a fresh permlink; - on chain with content that was not sent from here (the post was edited elsewhere): asked as well, "A post already exists at this link and differs from what you sent. Update it, or publish as new?";
- not on chain: the same permlink again (same signed transaction while the text is unchanged). With changed text the permlink is kept only while the first transaction could still land (2 minutes), and after such a send the chain is read again: when it holds another version than the one just sent, the user is told and asked.
A new permlink is always checked against the chain (never hivemind, which lags) and is never the pending one; a new post's permlink that is still taken after five regenerations is refused ("change the title"), never used. Tags are part of what is compared. A clock that steps backwards keeps a publish pending.
The pending publish is forgotten by Clear, by opening another draft and after 24 hours. Replies follow the same rule in the editor and in the quick reply sheet (
ReplyState.conflict), which share one draft slot and format.
- Edits: a recovery copy remembers the post's
updatedtime. A copy made from the version on chain comes back by itself; one made from an older version is offered ("Restore unsaved changes?"), never applied. Submitting re-reads the post and refuses when it changed since the editor opened, so a patch never reverts someone's newer edit. - Cleanup and privacy: local drafts live in one folder per account (names hashed). Logging an account out clears its drafts, reply drafts and recovery copies; a wipe (third wrong PIN, forgot PIN, log out of all) clears every account's, plus Android's camera temp files. The folder is excluded from backups (iOS
isExcludedFromBackup, Android backup and data extraction rules; Android's cache folder is never backed up). RN keeps drafts after logout; this app does not. - Posting authority for scheduling: when
ecency.appis missing from the posting authority the app asks first, then builds the SDK's grant (api/broadcast/PostingGrant.kt,account_updatewith the posting authority only) from an account row read at that moment (two reads made then must agree on every key and account with its weight, the threshold and the memo key; the newer of the two is used). It adds the one account auth and keeps every key and account auth with its weight, the threshold and the memo key, written in hived's order (accounts by name, keys by key bytes; the serializer sorts too). The grant is refused when the row does not look like a complete account (no owner or active authority, unknown fields, unreachable threshold, bad keys), when a key account's own posting key is not in it, or when it disagrees with the authority read a moment before. Signed with the active authority through the auth upgrade.OperationJson.decodeOwnis the only decoder that accepts it; links (canDecode) still cannot ask for authority changes. Vectors:node tools/golden/generate-grant.mjs shared/src/commonTest/kotlin/com/ecency/core/api/GrantGoldenVectors.kt. - Account ownership: an editor, its uploads and its drafts belong to the account that opened it.
submitrefuses when another account is signed in, saves and upload signatures name the owner, local draft keys carry the account, and an account change takes editor and drafts screens off the stack (requiresLogin). - Uploads: Android system photo picker (5 at most), a files fallback, camera through a
FileProvider, paste from the clipboard; iOS PHPicker, files, camera, paste. Images are read and resized off the main thread and never decoded at full size (Android subsampled decode, iOS ImageIO thumbnail after a file size and pixel count check). Every still image is written again without its metadata (no EXIF GPS, device or time, no XMP), with the EXIF orientation applied to the pixels (all eight values): over 1920 px becomes a 1920 px JPEG at quality 85, HEIC becomes JPEG, a PNG within 1920 px stays a PNG. A GIF goes as it is (re-encoding would drop the animation; GIFs carry no EXIF, comment and XMP blocks are not removed), 30 MB at most. An animated WebP is re-encoded like any other still image, so it loses its animation (first frame, as a JPEG). A camera capture's temp file is deleted once read or cancelled; Android keeps the capture uri across process death. The url the host answers with must be a clean https url on the image host before it reaches the body, and file names in placeholders are reduced to safe characters and made unique. The upload goes to<image host>/hswith the token inAuthorization: Bearer <token>(not RN, which put it in the path,/hs/<token>, where logs and crash breadcrumbs record it; imagehoster#84, @ecency/sdk 2.9.7). The token is RN'ssignImage(posting key message, or the access token for HiveSigner, HiveAuth and active key accounts), and crash reports redact a token still found in a/hs/<token>path (CrashScrubber;/hs/@author/permlinkis a tag route and stays). Uploads keep RN's retries (502, 503, 504, timeouts, network errors, twice), progress and cancel. The body shows RN's "Uploading..." placeholder until the url replaces it; a failed or cancelled upload takes its placeholder away. - Fake-data and test runs never reach the image host: the transport is
ImageUploadTransport.refusing()unless an app sets one; debug fake-data runs useImageUploadTransport.demo(). - Debug: iOS
-fakeData YES -seedAccounts YES -openScreen editor | editor:draft:demo-d1 | drafts; Android--es openScreen route:EDITORorroute:DRAFTS(with--ez demoAuth true --ez seedAccounts true).
What the editor does
Editor modes
- New post (optional community from the caller, preset tags)
- Edit post: patch or full body, metadata merged over the old, no
comment_options - Reply and edit reply in the editor (parent summary on top). Entry points as RN: the action bar and comment reply buttons open the quick reply, whose expand button continues in the editor; the post menu's "reply" opens the editor. The reply editor's account tile opens the accounts sheet; the reply opens again for the account switched to (
ReplyAccountHandoff), starting from the text that was there unless that account has its own draft of it. - Open a draft by id; "DRAFT" button for the most recent remote draft; local id-less draft first
- Template drafts: apply as a new post, "Save as template"
- Cross post is not in RN's editor (post menu, built in the feed area).
Markdown editing
- Toolbar: text format row (bold, italic, table, link wrap), insert link sheet, snippets, poll, image gallery, clear. Order: text format, Image, Video, AI Assist, Snippets, Link, Poll (new top-level posts only), Translate, Clear. The buttons are icons on both apps (owner 11-13, as RN's
editorToolbar:AppIcon.TEXT_FORMAT,IMAGE,VIDEO,AI_ASSIST,SNIPPETS,LINK,CHART_BAR,TRANSLATE,DISCARD), each named for TalkBack and VoiceOver (EditorFlowsTest.theToolbarButtonsAreIconsNamedForTalkBack,EditorUITests.testTheToolbarButtonsAreNamedForVoiceOver); the format row it opens (B, I, Table, link) stays text. The first four are on screen without scrolling on a 320dp Android phone at any text size (a long press shows the name in a tooltip at the full text size) and on a 375 point iPhone at the largest text (the icons stop at the first accessibility size, the large content viewer shows the name beyond). AI Assist is the editor's single AI hub: the image generator and dictation have no toolbar buttons and open from an "AI tools" group of cards above the actions in the AI Assist sheet (as RN's quick post composer does for the image card; locked while an assist run is running or has no answer yet, since leaving closes it), each sheet with its own prices, gating and charging unchanged (the image card names no starting price as RN's does: opening the hub asks no image price, the generator shows its cost before anything is charged).EditorFlowsTest.theToolbarLeadsWithTheWritingToolsAndAiAssistIsOnANarrowScreenAtLargeText, iOSEditorUITests.testTheToolbarLeadsWithTheWritingToolsAndAiAssistIsOnANarrowScreenAtTheLargestText. - Selection-aware insertion and caret placement as RN's
formats/*(golden against the RN sources) - Preview through the native renderer (title, tags, body, poll); mentions, links and images open as in a published post, as RN's preview did with its PostBody (tester report, #3676:
EditorFlowsTest.linksInThePreviewOpenAsInAPost,EditorUITests.testAMentionInThePreviewOpensTheProfile) - Words count, caret restore per local draft, sweep of dead "Uploading..." placeholders
- Username suggestions for
@mentions - Compose translate (RN
composeTranslateModal,translateMarkdown.ts,translation.ts,emojiStrip.ts;editor/TranslateMarkdown.kt,app/ComposeTranslateModel.kt). Read from the code: the sheet needs 30 characters of plain summary (first 2000 raw characters, 600 of the summary); the source is guessed on the device and defaults to English, the target is English, or for an English draft the app language (Spanish when that is English or unknown); choosing a source resets the target, and the target list never holds the source. Translate sendsPOST <translate host>/translate {q, source, target, format: "text", api_key: ""}once per request, one after another: blocks split on blank lines; code fences (also unclosed), blocks that start with<, GFM tables, rule-only, image-only and URL-only blocks are not sent; plain paragraphs are batched up to 1500 characters; a block with heading, quote or list markers goes line by line with the marker put back; longer text is chunked on whitespace. Emoji are cut out of each request and appended to its answer. As in RN, Translate sends the unpublished draft's text to the translate host when the button is tapped. Any failed request fails the whole run ("Translation failed. Please try again."), nothing partial is kept, and a run for another language pair or a closed sheet is dropped. Apply appends\n\n---\n\n## <target name>\n\n<translation>to the body as it is then, caret at the end, and[EN | ES]to the title when the box is ticked and the title is not blank. Free. Golden:node --no-warnings native/tools/golden/generate-translate.mjs native/shared/src/commonTest/kotlin/com/ecency/core/editor/TranslateGoldenVectors.kt(from the root of a checkout of thern-3.x-finaltag, where the app is undernative/) (RN's sources with a stand-in translator). Differences: the guess is this app's script and function word heuristic, not franc, so fewer languages show "Detected"; the heading is the English language name (RN asksIntl.DisplayNamesfor the name in the target language, which Hermes does not have, so RN writes the English name too); the title marker must fit the title field's 250 characters (RN allows 255 in all, a title its own form then refuses to publish); a retired run is cancelled at once (RN lets the request in flight finish) - AI assist (RN
aiAssistModal, SDKuseAiAssist;app/AiModels.kt,app/PaidCalls.kt,api/ecency/AiApi.kt). Read from the code: five actions (improve, suggest_tags, generate_title, summarize, check_grammar); prices fromPOST /private-api/ai-assist-price {code}(cost,free_remainingper action) and the balance fromPOST /private-api/points {username}are both on the sheet before anything runs; the text field starts with the body (10000 characters at most) and needs 50 characters for improve and grammar, 100 for the others; there is no confirmation step, "Run AI Assist" charges. The SDK sendsPOST /private-api/ai-assist {code, us, action, text, idempotency_key}with a new random key on every call, the app's mutations never retry (retry: false), and every error but 402, 422 and 429 is "Something went wrong. Please try again." (a 409 and a timeout included); "Try again" goes back to the form. Apply: a body action replaces the whole body and setsai_tools.writing_edit, a title is set, tags replace the tags. Server (ePointsai_assist.py, read from the repository): the points are taken before the model runs; the same key within 24 h answers 200 with the stored result, or 409in_progress(retry_after: 5) while the first request is still running; 402, 429, 400 and a 500server_errorcharge nothing; a 500generation_failedwas refunded; 422 is charged and not refunded - AI image generator (RN
aiImageGeneratorScreen, SDKuseGenerateImage;AiImageModel). Read from the code: a prompt (1000 characters; the post's title is offered as one), 7 aspect ratios (4:3 first), the server's power tiers when there is more than one;POST /private-api/ai-generate-price {code}gives the base cost per ratio and a multiplier per tier, cost = base times multiplier; balance and cost are on the screen; no confirmation step, "Generate Image" charges; the request isPOST /private-api/ai-generate-image {code, us, prompt, aspect_ratio, power, idempotency_key}; RN passes no key, so the SDK makes a new one per call, and RN shows its generic failure for the SDK's HTTP 202 ("paid, delivery pending, retry with the same key") and for a timeout. Insert puts the image at the caret and setsai_tools.media_generation. Server (ePointsai_image.py): 202delivery_pendingand 409in_progressboth mean the request with this key was taken and paid, and the same key fetches it (retry_after: 5); refusals as for assist, plus 429daily_limitand 503ai_unavailable(nothing charged). Presented as a sheet over the editor, and as a screen of its own on theAiImageGeneratorScreenroute (AppScreen.AiImageGenerator,env.aiImageScreenModel()): as RN's screen withoutonInsertit offers Share and Generate Again only, the account signed in when it opens pays, and its unanswered request waits under its own place (paid:image:standalone) - Dictation (RN
dictationModal,useDictationRecorder, SDKuseAiTranscribe;app/DictationModel.kt, AndroidDictationPlatform.kt, iOSApp/DictationPlatform.swift). Read from the code: AAC in an .m4a file, timed on the wall clock, stopped by itself one second before the server'smax_seconds;POST /private-api/ai-transcribe-price {code}givesunit_seconds,unit_cost,free_remaining,max_seconds; the sheet shows the rate, then the running cost (started units, minus the free ones), and Stop uploads and charges at once, with no confirmation: a multipartPOST /private-api/ai-transcribewithcode,duration_ms,idempotency_keyandaudio(nous). One key per clip, kept in memory across "Try again" after any error and dropped on success, on an empty transcript and when the sheet closes. The transcript replaces the selection at the caret, after one space unless the text before it is empty or ends in whitespace (not "appended"); the sheet stays open ("Record more") and a swipe down (Android also back or the scrim) closes it, never while a transcription runs; unlike RN it has no Done button (owner 12-01: it only closed the sheet). RN's sheet shows no balance. Server (ai_transcribe.py): same key rules as assist (200 replay, 409in_progress) - 3Speak video upload (RN
speakUploaderModal,providers/speak,speakQueries;api/speak/Tus.kt,SpeakApi.kt,app/VideoUploadModel.kt, AndroidVideoPlatform.kt, iOSApp/VideoPlatform.swift). Read from the code: the toolbar's video button refuses a second video ("A post can contain only one video..."); the picker gives one video; five frames are cut at the middle of five equal slices (10 s stands in for an unknown duration), the middle one is the default thumbnail and another image can be picked instead;POST <ecency>/api/threespeak/upload-token {owner, isShort, code}answers{token, upload_url, permlink, embed_url}; the file goes toupload_urlorhttps://embed.3speak.tv/uploadswith tus (Authorization: Bearer <token>, metadatafilename, chunks of 5, 10 or 20 MB by size, three parallel parts over 10 MB, retry delays 0, 3, 5, 10, 20 s); an older backend without a permlink is uploaded in order and read from the creation'sX-Embed-URLheader; then the thumbnail goes through the normal image upload andPOST /api/threespeak/thumbnail {permlink, thumbnail_url, code}(not critical); the bare embed address is inserted on a line of its own and the thumbnail joinsmeta.imagewhile that exact address is in the body (collectVideoThumbUrls, restored for a draft with exactly one video). RN has no size limit of its own (3Speak answers 413 over 1 GB) and limits the duration only for shorts (60 s, the wave composer). Toasts for 413, 429, 503, 401/403 and a generic one. Here: the tus client is this app's own, over the shared HTTP seam (so the build's user agent, which the transport adds for ecency.com hosts only, never reaches 3Speak): creation, PATCH pieces of 2 MB in order (no parallel parts), the server'sUpload-Offsetchecked on every answer (it must move forward and not past what was sent), HEAD after any failure and before a continued upload, a piece counts as stalled only when no byte went out and no answer came for 60 s (10 minutes at most a piece), creation carries no body and no content type and the one metadata field RN sends (filename), RN's retry delays, cancel. A failed upload keeps its place in the editor screen's model: "CONTINUE UPLOAD" asks 3Speak how far it got and goes on with the same token, or starts over with a new one when the upload is gone; another account never continues it. The upload endpoint and aLocationmust be on 3speak.tv, the embed address must be a 3Speak embed. Android: the shared media picker (see Media picking), the file is copied into the app's cache and read in pieces from there, frames withMediaMetadataRetrieveroff the main thread. iOS: PHPicker (videos), the lent file is copied totmp/video-uploadand deleted after the upload, frames withAVAssetImageGenerator. Android's photo sweep (an hour) never deletes a recording; a recording is deleted by the upload model that holds it, and every leftover goes at the next cold start, so "Continue upload" is an offer of this run; if the file is gone all the same, the upload ends with "This recording is no longer available on the device..." and no offer to continue. Video files go up as they are on both apps, as in RN: their metadata (location, device, time) is not stripped; only the thumbnail frame is re-encoded without any. Video in the wave composer: see "Waves and Shorts" - 3Speak uploader, the rest (RN
speakUploaderModal,uploadsGalleryModal_handleOpenCamera,quickPostModalContent_openVideoCamera). Read from the code: "Record Video" isImagePicker.openCamera({mediaType: 'video'}), the system camera UI with no length or quality option, and the recording then takes the same path as a picked video (the 60 s check for shorts included); the pencil on the current thumbnail opens the photo library for one image (_handleOpenImagePicker), which replaces the frame and is uploaded by the samesignImage+uploadImagecall (RN sends the picked file as it is); the preview is<Video repeat resizeMode="contain" paused={isUploading} volume={0}>over the local file, one per open uploader. Here:- Record: a second "Record Video" while the camera is open answers
Start.BUSYand launches nothing (the sheet says "A recording is already in progress..."). A recording is tagged with its screen kind plus an id of the editor or composer instance (saved with the screen), so it never lands in another editor of the same account. An account change drops and deletes the recording still open in the camera app too, and whatever the camera writes afterwards is deleted when its result arrives (also after a new process). Android asks the camera app (ACTION_VIDEO_CAPTUREthroughActivityResultContracts.CaptureVideo) to write intocache/camera/capture_<time>.mp4through the editor'sFileProvider, so the app needs no camera permission. The launcher belongs to the activity, not to a screen, andVideoCaptureskeeps what is open (uri, account, asking screen) in the activity's saved state: the result finds its recording after the app lock covered the screen or the process was recreated. iOS presentsUIImagePickerControllerin video mode and moves the recording into the app'stmp/video-uploadat once; the usage texts for camera and microphone name video. Without a camera (the simulator, a device without a camera app) the button says so. - A recording belongs to the account and the screen that started it: it is handed over once, only to that screen, only while that account is signed in; for anyone else it is deleted.
- No temporary file stays: a cancelled or empty recording is deleted when the camera closes; one that was not taken is deleted by the next recording, by an account change and at the next cold start; one that reached the upload is deleted by the upload model (
PickedVideo.letGo) when it is uploaded and placed, replaced by another video, refused (too long, empty), when the sheet is closed without an upload, and when the editor or composer goes. A failed upload that can still be continued keeps its file until then. On iOS the same hook deletes the app's copy of a picked video, so the editor and the wave composer never delete each other's file; the folder is emptied at app start. - Thumbnail: the picked image goes through the existing preparation (decoded and written again without EXIF or XMP, orientation applied, 1920 px) and the existing signed image upload; choosing a frame again drops it.
- Preview: one player (Android Media3
ExoPlayer, iOSAVQueuePlayerwith a looper) over the local file, looping, muted, fitted; it plays only while no upload runs, the app is in front and the app lock is open (VideoUploadState.previewPlays, the lifecycle or scene phase), and it is released when the sheet goes (on Android nothing is composed under the lock, so it is released there too). - Differences: RN keeps a recording in the picker library's cache until the system clears it; RN's uploader keeps the picked video when it is closed, here closing the sheet forgets a video that was never sent (a failed upload keeps its place). A recorded video's file goes up as it is, as in RN: its metadata (location when the camera app writes one, device, time) is not stripped
- Record: a second "Record Video" while the camera is open answers
- RN has no undo and no heading, list, quote or code buttons; neither has this (the system undo of the text fields works)
Fields and options
- Title, tags (RN's rules, toasts and the 7 warnings in order), community select with the posting restriction
- Layout with the keyboard up: the community row, title and tags (a reply's parent summary and account tile) scroll in one container with the body, which is at least as tall as the visible area; the words count and the quest chip (one row: chip leading, count trailing, the chip truncating at large text; Android moved the count there from the top bar), mentions and the toolbar stay under it, above the keyboard. RN keeps title and tags fixed above a body input that scrolls on its own, which left a few lines on a small phone (tester: "Window for editing drafts much too small"); deliberate difference.
- The title is at most three lines high and scrolls inside past that (Android
maxLines, iOSlineLimit(1...3)), so a long title typed first with the keyboard up leaves the body on screen (user report, Galaxy S25: a 250 character title took eight lines and left none of the body). RN's title grows without a limit; deliberate difference.EditorFlowsTest.onAPhoneALongTitleStopsAtThreeLinesAndLeavesTheBodyOnScreen, iOSEditorUITests.testALongTitleStopsAtThreeLinesAndLeavesTheBodyOnScreen(its body check skips on a simulator without the on screen keyboard). - The body moves to the top when the keyboard comes up over it, or when it takes the focus with the keyboard up; once a focus, so a title scrolled back to stays where it is. A keyboard that goes down and comes back while the body keeps the focus (iOS 27 hides and shows it again as text is typed into a just focused body, and the scroll view goes back to the title meanwhile) moves it up again (
EditorUITests.testTheBodyFocusedFirstMovesUpAndTheToolbarStillTakesTaps, #3677). While typing the caret is kept on screen; back from the preview the caret is shown again. - iOS (
BodyTextView): up to 10,000 UTF-16 units the text view grows with its text and the outer scroll view follows the caret; above that it is as tall as the visible area and scrolls itself, and a drag that reaches its top or bottom goes on in the outer scroll view, so the title stays reachable (it grows again below 8,000). A text view that does not scroll lays out all its text on every key: on the simulator about 12 ms a key at 10,000 units and about 400 ms for a 50,000 word draft, against 12 ms for a scrolling one. The keyboard counts from its frame notifications when it covers more than 150 points of the window (the hardware keyboard's bar does not); after a width change (rotation, fold, pane) with the keyboard up, a body left at the top goes there again.BodyTextViewTests,EditorUITests.testWithTheKeyboardUpTheTitleAndTagsScrollAwayWithTheBody,testTheBodyFocusedFirstMovesUpAndTheToolbarStillTakesTaps(both skip on a simulator that hides the on screen keyboard for the Mac's keyboard),testComingBackFromThePreviewShowsTheCaret,testTheQuestChipAndTheWordsCountShareOneLineAtTheLargestText. - Android: the body is Android's own EditText in Compose (
BodyEditText, as RN's editor was). Compose's text field laid out and drew its whole text on every key, so a long draft lagged: at 8,000 characters on an M1 emulator, release build, 17 ms of layout and 33 ms of drawing a key, both growing with the text; the EditText relays out only the paragraph that changed and redraws only the blocks that changed (drawing 3.9 ms a frame on the same draft). So the body always grows with its text, with no bounded mode for long drafts (EditorFlowsTest.aLongBodyGrowsWithItsTextAndKeepsTheCaretOnScreen). The model's edits (formats, inserts, a draft that loads) go in at eachbodyRevision; typing and selection go toEditorModel.setBody. The focused EditText keeps its caret, and a selection handle being dragged, in view itself: it asks its parents for that point and Compose scrolls the column to it, so a selection follows a handle dragged past the window's edge (tester report, #3679:aSelectionEndMovedOutOfViewScrollsTheEditorToIt); a draft opens at its title whatever its restored caret (aLongDraftOpensAtItsTitle). When the keyboard comes up over the focused body, or the body takes the focus with it up, the body goes into view, its top to the top (whenTheKeyboardComesUpTheFocusedBodyMovesToTheTop, faked IME insets). Tests reach the field through Compose semantics (set text, insert at the caret, select, focus), hidden from accessibility, so TalkBack reads the EditText itself.EditorFlowsTest.onAShortWindowTheTitleAndTagsScrollAwayWithTheBody,comingBackFromThePreviewShowsTheCaret,atLargeTextTheQuestChipTruncatesAndTheRowStaysOneLine.
- The title is at most three lines high and scrolls inside past that (Android
- Composer tags (
EditorTags.input,EditorModel.setTagInput): a typed tag leaves the field with the keystroke that made it a chip. On iOS the field is aUITextField, because a SwiftUITextFieldbound totagInputnever showed the model clearing the text it had just set inside its own setter (the next key would parse the old tag again): UIKit applies every edit (composed characters and emoji included),editingChangedhands the result to the model, and the model's text replaces it with the caret kept the same distance from the end. Shared guard for any field that lags a frame (Compose can too): the text that already became chips (TagInputResult.consumed) is dropped from the next value instead of being parsed again; it is forgotten once the field shows the model's text (tagFieldShown: Android after each composition, iOS after setting the field), and on a removed tag or a cleared editor, so a duplicate typed or pasted into the cleared field is always RN's toast. A real duplicate is one RN toast, nothing added, the field cleared; more than 10 tags keep RN's warning. iOS also adds a tag on losing focus (RNonEndEditing, as Android already does) - Post options: schedule, reward with "Set Default", reblog for community posts, thumbnail, short description; "Later" alone schedules the post for an hour from now, to the minute, until another time is picked (#3701: it published at once until the date changed;
EditorFlowsTest.laterSchedulesThePostWithoutOpeningThePicker,EditorUITests.testLaterSchedulesThePostAtTheTimeShown) - Beneficiaries: author row, add, remove, 3Speak row locked, "Support Ecency" chip, injection of the saved percent when the list was never set
- Poll: question, choices, end time, age, max options, interpretation, toggles; attach, update, reset
Publishing
comment+comment_options, permlink rules,json_metadata, reply and edit operations (byte-identical, golden)- Publish confirm, failure toast with everything kept, success toast, local draft cleared, "Post published" prompt, profile opens
- Reblog after publish (best effort, as RN)
- Schedule through
schedules-addwith options, grantingecency.appposting authority first when missing (confirmed, active key) - RC offer after an out-of-RC publish error (
RcErrors: RN's regex and copy; "Top up RC with Points" and "Boost account" open their routes, both placeholders) - RC precheck banner (RN
rcPrecheckBanner,useRcPrecheck,utils/rcPayload.ts; SDKestimateRcPrecheck,estimateCommentTransactionBytes,countCommentResourceUsage,priceRcUsage,computeResourceCost; heremath/UBig.kt,hive/RcCost.kt,EditorModel.rcPayload). Read from the code: 800 ms after the last change the editor builds the operation it would broadcast (a new post with itscomment_optionsand the beneficiaries the submit adds, a reply with the parent's tags and no options, an edit with its patch; image ratios left out) and prices it: transaction bytes (11 header, the operation count, one varint-prefixed field per string, 16 for the asset, 65 per signature), usage per resource fromsize_info, and per resource with a share((regen * share / 10000 * coeff_a) >> shift + 1) * usage / (coeff_b + pool) + 1, summed; the mana iscurrent_mana + elapsed * max_rc / 432000(not capped at the maximum, as the SDK); the banner ("This post may be too large to publish" / "Your resource credits look too low for a post this size." / "Top up RC with Points") shows when the mana is below 1.2 times the cost, never blocks the submit, and a tap opens the same offer a failed broadcast raises. Without any of the three node answers (rc_api.find_rc_accounts,get_rc_stats,get_resource_params) nothing is said.UBigis a minimal unsigned big integer (add, multiply, shift right, divide, compare, decimal and double conversion withNumber(bigint)rounding), becausecoeff_ais about 1e19. Golden:node --no-warnings tools/golden/generate-rc.mjs shared/src/commonTest/kotlin/com/ecency/core/math/RcGoldenVectors.kt(207 BigInt operations, 600 curve costs and 32 comment estimates from the SDK);RcPrecheckEditorTestalso checks that the estimate's byte count equals the app's own serialized transaction plus one signature. The account's RC and the stats are read once per editor, the curve parameters once a day - The wave composer's PUBLISH is off, and grey, while there is nothing to publish (
WaveComposeState.publishEnabled; RN'scanPublishis unchanged). - Quick reply toolbar (RN
quickPostModalContentin comment mode,_renderExpandBtn): under the reply text, the wave composer's row of buttons (AndroidQuickComposeTools, iOSQuickComposeTools; icons on both apps, as RN's, each named for TalkBack and VoiceOver:WaveComposeCopy): Image, Dictate and AI (improve, grammar, summarize), its own line on Android (then "Open editor" and Reply as before), under the text on iOS (expand stays in the bar); no poll and no video (RN shows those in wave mode only). One image a reply, uploaded for the composer's owner through the wave composer's attach (WaveImageAttacher,WaveUploadAttacherand its pickers), shown as a thumbnail with a minus badge (a tap removes it), sent as RN'stext\n\n (an image alone is a reply); Reply waits for the upload; RN's clipboard chip ("Image in clipboard · Paste image") too. Image opens the blog editor's image sheet, the one image flow of the app (see "Images" under "Editor and publishing"): its tiles (gallery, files, camera, paste) attach through the composer (ComposeReplyModel.attachFrom), and a tapped image of the account's uploads is the reply's image (ComposeReplyModel.pickUploaded), nothing is uploaded.ComposeReplyModelis anAiTextTarget(paidScope= the reply slot, shared with the editor's reply mode); expand writes the image into the body the editor continues (RNreplyMediaUrls). Deliberate differences: the image stays with the in-memory draft (RN also kept it in its reply cache across restarts), no long press paste on the image button (the chip does it), and the AI hub has no image generator here (as in the wave composer). The full editor's reply and edit modes keep the editor toolbar. Tests:QuickReplyToolsTest, AndroidReplyToolbarFlowsTest, iOSReplyToolbarUITests. - Quest chip on a new post (progress shown up to the goal, "Daily post 1/1" after three posts; RN prints "3/1", deliberate difference) (
POST /private-api/quests, RNderiveQuestChipState; tap opens Perks, a placeholder; closed for the run of the app) and the short reply hint (SDKearnsQuestContentCredit: more than 25 code points, links not counted) in the editor's reply mode and the quick reply sheet - Posting authority prompt ("Enable Faster Posting", RN copy and condition: HiveAuth, HiveSigner, or a key login without a posting key but with a token, and no
ecency.appposting authority). Grant uses the guarded grant above with the active authority; skip remembers nothing, as RN. The confirmation names@ecency.appand the active key (RN's three benefits and its security note stay) - Posting authority prompt after an
unauthorized_clienterror in the quick post paths (RNusePostSubmitter_promptPostingAuthorityRecovery,hive.tsisMissingEcencyPostingAuthorityError;app/PostingAuthorityFlow.ktAuthorityRecovery, inWaveComposeModelandComposeReplyModel). Read from the code: when the broadcast of a wave or a quick reply fails and the error says "permission to broadcast" (inerror_descriptionor the message, lower-cased), or its code isunauthorized_clientand it mentions ecency.app, RN opens the same prompt instead of an alert; "Grant Permission" grants and sends once more (isAuthorityRetry, so the retry cannot ask again and its failure shows as an error); "Skip for Now", a grant that failed or a prompt that was closed ends the publish without an alert and keeps the draft. The bareunauthorized_clientcode is not enough (HiveSigner answers it for an expired token too). Here the grant is the guarded one that scheduling uses (PostingAuthorityFlow.grant: built from two agreeing reads made now, active authority through the auth upgrade), the prompt is the editor's dialog, and it only grants and resends while the composer's owner is signed in. Golden:WavesGoldens.authorityErrorsfrom RN's function. Not built: RN's quick post also asks before the first send (shouldPromptPostingAuthority); here the quick paths ask after the refusal only (a HiveAuth account signs in its wallet as before) - Rating prompt (RN
maybeRequestReview,utils/storeReview.ts;AppRating,AppEnvironment.maybeRequestReview). Read from the code: asked for after a successful publish (editorContainer) and after a vote that went out with a weight other than zero (upvotePopover), never on their failure paths; once (hasRequestedReview), not before 3 days since first use and 5 app starts, 1.2 s after the action, one at a time (reviewRequestInFlight);hasRequestedReviewis only set whenStoreReview.requestReview()did not throw, so a request the store could not take is tried again at the next occasion. iOS asks StoreKit. Android asks Google Play's In-App Review (PlayReview:com.google.android.play:review2.0.1; it and what it pulls in are Java-only, no class carrieskotlin/Metadata, checked in the unpackedclasses.jarof each; the-ktxartifact is not used): the flow runs over the activity in front, nothing is asked for while the app is in the background, and a flow that failed (no Play Store) leaves the one request unspent, as RN. Play does not say whether its dialog was shown (it has its own quota); a flow that completed counts as the request, as in RN. Never in demo or fake-data runs - First publish digest offer (RN
utils/firstPublishDigest.ts,components/newsletterDigestSheet,providers/queries/newsletterQueries.ts, SDKsubscribeDigestRequest,getDigestSubscriptionsRequest,leaveDigestRequest;api/ecency/NewsletterApi.kt,app/DigestModel.kt, Androidui/DigestUi.kt, iOSScreens/DigestViews.swift). Read from the code: one second after a new post was published (never a reply, an edit or a schedule), when the account'spost_countfrom before the publish is known and zero and the flagfirst_publish_digest_<user>is not set, the flag is written and theNEWSLETTER_DIGESTsheet opens for the own-notifications list with "Congrats on your first post!"; an account change within that second skips it without writing the flag; nothing of it can fail or delay the publish. The sheet readsGET <ecency>/api/newsletter/subscriptions(headerX-HS-Token: <code>), shows nothing but a spinner until that answered and "Email digests are not available right now." when it failed; it asks for an address only when the service holds none for the account (/^\S+@\S+\.\S+$/on the trimmed text), offers Weekly or Monthly, and sendsPOST /api/newsletter/subscribe {email, type, target, cadence, source: "mobile-app", code}:pending_confirmationshows "Check your inbox",refusedan alert, a 429 "Too many attempts", any other failure "Something went wrong", success a toast and the sheet closes; an existing subscription shows its status, "Update" (off while the cadence is unchanged) or "Resend confirmation", and "Leave digest" (DELETE /api/newsletter/subscriptions/<id>). Not paid: no points, no idempotency key, a tap sends again. Here: the calls go throughEcencyPrivateApi.relay(30 s bound, the owner's own code); the sheet belongs to the account it opened for, drops an answer that arrives after an account change and closes on it; the post count is read from the node before the first send of a new post (3 s at most, kept across retries of that publish, never asked again once the account was offered or is known to have posts); the flag isdigest.firstPublishOffered.<user>in the app's preferences. Golden:node tools/golden/generate-newsletter.mjs shared/src/commonTest/kotlin/com/ecency/core/api/ecency/NewsletterGoldens.kt(the SDK's requests and answer handling, RN's form rules, address test and offer rule). The other places RN opens this sheet from (a profile, a community, the end-of-post prompt, the own profile's sender row) are described in the profile and community areas; Settings "Email digests" and "Stop all" are in "Settings"
Drafts and schedules
- Local draft per account, reply drafts per parent. The quick reply sheet and the editor's reply mode share the slot; the sheet's model is kept app-wide (see the post screen), so whenever the editor's reply mode writes a reply draft that model reads it again in place (
AppEnvironment.replyDraftWrittenElsewhere,ComposeReplyModel.draftChangedElsewhere; a sheet showing it stays alive), except while it sends, uploads an image or has typing not saved yet (on a two pane window the later save wins), and keeps what it shows when nothing could be read back. Text the sheet is given back (iOS sets its field and echoes it) saves nothing. A reload never drops a permlink a failed send of the sheet left, nor applies a read made before a send of the sheet ran, and Send reads the saved draft's permlink when the sheet has none (its own save may still be waiting). The editor tells the sheet when it saves the permlink of a send, before the broadcast (theSheetKnowsTheEditorsPermlinkBeforeItsBroadcastAnswers), and the sheet's own save keeps such a permlink, so for a send whose answer was lost a retry from the sheet asks the chain first and never posts a second reply. An edit of a reply writes its own slot and leaves the quick replies under it alone. Before this a reply continued in the editor ("Open editor") came back in the sheet as it was before, or empty, and the next keystroke wrote that over the editor's text (Android 4.0.0 user report;EditorModelTest.theQuickReplySheetShowsWhatTheEditorWroteAfterIt,aQuickReplyBeingSentKeepsItsModelWhenTheEditorSaves,editingAReplyLeavesTheQuickRepliesToItAlone,QuickReplyToolsTest.aDraftSavedElsewhereNeverReplacesAnUploadOrUnsavedTyping,aReloadKeepsTheSheetOnAFailedReadAndAnEchoNeverBlocksTheNext,EditorModelTest.aReplyTheEditorSentIsNeverSentAgainFromTheSheet,theSheetsOwnSaveKeepsThePermlinkTheEditorSentUnder). One composer per reply at a time: the editor never shares the window with the post (it is not a pane screen, so it covers the window on iPhone Duo and large Android windows too) and the sheet is modal, so the editor does not follow the sheet's saves; it reads the slot when its screen shows, and again whenever that screen shows again (a post opened from its preview was closed: a quick reply saved there is what it continues), unless it has typing not saved yet or a load, send or upload is under way (EditorModelTest.anEditorShownAgainContinuesTheQuickReplySavedMeanwhile; end to end: iOSGaps3UITests.testAReplyEditorShownAgainContinuesTheQuickReplyWrittenOverIt, the preview's post link card opening the post over the editor, and AndroidGaps3FlowsTest.aReplyEditorShownAgainContinuesTheQuickReplyWrittenOverIt). A read that fails keeps what it shows and its pending send (LocalDrafts.readtells a draft that is not there from one that could not be read, and iOS'sFileDraftStoragefails for a file it cannot read instead of answering null, as Android's does;aFailedReadWhenTheEditorShowsAgainKeepsItsReply,FileDraftStorageTest), and a read is not applied when the text, or the pending send (a send that ran and failed meanwhile), changed while it ran. An edit left without saving is never written back by a later flush (anEditDiscardedDuringItsAutosaveIsNotWrittenBack). Text whose autosave failed counts as typing not saved yet and is written on leaving, and leaving while an autosave is on its way writes the text again (textWhoseAutosaveFailedIsWrittenOnLeaving). - Save draft (update or save as new), save on leaving. Difference from RN: a draft deleted elsewhere (the web, another phone) is saved as a new draft, which later saves update; RN failed every save, as the private API answers the update with 404 (Sentry ECENCY-MOBILE-3R2). Only a 404 that the drafts list confirms (the draft id is no longer in it;
EditorApi.hasDraft, strict whereallDraftsis lenient: a body that does not parse, has no list, or has a row without a string_idanswers nothing) does that: a 404 from a broken route with the draft still there, or a list that cannot be read, fails the save and makes no second draft; any other failure stays a failure; a replacement that failed to be created is tried again by the next save (EditorModelTest.aDraftDeletedElsewhereIsSavedAsANewDraft,aBrokenUpdateRouteNeverDuplicatesAnExistingDraft,aFailedReplacementIsTriedAgainByTheNextSave,anUnreadableDraftsListNeverConfirmsADraftGone,anotherDraftUpdateFailureIsStillAFailure). - Drafts screen: Drafts, Schedules, Templates, paging by 20 as the list scrolls (RN
onEndReached, threshold 0.5, #3782: the next page loads when the end comes within half a screen and again whenever a load ends with it still in view, with a loading row and no button; a list whose own last load failed waits for Retry,DraftsState.loadFailed; a page that brings no new rows, or a cursor already asked for, ends the list; iOS pages only while the list is the pane's top; on Android the list and the Delete button end above the navigation bar), unsynced local draft row, open, delete, clone, batch delete. Each row shows RN's summary (postBodySummaryof 100: plain text, links as their text, cut at a word;DraftsState.summaries, made off the main thread) - Schedules: status, delete, move to drafts
Images
- Gallery picker, files picker, camera, paste
- HEIC to JPEG, resize over 1920 px, JPEG quality 85
- Signed upload with retries, progress and cancel, placeholders
- Uploaded images gallery: list, insert, delete, and a "+" that adds images to the gallery without putting them into the body
- The same sheet in the quick composers (reply and wave), one image flow with the blog editor (as RN's quick post modal mounts
UploadsGalleryModalwithallowMultiple={false}): their one Image button (tagsreplyAttach/waveAttach, iOSreply-attach/wave-attach) opens the editor's uploads sheet (QuickUploadsSheetoverUploadsSheet, both apps) with the editor's source tiles (MediaSourceMenus.editorUploads: gallery, files, camera where there is one, paste when the clipboard has an image) overenv.uploadsModel(null), the signed-in account's gallery with nothing inserted into an editor. A tile closes the sheet and runs the composer's own one image attach (attachFrom:WaveImageSource.of(source), paste being the clipboard chip's paste; iOS starts it in the sheet'sonDismiss, since the pickers are sheets of their own). There is no "+": the composer's one image is whatever is picked. A tap on an uploaded image makes that image the composer's one image and closes the sheet (ComposeReplyModel.pickUploaded,WaveComposeModel.pickUploaded: not while an image is being picked or uploaded or a send runs, only for the composer's owner while signed in, only a clean https address (UploadNames.isClean: any host, since older uploads sit on older hosts and the editor inserts them too); the reply saves it with its draft at once). Delete mode works as in the editor. A failed load says why with a retry (over any images already shown), and an empty gallery says RN's "No Existing Uploads..." (UploadsState.showsError,showsEmpty,showsLoadMore, in the editor's sheet too;EditorModelTest.theGallerySaysWhenItFailedOrIsEmpty, AndroidWavesFlowsTest.anEmptyOrFailedGallerySaysSo). A gallery image has no known ratio unless it was uploaded in this run, so a wave writesnullfor it inimage_ratios(a difference: RN measured the image;nullis what RN writes when it cannot). Tests:QuickReplyToolsTest(theImageSheetsTilesAttachThroughTheSameUploadAsTheEditorsSheetOffers),WavesModelsTest.anImageFromTheUploadsGalleryBecomesTheWavesOneImage,theImageSheetsTilesAttachThroughTheComposersUpload, AndroidReplyToolbarFlowsTest,WavesFlowsTest.theImageButtonOpensTheEditorsSheetWithTheGalleryInIt, iOSReplyToolbarUITests,WavesUITests. - Error copy for 413, 429, 400 and unavailable signing (RN), and for the image host's own refusal of the account (a 403 naming its
deplorableerror; any other 403 keeps the generic failure; native: RN shows its generic failure)
Snippets
- List, add, edit, delete, insert at the selection. The caret ends after the inserted snippet (and after a link from the insert link sheet), so the next insert, such as a gallery image, goes in after it. RN's applySnippet left it selected and the next insert replaced it.
EditorModelTest.aSnippetOrALinkLeavesTheCaretAfterItAndTheNextInsertKeepsIt, iOSEditorUITests.testSnippetsAndGalleryImagesGoInAtTheCaret.
Paid AI features: the money rules
AI assist, the AI image generator and dictation spend Ecency points. All three go through PaidCalls.kt (PaidIntent, PaidIntents, PaidRunner, PaidCalls.classify) and PaidFlow in AiModels.kt:
- Price and balance come from the server and are on screen before the charge; without a price nothing can be sent (RN's image screen falls back to a made-up 150). As in RN there is no confirmation step, the action button charges; here its label states the cost: "Run AI Assist (5 POINTS)" or "(Free)", "Generate Image (150 POINTS)", "Stop (15 Points)". One balance format everywhere (
PaidCalls.balance: "1,250.500 POINTS"). The AI image generator opened on its own is a gated route; its stored intent and 130 s wait have their own tests (AiModelsTest). Android's dictation sheet holds the room of its three late lines from the first frame; the standalone AI image screen has one title. When both reads ended with no price for any action the sheet offers (failed, an empty list, or only other actions) or no balance (failed or not a number), the sheet says "We could not load this. Please try again." with Try again (loadFailed,reload(); #3701: the sheet dead ended with a disabled button and "..."). - One idempotency key per intent (one assist run, one image, one recorded clip): 32 hex characters from the secure random source, made once, written to the account's local store (
paid:<kind>:<editor>, one place per editor: its draft, reply or edit, so two editors of one account never overwrite or delete each other's request; next to the drafts: private, cleared at logout, never backed up) together with what was asked, before the request leaves. Every later request for that intent carries the same key and the same payload, also after the app was killed: the sheet then opens on "An earlier request has no answer yet" with the stored text or prompt, and its inputs stay locked. The key is dropped when the result was delivered, on a definite refusal, or when the user gives up (confirmed: "the points were spent and the result will be lost"; a dictation clip that was held back and never sent, or that the server refused without charging, says instead that nothing was charged and that it will be deleted). A record older than 20 hours by the device's clock, or dated in the future (the clock was set back), is dropped unread, because past the server's 24 hour replay window its key would pay again. A record is only removed by the intent whose key it holds. No monotonic guard was added: a monotonic clock does not survive a reboot or count across process death in a way both platforms expose alike, and there is no server time on these answers to anchor to; the wide margin and the refusal of future-dated records are what stands in for it. Logging out clears the store, so an unanswered paid request of that account can no longer be fetched from this device. RN: a new key per tap (assist, image), or one kept in memory only (dictation). - A paid request is sent once per tap and never again by itself, except one resend with the same idempotency key when Ecency answered 401 and the session could be renewed (a 401 is refused before anything is charged; see "Ecency session renewal"). The two JSON calls wait 130 s for their answer and the transcription upload as long (above the gateway's 120 s, so a slow generation is an answer; everything else keeps the 30 s bound). No answer within that, a lost connection, a 5xx that says nothing about the charge, and a 200 that cannot be read are "result unknown": "No answer yet. The request may still be running. Check again to fetch the result: it is not charged a second time." The only button is "Check again", which sends the same key (production dedupes on user and key: a repeat answers the stored result or 409
in_progress). A request that failed before anything left the device (a clip that cannot be read, no session) is not "unknown": it says nothing was sent. There is no "Try again" that could charge twice. - 202
delivery_pending(images) and 409in_progress(all three) are "paid, not ready": asked for again with the same key after the server'sretry_after(2 to 60 s), at most 12 times, then left to "Check again". RN treats both as a failure and, for assist and images, forgets the key. - A refusal ends the intent: 400, 402, 429 and 503 charge nothing, the 500s the server names (
generation_failed,transcription_failed,server_error) are refunded or unpaid, 422 is charged and says so. 401 and 403 keep the intent ("Sign in again, then check again"). Dictation keeps the clip and its key after 402 and 429, as RN ("Try again"). - Every response field is untrusted: costs and balances must be finite and not negative, texts must be strings within a size bound, a generated image's address must pass the same check as an uploaded image's (
UploadNames.isSafeUrl: https, on the image host, no brackets or whitespace) before it is shown or inserted, suggested tags go through the tag field's own rules. - Account binding: an intent names its owner, the request uses the owner's session, and nothing is sent while another account is signed in ("This belongs to @owner"). A result is only written into the editor while the editor's owner is signed in (
applyAiResult,insertAiImage,insertDictation). The stored intent stays for the owner's return. - Dictation: the clip's file lives in a folder the system does not purge and that is not backed up (Android
noBackupFilesDir/dictation, iOSApplication Support/dictation, excluded from backup), is known by its file name only (the folder's path changes with an app update), is checked for readability and size before it becomes a paid request, and is deleted when its request is settled, given up or interrupted; stray files go when the sheet opens. A clip that was sent and is gone at "Check again" is said plainly (the points may be spent, the transcript cannot be fetched). iOS puts the audio session's category back after a recording. Nothing records while the app is locked or in the background; a recording stops and is thrown away, without any upload or charge, on lock, on leaving the foreground, on an account change and when the sheet closes. The balance line is an addition (RN's sheet shows the rate only). Transport: the upload is one multipart request through the sameAuthHttpseam (AuthHttpRequest.bytes), bounded at 130 s. - Production forwards
idempotency_keyfor assist and images and the points service dedupes on (user, key) (the local backend checkouts predate it). A "(Free)" label older than a minute is checked again before a new run: when the free allowance is gone meanwhile nothing is sent, and the button shows the cost. Dictation does the same at Stop: a clip stopped under "Stop (Free)" on a price older than a minute is held back when it is no longer free, and only goes out on "Transcribe (N Points)"; "Give up" throws it away uncharged. A paid run needs a balance that was actually read. - Fake-data and test runs never reach these endpoints:
DemoAuthServicesanswers them with synthetic prices, balance and results; iOS fake-data runs useDemoDictationRecorder(no microphone).
Differences from RN
- Retry after a lost answer: RN checks whether the permlink exists and, when it does, publishes again under a random suffix (a duplicate post). Here the pending publish is remembered with a hash of what was sent: the retry confirms that post, or asks whether to update it or publish a new one.
- Logout clears that account's local drafts (RN keeps them); a wipe clears all of them.
- The posting authority grant asks first and writes the account's
json_metadataback unchanged (RN grants without asking and writesposting_json_metadataintojson_metadata). - Reply permlinks keep the base's zero-padded UTC form (RN's unpadded local form collides).
- Leaving an edit with changes asks "Discard changes?" (RN drops them silently), and an edit keeps a recovery copy until the screen is left, so process death does not lose it. An edit is refused when the post changed on chain since the editor opened.
- The local draft is written 300 ms after the last keystroke (RN: 500 ms typing pause, then 300 ms).
- A draft save keeps the author's short description (RN overwrites it with the body summary on every save). As in RN, the description is stored in drafts only and is not part of the published
json_metadata. - Beneficiaries need a whole percent from 1 (RN accepts 0, which the chain refuses); the list is sorted by plain byte order (RN's
localeComparegives the same order for account names, and hived requires byte order). image_ratiosare known for images uploaded in the session; other images get JSONnull, as RN writes when it cannot measure one.links_metaholds the linked post's title (the fields RN reads besides it,summaryandimage, do not exist on the SDK's entry).- RN orders the images with an inconsistent one-argument comparator; V8 leaves the thumbnail first and the rest in order for up to 63 images (golden). With 64 or more, V8's merge path may order the rest differently; here they stay in order.
- The image url validator caps input at 2048 characters; a 429 upload says "Upload quota exceeded" (RN shows the raw message id, the string is missing from its locale file).
- AI assist: suggested tags go through the tag field's rules, ten at most (RN sets whatever the answer holds); a title list that is empty after cleaning shows as text (RN would apply
undefined). The AI image generator is a sheet over the editor, not a route. - The reply tile reopens the editor for the new account instead of keeping one editor across accounts.
- iOS shows the words count above the toolbar, not in the navigation bar; toolbar buttons are icons on both platforms (each platform's own set, not RN's icon fonts; since 11-13), in this app's order rather than RN's, and RN's full editor keeps separate AI image and dictation buttons where native lists both inside AI Assist; schedule and poll dates use the system pickers.
Tests of the prompts: shared AuthorityRecoveryTest, RatingPromptTest, DigestModelTest; Android WavesFlowsTest (the grant prompt in the composer), PlayReviewTest (Play's own fake review manager), EditorFlowsTest (the digest sheet); iOS EditorUITests.
Tests of the RC precheck: shared RcCostTest (golden), RcPrecheckEditorTest.
Tests of the video upload: shared VideoMetaGoldenTest (RN's collectVideoThumbUrls, restoreVideoThumbs and extractMetadata with a video; node --no-warnings native/tools/golden/generate-video-meta.mjs native/shared/src/commonTest/kotlin/com/ecency/core/editor/VideoMetaGoldenVectors.kt (from the root of a checkout of the rn-3.x-final tag, where the app is under native/)), TusClientTest (an in-memory tus server), VideoUploadModelTest (also: when a video's file is let go, another image as the thumbnail, no preview behind the lock); Android EditorFlowsTest (a recording through a fake camera app, a recording preview player), VideoPlatformTest (VideoCaptures: owner and screen, saved state, every path that deletes the file); iOS EditorExtrasTests, EditorUITests.
Tests of the paid features: shared AiModelsTest, DictationModelTest (fake recorder, scripted endpoint), TranslateMarkdownTest, ComposeTranslateModelTest; Android EditorFlowsTest (assist, image, dictation, translate), DictationPlatformTest; iOS EditorExtrasTests, EditorUITests.
Tests: shared EditorTagsTest (tag chips and the lagging field), EditorGoldenTest (slugs, formats, media placeholders, urls, metadata, edits, beneficiaries, operations with transaction ids and signatures, upload token), EditorModelTest (publish, pending publish and conflicts, replies in both surfaces, recovery, cleanup, validation, grant flow, uploads), PostingGrantTest, JsRegexTest; Android EditorFlowsTest (also the reply tile handoff), EditorPlatformTest (metadata stripping with a generated GPS fixture, orientations, capture cleanup, draft files, backup rules); iOS EditorTests, EditorUITests.
Waves and Shorts
RN screens/waves, components/quickPostModal, wavesTabBar, wavesTagPickerModal, providers/queries/postQueries/wavesQueries.ts and shortsQueries.ts, constants/waves.ts.
Features
RN does not page waves container by container: getWavesFeedQueryOptions reads one combined, cross-container feed (GET /private-api/waves/feed, keyset cursor, 20 a page) and every tab is a filter on it. Containers matter only when publishing.
- Tab bar: For you, Following (login gate), pinned source tabs, pinned #tag tabs and a "+" picker; a re-tap scrolls to the top. On Android the strip fades out at an edge it can still scroll toward (
horizontalEdgeFade,EdgeFadeTest), so a tab cut off at the "+" reads as more to scroll to, not as a shortened tag. - Combined feed:
waves/feedwithcontainer,tag,following,author,observerand cursor paging; a short page ends the feed. - Pull to refresh, a 60 s refetch and a scroll-to-top popup past 5000 px. The refetch reads the first page only and merges it. Android's popup is keyed on rows, not pixels; iOS uses the shared
ScrollTopRuleon points. - Visibility filter: viewer mutes, muted or gray waves, bot authors. Promoted waves (
promoted-entries?short_content=1) come after the 2nd wave and then every 4th, on For you and Following only. As in RN, the "muted or gray" test only ever fires for promoted entries: combined-feed rows carry nostats,net_rsharesor reputation. Organic rows are gated by the server's observer mute (and Ecency's own moderation there), the client ignore list and the bots list. - Explicit waves:
WaveEntry.flaggedNsfw(only a JSONtrue) andWaveNsfw.isHiddenhide a flagged wave unless NSFW is "Always show" (also under "Always warn", since waves have no placeholder; never the viewer's own wave). It applies in every waves list including promoted waves. The shorts reel keeps its own filter (RN changed onlyuseWavesQuery). Separately, the app's NSFW setting covers thensfwtag (in any case and spacing, as the website reads it:NSFWandnsfwtoo;NsfwMode.isNsfw, the posts' rule as well): "Always hide" drops the wave, "Always warn" hides the body behind "NSFW Tap to reveal". - Wave card (RN comment view): avatar, name, age, body with images, vote and payout, reply count and reply, tip, options, Ecency badge. Tip opens the transfer placeholder, as on the other cards.
- Hashtag tap: a transient tag filter chip over For you.
- Custom feeds picker: sources (Shorts, Waves, Threads, Snaps, Moments, Speaks), your tags and trending tags (
waves/trending/tags), persisted. - Wave thread: the post screen without the parent box;
/waves/<author>/<permlink>links open it. A reply, mention or vote notification on a wave opens this post screen (no notification type opens the Waves tab in RN). - Options menu on a wave (
isWave: no pin to blog, canonical link) is the existing menu, a wave being a comment there; delete drops the wave from the feed. - Own waves and replies (RN
commentViewfooter,post.a11y_edit/post.a11y_delete): an Edit pencil on every own wave card and own reply row of the post screen, and a Delete trash only while the wave or reply has no replies and no votes (the card's count, so a vote just made in the app counts;stats.total_voteszero,net_rsharesnot positive, not paid out, as RNisDeletable). Never on others' content or a cross-post. Which icons show isPostFooter.actions(shared, both apps draw that list); a tap runs the menu's own item throughPostActionsModel.select: Edit opens the editor, Delete asks the menu's confirmation and broadcasts throughSigningModelfor the account that asked. VoiceOver and TalkBack get both as actions on the row's header. AndroidOwnFooterButtons(ui/PostMenuUi.kt), iOSOwnFooterButtons(Screens/PostMenu.swift). - An edited wave (the editor's
AppEvent.PostChanged) is read again (bridge.get_post) and its card replaced in place, in the Waves tab and the profile's Waves tab alike (both areWavesFeedModel), so the fix shows without a refresh. The edit is broadcast before the API shows it: a read that still has the shown body, or is older than the card shown (or has noupdated, whichbridge.get_postalways sends), is tried again 3 s and 6 s after the edit. A second edit cancels the first one's read, and an answer older than the card shown is never applied, so reads that finish out of order never bring back an earlier body. The minute's refetch and a pull to refresh keep the read wave's body while the feed's row is older (a row withoutupdatedcarriescreated, so it never catches up) but takes its votes, replies, payout and tips (WavesFeedModel.keepNewerBody). A vote made while the read runs stays on the card. A failed read keeps the card, and an answer for a previous account never lands. Tests:WavesModelsTest.anEditedWaveIsReadAgainAndReplacedInTheList,anEditedWaveTheApiDoesNotShowYetIsReadAgainAndAnAnswerAfterAnAccountChangeIsDropped,aSecondEditsReadWinsOverTheFirstOnesLateAnswer,anEditedWaveKeepsItsBodyWhileTheMinutesRefreshUpdatesItsCounters,anOlderAnswerIsTriedAgainAtThreeAndSixSeconds. - Reply to a wave (quick reply sheet) and vote use the existing sheets. Waves keep their own last vote weight (
env.waves.voteWeightPercent, the wave kind ofenv.voteWeights), in lists and on a wave's thread. - Profile Waves tab:
authorfilter, no mute filter, no promoted (ProfileModel.waves(), rows inside the profile's own list on both apps). It empties and loads again on an account change, and a late answer for the previous account never shows. - Links:
ecency.com/wavesopens the tab;?text=opens the composer with the text. A share link's text waits for the composer at most 5 minutes and only for the account it arrived for (signed out: for the next sign-in); a logout, switch, wipe or a login closed without signing in drops it. - Shorts: pinned
Shortssource,waves/shortsfeed, full-height reels, 3Speak HLS in the platform player (cover for portrait, contain otherwise), poster while loading, mute button, web player fallback, upvote, reply, tip rail, caption; one reel plays at a time and it stops off screen. Playback of a real stream was not exercised. - RN has no setting for autoplay on metered data, so there is none here.
Composer
The composer is RN's quick post modal in wave mode: text with a 250 character limit and counter, the short content hint, one image, PUBLISH. The text fills the sheet down to the short-content hint and the toolbar, and the toolbar sits on the keyboard (or on the sheet's bottom edge without one, iOS hardware keyboard included). iOS: the sheet background covers the keyboard area and PUBLISH stays on one line. Android: the sheet takes the full height and the text field takes the rest (weight). The draft is kept in memory per account. Screenshots of the layout: PolishUITests with TEST_RUNNER_POLISH_SHOT_DIR.
- Images. The image sheet's tiles use the editor's upload.
WaveUploadAttacher.install(env)(both apps, at start) setsenv.waves.attacherandenv.waves.imageRatios; the composer screen sets itsonPick(Android: the system photo picker and the camera through the editor'sFileProvider; iOS:PhotoPickerwith a limit of one andCameraPicker), prepares the picked file exactly like an editor upload (EditorImages.prepare: metadata stripped, 1920 px, off the main thread) and hands it topicked. The upload itself isImageUploads.upload, the one signed upload shared withUploadsModel: signed for the composer's owner whoever is signed in when it runs, 30 MB guard, three tries, stall timeout, and only a clean https address on the image host is accepted. One image a wave, as RN; a closed picker, an unreadable file, a failed upload or leaving the sheet end the attach and leave the composer as it was. The ratio comes from the picked image's size (as the editor'simage_ratios); an image pasted as a link has none. An "Image in clipboard · Paste image" chip offers the clipboard image. The Image button opens the editor's image sheet (source tiles over the account's uploads gallery, RNUploadsGalleryModal,allowMultiple={false}): a tile runs the attach above (WaveComposeModel.attachFrom) and a tapped upload becomes the wave's image (WaveComposeModel.pickUploaded; see "Images" under "Editor and publishing"). - Dictation and AI assist work over the composer (
AiTextTarget; a wave offers improve, grammar and summary). A dictated wave transcript goes at the end of the text, because the composer does not report its caret. - Poll. The poll button opens the editor's poll wizard (
PollSheet, the editor'sPollDraft) and the wave is published with the poll: the poll is part of the content permlink key (JSON.stringify(pollDraft)in RN's key order) and ofjson_metadata(content_type: "poll"first, the poll fields beforetype), then removed from the composer. Only a valid poll attaches. - Video (RN
quickPostModalContent,SpeakUploaderModal isShort,usePostSubmitter,providers/speak/speak.tslinkVideoToHive). The video button (wave mode only) asks "Add Video": "Record Video" (ImagePicker.openCamera, video) or "Choose from Library" (openPicker, video). The uploader refuses a video over 60 s ("Short videos must be 60 seconds or less.") and has no size limit of its own; the upload asks for its token withisShort: true. Afterwards the composer holdsvideoEmbedUrlandvideoThumbUrl, shows "Video attached" with a minus badge (a tap removes it) instead of the image, the button is tinted and off, and PUBLISH is off while the upload runs._submitPostwritestext\n\n<embed url>(the video wins over an image, never both); the 250 counter is the typed text only; the thumbnail goes intojson_metadata.imageafter the body's images (extractMetadata({videoThumbUrls}), withimage_ratios) and is not part of the content permlink; the body's 3Speak embed adds thecomment_optionswith thethreespeakfundbeneficiary. After the broadcast answers, RN finds the firsthttps?://[a-z.]*3speak.tv/embed[?/]...in the body, takes its permlink (extractPermlink) and callsPOST <ecency>/api/threespeak/link-hive {permlink, hive_author, hive_permlink, hive_tags, code}once, not awaited, errors only logged; without an access token it is skipped. Native:WaveComposeModel.video()(the editor'sVideoUploadModelwithisShort, owned by the composer: owner-bound, cancellable, continued within the session),setVideoEmbed(takes only a 3Speak embed address, or null to remove the video) /removeVideo,WavePublish.body / metadata / videoLinkPermlink,SpeakApi.linkHive,WavesService.linkVideo. Differences: the link call is tried up to three times (at once, after 3 s, after 10 s) when no answer, a 5xx, a 408 or a 429 comes back (RN: once); it carries the same video and wave each time, and one wave is linked at most once per run of the app; a video permlink that is not letters, digits,-or_is not sent; a pasted 3Speak embed in the text also blocks a second video. When the call fails the wave is published all the same and the user sees "Success!" and nothing else (as RN): the video plays in the wave, it is only missing from 3Speak's own feeds; it is not tried again after the app restarts. - A wave may carry a poll and a video together, as RN (
submitWave(body, pollDraft, videoThumbUrl)): the poll is part of the permlink key and the metadata, the thumbnail joinsimageand is not part of the key. - Publish. The newest container of
hive.flow, elseecency.waves; content-hash permlinkwave-<16 hex>; json_metadata (links, image, image_ratios, type wave, tags with hashtags, app, format); 3Speak beneficiary; an optimistic card on For you; a "Success!" toast and a "Something went wrong" alert.image_ratiosare known for images uploaded in the session (null otherwise, as RN writes when it cannot measure). A wave HiveSigner refuses for the missingecency.appauthority opens the grant prompt (see "Editor and publishing"). As in RN, the container is the newest post of the first host that answers with one: a first host that fails falls through to the second.
Getting started card and daily check-in
RN screens/waves/children/wavesOnboardingChecklist.tsx, utils/wavesOnboarding.ts, useCheckIn in providers/queries/pointQueries.ts, providers/ecency/ePoint.ts (userActivity), utils/refreshQuests.ts. Shared app/WavesOnboarding.kt (WavesOnboardingModel, CheckInRecorder). UI: Android WavesOnboardingCard in ui/WavesScreen.kt, iOS WavesOnboardingCard in Screens/WavesViews.swift. The same card also heads the Feed tab for signed-in readers (the shared WavesOnboardingModel); "Post your first Wave" opens the wave composer there.
- Shown to a signed-in account that is new: created within 30 days, or fewer than 10 posts (
isNewAccount). - Four items: "Post your first Wave", "Vote on a Wave you like", "Reply to someone", "Check in to start your streak"; from the quests endpoint's daily progress (
vote,comment,checkin) and the streak, asderiveWavesOnboardingState. - Completed items are latched per account on the device (daily progress resets at 00:00 UTC; an item never un-checks). "Post your first Wave" has no quest signal and latches when a wave is published from the app, only for the wave's author.
- Title, subtitle, "n/4" and the progress bar; the wave row opens the composer, the check-in row opens Perks (still a placeholder route).
- Dismiss hides it for good for that account; when everything is done it shows "All done" once (the one celebration) and then stays away.
- The quests come from the editor area's client (
QuestChip.loadRaw, the samePOST /private-api/quests {username}), read again when the tab comes back and 70 s after a check-in was recorded (RNQUESTS_REFRESH_DELAY). - Check-in: recorded when a post is opened (RN's reading area:
PostScreenon both apps, AndroidGapsFlowsTest.openingAPostRecordsTheCheckInOnce) and when the Waves tab is on screen (first shown, each time the app comes back to it, and after an unlock: the tab is not composed while the lock hides the app, and Android's effect is keyed on the lock state as well):POST /private-api/usr-activity {ty: 10, code}, at most once per 15 minutes and account. The window is claimed before the request and given back when it fails. It is never sent while signed out or locked, and carries the code of the account signed in at that moment. - Account rules: the card and its latches belong to one account; an account change drops the card before the next account's data is read, a late answer for the previous account is ignored, and a latch is written only for the account that earned it.
Golden vectors: node --no-warnings native/tools/golden/generate-waves-gaps.mjs native/shared/src/commonTest/kotlin/com/ecency/core/app/WavesGapsGoldens.kt (from the root of a checkout of the rn-3.x-final tag, where the app is under native/) (from the RN root: isNewAccount, 35 derivation cases, five waves with a poll, two of them with a video as well, through RN's extractMetadata, makeJsonMetadata and generateContentBasedPermlink). The poll side lives in WavePublish.pollKey and the poll argument of WavePublish.metadata / draft, WaveComposeModel.setPoll.
How it is built
val tabs = env.wavesTabsModel() // WavesTabsState: tabs, selected, activeTag, pins, trendingTags
tabs.select(key); tabs.filterByTag("hive"); tabs.addTag("#Art"); tabs.toggleContainer("leothreads")
val list = tabs.feed(tabs.current.feedKey) // WavesFeedModel: start, refresh, loadMore, retry, setActive(true)
val reels = tabs.shorts() // ShortsModel: setFocused, setActive(key), playbackFailed(key), toggleMute
val composer = env.waves.composer() // WaveComposeModel of the signed-in account: setText, attach, send
env.waves.openLink(url) // ecency.com/waves?text=... asks for the composer
- API (
api/waves/Waves.kt):WavesApi.feed / shorts / promoted / trendingTags / threeSpeakStream, URLs built asURL.searchParamsdoes and pinned to the SDK's own requests; rows normalized as SDKnormalizeWaveEntryFromApi(createdfromtimestamp, payout defaults). Feed rows are light (noactive_votes, noparent_author, no reputation): the card showsnet_votes, the host stands in as the parent, and whether the reader voted is only known for votes made in the app. Promoted rows carry a voter list and are read for the signed-in account (WavesApi.promoted(observer)). - Publishing (
api/waves/WavePublish.kt): RN's_submitPostbody (text\n\n ),generateContentBasedPermlink,extractHashTags,extractUrls,extractImageUrls,extractMetadata+makeJsonMetadataand the SDK's 3Speak beneficiary, as oneCommentDraftsent throughenv.signing. Golden vectors (node tools/golden/generate-waves.mjs shared/src/commonTest/kotlin/com/ecency/core/api/waves/WavesGoldens.ktfrom the RN root, offline: fetch is recorded) run the RN helpers copied into the generator and the SDK's op builders, and pin the operations, transaction ids and deterministic signatures with the throwaway key. - Lists (
app/WavesModels.kt): one keyset pager per list; RN's visibility filter plus the NSFW rules above; promoted waves at RN's cadence; a wave published here stays on top of For you for up to 10 minutes or until the feed returns it; while a list is on screen its first page is read again every minute (new waves on top, fresh counts). - Publishing guards: a container is only the host's own root post with a well-formed permlink (
WavesService.isContainer; a reblog row, a comment or a wrong node answer is skipped, and with no container nothing is signed); container tags are read as RN'stags || ['ecency'](an empty array stays empty); a retry first asks the chain (database_api.find_comments) and treats the same body as published, and an existing comment is never sentcomment_optionsagain. - Share text (
?text=): waits through the login it sends a signed-out reader to, never replaces a draft already in the composer, and reaches an open iOS sheet throughWaveComposeState.prefillSeq. - User agent:
ClientIdentity.headersadds the build's user agent only for the first-party hosts (FIRST_PARTY_HOSTS: ecency.com and hivesigner.com with their subdomains, https, default port); 3Speak and GitHub get the platform default. - Web data: the video player's cookie and storage wipe is skipped while a HiveSigner web view is alive (
WebData.authViews; the editor's HiveSigner pages go through the same counted view). On Android cookies and web storage are one process-wide WebView profile, so a closing video player skips its wipe while a HiveSigner page is alive; the auth page wipes before and after itself. - Account binding: a list drops everything it shows the moment the account changes and ignores an answer still on its way for the previous account; the composer belongs to the account that opened it, refuses to send or attach as anyone else and is disposed on the session change; both apps close an open composer sheet on an account change. The reels start over too.
- Shorts (
app/WaveCompose.ktShortsModel): exactly one reel may play,ShortsState.playingKey, the reel in view while the tab is focused. Android composes a Media3 ExoPlayer (1.4.1, HLS) only for that reel and releases it on dispose; focus follows the lifecycle (RESUMED). iOS builds an AVPlayer view only for that reel; focus follows the tab's appearance and the scene phase. A stream that is not https, cannot be resolved or fails in the player falls back to 3Speak's web player through the existing embed web view (allowlisted, same-host navigation only).
Differences from RN
- A body of only whitespace is refused (RN would broadcast it).
- A retry after a failed publish resends the wave built the first time, even when the day's container changed meanwhile (RN rebuilds and could post twice).
links_metacarries the linked post's title only (what RN's raw SDK entry leaves afterJSON.stringify).- NSFW waves follow the app's NSFW setting.
- The refetch merges the first page instead of refetching every loaded page; the list jumps to a wave just published.
- The iOS reels cannot be muted before a stream plays; iOS has no scroll-to-top popup (the status bar tap and a re-tap of the tab do it).
- The video link call is retried (see Composer).
Debug and tests
- Debug: iOS
-fakeData YES -startTab WAVES(offline rows; the reel player is a labelled stand-in there); Android--ez demoAuth trueanswers the waves endpoints with synthetic rows (DemoAuthServices). Take screenshots from these, never from the live feed. - Tests: shared
WavesGoldenTest(also the video cases and the link call's permlink, from RN's own code),WavesModelsTest,WaveVideoTest(upload as a short, the wave RN would broadcast, the link call's request, its retries and that it never touches the publish, owner binding),WavesGapsTest(18); AndroidWavesFlowsTest(Robolectric, a recordingReelPlayer),GapsFlowsTest(waves cases); iOSWavesTests,WavesUITests,WavesGapsUITests(EcencyAppUITests/WavesGapsUITests.swift).
Listen (natural-voice post audio)
RN components/listen/listenBar.tsx, listenAudio.tsx, utils/listen.ts, hooks/useRefreshAccessToken.ts, SDK 2.4.26 getListenStatusQueryOptions and useListenUnlock. It replaces on-device text to speech: the Listen column and the settings cog left the reading bar, and the TTS settings sheet and its helpers are gone (here SpeechUi.kt, SpeechPlayer, TtsSettingsSheet, TtsSettings, Speech.chunks and Speech.detectLanguage; the plain text, word count and reading time stay, as RN keeps them).
Shared: api/ecency/ListenApi.kt (status and unlock, the answer read as untrusted: only a JSON true unlocks, a track needs a language and an https URL), app/Listen.kt (Listen helpers, ListenPlayerState, ListenBarState, ListenModel, SessionRenewals), demo answers in DemoAuthServices (fake-post-1 ready, fake-post-2 at 42 %, others locked; nothing is charged, the audio URLs lead nowhere). Android: ui/ListenUi.kt (ListenController, ListenSection), ListenPlayback.kt (ListenPlaybackService, MediaListenEngine). iOS: Screens/ListenViews.swift (AVListenEngine, ListenNowPlaying, ListenAudioController, ListenScreen, ListenSection).
Behaviour
- The bar sits above the post body, after the reading bar (RN
postDisplayView). Nothing for comments (the status is not even asked), posts without a body, posts the server callsunsupported, and posts mostly in a script the voice cannot read (Thai, Bengali, Hebrew, Tamil, Telugu, Chinese without kana or hangul; links and image markup left out) until the server's analysis finds a voice. No minimum length. - Status
POST /private-api/listen-status {code?, author, permlink, updated?}: anonymous without a session token; with one, the reader's own answer with signed track URLs. Polled every 5 s whilepreparingoranalyzing, then it stops. Three retries 1, 2 and 4 s apart on other errors (React Query's defaults). - Text: "Listen to this post", "English + German · ~3 min" (the longest track, else the word count at 150 a minute), "· Audio could not be made, your Points were refunded" for a failed job. Log in for a visitor (the login screen), a spinner while a reader's status loads, "Unlock · 50 Points".
- Unlock: a confirmation first ("Spend 50 Points to listen to this post? The audio is yours to replay any time."), never on one tap.
POST /private-api/listen {code, author, permlink, idempotency_key, updated?}; the answer is the new status at once, then polling goes on from it. A transport error or a gateway status (502, 504, 520, 522, 524) is sent again with the same key twice, 2 s apart (the SDK's rule). The key is kept until the outcome is known: a 4xx clears it, a lost answer (a thrown transport error or an unreadable 200 included) keeps it, so the next tap is a replay and never a second charge. 402: "Not enough Points" / "Listening needs 50 Points and you have 3." with Get Points (the Boost route, as RN). Any other failure: "Fail!" / "Could not unlock the audio, please try again". After a failed unlock the status is asked again (the SDK's invalidation). - Preparing: the server's percentage once the worker has the job (capped at 99), else "Waiting in line, N ahead..." / "Next in line...", else "Preparing audio, about N min..." (0.3 s of work per second of audio), else "Preparing audio...".
- Player: play and pause (nothing loads before the first play; from then the source stays while paused, so the media controls stay), the elapsed time, a seek slider, the length, a speed chip 1x, 1.25x, 1.5x, 1.75x, 2x, 2.5x and back, a chip per language when there are several (the reader's interface language first, else the main one; a switch starts the other track from its start), the lock screen and notification following both ways (not while loading or seeking), back to the start at the end.
- Expired URL: the status is asked again for fresh URLs and playback picks up where it failed; after three renewals that did not help it stops with "The audio could not be loaded." and "Try again" (which starts the count over). The count also starts over once playback runs 30 s past the point that failed. A failed or track-less renewal is an error, not a silent player.
- Tokens: a status refused with 401 renews the access token once and asks again with it, and is allowed to renew again after a failed renewal (a cancelled renewal too; it is not repeated after a success); an unlock refused with 401 renews and resends the same request (same key) once; the player renews the token when fresh URLs do not come with the old one. A renewal that brings nothing newer than the token in use ends it.
- Background playback with lock-screen and notification controls: iOS
UIBackgroundModes: audio, the.playbacksession (plays with the silent switch on),MPNowPlayingInfoCenter(title, @author, Ecency, length, position, rate) andMPRemoteCommandCenter(play, pause, toggle, seek). Android: Media3MediaSessionService(ListenPlaybackService, not exported,foregroundServiceType="mediaPlayback") withFOREGROUND_SERVICEandFOREGROUND_SERVICE_MEDIA_PLAYBACK; the app's player is aMediaController, the media notification and the lock screen come from the session. - One audio source app-wide: Listen goes through the 3Speak voice players' coordinator (
SpeakPlayback), so starting either pauses the other. - On-device text to speech and its settings sheet (
tts_settingsreads) do not exist.
How it is built
ListenModelbelongs to the post screen's stack entry (Android) or the screen's@StateObject(iOS), as does its player, not the lazy list row: the audio goes on while the post scrolls, behind pushed screens and in the background, and stops when the screen closes (RN unmounts the post screen then). The reader follows the session: another account (or a sign-out) drops the status, the busy unlock and its key, and asks again for the new reader.ListenPlayerStateis RN's player logic as an immutable value; the platform controllers drive their stream from it and report the stream's events to it. A source is opened only after the first play, never while new URLs are being asked for and never after they could not be had (until "Try again"). Progress is read every 500 ms from the stream while playing, in the background too (the renewal count depends on it).- One renewal per account at a time, app-wide (
SessionRenewals): the Listen bar's status, its unlock, its player, every screen and the app start's own session refresh (SessionModel) share oneAccountManager.refreshSessionper account; a second caller waits for the first one's answer instead of spending the refresh token again. - No write after logout: the renewal is
AccountManager.refreshSession, which never stores for an account that left while it ran, andSessionRenewals.renewhands a token out only while its account is still the current one (RN'sisCurrent). An unlock is never sent while another account is signed in (an account change already cancels the unlock before it can run, so this check is a second line). - Status renewal after a 401 runs in its own job: a reload asked for meanwhile (the foreground, an edit, a failed unlock) waits for it and runs after it; a renewal that failed or was cancelled is allowed again.
- No polling in the background (React Query's focus manager): the screen's owner, not the bar's lazy row, reports the app's background and foreground (Android
ProcessLifecycleOwnerinListenController, iOSdidEnterBackground/didBecomeActiveinListenScreen); the foreground asks again for a failed status or a paused poll, and an answer that came in the background schedules no poll. - An unlock on its way runs in the app's scope and is kept app-wide per account and post (
ListenUnlocks) with its key: neither the screen closing nor another reader cuts it off; a reopened screen, a second open screen of the post or a reader switching back joins it (busy, then its answer as the status) instead of spending a second key; a lost answer leaves the key for the next tap from any screen; the key goes once the outcome is known (delivered, or a 4xx). - The bar stays hidden until the script guess for the body is in, so an unreadable post never flashes the bar.
- Android: renewed URLs and a switched language load into the same stream and media session (no stop, no clearing), so the media notification and the foreground service stay up; the player keeps the network awake with the screen off (
WAKE_MODE_NETWORK,WAKE_LOCK). Android 12+ refuses a foreground service started from the background (a renewal resuming there): Media3's listener then posts a plain "Listen paused" notification that opens the app. iOS: a renewed URL or another language loads into the same AVPlayer (replaceCurrentItem), keeping the session; one.playbacksession counter shared with the 3Speak voice streams (PlaybackAudioSession), held by a Listen stream from its first play to the end of the track or its release, given back to other apps (notifyOthersOnDeactivation) when the last holder lets go. - Android's playback service has one ExoPlayer: each stream has its own
MediaControllerand media id, acts only while its own item is in the player, and puts its item back at its last place when it plays again (another post screen's Listen may have taken the player).
Differences from RN
- Fresh URLs from a renewal always reload the source at the place it failed, even when the server hands back the same URL; a source change for any other reason does too. RN reloads only when the URL string changes, and an unplanned refetch with a new URL started RN's player from 0.
- No refetch on focus or reconnect: the status is asked again on the app's return to the foreground only when the last load failed (RN's React Query refetches on focus and reconnect).
- Play on a player whose URL could not be renewed tries a renewal first (RN plays the dead URL, which fails again).
- A track URL that is not https, or has white space or control characters, is dropped; a status word longer than 32 characters reads as "none".
- The unreadable-script guess knows letters outside the BMP from a list of letter blocks (historic scripts, kana supplements, mathematical letters, Mende, Adlam, CJK extensions), the same on both platforms (Kotlin/Native's regex has no categories there); JS reads
\p{L}. Only rare characters can count differently. - iOS shows the system's headphones symbol and SwiftUI's slider and alerts; Android uses Material 3's slider and dialogs.
Store setup
Android 14 requires the media playback foreground service to be declared. In Play Console, App content > Foreground service permissions declares FOREGROUND_SERVICE_MEDIA_PLAYBACK for "Media playback" (Listen: post audio the reader started, playing in the background with media controls), with a short video of playback continuing with the screen off. Play rejects a release that adds the permission without the declaration.
Tests
Shared ListenTest (23: the helpers against RN's own listen.ts through ListenGoldens, generated with node --experimental-strip-types native/tools/golden/generate-listen.mjs native/shared/src/commonTest/kotlin/com/ecency/core/app/ListenGoldens.kt (from the root of a checkout of the rn-3.x-final tag, where the app is under native/) from the RN root; the untrusted status; visitor, hidden cases, reader token, the place in line, percentage and tracks; the confirmation; 402; the replayed key after a lost answer; the 401 renewals of status, unlock and URLs; one renewal across screens; no token handed out after a switch; nothing written after a logout; another reader; the player's renewal count, its reset, speeds, languages and the lock screen). Android ListenFlowsTest (8, Robolectric with a scripted engine: log in, the confirmation then the place in line, Get Points, playing on while the bar scrolls away and stopping with the screen, renewal and language reloads at their places, the error and Try again, one audio source with the voice players, the service and permissions declared). iOS ListenTests (5, the controller with a scripted engine over the demo answers) and ListenUITests (3: log in, the confirmation then the place in line, the unlocked player).
Background media and widgets
Listen in the background with lock screen controls, dictation that goes on in the background, and lock and home screen widgets. Shared: app/BackgroundMedia.kt (NowPlaying, NowPlayingCard, BackgroundSessions), app/DictationModel.kt (DictationHost, DictationSessions), app/Widgets.kt (AppShortcuts, WidgetSnapshot, WidgetFeed, WidgetStore). Android: ListenPlayback.kt, DictationService.kt, widgets/EcencyWidgets.kt (Glance). iOS: Screens/ListenViews.swift, App/DictationPlatform.swift (IosDictationHost), App/WidgetStore.swift, the EcencyWidgets extension (iosApp/Widgets).
Background media
- Listen keeps playing with the screen off and the app in the background (iOS
.playbacksession withUIBackgroundModes: audio; Android Media3MediaSessionService,mediaPlaybackforeground service, see "Listen"). Lock screen, Control Center and the media notification: play, pause, skip back and forward 15 s (NowPlaying.SKIP_SECONDS; iOSskipBackwardCommand/skipForwardCommand, Android the session's custom layout of two custom session commands (media3 1.4's notification drops custom layout buttons without one), handled byseekBack/seekForwardwith ExoPlayer's 15 s increments, previous and next taken away), scrubbing, and the now playing card (title, @author, "Ecency", artwork). iOS: an interruption (call, Siri) pauses and resumes when the system says so; headphones unplugged pause and stay paused. Android: audio focus and becoming noisy are ExoPlayer's (handleAudioFocus,setHandleAudioBecomingNoisy). - Now playing privacy (
NowPlaying.card): the card shows the post's title and its author, which are public on chain. The artwork is the post's image (the author's avatar for an NSFW post or one without an image) and none while the PIN lock is on: a locked phone shows only title and author. The card is read again for every source the player loads and when the PIN lock is turned on or off while it plays (retitle: the same source, no reload). - Teardown: every Listen player registers with
BackgroundSessions;AppEnvironment.accountsLeftstops them all when the current account leaves (logout, logout-all, the PIN wipe): the stream, the lock screen card, the media notification and Android's "Listen paused" notice go. Another account leaving leaves the reader's audio alone. An account switch stops it through the model. - Dictation starts only in the foreground and goes on in the background: Android starts
DictationService(microphoneforeground service, not exported) with an ongoing notification "Recording for dictation" and a Stop action, started from the Record tap (Android 14 refuses a microphone service started in the background); iOS keeps the.playAndRecordsession active with theaudiobackground mode and the system shows its recording indicator. The notification is private on the lock screen (a public version without actions); its Stop holds the clip unsent ("Recording stopped from the notification"), because a notification can be tapped without unlocking: the user confirms "Transcribe (N Points)" in the app. When the platform cannot show the recording in the background (Android: the foreground service refused, or notifications off) it records in front and is held unsent the moment the app leaves the foreground. It stops and is thrown away (nothing charged) on logout, wipe, an account change and when the sheet or its composer closes. These stop it and hold the clip unsent: the app lock engaging on the return (after the lock timeout, also when the lock cover closes the sheet first), the notification's Stop, leaving the foreground without a visible notification (above), on iOS an audio session interruption (a call, Siri), on Android a transient audio focus loss (a call, an alarm), on Android 10+ the system silencing the recording, and below Android 10 any audio focus loss (a permanent loss, music or Listen starting, is ignored from 10 on). The clip is kept until the user taps "Transcribe (N Points)" or "Give up" in the app (after the unlock when locked); the hold outlives the sheet (DictationSessions.Held, memory only: Android leaves the composer out behind the lock cover), and the next sheet of that account and editor takes it back. The clip ownership rules stay: a clip carries its owner's tag, a held clip is kept by the purges of its own account and goes with the account.
Widgets
Three widgets, both platforms:
- Notifications: the unread count; opens
ecency://notifications(the Notifications tab). - Quest streak: the daily quest streak as Perks last read it; opens
ecency://perks. - Write: quick New wave (
ecency://compose/wave, the Waves tab with an empty composer) and Write (ecency://compose/post, the editor); shows no data.
iOS: a WidgetKit extension EcencyWidgets (app.esteem.mobile.ios.widgets, App Group group.com.ecency.eshare), families accessoryCircular, accessoryRectangular, accessoryInline (Lock Screen) and systemSmall (Home Screen); counts are also privacySensitive. Android: Glance home screen widgets (NotificationsWidget, StreakWidget, ComposeWidget). Android phones have no lock screen widgets; the provider info lists keyguard, which only tablets and hub mode on recent releases use.
- Data: the widgets read ONLY
WidgetSnapshot({"v":1,"signedIn","locked","unread","streak"}), whichWidgetFeedwrites from the signed-in account, the PIN lock setting, the unread count (as the notifications model refreshes it) and the streak (as Perks reads the quests): iOS into a file in the App Group container (Widgets/snapshot.json, its folder left out of backups, thenWidgetCenter.reloadAllTimelines), Android into the app's ownecency.widgetspreferences (left out of backups, then GlanceupdateAll). No name, key, token or session code; the widget never reaches the network; anything unreadable reads as nothing. - Privacy per widget: the unread count and the streak are hidden while the PIN lock is on ("Unlock Ecency to see") and cleared on logout and wipe ("Log in to Ecency"); the Write widget has no data.
- Links:
AppShortcuts.parsetakes exactly the four shapes above (no query or argument is used, nothing is prefilled, signed or sent).AppEnvironment.shortcutEntryturns one into aNavEntrythat the platforms open as any link entry (New wave asks for the empty composer only once the entry opened,entryOpened, and never over a shared text that waits): after the accounts were read, behind the app lock, login gated byNavState.open(Perks and the editor need an account; the tabs show their login prompt). The auth link parser never claims them. - Language: the widgets' text, picker names and descriptions follow the app language (README "Localization", OS-read strings).
- Widget setup: the widget App ID and its provisioning profile, secret
WIDGET_PROVISIONING_PROFILE(docs/release-builds.md, "Widget extension"); CI installs it asECENCY_WIDGET_PROFILElike the other extensions.
Store setup
Besides Listen's FOREGROUND_SERVICE_MEDIA_PLAYBACK, Play Console declares FOREGROUND_SERVICE_MICROPHONE for "Microphone" (dictation the user started keeps recording in the background, with a visible notification and a Stop action), with a short video of a recording continuing in the background and stopped from the notification.
Tests
Shared BackgroundMediaTest (card, privacy, skips, teardown on logout and wipe), DictationModelTest (background recording, notification Stop, lock and call holds, the hold outliving the sheet, teardown), WidgetsTest (shortcuts, snapshot privacy and decoding, the feed). Android BackgroundMediaFlowsTest (dictation service and notification, widgets), ListenFlowsTest (card, teardown, 15 s skips), LinkEntryTest (shortcuts). iOS ListenTests (card, teardown, skips), WidgetViewTests (snapshot reader against the shared encoder, copy, links, App Group store, a rendered sheet).
Notifications and push
RN screens/notification, components/notification, notificationLine, leaderboard, foregroundNotification, providers/queries/notificationQueries.ts, unreadActivityCount.ts, utils/pushRegistration.ts, the push and websocket parts of screens/application and the push section of settings. Shared: api/ecency/NotificationsApi.kt, api/broadcast/NotificationOps.kt, app/NotificationFormat.kt, NotificationsModel.kt, PushPayload.kt, PushModel.kt. UI: Android ui/NotificationScreens.kt, push/AndroidPush.kt; iOS Screens/NotificationViews.swift, App/Push.swift.
env.notifications.start(); show(); selectFilter(f); toggleUnreadOnly(); refresh(); loadMore(); open(id); markAllRead(); refreshUnread()
env.leaderboardModel() // day, week, month; public; tick() from the daily reset line
env.pushPlatform = ...; env.push.start() // each app sets its platform first; PushPlatform.None: push inactive
env.push.opened(data); received(data, title, body); onTokenRefreshed(); onForeground(); onBackground()
env.push.setEnabled(on); setType(PushType.VOTE, on) // PushState.settings, available, open (a NavEntry to open, then consumeOpen())
- Requests are the SDK's:
POST /private-api/notifications {code, filter?, since},notifications/unread {code},notifications/mark {code, id?},register-device {code, username, token, system, allows_notify, notify_types},GET /private-api/leaderboard/<day|week|month>. "Mark all" also broadcasts the SDK's twosetLastReadcustom_jsonoperations (notify,ecency_notify) throughSigningModel. - Rows (
NotificationFormat): RN's copy per type (en-USnotification.*), the transfer amount, delegations in HP or RC, the vote percent, the account update variants, the post or parent title, a 96 px proxied thumbnail for RN's image types, and the tap target. Number and time formatting is pinned to RN's own helpers:node --experimental-strip-types --no-warnings native/tools/golden/generate-notifications.mjs native/shared/src/commonTest/kotlin/com/ecency/core/app/NotificationGoldens.kt(from the root of a checkout of thern-3.x-finaltag, where the app is undernative/) (from the RN root; offline, synthetic values). - Tap targets (
NotificationFormat.target, RN_navigateToNotificationRoute): a row with an author and permlink opens the post;scheduled_publishedopens the published post; follow types open the follower's profile;tagsopens the post or the tag feed;transferandweekly_earningsopen the Wallet tab;spinopens Boost; theinactivereminder (list row and tapped push) opens the editor (AppScreen.Editor, a new post). Every account, permlink and tag is validated, and a row whose target does not validate opens nothing. - Account and lock: nothing is requested while signed out or while the lock hides content. An account change clears rows, count and badge before the session shows the new account (
AppEnvironment.forgetSessionState), every request carries the generation it was started in, and a late answer for the previous account is dropped. UIs also draw rows only whileNotificationsState.accountis the signed-in account. - Unread count: read when the account is loaded or unlocked, on foreground, after a foreground push or websocket event, on pull to refresh, and replaced by the server's number after a mark. RN has no timer for it (the SDK query's
refetchIntervalhas no observer in RN), so there is none here. A failed read keeps the last count; a grown count reloads the list. - Push payloads are untrusted (
PushPayload,PushRouting): on Android any installed app can start the exported activity with extras that look like a tapped push. Only the known string fields are read, oversized values are dropped whole, accounts, permlinks and tags must passSafeTarget, texts are capped single lines read by code point (also the names put into a banner's title): control characters, line separators, bidi embeddings, overrides and isolates, zero width space, byte order mark, soft hyphen, other format characters, tag characters and lone surrogates are removed; the zero width non-joiner and joiner and the direction marks stay, so Persian and Indic words and emoji sequences show as sent; the cap never splits a surrogate pair. A payload cannot name a screen, a URL or a link of any kind: RN'shiveuritype (a signing link from a push) is not ported (the notification server never sends it). - A tapped push is kept in memory (the latest only) until the accounts were read and the lock is open; it then sets
PushState.openfor the platform's navigation. Nothing of it shows on the lock screen. Its id is sent tonotifications/markonly when the push names the current account as its target and the id is id-shaped (the server marks only the caller's own unread rows); a row already known to be read is skipped, anything else is dropped without a request. - A push addressed to another account signed in on the device (RN registers every account) shows no banner, does not touch the current account's count and marks nothing; tapped, it still opens its public content. A push in front does nothing while locked or signed out.
- Token lifecycle (
PushModel, RNpushRegistration.ts): every signed-in account with an access token registers the device token at start, on reconnect (60 s dedupe), on foreground after 24 h, when it becomes current, on token refresh, and again after a 401 or 403 once its access token changed. A logout reads the leaving account's token before the vault forgets it and disables its row in the background; the device token is deleted when no account is left or a row could not be disabled (then the others register the new token). Registrations wait up to 30 s for running logouts and register once more if they gave up waiting; logouts wait for registrations already sending. A wipe deletes the device token. - Releases that cannot finish (offline logout or wipe, the process killed mid-logout): written to
Prefsunderpush.pendingReleasebefore any request, as the device token and the account names (a wipe stores*instead of names). No access token is stored, so a finished logout leaves no credential behind; the preferences are not part of the vault and survive the wipe. At the next start, reconnect or foreground the entry is finished by deleting the device token (the backend's sends to the old token then fail as unregistered), or dropped when the device token is already a different one. While an entry exists nothing registers, so the old token is never refreshed for the account that left; afterwards the accounts that stay register the new token. - Timeouts: every notification and push call to the Ecency API gives up after 30 s (
NotificationsApi.TIMEOUT_MILLIS; the shared HTTP client has none on Android), and one release holds its lock for at most 120 s, after which its entry stays pending for the next retry. - No token before consent: Firebase's auto-init is off (
firebase_messaging_auto_init_enabledfalse in the manifest,FirebaseMessagingAutoInitEnabledNO in the iOS push include), the platforms never ask Firebase for a token while notifications are not allowed, and they turn auto-init on once they are (also for users who allowed them earlier). On Android the one-time dialog counts as used only when an answer arrives, and an answer given while the activity is recreated reaches the waiting callers (they live in the push platform, not the activity). - Websocket (
ActivitySocket): only where push is unavailable, only signed in, unlocked and in front, onlywss://; RN's backoff (2, 4, 8, 16, 30 s, then it waits for the next foreground, unlock or account change).
RN feature checklist
Done on both apps unless noted. Everything that needs a real Firebase project (the system permission prompt, a real token, a delivered or tapped system notification) is built against the shared model and covered with fakes only; it has not run on a device.
Notifications tab
- Two top tabs: Notifications and Leaderboard.
- Filter selector with RN's 15 filters, labels in capitals.
- Flat list, newest first, unread rows highlighted (RN does not group by day: its
recent/yesterday/this_weekstrings are unused). - A row per type with RN copy: bold source, Pro badge, text, extra, post or parent title, description, time, avatar, thumbnail (hidden with "Show Images" off).
- Paging by
since, pull to refresh (also the badge), footer spinner, placeholder, "No recent activity", error with retry. - A row tap marks it read and opens its target (see Tap targets above).
- Avatar tap opens the quick profile.
- Mark all as read: API plus on-chain
setLastRead, optimistic, "Fail!" on failure, nothing while offline. - Signed out: "Login to see"; Leaderboard stays visible.
- Leaderboard: daily, weekly, monthly; rank or quests check, user, activities, reward; pull to refresh; a tap opens the quick profile; a tap on the reward shows RN's "Earn points" hint. Beyond RN: the daily board is read again once when the 00:00 UTC reset passes while it is shown (
LeaderboardModel.tick, called by the "Today (UTC), resets in ..." line when it shows and at each minute tick; it compares the UTC day of the last read with the clock, so a board kept while the tab was away is read again on return; weekly and monthly are not). Only a daily read that answered counts (a weekly or monthly one never does): a failed read of the daily board is tried again by the tick 5 minutes later, without a toast). - Tapping the selected Notifications tab scrolls to the top.
- Beyond RN: swipe an unread row from the end towards the start (mirrored in RTL) to mark it read without opening it: SDK
notifications/mark {code, id}through the same optimistic path as a tap (NotificationsModel.markRead(id), the row springs back and stays). TalkBack custom action and VoiceOver rotor action "Mark as read" on unread rows. AndroidSwipeToDismissBox(end to start only), iOS a horizontalDragGesturebeside the scroll (a mostly vertical drag or a diagonal flick stays the scroll's: only a drag the row followed can mark; the drag is flipped in right to left layouts; the list is aLazyVStack, soswipeActionsis not available). - Beyond RN: quick chips for Replies and Mentions next to the filter menu (
NotificationFilter.quick,NotificationsModel.toggleQuickFilter): a chip is the same as choosing that filter in the menu (both stay there), the selected chip is filled blue (Android a checkbox role, iOS the selected trait) and a tap on it goes back to All; menu and chips wrap under each other on a narrow phone or with large text. There is no All / Unread / Read menu: two "All" menus side by side confuse. - Beyond RN (issue #2686, web has an All / Unread / Read view): an Unread chip before Replies and Mentions (
NotificationsModel.toggleUnreadOnly,NotificationsState.unreadOnly,shown). It turns on and off by itself and combines with the menu filter and the quick chips (unread mentions). Client side: the notifications API takes no unread parameter (SDKgetNotificationsInfiniteQueryOptionssendscode,filter,sinceonly; web filters its loaded pages too), so the rows in memory are filtered and paging stays the API'ssince. A row marked read (tap, swipe, mark all) leaves the unread view at once; the empty view says "No unread notifications". A page that brings no unread row (and an empty view when the chip is turned on, or after the last unread row was read) is followed by the next page by itself, since nothing on screen would ask for it; this stops at the end of the list, once the unread rows shown reach the server's unread count, and at 10 pages (the window kept in memory, so no unread row leaves it); scrolling goes on from there. A quiet reload after a long trip away that leaves the view empty pages on the same way.
Unread count
- Badge on the tab icon ("99+" from 99).
- Refreshed at account load and unlock, on foreground, after a foreground push or websocket event, on pull to refresh, after mark as read; the list reloads when it grows.
- Delivered notifications are cleared at start (and the app icon badge on iOS).
Live updates
- Foreground push: count refresh and the in-app banner with RN's texts and routing.
- Websocket fallback with RN's backoff (inactive until
ecency.activityWebsocketUrlis set).
Push
- Permission prompt at app start (only in builds with a Firebase configuration).
- Token registered for every signed-in account on RN's triggers, system
fcm-android/fcm-ios. - Logout disables the leaving row, deletes the token when needed, the others register again.
- Registrations and logouts wait for each other; a leaving account is never registered.
- Settings: master switch and 14 type switches, kept on the device, sent for every account, the unavailable notice.
- iOS token timing: Firebase refuses a token until Apple's push token of the launch is set, so a token request waits for it (
APNsTokenGate, at most 10 s; a failed APNs registration answers at once). Without Apple's token no Firebase token is asked for (one minted then cannot deliver through APNs, and counting it would hide the notice and the websocket fallback), and its arrival registers every account again when a request ended without it or the token changed (Firebase calls back only for a new token). Never on the same token: each registration's permission check asks Apple again, and Apple answers every time, so registering on each answer would loop. Android has no such wait: Firebase answers from Play services, and its permission check only reads the state. Before, the first check of a launch could run too early: Settings said push is unsupported, the websocket fallback opened and nothing registered until the next foreground.PushTests. - Tapped push: RN's routing table (without
hiveuri), marks read when the id is the current account's, waits behind the PIN. - Availability (configuration, permission, token) decides between push and the websocket.
Rich push (iOS)
RN's ImageNotifi notification service extension: NotificationService/ with App/RichPush.swift attaches the payload's fcm_options.image (https only, 2 KB URL cap, 20 s, image types only, at most 10 MB: refused on its announced length, and streamed with the request cancelled past the cap; anything else leaves the notification as it came). It needs no Firebase code (RN used FIRMessaging's helper). Built with push: push-extension.yml, enabled by ECENCY_PUSH_EXTENSION=true (ios-sim.sh sets it with ECENCY_FIREBASE). Signing: it is RN's App ID app.esteem.mobile.ios.ImageNotifi with RN's profile (CI secret NOTIFI_PROVISIONING_PROFILE, named per target through $(ECENCY_NSE_PROFILE)). Android shows notification images itself (FCM).
What push needs
None of this is in the repository, and none of it may be committed. Without it both apps build, run and pass their tests with push inactive (settings show RN's "not supported on this device" notice).
- Firebase: the RN app's Firebase apps (
app.esteem.mobile.android,app.esteem.mobile.ios) and their files, whose sender the Ecency notification backend already uses. CI decodes them from the existingGOOGLE_JSONandGOOGLE_PLISTsecrets. - Android:
androidApp/google-services.json(RN'sandroid/app/google-services.json).androidApp/build.gradle.ktsreads it at build time and writes the values Firebase needs as string resources (no google-services Gradle plugin); a file without anapp.esteem.mobile.androidclient fails the build with a message. - iOS:
iosApp/GoogleService-Info.plist, an APNs key uploaded to the Firebase project, and the Push Notifications capability on the app id with a matching provisioning profile.scripts/ios-sim.shsetsECENCY_FIREBASE=truewhen the plist exists;xcodegen generatethen mergesiosApp/push-firebase.yml(the FirebaseMessaging package, the plist as a resource, theaps-environmententitlement). CI has to place the plist and exportECENCY_FIREBASE=truebeforexcodegen generate. The simulator never registers (no APNs token there, as in RN). - Optional: RN's
ACTIVITY_WEBSOCKET_URLasecency.activityWebsocketUrlinlocal.properties(Android also takesECENCY_ACTIVITY_WEBSOCKET_URL), for the websocket fallback. - Dependencies: Android
com.google.firebase:firebase-messaging25.1.3 (built with Kotlin 2.0.21); iOS firebase-ios-sdk 12.4.0 (Swift and Objective-C).
Differences from RN
- The list ends only on an empty page or a page of rows seen before (RN's cursor asks for the first page again after an empty one). Like RN's
maxPages: 10the last 10 pages stay in memory and the page loaded first leaves; a refresh starts from the newest again (RN has no other way back either). - RN's
hiveuripush type goes to the auth link model like anyhive://orecency://link (it asks before signing), and only when the push is not addressed to another account signed in here. A tapped push marks its activity read only under the conditions above (RN marks whatever id the payload carries, with the current account's token). A link the app refuses (an operation it cannot sign, a malformed link) shows nothing when it comes from a tapped push (AuthLinkModel.handleFromPush): any app can hand the exported activity a push-shaped intent. - Pushes for another signed-in account are ignored in front (RN shows their banner and refreshes the current account's count).
- A failed list request shows the error with a retry (the SDK query turns HTTP errors into an empty list, which RN shows as "No recent activity").
- A failed mark always puts the row back and shows "Fail!" (RN stays silent when the failure comes within 5 s), and the count is read again.
- Turning one push type off sends
allows_notifyfrom the master switch. RN sends the toggled value there, which turns every push off on the backend until the next registration.notify_typesare sent in numeric order. - A delegation row without an amount shows no extra (RN throws); an RC amount with text after the number uses the number.
- The websocket's attempt count starts over after a message or 30 s of connection (RN resets it on every open, so a server that accepts and drops reconnects every 2 s forever), and it disconnects in the background.
- The banner shows one line each for title and body, as RN, with the actor's avatar only when the name is a valid account.
- "Show Images" (settings, RN
hidePostsThumbnails) also hides the notification rows' thumbnails. - The leaderboard's "Earn points" tooltip is a toast.
- RN's push switches are imported once from the RN app's storage (see Settings); a fresh install starts with every switch on.
- The Android status bar icon is a plain white bell vector: the repo has no monochrome brand vector (the launcher icon is a PNG).
Debug
iOS -fakeData YES -seedAccounts YES -startTab NOTIFICATION, -demoPush tap|banner (a tapped reply notification, or one arriving in front; with -lockDemo YES the tap waits behind the PIN), -openScreen settings. Android --ez demoAuth true --ez seedAccounts true --es openTab NOTIFICATION, --es demoPush tap|banner. DemoAuthServices answers the notification calls with one synthetic row per type.
Tests
Shared NotificationsTest (requests, RN goldens, copy per type, routing, paging, filters, errors, lock, account switch with a held-back answer, unread count, mark as read, leaderboard) and PushTest (registration triggers, logout ordering, settings, tapped and foreground pushes, hostile payloads, the lock, the websocket and its backoff); Android NotificationFlowsTest; iOS NotificationTests, NotificationUITests.
Chats
RN screens/chats, providers/chat (mattermost.ts, mattermostWebSocket.ts), config/chatApi.ts, hooks/useMattermostWebSocket.ts, the chat sheets (channel and message options, new group, rename, who reacted, emoji picker), the settings DM privacy row and the profile and quick profile "Message", including RN's group conversations and who-reacted features. Shared: api/chat/ChatApi.kt, ChatModels.kt; app/ChatService.kt (sessions, badge, privacy), ChatsModel.kt, ChatThreadModel.kt, ChatSheets.kt, ChatSocket.kt, ChatFormat.kt (RN's pure helpers), DemoChat.kt (offline fake). UI: Android ui/ChatScreens.kt; iOS Screens/ChatViews.swift. Inventory row by row: chats-inventory.md.
env.chat.start(); env.chat.onForeground() // the chat badge (apps call these next to notifications)
env.chat.chatsModel() // the Chats tab: show(), refresh(), setQuery(), toggleSort(), perform(row, action), join(), startDirect(), groupCreated(id)
env.chat.threadModel(channelId, type) // a conversation: start(), setActive(), loadMore(), setText(), send(), replyTo(), startEdit(), react(), remove(), setPinned(), attach(file)
env.chat.newGroupModel(); renameModel(id, name); privacyModel(); openDirect(username)
- Transport: the chat API is Ecency's relay on RN's
ECENCY_BACKEND_API(ecency.com) under/api/mattermost/...:POST bootstrap {accessToken, refreshToken, username}gives a chat token and the viewer's Mattermost user; every other call carries the token inX-MM-Token. The websocket iswss://<that host>/api/mattermost/websocket?token=...(RN derives it fromECENCY_BACKEND_API;ACTIVITY_WEBSOCKET_URLis the notification socket, not the chat one). Build setting:ecency.chatBackendUrlinlocal.properties(Android alsoECENCY_CHAT_BACKEND_URL), empty for ecency.com; anything but a bare first-partyhttps://host(no port, not even 443, no path, query or fragment; lower-cased) is ignored (AppEnvironment.setChatHost,ChatApi.canonicalBase) andChatApisends nothing to an untrusted base, so the access token and the chat token only ever reach Ecency. - Session (RN bootstrapMattermostSession): one bootstrap per account at a time, the answer reused for 30 s, tokens in memory only and passed per call (no shared header that one account could overwrite for another). Logout, logout-all and the wipe (
accountsLeft) void every bootstrap on the way (also for a caller that joined one already on its way), so a chat token never outlives its account; the channel hints, renames and closed DM notices (kept by channel id) that a departing account saw go too, while what only the accounts that stay saw is kept. A refused access token is renewed once (SessionRenewals); a call refused with 401 bootstraps again once. - Badge (RN
_refreshUnreadChats): read at account load and unlock, on foreground, after a channel was read or muted, when a read conversation closes; never while signed out, offline or locked. Every read of the channel list goes throughChatService.fetchChannels: the badge and the list's rows take the same answer (a loaded list of the same account adopts each badge read, keeping renames and its own read, favorite, mute and leave changes made after that read started; an older answer never replaces a newer one), and the badge is the sum of the rows. A list for another account is never taken (ChatListFreshnessTest; tester report: an unread count on the tab that no row showed). RN's unread rules (unread_eligible, muted, never-viewed non-DMs with 0 or null) are pinned by goldens from mattermost.ts. - List: RN's four sections and sort orders (and sort by name), DM partners resolved through
users/ids, group titles and two avatars, community avatars fromhive-NNN, relative times (never in the future: the server's clock may run a little ahead of the phone's, so a stamp ahead of now reads "a few seconds ago", in the list, the conversation, pinned messages and "joined" notes;ChatThreadTest.aMessageStampedByAServerClockAheadOfThePhoneIsNotInTheFuture,ChatsListTest.aLastMessageStampedByAServerClockAheadIsNotInTheFuture), unread counts, an in-line connecting notice only while the chat is not connected (no "Connected" pill), a round Esie button at the bottom end (the FAB's size and place, hidden signed out or disconnected) that opens her direct message as "Ask Esie" does; options (mark read, favorite, mute, leave channel or conversation, rename group for the owner); search (350 ms, 2 characters, local plus server channels, people with a Hive name first) with Join and message buttons; New group (2 to 7 others, the server's refusal text shown); renames newer than a list fetch are kept. The tab shown again reads the list again quietly (no spinner, a failure keeps the rows). The platform's reachability flag never stops a load (it can read offline for a moment at launch, on resume or between networks while requests go through; tester report: "No Internet Connection" on the chat while the rest of the app loaded): "No Internet Connection" shows only when the request could not connect, and a list that failed loads again when the connection comes back. Any other failure shows itself: the server's text, else "Request failed (N)" or the fallback with the report's error code. - Conversation: pages back with
before, a non-member joins and reads again, fewer than 15 rows asks for more; RN's join notices grouped ("N people joined"), rename notices; the "New messages" marker at the oldest unread row (the thread is not scrolled to it: it opens at the newest message, because jumping to the marker sent a thread with many unread messages up into its history), the channel marked read; messages with RN's parsing (images out of the text,@nameto profile links,:emoji:from RN's map, links includinghive://, mentions bold, markdown as web'ssimpleMarkdownToHTMLreads it: inline marks, lists, quotes, headings, code), quotes (a reply whose root is not loaded reads it by id, best effort as RN'sfetchMattermostPost: a 404 skips that root, a 405 stops these reads for the conversation, neither is reported), link cards, reactions (tap toggles, long press: who reacted), "Edited"; composer with mentions, reply, edit, Hive post link card, image attachment through the app's image upload, send withpending_post_id, the posting ban notice (counts down, lifts itself) or RN's toast; message options (quick reactions: RN's four, then a wave and a party, with More at the row's end for the emoji picker; Reply, Copy, Share, Translate, Edit, Pin/Unpin, Delete with confirmation); pinned, members and group sheets; the DM safety notice; moderators of the channel's community may pin and delete anyone's message. Who moderates is the server's word, not worked out in the app: every posts page carriescanModerate(an open channel whose Mattermostnameis the community,hive-NNN, and the viewer is its owner, admin or mod) andcanMentionEveryone(a moderator, or anyone in a direct message), the same rule the server enforces on delete, pin and send (#3710; RN found the community in the channel's name, display name or header and read the team itself, and the first native port lost thename). Pin stays for both people of a direct message and community moderators, as RN. Channel-wide mentions as web, in open (community) channels only: an@query of at least one character offers@here,@channel,@all,@everyone(those starting with it) to who may use them, and to the others, once the server has said what they may do, a one-line notice that they are for moderators. The rights are read again on every catch-up after a gap (a moderator given or taken meanwhile), a restored thread offers them once its type is known, and a sent draft takes the offer with it. The list scrolls inside a panel at most 220 points high (AndroidheightIn, iOSViewThatFitsover aScrollView). Mentions of people keep RN's list (every conversation, from a bare@). Fake data: iOS-demoChat moderatormakes the viewer a moderator of the Ecency demo channel. The socket replays nothing: once it is up again after a gap (back from the background or the lock, or its own reconnect on an open conversation) the newest page is read and merged, so messages sent meanwhile show without a pull to refresh. A catch-up waits for the socket to be up (a load that ends while it waits to reconnect leaves the gap for the reconnect) and for a page load that is running, keeps what changed here while its read is out (an edit keeps the edited copy unless the read's is newer; a reaction or a pin keeps only that field, so newer text the read brings still shows; a message removed here does not come back), is read again when a pull to refresh overtook it (that refresh may have failed) or when another gap or return came while it ran (never as a retry of a failed read), and is never applied or marked read while the conversation is hidden; when none of the page is in what the thread held before the gap, the thread starts again from that page and keeps what the socket delivered since (ChatThreadModel.catchUp, #3701, #3706). - Attachments and keyboard: "+" attaches one image (library or files), as RN (
ImagePicker.openPicker({ mediaType: 'photo' })); RN chat had no video attachment either, a video is shared as a link. With the keyboard up the composer row sits right on it: Android'sMainActivityisadjustResize(as RN's), so the keyboard reaches the edge to edge window as an inset for the thread'simePadding; unspecified, Android also panned the window up to the field and the row stood a keyboard's height above the keyboard (tester report). With no system pan, every screen of the main window with a text field low on the screen takes the IME itself (imePaddingon the screen column, orfitInside(WindowInsetsRulers.Ime.current)on Edit Profile:ProfileFlowsTest.theFocusedProfileFieldAndSaveStayAboveTheKeyboard); sheets and dialogs are windows of their own.ChatFlowsTest.theComposerSitsRightOnTopOfTheKeyboard(faked IME and 3-button bar insets),LaunchSplashActivityTest.theWindowResizesForTheKeyboardInsteadOfPanning, iOSChatUITests.testTheComposerSitsRightOnTopOfTheKeyboard(skips without the on screen keyboard). - Live: the websocket follows the screen (on screen, app in front, not locked): authentication, ping every 30 s with a 10 s pong bound, backoff 1 s to 30 s for at most an hour; only a connection that got the server's
hellocounts as up (open-then-close before it is a failed attempt, so the backoff grows and the hour runs). It ends for good on a 15 s connect timeout (Android's OkHttp connect bound is the same 15 s), a handshake refused with 401, 403, 404 or 426, a close with one of those codes or 1002 or 1003 (RN doNotReconnectCodes; the code comes fromHasSocket.closeCode) and a FAIL answer to the authentication challenge. The handshake status is read from the engine's own wording (HasSocketRefused: Ktor's "expected status code 101 but was N", 401 on both engines; OkHttp's "Expected HTTP 101 response but was 'N ...'"); Darwin reports other refused statuses as NSURLErrorBadServerResponse without the code, so on iOS a 403, 404 or 426 is retried with backoff until the hour runs out; posts, edits, deletions, reactions, typing ("a is typing...") and group renames arrive in place; the echo of one's own send is recognised by its pending id, and whichever of the echo and the send's answer lands first scrolls the thread to the sent message (the thread may sit at the unread marker; RN scrolls only when the answer lands first). - Lock and accounts: no chat request while the lock hides content (Android and iOS compose nothing then); the websocket closes behind the lock; an account change empties the list and stops any open conversation (its models answer nothing for the next account).
- Entry points: the Chats tab, profile and quick profile "Message" (RN's "User has not joined chats" toast). RN has no push type and no link that opens a chat; this app has no push type either, but opens ecency.com/chats links (README "App shell", App links, #3753); a restored conversation (saved navigation keeps only the channel id and type) reads its name and type from the channel list.
Official accounts and Ask Esie
- Shared
app/OfficialAccounts.ktports the web'sfeatures/chat/official-accounts.ts: the fixed list (esie,ecency),isOfficial(exact, ignoring one leading@and case, soesie1,ecency-official,esiewith a Cyrillic letter or in fullwidth letters never match) andimpersonates/safeName(a chosen name that reads as an official account: lookalike letters, digits for letters, spaced or dotted letters, invisible characters, NFKD with marks dropped, one unreadable letter allowed;UnicodeTextgives NFKD and the categories per platform). One source of truth for both apps. - The badge keys only on the chat user's
username(nevernickname,props.hive_usernameor a post'soverride_username); posts from webhooks or bots (relayed) and system notices never get it. It shows on the chat list row (ChatRow.official), the conversation header (ChatThreadState.official), message author names (ChatMessageItem.authorOfficial) and the profile header. A text label "Official" (white on the blue fill, AA in both themes, in sp / Dynamic Type), read as "Official Ecency account" (native.chat.official_badge*). - Names other people chose (
nickname,name,hive_username, group names) that pose as an official account are replaced by the username (or a group's members) wherever chat shows them (ChatUser.safeNickname,safeName,hiveName,ChatGroups.safeGroupName). - "Ask Esie" (
SideMenuItem.ASK_ESIE,native.side_menu.ask_esie) sits after Docs and opens the direct message withesielike profile "Message" (MenuAction.DirectMessage); signed out it is not listed, as on the web. It differs from the web in two ways: there is no pinned Esie row at the top of the chat list and no Esie avatar in the menu row (the menu uses the AI sparkles icon like its other rows). - Tests: shared
OfficialAccountsTest(web cases plus lookalike usernames),OfficialChatTest,ShellTest; AndroidChatFlowsTest.askEsieOpensHerConversationMarkedOfficial; iOSChatTests/ChatUITestsofficial cases. Fake data:DemoChatanswers a direct message withesiewith one made-up greeting.
Differences from RN
- Chat tokens are passed per call instead of one shared axios header; a 401 re-bootstraps once and an expired access token is renewed once (RN shows the error).
- "Mark as read" also zeroes
message_countlocally (RN zeroes the other counters only, so its row could keep a badge until the next load). A failed badge read keeps the last count (RN sets 0). - A conversation read on screen clears its row in the list at once (
ChatService.viewed, after the server took the view); RN refreshes only the tab badge and its row keeps the count until the next load. - The warning box (the direct message warning and the ban notice, RN
dmWarningContainer) takes theme colors (AppTheme.warning*,EcencyColors.warning*, the same values): RN's cream 0xFFF6DF with a darker amber border than RN's, 0xB07800 (3.5:1, RN's 0xF4C26B was 1.5:1), and text 0x8A5B00 (5.5:1) in light; in dark an amber dark surface 0x3A3223 with border 0xC9963A (4.8:1) and text 0xFFD98A (9.4:1); iOS Increase Contrast darkens the light text to 0x6B4500 (7.9:1) and lightens the dark ones to 0xE8B04F (6.5:1) and 0xFFE7B3 (10.4:1). Tests: iOSAccessibilityTests.testTheWarningBoxMeetsAAInEveryTheme,ThemedBackgroundUITests.testDmWarningBox; AndroidContrastTest,ChatsThemedBackgroundTest.dmWarningOnThe*Theme. - A tap on the quote above a reply goes to the quoted message (RN's
ReplyPreviewdid nothing; owner request): it is scrolled to and its row tinted for 1.5 s (ChatThreadModel.openQuote,highlightId). One older than the loaded pages is looked for in the pages before, 10 at most; one not found says "The quoted message could not be found." A long press on the quote still opens the message options; VoiceOver and TalkBack offer "Go to the quoted message". Tests: sharedChatThreadTest(aTappedQuote...,aQuoteOf...), AndroidChatFlowsTest.aTapOnAQuoteScrollsToTheQuotedMessage, iOSChatUITests.testATapOnAQuoteScrollsToTheQuotedMessage. - The conversation is an inverted list on both apps, as RN's (
invertedFlatList): AndroidreverseLayout, iOS a flippedScrollViewwith each row flipped back. It opens at the newest message (RN opened at the first unread one), older pages go in above without moving what is shown, and a page is asked for only when the oldest row comes on screen. Two traps the layout avoids: iOS's bottom-anchored stack in reading order lays out from its top, so the oldest row would appear and each page push the view up into old history or blank space; and on Android the loading row joins the list only under messages, because a list keeps its only item in place when the first page comes in. Tests: sharedChatsListTest.aConversationReadOnScreenClearsItsRowOnReturn, AndroidChatFlowsTest(long channel, direct message, read on return), iOSChatUITests(long channel, direct message). A message's text keeps its full height (iOSfixedSize): under a quote, whose bar takes any height offered, a long reply would give its height to the quote and be cut after a few lines (iOS, large text). Fake data:-demoChatHistory <n>(Android--ei demoChatHistory <n>) adds n older messages, one long message and a long reply quoting it to the demo channel, DM and group. - The composer's link preview is made only for Hive posts: the app never fetches arbitrary third-party pages while someone types (RN reads any page's Open Graph tags with a desktop user agent). Cards that arrive with a message (
link_*props) show as RN shows them. - Message images and link card images go through the image proxy (RN loads them from their hosts).
- E-mail addresses in messages stay text (RN's linkify makes mailto links); link detection otherwise matches linkify-it on the golden cases.
- A send error is a toast (RN sets an error that is only visible in an empty thread). The typing event is sent at most every 2 s (RN sends one per keystroke).
- The DM safety notice, once closed, stays closed for the run of the app (RN per screen). The unread marker sits on the right row when join notices are grouped (RN counts posts, not rows).
- A URL that is not a valid pattern does not crash the message (RN builds a RegExp from it).
- Inline markdown reads as web's
simpleMarkdownToHTMLreads it, not as RN's ownparseInlineMarkdown:render/markdown/ChatInline.ktruns the remarkable port with only its text, escape, code span, strikethrough and emphasis rules (InlineParser.chat()). So\*escapes, a code span takes a run of backticks (ab `` ``),a*b*citalicises,snake_caseand__init__.pystay, and remarkable's own oddities (**_*x*_**) are web's too. HTML and entities stay as typed (!ban [30d]keeps its placeholder; web's sanitizer drops it), and marks never pair across a blank line. Links and mentions are single units for the markdown (a placeholder character during the parse): marks run through them as on web (**hi @bob**is bold through the mention, a link inside_..._is italic), markers inside them never count, and a code span shows a link or mention as raw text. A link ending in markers leaves only the part that closes a mark opened before it (**see https://x.com**`;**see https://x.com/a_**anda _b_ c https://x.com/a_keepa_), as web's linkify-after-emphasis does;_right after a link or mention is inside a word (hi @bob_x_stays plain, as on web). Messages over 8,000 characters (ChatText.MAX_MARKDOWN; Mattermost allows 16,383) show their marks as typed, since rebuilds run on the main thread; links and mentions still work. Code spans get a 12 % black shade on both apps. Blocks are cached per message id and text (ChatThreadModel.blocksFor), so a rebuild for a reaction or a new message parses only new or edited messages. Goldens:node tools/render/generate-chat-markdown-fixtures.mjs(ChatInlineFixtures, 387 cases, 239 of them checked againstsimpleMarkdownToHTMLitself inside the generator); RN'smarkdowngoldens inChatGoldensare not asserted. - Block markdown (#3468) reads as
simpleMarkdownToHTMLreads it too:render/markdown/ChatBlocks.ktruns the remarkable port's block rules (BlockParser(chat = true): indented and fenced code, block quotes, rules, bullet and ordered lists, nested,#and setext headings, paragraphs) and reads each block's text with the inline rules above, so#hashtag,-wordand1.5stay text,- aand1. aare lists,> aa quote,textover---a heading, and a line can end a paragraph as on web. HTML blocks, tables, footnotes and reference definitions are not read (their lines stay as typed: no HTML parsing of message text). The model isChatBlock(ChatParagraphBlock,ChatHeadingBlock(level),ChatQuoteBlock,ChatListBlockwithChatListItem.marker,ChatCodeBlock,ChatRuleBlock) over the sameChatSpans, fromChatText.blocks; links and mentions are placed by the same placeholders (one in a fence's info string is skipped, as the info string is not shown). Both apps draw the blocks natively (AndroidMessageBlocks, iOSChatBlocksView): a heading is bold at the body's size (so# introduceyourselfis no title; Dynamic Type and font scale apply as to the body), a quote has a bar, list items sit after their marker (disc, circle, square by depth), code is monospaced on the code shade. An ordered list counts from 1 whatever its first number, as web shows it (its sanitizer dropsstart). The bubble still reads as one message:ChatMessageItem.spansisChatText.flatten(blocks), each block on a line and each item after its marker, for VoiceOver's label, TalkBack and the link actions. Goldens:node tools/render/generate-chat-block-fixtures.mjs(ChatBlockFixtures, 514 cases, 506 of them checked againstsimpleMarkdownToHTMLitself inside the generator; the other 8 are the as-typed cases). Fake data: the demo channel's "Club notes" message (DemoChat.BLOCKS_MESSAGE). - As in RN, a reply's quote is the parent text the sender's client put in the post (
parent_messageprops) when present, shown as sent and not checked against the quoted message. - Name sorting follows ICU's root order for the characters names use (
Collate), not a full collation.
Setup
Chats need a signed-in account with an Ecency access token. Tests and fake-data runs go through DemoChat; the app has not been run against the production chat API. An unauthenticated read of /api/mattermost/channels answers 401 (reachable, not IP-locked). Whether bootstrap accepts this app's user agent has to be checked once with a real account.
Debug (fake data only): Android --ez demoAuth true --ez seedAccounts true --es openTab CHATS, --es openRoute ChatThreadScreen --es arg ch-ecency (also ch-dm-alice, ch-group); iOS -fakeData YES -seedAccounts YES -startTab CHATS, -openScreen chat:ch-ecency, -demoChat offline (the chat sign-in fails: the connecting notice). Goldens: node --experimental-strip-types --no-warnings native/tools/golden/generate-chats.mjs <ChatGoldens.kt> <ChatEmojiData.kt> (from the root of a checkout of the rn-3.x-final tag, where the app is under native/) from the RN root (RN's own modules, synthetic inputs; it also writes the emoji map).
Tests: shared ChatFormatTest (goldens), ChatInlineTest, ChatBlocksTest, ChatMessageBlocksTest, ChatSessionTest, ChatsListTest, ChatThreadTest, ChatSocketTest, ChatListFreshnessTest, ChatThreadRootsTest; Android ChatFlowsTest; iOS ChatTests, ChatUITests.
Platform features
Share in, QR scanner, dApp browser and bridge, proposal vote.
RN screens/dappBrowser (screen, bridges, useHiveBridgeHandler, signConfirmSheet, domainBlacklist), components/qrModal, components/shareIntentSheet, ios/eshare, the Android SEND intent filters, components/proposalVoteRequest with providers/queries/proposalQueries. Shared: app/DappBrowserModel.kt (tabs, URL bar, BrowserPolicy, the bridge), DappBridgeOps.kt (BridgeOps, BridgeGuards, DappBlacklist, BridgeLabels), DappBridgeScript.kt (the page side), QrScan.kt, ShareIntake.kt, ProposalVote.kt, DemoDapp.kt, hive/GovernanceOperations.kt. Android ui/PlatformScreens.kt, ui/QrCamera.kt, ShareIntents.kt; iOS Screens/PlatformViews.swift, App/SharePlatform.swift, the EcencyShare extension (ShareExtension/). Inventory row by row: platform-inventory.md.
- Share into the app: Android
ACTION_SEND(text, an image) andACTION_SEND_MULTIPLE(images); iOS share extension (images, one web URL, text). "Share to..." (Blog Post / Wave; closing it is Blog Post, as RN) shows only once the app is unlocked and the accounts were read; signed out the login opens and the share waits for that sign-in (RN opened the editor signed out). Blog Post: a new post, the text inserted as a snippet at the caret, the images uploaded through the editor's upload (prepared like picked images: re-encoded, metadata such as EXIF and GPS stripped). Wave: the composer with the text and the first image. A share belongs to the account that picked its target only; an account change, a logout or a wipe drops it; unclaimed it expires after 10 minutes. At most 5 images (the app's pick limit; RN takes up to 100) and 60,000 characters.- Android takes only
content://images from another app's provider:file://URIs and the app's own providers are refused, so a share can never upload the app's private files (ShareIntents). - iOS: the extension (RN's bundle
app.esteem.mobile.ios.eshare, shown as RN's "eshare" share entry) writesShare/<uuid>/(files plusshare.json) into RN's App Groupgroup.com.ecency.eshareand opensapp.esteem.mobile.ios.share://inbox/<uuid>(a scheme of its own; RN's eshare usedShareMedia://with another format, so leftovers of RN shares in the group are never read). It reads nothing of the app: no Keychain group, no settings. The app reads a folder only for a UUID id, plain file names, files inside that folder (symlinks out are refused), deletes each file once prepared, and removes folders older than a day at launch and all of them on a wipe.
- Android takes only
- QR scanner (RN QR_SCAN,
AppScreen.QrScan): header and side menu. Android CameraX preview with zxing decoding (QrDecoder), iOS AVFoundation metadata output; the permission is asked on open and a refusal shows RN's "Unable to get Camera permission" with Close / Allow (system settings). One code per open. A code goes through the app's link handling (QrScanModel):hive://,ecency://and ecency.com /auth links toAuthLinkModel(which still confirms anything it would sign), ecency.com content links into the navigation, other web pages to the in-app browser, anything else "Unsupported URL!". The transfer screen's scan button reads the recipient (TransferRecipientParser). DeclaringCAMERAon Android makes the system refuse the photo and video capture intents to an app that does not hold it, so "Capture a photo" and "Record Video" ask for it first (rememberCameraGate,MainActivity's video capture). - dApp browser (
AppScreen.Explorehome,AppScreen.DappBrowser(url)a page; saved as the home: a URL is history and may carry a page's token): RN's tabs, header (home or close, back, forward, URL bar with the lock, clear, reload), progress, error with Retry, the directory on a home tab. The tabs last for the session (ExploreTabs, beyond RN): Explore closed and opened again shows the tabs it had (address and title) with the same one active, and a page opened in Explore (DappBrowser(url)) joins them as a new active tab. They are kept in memory only, never saved (a URL may carry a page's token), and go on every account switch, sign-out and wipe with the web profile (a browser still open across one keeps nothing when it closes); each page loads again when its tab is shown, and a waiting request or a site's connect approval does not carry over. Only http(s) loads in a page's main frame;about:,data:andblob:only in frames;javascript:,file:,content:,intent:and the rest are blocked; ahive://orecency://link opens the app's link handling only when the user tapped it (BrowserPolicy). No file or content access, no mixed content, no popups (new windows load in the tab), camera, microphone and location refused. Explore has its own web profile (AndroidProfileStore"explore" where supported, iOS a persistentWKWebsiteDataStore(forIdentifier:)), apart from HiveSigner's pages, the players and the signup challenge; it is cleared on every account switch, every sign-out and on a wipe (Android without profile support clears the default cookie store and web storage instead). Android back goes back in the page's history first (RN closes the screen). A page whose renderer crashed or was ended under memory pressure shows the failed state with Retry, which builds a new view; on Android everyWebViewClientanswersonRenderProcessGonethroughRenderGone.handle(otherwise Android ends the app), the HiveSigner pages and players show the failed state too, the signup challenge its own Retry, and a HiveSigner signing page closes its prompt instead (it may have signed; never loaded again). A request the page was waiting on goes unanswered, and one still being prepared shows no prompt, also after Retry or a navigation loaded the page again (a request belongs to the page load that made it,BrowserTab.load;DappBrowserModel.pageGone). On iOS the browser shows the failed state, players and the HiveSigner login page load again once and then show the same failed state with Retry, also when that reload fails (WebProcessRecovery), and a signing page closes its prompt.RenderGoneLintTestchecks every client and delegate (#3701). - The bridge (
window.hive_keychainwith Keeper'swindow.hive.providersentry,window.peakvault; RN's request APIs kept): the script runs in the top frame of https pages only and never on hivesigner.com; messages travel through an origin-bound channel (AndroidWebViewCompat.addWebMessageListenerwithaddDocumentStartJavaScript, answering through the frame's reply proxy; iOS aWKScriptMessageHandlerin the page world, answering with a JSON string literal to the script's receiver). Without those Android features (WebView before 83) the bridge is off, never a JavaScript interface. Rules (DappBrowserModel, all beyond RN unless noted):- A request counts only from the active tab's main frame, over https, from the origin the tab shows; the confirmation names the host the web view reports, never the page's
domain/sourceUrl. Nothing is asked behind the app lock; one request at a time (others answer "busy"); a tab that navigated to another origin or closed drops its request unanswered; closing the browser rejects a waiting one. - RN's sheet (label, host, phishing warning from RN's list, Account, Authority, details; Confirm / Cancel, dismissing rejects). The phishing and request warnings are a danger box in theme colours (
dangerBackground: RN's pink in light, a dark red surface in dark, with the theme's text and a red icon), on both apps. Text the page wrote (Peak Vault'sdisplayMessagetitle, a Keychain custom request'sdisplay_msg) is never the sheet's title: it shows quoted under "Message from " (RN used Peak Vault's title as the sheet title). - Every field, message and page text shows whole, never cut, so padding cannot hide a transfer. A run of more than 16 blank characters (whitespace, control, format and blank looking characters) or more than 2 line breaks shows as "[N blank characters]", and every bidi control (embedding, override, isolate, mark) as "[U+202E]" even alone (
BridgeDisplay, display only: the signed value is the page's, byte for byte). A request whose operations and page text pass 128,000 characters is refused with a toast. The app's sign prompt for links does the same and lists the account, recipient, recovery account, authorities and amount first (AuthLinkModel.KEY_FIELDS). - A
hive://orecency://link tapped in a page opens the app's sign prompt with "Requested by the page " when the link names no requesting app. - Peak Vault's
connectasks first ("Share your account name with ?", key row "None: only your account name is shared") and remembers an approval for that origin until the account changes; a refusal holds while that tab stays on the site (DappBrowserModel.documentStartedfrom Android onPageStarted and iOS didCommit: a page that reloads itself keeps the refusal, a new document on another site or an account change asks again), so a page cannot ask in a loop; RN answers the account name to any page without a prompt. An account mismatch error names the signed-in account, as RN does (Keeper and Peak Vault behave the same). The operations shown are the ones that will be signed, built here (BridgeOps, pinned to RN's own builder byPlatformGoldenVectors), and their authority is what they need (OperationAuthority.required), not what the page claims. An operation must be[name, {body}]with the name as JSON text and a nameOperationAuthorityknows: hived also takes an operation's number (10 is account_update) or a<name>_operationspelling, which would show as something else, so both are refused before any prompt for every kind of account. The operations the SDK's authority map leaves out (limit_order_create2, witness_update, witness_set_properties, feed_publish, the escrow operations, account creation) are active, decline_voting_rights owner (refused), instead of the SDK's posting default. - Refused before any prompt: owner operations, account_update, account_update2 with key fields, witness key and property changes (
witness_update,witness_set_properties, the link flow'sOperationAuthority.WITNESS_KEYS), recovery and account creation (BridgeGuards), for every account type, more than 10 operations, operations a key account cannot serialize yet; RN's unsupported types (signTx, encode, decode, signedCall, addAccount, authority changes, createClaimedAccount, swap); Peak Vault sign-only, contact picker, encode/decode and memo broadcasts (RN). Amounts must be exact text or numbers with at most the asset's decimals (RN roundsparseFloat(x).toFixed(3)). - A confirmed broadcast is one action with its own id through
WalletSends(auth upgrade, HiveSigner, HiveAuth as everywhere; a send that may have landed is followed up, never signed twice). signBuffer signs sha256 of the UTF-8 message with the posting or active key (lone surrogates refused, memo refused) after the confirmation and, when the app lock is on, the PIN (as the sign-in proof for another app); HiveSigner and HiveAuth accounts have no key to sign with (RN). A HiveSigner signed message the app must not sign for a page is refused before any prompt (BridgeSignatures.reserved): one for Ecency's app (signed_message.appisecency.app, trimmed, any case, any type), since Ecency's login code, image upload token and HiveAuth challenge are signed over the same digest, and acodeorrefreshmessage for any app, since HiveSigner trades those for tokens. The one exception is Ecency's own site: from the verified top frame of exactlyhttps://ecency.com(DappBrowserModel.ECENCY_ORIGIN) two of them reach the confirmation with the posting key, since there they are the site's own login (acodeforecency.appwith no audience) and Raidstead's wallet sign-in (aloginforecency.appwith an audience), as RN signed them (BridgeSignatures.ecencySiteLogin); any other reserved message, the active key, a subdomain, a look-alike host or a frame is still refused. Other apps'login,postingandofflinemessages are signed after the confirmation, so HiveSigner style logins on other dApps work. HiveSigner takes another app'spostingorofflinemessage as a lasting token for that app, so their confirmation shows a warning line, "This gives lasting permission to post, vote and comment as you." (BridgeSignatures.lastingGrantApp,BridgePrompt.warning); aloginmessage shows none. The message is read leniently (spacing, key order and escapes do not matter, also inside a JSON string), a duplicate key counts as its last value as inJSON.parse, and asigned_messagethat is not an object or anapportypethat is not a string is refused. Text that does not parse is refused when it namessigned_messagetogether withecency.app,codeorrefresh. Plain text and other JSON are signed as before. The account must be the same when the request came and when it is confirmed.
- A request counts only from the active tab's main frame, over https, from the origin the tab shows; the confirmation names the host the web view reports, never the page's
- Proposal vote (RN ProposalVoteRequest): the card above the main feed's first tab, signed in, for the newest non-expired @ecency proposal (
database_api.list_proposals) the account has not voted (list_proposal_votes), not dismissed "Forever" and not "Remind Later" within 3 days (device preferences per proposal and account, removed by a wipe). A new account the Getting started card still asks things of (RNisNewAccount: created within 30 days or fewer than 10 posts, so also an old account that never posted; neither dismissed nor finished) sees no proposal card: it waits for a later run of the app after the checklist, never the same run. Known from the account read or from Getting started showing in this run; unknown is not established, so a failed account read keeps the card out until the next read (pull to refresh, an account change, the next run), as any failed query does, and a vote's thanks never bring it back beside Getting started (#3728, a deliberate difference from RN, which asks on day one;PlatformModelsTest.aNewAccountGetsTheProposalCardOnlyOnALaterRunAfterGettingStarted). "Cast My Vote" signsupdate_proposal_votes(new serializer, withaccount_witness_voteandaccount_witness_proxy, golden vectors from dhive and the SDK) with the active authority as one action; "Thank You!", then "We are grateful!" for the rest of the run; failure "Fail!: ". A vote still in flight stays the voting account's (#3725, as the governance card): switching away and back shows that card still voting and sends no second vote, the outcome is toasted whichever account is shown, and a logout ends the wait (ProposalVoteModelTest). iOS heads the first tab's list with the card only while it shows: a hidden card (voted, dismissed) would leave an empty header row, under which the lazy list draws no rows at all (FeedReadingUITests.testTheFirstTabShowsItsPostsWithoutTheProposalCard).
Golden vectors: GOLDEN_MODULES=<the wallet scratch install> node tools/golden/generate-platform.mjs shared/src/commonTest/kotlin/com/ecency/core/hive/PlatformGoldenVectors.kt (governance transactions, 28 bridge requests through RN's builder, signBuffer).
Differences from RN
Everything marked "beyond RN" above; the wave composer takes one shared image; the share waits for the login; the transfer scanner is a full-screen cover (RN's sheet); witness votes and proxy links are signable by key accounts.
Store and signing setup
No new ids or profiles: RN's App Group and eshare App ID and profile are reused (CI secret EXTEN_PROVISIONING_PROFILE, named per target through $(ECENCY_SHARE_PROFILE)). App Store review note: the share extension only hands content to the app. Play: the camera permission is for QR scanning, photo and video capture.
Debug
Fake data only: Android --es openScreen explore|qr|dapp, --es demoShare <text>; iOS -openScreen explore|qr|dapp, -qrScan <value> (the simulator has no camera), -demoShare <text>. dapp loads DemoDapp as if from https://dapp.example/, which asks for a vote on load.
Kotlin/Native note: in DappBrowserModel.kt's iosX64 build (2.3.10) a leading if (!isMainFrame) return null in BrowserPolicy.bridgeOrigin behaved as if it were not there (frames passed). This was observed for that file's compile only, not as a general rule. The check is the function's last expression with its own assertion, and both apps also drop frame messages before the model sees them (Android DappWeb.mainFrameMessage, iOS DappWebViews.mainFrameBody). Android WebView 113 refuses the origin rule https://*: the listener and the script use *, and the native origin check decides.
Tests
Shared PlatformGoldenVectorTest, DappBrowserModelTest, PlatformModelsTest; Android PlatformFlowsTest (and the Explore case in CommunityFlowsTest); iOS PlatformTests, PlatformUITests.
Wallet
RN screens/wallet, assetDetails, assetsSelect, transfer, trade, redeem, components/tipping, providers/queries/walletQueries and the wallet mutations of providers/sdk/mutations, over @ecency/sdk 2.4.26. Shared code: hive/WalletOperations.kt (serializers), api/broadcast/WalletOps.kt (the SDK builders), api/broadcast/Amounts.kt, api/wallet/ (reads, history), app/WalletModel.kt, AssetDetailsModel.kt, TransferModel.kt, StakeModels.kt, WalletActionModels.kt, WalletSends.kt, SendJournal.kt, WalletCopy.kt, DemoWallet.kt, BalanceAnalytics.kt, ProfileWallet.kt. UI: Android ui/WalletScreens.kt, ui/TransferScreens.kt; iOS Screens/WalletViews.swift, Screens/TransferViews.swift.
- Data: as RN, the Wallet tab renders Ecency's portfolio (
POST /wallet-api/portfolio-v2 {username, onlyEnabled, currency}): balances, fiat rates, APR, pending rewards, the actions per asset and the extra rows are the server's. Order: POINTS, HP, HIVE, HBD, then the profile's tokens (posting_json_metadata.profile.tokens, ENGINE and CHAIN entries that show). SPK, LARYNX and LP are dropped (RN removed them). Polled every 2 minutes while shown; pull to refresh; an account change empties it. The currency comes from thesettings.currencypreference (USD until Settings writes it). - Reloads keep rows: a reload of the same account and currency (pull to refresh, the 2 minute poll, the quiet reads after a claim or a send) merges its answer into the portfolio shown by symbol: an answered symbol takes the new item, and a symbol the answer left out keeps its last one while the answer is plainly partial (it lacks one of the default assets POINTS, HP, HIVE, HBD, which a whole answer always holds) and the symbol is still selected, so a partial answer (POINTS alone after quick claims) never drops a row or its share of the total. A whole answer is the portfolio, as in RN, and a token turned off in Manage Assets (the enabled-only portfolio leaves it out) goes on the next reload with its share of the total (RN sums every portfolio item, selected or not) and any stale pending reward. A failed or empty answer changes nothing, and a failed account read keeps the selection shown instead of falling back to the defaults. A full load (the first one, Try again, a currency or account change) replaces the portfolio, so a token the account no longer has goes then; the manage assets selection still removes a row at once. The latest reload wins and an answer for an account no longer signed in is dropped (
WalletReloadMergeTest). - History: hive layer
condenser_api.get_account_historywith RN's per-tab operation sets as the bitmask (never an empty request), the SDK's per-asset filters, RN's grooming and ticker match; pages arrive ascending, so rows are deduped by history index and ordered newest first by it (WalletHistory.order), and an empty filtered list advances by itself at most 5 pages. Hive Engine/private-api/engine-account-history(newest first by time after dedupe), Points/private-api/point-list(API order). Pending requests (savings withdrawals, conversions, open orders with cancel), recurrent transfers (with delete), outgoing and expiring delegations and incoming ones (balance-api REST, read only), the filter sheet, transaction id copy (hivexplorer link) and the repeat button (prefill kept out of the saved navigation,AppEnvironment.transferPrefill). Deliberate difference: a reward row's details (author_rewardandcomment_benefactor_rewardbyauthor/permlink,curation_rewardbycomment_author/comment_permlink, an engine reward byauthorperm) are a link (CoinActivity.post) that opens that post or comment, a long press copies its ecency.com link; RN shows them as plain text. - History categories (web's wallet history): chips over the history of HIVE, HBD and HP with web's groups (SDK
HIVE_ACCOUNT_OPERATION_GROUPS: Transfers, Market orders, Interests, Stake operations, Rewards;HistoryCategory), each cut to the asset's own operation set and offered only when that leaves something (HIVE: transfers, market, stake, rewards; HBD: transfers, market, interests, rewards; HP: stake, rewards). A chip sets the operation filter, so the chain filters by the category'sget_account_historybitmask exactly as web does, and the per-operation sheet still refines it (no chip is selected for a set the sheet made). HBD's history also asks for and showsinterestandproposal_pay(web's HBD list has them, RN did not). Points: web's type filter overpoint-list {type}(the server filters), All plus web's 12 types labelled with the rows' own titles, except the earning types, which drop the rows' "Points for" (Heartbeats, Login, Post, Comment, Vote, Reblog;native.wallet_history.point_type_*), and the two transfer types, whose rows both read "Transfer/Gifting", are "Transfers sent" (998) and "Transfers received" (999). Transfers also holdsfill_transfer_from_savings(web's group lacks it while its HIVE and HBD lists show it); Hive Engine tokens get no categories (web has none, and the engine history API has no operation filter). - Operations: transfer (multi recipients up to 50 in one transaction), recurrent transfer (and delete with amount 0), to and from savings (request id
Date.now() >>> 0), power up, power down and stop (0 VESTS), withdraw routes, delegation and undelegation (the amount is the new total; at the max the whole delegatable VESTS go, never a rounded figure above them), convert, claim rewards (only the clicked asset, posting), points transfer, Hive Engine transfer, stake, unstake, delegate, undelegate (quantity cut to the token's precision, RN #3569) and the engine reward claim, internal market swap (limit_order_create, order id9+ now % 1e8, 27 days) and order cancel, promote, Boost+ and RC top-up with points, RC delegation (delegate_rc, posting; from another profile's menu, see Profile), tips (HIVE, HBD, POINTS and, as RN, every engine token held with a balance, shown in the wallet or not, in one row that scrolls sideways; memoTip for @author/permlink; a refused tip says why under RN's "Failed to send tip",WalletActionsTest.aRefusedTipSaysWhy). Amounts are exact decimal text, truncated as RN (Amounts,Dec), never through a float. Memos go as plain text, as RN, except a#memo on a HIVE or HBD transfer, which is encrypted (see "Memo safety" below, #3633). - A reward claimed elsewhere (Sentry ECENCY-MOBILE-3Q0): the claim reads the account first; when the chain has nothing left of that reward (claimed on the web or another phone since the row was read) nothing is signed, shown or reported, and the reward reads 0 as after a claim. Only a reward field the node sent that reads zero counts; a missing or unreadable one leaves the claim as before (the mask below, while the portfolio still reports it) until the portfolio agrees. Before, that claim failed on "nothing to claim" with an error and a code (
WalletModelsTest.aRewardClaimedElsewhereIsNoFailure). The read can still hold a reward that is gone (a node behind the chain, or a claim elsewhere between the read and the send); the chain then refuses with "Cannot claim that much VESTS ... Actual: ..." (ChainRefusal.NOTHING_TO_CLAIM,ErrorKind.NOTHING_TO_CLAIM), and the claim ends without a toast or an error report. That refusal only says the claim asked for more than is left, so the account is read again: nothing left ends as above (the row masked, the wallet read again); anything left, or no answer, masks nothing and reads the wallet again, so what remains shows and can be claimed (WalletModelsTest.aClaimRefusedWhileSomeRewardRemainsKeepsTheRemainderClaimable). Whether the key, HiveSigner or a HiveAuth wallet relayed it, the reward is gone, so through HiveSigner or HiveAuth that one refusal is definite; any other refusal those signers relay keeps a wallet send "may have gone through", since an earlier transaction of the same request may have landed (Sentry ECENCY-MOBILE-3V2, 3VH, 3VD, 3V3, 3VP;WalletModelsTest.aClaimTheChainSaysWasAlreadyMadeIsNoFailure). - After a claim: as RN, the claimed reward reads 0 while the portfolio still reports exactly that amount as pending, for 3 minutes at most (RN claimsCollection); any other pending amount is the server's and shows. The balance is always the portfolio's own: the app never adds a claim to it, so a read that already holds the claim with a transfer or a new reward besides cannot count it twice. The portfolio is read again quietly 2 s after the claim and then at 5, 10, 20 and 40 s (at most five reads), stopping once its pending reward falls below the claimed amount, which only a claim does, with no refresh by the user (
WalletModel.readUntilClaimed; tester report: the balances stayed old until a manual refresh). Asset details draw the same values. The claim on its way and the claimed mask are kept per account and asset and survive an account change, so switching away and back while a claim signs cannot send a second one (#3701, Sentry "Cannot claim that much VESTS";WalletModelsTest.aClaimOnItsWayIsNotSentAgainAfterSwitchingAwayAndBack). - Balance analytics (RN balanceAnalyticsSheet; Android
ui/WalletChartsUi.kt; the chart-line button on HIVE, HBD and HP details):balance-apibalance-history(200 a page, newest page first, older pages when the chart is panned to its left edge) andaggregated-history(yearly, monthly, daily). Android draws the chart on a Canvas with RN's pinned y labels; iOS uses Swift Charts. RN's CoinGecko price chart is dead code in RN and not built. - Another account's Wallet tab (RN walletView without dropdowns): unclaimed rewards as text and Wallet Details (HIVE, staked HIVE with delegated / received / net, HBD, savings HIVE and HBD, next power down), read only. The tab keeps its "Wallet" label (RN shows the estimated value there).
- Governance card (#3724, native only;
app/Governance.kt, Androidui/GovernanceUi.kt, iOSGovernanceViews.swift): Hive clears an account's witness votes, proposal votes and proxy 365 days after its last witness vote, proposal vote or proxy change, and itsgovernance_vote_expiration_tsthen reads1969-12-31T23:59:59, as for an account that never voted. On the signed-in account's own wallet a card shows when that value comes with no proxy and no witness votes (inactive: "expired or never cast"; no history read tells the two apart) or when the expiry is 30 days away or less (expiring). Inactive offers "Set @ecency as proxy": a sheet says what that means (@ecency votes on witnesses and proposals for you: hived counts no proposal vote of an account with a proxy and gives the proxy its stake; whose votes @ecency itself follows, read from @ecency's account on the chain; your own witness votes are removed; the proxy can be removed; it lapses after a year) beforeaccount_witness_proxy {proxy: "ecency"}is signed with the active authority throughWalletSends, one action id. Expiring with a proxy to @ecency offers Renew: the chain refuses to set the same proxy again ("Proxy must change"), so the proxy is cleared and set in one transaction (PlatformGoldenVectorsaccount_witness_proxy_renew); expiring with own votes or another proxy only points to voting. "Vote yourself" openshttps://ecency.com/witnessesin the in-app browser (no native witnesses screen). Dismiss: "Don't show again" per account and state (an expiring card per expiry date, so next year's still shows) or "Remind Later" for 3 days, in device preferences a wipe removes (governance.card.). The sheet cannot be closed while it signs and sends; once the send is being checked with the chain it gives way to the card (button off). A failed send reads the account again (a proxy cleared meanwhile turns Renew into Set proxy). A confirmed send turns the card into thanks for the run. No card for @ecency itself or an account that declined voting rights (can_vote). Every wallet opening reads the account again (so "Remind Later" ends), a refresh keeps the card until the answer lands, and votes that count again end an earlier "Don't show again" on the inactive card. Debug:-demoGovernance inactivewith-fakeData YES(iOS) makes spike-alice's votes expired. - Golden vectors: every serializer is pinned by
WalletGoldenVectors(33 transactions): the operation JSON is the SDK builders' and mutations' own, the bytes, transaction id and digest the SDK's own serializer's (HiveTxTransaction;generate-wax.mjschecks them against hived's own code), the signature the deterministic RFC 6979 one. Fully offline:GOLDEN_MODULES=<scratch npm install of @ecency/[email protected] @noble/curves@2 @noble/hashes@2 @tanstack/react-query@5 react> node tools/golden/generate-wallet.mjs shared/src/commonTest/kotlin/com/ecency/core/hive/WalletGoldenVectors.kt. The wallet serializers also make those operations signable from hive:// links for key accounts. - One action, one id: every value-moving send goes through
WalletSends.send(user, ops, authority, actionId)with an id made once, when the user confirms (env.idempotencyKey()); a second tap or a retry of that action resumes its transaction, a new confirmation is a new action. Claims are not repeat safe and get an id too. Active operations take the existing routes: stored active key, the auth upgrade sheet (temporary active key, 60 s, one signature), HiveSigner's page, HiveAuth's wallet. - Check your wallet: a send that may have landed (
BroadcastException.Networkafter an uncertain attempt, orundecided) isSendPhase.Checking: a spinner and "This may already have gone through..."; no retry button. The send runs in the app's scope and asks the chain again throughSigningModel.resumewith the pending's own key (no prompt): the same signed transaction is re-sent every 5 s while it can still be accepted (PendingBroadcast.resendDeadline), after thatfind_transactiondecides, asked after 5, 10 and 20 s, then every 30 s; an "unknown" answer (not expired yet by the chain's clock) needs no read of the chain's head. A new transaction is signed only after the chain said the earlier one did not land.BroadcastException.Unconfirmed(by the chain's clock) ends it as "Could not confirm..."; after 15 minutes without an answer the screen stops waiting and the journal keeps asking. A failure where nothing reached a node is an ordinary failure (RN: back, and "{operation} failed: {reason}"). For HiveSigner and HiveAuth accounts, a failure after the request may have been answered (HiveAuth's request expiring included, the HiveSigner page closed by the user, which may have broadcast before, and the HiveAuth prompt closed once its request reached the relay, as the wallet app can still approve it:AuthException.Cancelled.mayHaveSigned,SigningModelTest.aHiveAuthPromptClosedWhileTheWalletWaitsMayHaveSigned,aHiveAuthPromptClosedOnceTheRequestReachedTheRelayMayHaveSigned,aHiveAuthPromptClosedBeforeTheRequestWasSentSignedNothing) says "This may already have gone through..." too, never "try again" (only a refusal before anything left the app, or a wallet that rejected, is a plain failure). A HiveAuthsign_ackwithoutbroadcast: true(signed, not broadcast) is a failure with RN's "Transaction Failed", never a success. A swap or a redeem (promote, Boost+, RC top up) whose failure is undecided keeps its form blocked asSendPhase.Unconfirmedwith that message and Close, so the same one is never sent twice (WalletDeltaFixesTest.aSwapThatMayHaveGoneThroughIsNotSentAgain,aRedeemThatMayHaveGoneThroughIsNotSentAgain, #3703). - Leaving a running send: back asks first ("Still sending"); the send goes on without its screen (
WalletSendscounts the screens that own it,SendOwnership) and a send nobody owns any more reports its outcome as one toast and is forgotten. An account that leaves (logout, logout-all, wipe) stops its sends at once: nothing signs again for it. - Links: hive:// and ecency://sign operations go through the same
WalletSends(one action per confirmed link, "check your wallet", same transaction); the requesting app hears only the final word:status=success&id=...,user_cancelled,unconfirmedwhen the chain cannot tell, elseqr.transaction_failed. - One amount reading: every amount, the checks and the signed text alike, goes through
Amounts.normalize/Dec.of: ".5" is 0.5 (read as 0.000 it would delete a schedule when sent as a recurrent transfer), "", "." and "1e3" are not amounts. Single-recipient kinds refuse several typed names instead of sending to the first. - Restart journal (
SendJournal): when a key account's send turns uncertain,{account, actionId, txId, expiration, operation name}goes into the secure store entrywallet.sendJournal(no key, signature, amount, recipient or memo;WalletModelsTestchecks the stored text); it is removed when the send settles in this run. At launch (env.sendJournal.start(), called by both apps at launch) every entry left is resolved withtransaction_status_api.find_transaction: in a block or the mempool "went through",expired_irreversible"did not go through",too_oldor the chain's head time past expiration + 10 minutes "could not confirm"; anything else keeps checking (after 5, 10, 20 s, then every 30 s for about 10 minutes while the app runs, again at the next start). The result shows as a notice on the account's Wallet tab until dismissed. Logout removes the account's entries, undecided ones included (the account's sends stop at the same time; the user checks that account's wallet after signing in again). Stopping a send does not take back a request already on the wire: a broadcast a node had received before the logout may still land; a wipe removes the store. A change the store refuses (iOS before the first unlock: a send journaled, settled, dismissed or forgotten while the Keychain is locked) is kept in memory and in an ordered list of unsaved changes; the next read that works (the next change, orstart()again at the next activation) applies them again, in order, to the stored list before its own change and writes the result, so an entry recorded while locked keeps its notice and its place in the 32 below, and one removed while locked is not brought back by the stored copy (every change is idempotent, so one applied twice after a failed write is the same;WalletDeltaFixesTest.aSendRecordedWhileLockedSurvivesTheStartAfterTheUnlock,theFirstChangeAfterTheUnlockKeepsTheSendRecordedWhileLocked,removalsWhileLockedAreNotBroughtBackByTheStoredCopy). Updates run one at a time, from taking the queued changes to clearing them, so two at once after the unlock replay a change once and never write back what the other settled (twoChangesAtOnceAfterTheUnlockNeverBringASettledSendBack). A start after a good launch writes the changes a later lock kept in memory (aChangeRefusedAfterAGoodLaunchIsWrittenAtTheNextStart), and a send's settle on success is not cancellable, as on the failure paths. At most 32 entries: past that, decided entries whose notice was not read give way, oldest first; undecided ones never do, and while 32 undecided entries wait no new value send starts ("Too many earlier sends are still being checked...").
Differences from RN
- Link decoding wants JSON numbers for percents, recurrence and executions.
- Withdraw route percents go on chain in chain units (RN sends the typed 0..100 value as 0..10000 units, which reads as a hundredth of what was typed).
- The transfer screen allows several recipients only where RN sends them (plain transfers, points, engine transfers), one elsewhere.
- A send's outcome is followed after its screen closed (one toast).
- The trade order book stays the RN walk (its double count of the first level kept,
SwapCalculator.price). - A swap signs the amounts its confirmation showed (
TradePrompt.Confirm.amountToSell/minToReceive), and the minute's order book refresh leaves an open confirmation alone; the quote follows the book again once it closes. RN signs the live quote, which a refresh can change under the open alert. A delegation likewise signs the recipient and VESTS its review showed (StakePrompt.Review.delegatee). - A swap that went through shows its done state in place of the form (
TradeState.finished): the outcome's icon and title ("Successfully Swapped" or "Swap Pending!"), what was swapped ("12.345 HIVE for 3.086 HBD", the signed amounts), "Done" and "New Swap". The finished form takes no input, shows no amount checks (the balance reload after the send would read as "more than your balance") and cannot be sent again; only "New Swap" (TradeModel.reset) brings an empty form. The wallet reload is scheduled the moment a node accepts the swap, in the wallet's own scope, so "Done" tapped during the outcome check still reloads it; the swap form offers the last chain read of the account's liquid balance (get_accounts; the portfolio, which can lag behind the chain, only when there is none; a failed read keeps the last) less every swap the chain may not have decided yet. A swap that may be on chain (Done, Unconfirmed, or an undecided failure) is recorded app-wide by its send (WalletSends.afterOutcomecallsWalletModel.spent), so a swap screen closed before the swap ended, or opened again before the reload, still takes it off; a refused one is not, nor one cancelled before anything was sent (a HiveAuth prompt closed after its request reached the relay is undecided, so that swap is taken off). Pending swaps outlive an app restart: saved in the secure store at each change (wallet.pendingSwaps: account, symbol, amount, times, action and order id; a wipe clears it, an account leaving takes its own) and read back before any wallet load reads a balance (every load and save waits for it, and the swap form has no balance until then; a failed read is not an empty list: the next load or save tries again); a save finishes even if the wallet closes, and a failed one is written again on the next load. A restored swap waits for its expiration (the early clear below needs this run's record of other sends), and each is settled by the chain's time, never this phone's clock (which may move while the app is closed): its signed expiration, or for one signed elsewhere the latest it could land, saved with it (Swap.latestBy: the last chain head before it, plus the time since that read on the monotonic clock (never the phone's, which can be set back), plus a transaction's hour, and for an undecided outcome another hour for a wallet app's late approval, such as a HiveAuth request closed while waiting; the first load after a restart bounds a swap by the earlier of that and its own head plus the same window); a restored swap counts as started before the restart, so the first load bounds one signed elsewhere even if the phone's clock ran ahead at the swap. An account leaving drops its swaps after its sends stopped, and records none until it signs in again, so a late outcome of its send cannot save one back. A swap leaves at once on a chain read sent after it (in a later millisecond of the monotonic clock, as are the bounds below: a phone clock set back after a swap never makes later loads look sent before it) that is down by the whole swap from the last chain read before it, less the swaps still waiting (Swap.floor), and only when the account's history, read just before that account read in the same load, has the swap's own limit order (limit_order_createwith itsorderid,Swap.orderId; read only while a swap waits), so a send of as much from another app or device never passes for it; nor does a drop when this account started another broadcast from this app after that read, before the swap or after it (SigningModel.broadcastSince). An accepted swap can show in the balance before its block reaches the history, so such a read books up to six more looks 5 s apart (ORDER_LOOK_MILLIS), a failed load among them too, before the expiration wait. One case could still clear a swap early, and the chain refuses the over-spend: an account server behind the history server (one node URL can route the two reads to different servers) that lacks the swap and shows another drop of as much. Otherwise it waits for its expiration: past it a transaction is in a block or never will be, so a swap leaves once a wallet load reads the chain's head time (get_dynamic_global_properties, never this phone's clock) past it plus 2 minutes (NODE_LAG_MILLIS: another node, or another server behind the same URL, may lag up to the 90 s the app's node health allows). A swap this app signed is bounded by its signed transaction's own expiration (this phone's clock at signing plus 60 s,HiveBroadcaster.EXPIRATION_MILLIS, carried inSendPhase.Done.expiresAtMillis), so about three minutes; one signed by HiveSigner or HiveAuth, or with an undecided outcome, can live up to Hive's hour from its acceptance, bounded by the head time of the first load sent after it. The chain read only moves forward: a read without a head time, or with an older one than the last, is set aside, so a stuck node never brings back a balance from before a swap. A load that finds swaps waiting books the next one for when they are due, a failed one (portfolio included) too, 2 minutes on; the looks are capped, never endless on a stalled chain, but enough for an undecided swap's two hours of failed reads. A read not down by the whole swap keeps it off until then, however late: accepted is not decided, nor is a block (doneTappedAtOnceStillReloadsTheWallet,newSwapTappedAtOnceNeverOffersTheSpentBalance,aReadThatShowsTheWholeSwapTakesItOffOnceAtOnce,aTransferFromAnotherWalletNeverPassesForTheSwap,aSwapPendingAtARestartStillComesOffUntilItExpires,anAccountThatLeftTakesItsPendingSwapsWithIt,aSavedSwapOlderThanAnyTransactionCanLiveIsDropped,aSwapSavedWithTheClockAheadStillGetsItsHourAfterARestart,aHiveAuthSwapWaitingAtLogoutIsNotSavedForTheAccountThatLeft,aLoadOtherThanTheFirstStillWaitsForTheSavedSwaps,anAccountThatLeftRecordsNoSwapFromALateOutcome,aSwapRecordedJustBeforeTheWalletClosesIsStillSaved,aSavedSwapReadThatFailsIsTriedAgainNotTakenAsNone,aSavedSwapWithAKnownExpirationOutlivesAPhoneClockJump,aSwapSignedElsewhereStaysPendingAcrossAPhoneClockJump,aSwapSignedElsewhereSavedLongAgoIsSettledByTheChainAtTheNextLaunch,aPhoneClockSetBackBeforeASwapNeverShortensItsBound,aPhoneClockSetBackAfterASwapStillLetsTheNextLoadsBoundIt,aSavedSwapReadsBackAsItWasAndSkipsWhatIsNotOne,aSwapWhoseHiveAuthPromptClosedWhileTheWalletWaitsStaysOffForTheHour,aSwapWhoseBlockReachesTheHistoryLateStillComesOffInSeconds,aFailedLoadAmongTheShortLooksKeepsThemGoing,aSwapAcceptedButNotInABlockStaysOffWhateverItsAccountReads,aSwapThatNeverLandedIsOfferedAgainOnceItExpired,aPhoneClockAheadOfTheChainKeepsTheSwapOffUntilTheChainPassesItsExpiration,twoSwapsEachComeOffOnce,aReadWithOnlyTheFirstOfTwoQuickSwapsKeepsTheSecondOff,aLaggingPortfolioNeverBringsTheSpentHiveBack,aSwapScreenReopenedBeforeTheReloadStillTakesTheSwapOff,aSwapThatEndsAfterItsScreenClosedStillComesOff,aSwapWhoseOutcomeIsUnknownStaysOffAsLongAsItCouldLand,aRefusedSwapIsNeverTakenOff,anEarlierReadInFlightLeavesTheSwapOff,aReadThatLandsBeforeTheSwapIsAcceptedNeverTakesItOffForGood,aFailedChainReadKeepsTheLastOneAndSettlesNothing,aSwapSignedElsewhereStaysOffAsLongAsItCouldLand,aLoadSentBeforeASwapNeverStartsItsHour,aFailedReadStillBooksTheNextLook,anUndecidedSwapIsStillSettledWhenReadsFailForItsWholeTwoHours,aFailedPortfolioReadStillBooksTheNextLook,aSendSinceTheLastReadKeepsTheSwapOffUntilItExpires,aSendAfterTheSwapNeverPassesForIt,aPhoneClockSteppedBackBeforeDoneStillWaitsForTheSignedExpiration,aStuckNodeAfterASwapSettledNeverBringsItBack,aReadWithoutTheChainsTimeIsSetAside,anHbdSwapComesOffTheHbdBalanceOnly,anotherAccountsSwapNeverComesOffThisOne). RN showed the same buttons in a sheet over the screen (WalletActionsTest.aSwapThatWentThroughShowsItsDoneStateAndNoStaleFormErrors, AndroidWalletFlowsTest.aSwapThatWentThroughReplacesItsFormWithTheDoneStateUntilANewSwap). - The price chart (dead code in RN) is not built.
- Get Points and Account Boost are the in-app purchase screens (see In-app purchases).
- After a claim the portfolio is read up to five times until it shows the claim; RN read it once, 2 s later, so a lagging answer stayed until a manual refresh.
- After the account's own send (transfer, power up, delegation, stake, tip...) an open asset details screen reads its history again, quietly, with the portfolio's read 3 s later (
WalletModel.refreshLateremitsAppEvent.WalletSent), and once more 3 s after that when the newest row did not change (a node behind its head;AssetDetailsModel.SEND_READS). RN left the history as it was until a pull, so the balance moved and the rows did not (WalletModelsTest.theAccountsOwnTransferShowsInTheOpenAssetHistory). - A reload merges a partial portfolio answer into the rows shown and a failed account read keeps the selection; RN's query replaced its data with whatever a successful fetch answered.
Memo safety: a memo that holds a private key (a WIF whose checksum holds) or a master password (P5 and 50 base58 characters) blocks Next with "This memo holds a private key or a master password..." on every transfer screen with a memo (MemoSecrets, TransferState.memoHasSecret), and blocks deleting a recurrent transfer too (the deletion sends the memo as it stands, except a # memo, which goes empty: TransferCopy.deletionMemo). A key is found inside a longer word and when split by spaces, line breaks or invisible characters (KeyInput.isNoise); a password counts as a whole word or at either end of one. Public keys, ordinary text and encrypted memos go through. Recipient avatars (RN transferScreen): over the recipient field, the sender's avatar, an arrow and the avatar of each typed recipient that is an account name (5 at most), on every transfer screen with a recipient field, Points included (TransferState.recipientAvatars, TransferModel.avatarUrl), so a mistyped name shows a stranger's face before anything is sent. Exchange deposit memos: after a plain HIVE or HBD transfer to one exchange (ExchangeAccounts; not savings, not several recipients) went through, its memo is kept on the device for that account and exchange (ExchangeMemos, prefs transfer.exchangeMemos; a later one replaces it; a memo the secret guard refuses, a # memo, or one whose send was cancelled or failed is never kept). The next transfer from that account to that exchange offers it under the memo field ("Use the memo you sent to @bittrex last time: 104857"); it is filled in only on a tap, never by itself, since a wrong deposit memo can lose the funds and an account may have several. The memos leave with their account (AppEnvironment.accountsLeft) and on a wipe. Not in RN. The transfer favourites sheet (RN transferFavoritesSheet) picks a recipient from the account's favourites (TransferFavoritesModel), searched by name (a typed @, whitespace anywhere and capitals do not count; RN kept a space after the @), and adds one by name from its header button (favorites-add; the list is read again and searched for the new name, a newer read replacing an older one still running; a refusal says "Could not add favorite"; a name typed while saving stays in the row; an answer after an account switch changes nothing); Refer & Earn's "Delegate HP" opens the delegation form for the referred account (AppScreen.of(TRANSFER, account)); a QR scan fills the recipient (TransferRecipientParser). Encrypted memos (#3633, not in RN, which sent a # memo as text): a memo starting with # on a HIVE or HBD transfer, savings deposit or withdrawal (one-time or recurrent) goes on chain encrypted for each recipient's memo key, in the format every Hive wallet reads (hive/Memo.kt, pinned to @ecency/sdk and dhive by MemoGoldenVectors). Next reads the recipients' memo keys and encrypts before the confirmation (TransferState.memoEncryption, encryptingMemo); the sender's key is the memo key, else the posting key, else the active key on the device (the recipient reads it with their memo key either way). It is never sent as text instead: without a key on the device (HiveSigner, HiveAuth: neither can encrypt for the user) or on Points and Engine transfers Next stays off and says why, and a recipient without a readable memo key stops the send. A # memo to an exchange is refused too, cipher text already encrypted included (an exchange cannot read it, and the deposit may not be credited); for cipher text the note asks for the exchange's deposit memo instead of dropping the # (TransferCopy.memoExchange). Cipher text already encrypted (an existing schedule's memo, a pasted one: Memo.isEncrypted) goes as it is, never encrypted twice. A form edited while the memo is being encrypted offers no confirmation for the old values (Next again encrypts what is there now). The dApp bridge refuses a Hive transfer, recurrent or savings request with a plain # memo (Keychain encrypts those; the bridge has no memo key lookup), in a typed request and in a raw broadcast alike (BridgeGuards.HASH_MEMO_REFUSED), and a Hive signing link with one is refused before its confirmation (HiveUriTx.HASH_MEMO, Memo.hasPlainHashMemo). Memo.isEncrypted takes only a whole cipher text: two compressed keys, then a length prefix that matches the rest and fills whole AES blocks. Deleting a recurrent transfer sends an empty memo instead of a # one, from the transfer screen and from the wallet details alike (TransferCopy.deletionMemo). The wallet history shows an encrypted memo as "Decrypt memo"; a tap reads it with a key of the account on the device that matches the memo's sender or recipient key (AssetDetailsModel.decryptMemo), kept in memory for that screen only; Repeat uses the read text (encrypted again on the way), never the cipher text.
Debug (fake data only): Android --ez demoAuth true --ez seedAccounts true --ez acceptTerms true --ez walletTab true, --es walletScreen transfer,transfer,HIVE,hive,spike-bob (a saved-navigation line, ',' separated), --ez demoUndecided true (broadcasts never answer: the check-your-wallet state); iOS -fakeData YES -seedAccounts YES -startTab WALLET or -openScreen wallet:<line>. DemoWallet answers the wallet reads offline; broadcasts are still refused.
Tests: shared WalletGoldenVectorTest, WalletModelsTest, WalletActionsTest (and the link and navigation cases), BalanceAnalyticsTest, the profile wallet cases of Gaps2Test; Android WalletFlowsTest; iOS WalletTests, WalletUITests. They guard: the journal's record, its "only an irreversible expiry is final" rule, the chain's clock, its removal with the account, no operation body stored; a send that never reached a node not being "checking"; one action per confirmation; amount above the balance, low liquidity per recipient, the exchange memo, executions >= 2, picking yourself, the engine precision cut; history order, dedupe, ticker match and the auto-advance bound; the claim of only the clicked reward and its mask, the claimed amount in the balance at once and the reads until the portfolio shows it; the delegation max and "0 only to remove"; route chain units and duplicates; promote's post check, the Boost+ block, tip decimals; HIVE tokens never written and the saved selection over a lagging node; the signed-out transfer link. The builder's recurrence >= 24 and the decoder's uint32 check are both repeated by the operations' own checks.
Points and perks
RN screens/perks (questsCard, spendOptions), screens/spinGame with containers/spinGameContainer.ts and components/spinGame, providers/queries/pointQueries.ts, utils/refreshQuests.ts, providers/ecency/ePoint.ts and the adapter's recordActivity, over SDK 2.4.26 modules/quests and modules/games. Shared api/ecency/PerksApi.kt, app/Perks.kt (QuestCatalog, QuestsData, PerksModel, StreakFreezeBuys, QuestRefreshes, SpendOptions), app/SpinGame.kt, app/PointActivities.kt. Android ui/PerksScreens.kt; iOS Screens/PerksViews.swift.
- Perks (
AppScreen.Perks, from the header gift, the editor quest chip, the Waves "check in" row and thespinpush): quests fromPOST /private-api/quests {username}(public), asked on open, on every return to the foreground (RN opts this query into refetch on focus) and 70 s after an activity of the account (QuestRefreshes, one timer per account). Daily, Weekly and Monthly tabs from the SDK catalog without the spin; "progress/goal", the bar (green when done), the streak badge, "{n} in reserve" and "Protect streak (300 Points)". A failure without data shows RN's QueryErrorRetry texts; a failed refetch keeps the numbers. "Use your points": Daily spin, Boost Plus, Top up RC, Promote a post (Redeem), Account boost (an in-app purchase). - Streak freeze (
POST /private-api/streak-freeze/buy {code, idempotency_key}): a confirmation first (RN buys on the tap), one key per confirmation made at the confirmation, kept app-wide per account while the outcome is unknown (a timeout, a thrown transport error, a 5xx or an unreadable 200), so the next confirmation replays it and never buys twice; a 4xx ends the key. 402 opens Get Points for the account, 409 is silent, anything else RN's "Could not buy a streak freeze. Please try again."; the quests are asked again after every outcome. The buy runs in the app's scope: a closed screen does not cut it off and a reopened one joins it. A key goes only with a definite outcome, not with a logout (the returning account's next confirmation replays it); the keys live in memory. After the outcome the owned count is asked again, queued behind a refresh already on its way. - Spin (
AppScreen.SpinGame, "Free Points"):POST /private-api/get-game {game_type: spin, code}always from the server; every status request is numbered app-wide (SpinStatusRequests), only the newest sets the counters and only its failure alerts. SPIN & WIN turns the rings for 8 s; one claim at a time (a press while one runs sends nothing, also after the rings stopped); a press asks a fresh status, drops it when a newer request started meanwhile, status 18 shows none left, no key says "Game key missing", elsePOST /private-api/post-game {game_type, code, key}in the app's scope. After the claim: 5 for a pack (status 3) else 0, the score bubble, the status again, unless the screen closed meanwhile (no status check from a claim that outlived its screen); no quest refresh (RN asks none). None left: the 5 SPINS pack (an in-app purchase) and "Next free spin in H:m:ss" (moment'sutc(diff).format('H:m:ss'), pinned to node output, every 3 s). - Spin wheel layout (iOS
SpinStage): the wheel sits on the screen's centre line. The screen's column must fill the width itself, because aGeometryReaderplaces its content top leading and the column would only be as wide as its widest part (so the wheel sat at the left while the rings turned). The rings shrink to their part where 230 pt do not fit (short phones, large text; Android scaled them as ovals). Portrait only, as the app. - Earning points (
PointActivities):POST /private-api/usr-activity {ty, bl?, tx?, code}after a vote (120), a new post (100), a new reply or wave (110; edits nothing), a reblog or cross post (130), each with the broadcast's transaction id (none: nothing sent, and reported lost), a key login (20), and the check-in (10) on the Waves tab and when a post or comment is opened (15 min per account). Which failures are tried again follows @ecency/sdk 2.10.0usrActivity(#3770): a lost connection or a timeout, a 429 or a 5xx (and a failure before any request was sent, such as the account's code not read) gets three tries (RN's React Queryretry: 2, 1 s then 2 s apart); a 401 (the private API already renewed the session and sent again) is parked at once; any other status (a 4xx, a redirect) is a refusal that can never go through, so it is tried once, never parked, and a parked one refused on a replay is dropped. Still failing, it is parked per account in the device preferences (points.pendingActivities.<user>, at most 50, removed with the account on a sign-out and by a wipe; a report is parked only while its account is still in the vault, so one still being tried, or from a broadcast that ends after the sign-out, is not parked for an account that left; a vault that cannot be read keeps the report rather than lose it) and replayed 3 s after the start, on every later return to the foreground and when the app lock stops hiding the app (a report is never sent while it hides the app), for the signed-in account: one replay per account at a time, each entry read again right before it is sent. A removed vote and an undone reblog report too, as the SDK's mutations do. An account without an Ecency session parks nothing. A report that went through schedules the quest refresh. A lost broadcast activity (post, comment, vote, reblog: the ones with a transaction id, which are the ones web reports) is reported as a warning, as web does since @ecency/sdk 2.10.0 (points-activity: <reason>/<type>, grouped by reason, tagspoints.reason,points.type,points.status,points.parked): a broadcast without a transaction id (missing-tx-id), a refused report or one parked after a 429 or a 5xx (request-failed, reported once it is known whether it was kept) and a parked report the cap of 50 dropped (parked-dropped). A report the device could not keep (its preferences write failed) is reported too. Not reported: a lost connection or a 401 (parked and replayed; a refused session is reported where it is renewed), a replay that fails again, a login or check-in. One activity can be reported twice (parked, then dropped by the cap or refused on a replay); at most 30 reports per run. Proposal votes report nothing (2.10.0 dropped the SDK's type 150 for them; native never sent it).
Differences from RN
- The streak freeze asks for a confirmation and keeps its key after a lost answer (RN: a new key per tap, no confirmation).
- The status answer is untrusted: a non-2xx is an error ("An error occurred" or the server's JSON
message), not a status; a key with white space is no key; anext_datewithout a zone is read as UTC (moment reads it in the device's zone). - Spin rings: Material-style arcs drawn natively, not RN's SpinIndicator geometry; the ESTM tags and the logo are RN's images.
- The empty tier text has no dash ("No quests here yet, check back soon."); it cannot show with the 2.4.26 catalog.
- Not sent: the SDK's analytics
recordActivity("spin-rolled")(in RN it posts an empty url and domain, which Plausible rejects; see Analytics).
Debug (fake data only, nothing is paid or claimed): Android --es openScreen perks|spinGame, --ez demoStreak true; iOS -openScreen perks|spinGame, -demoStreak YES. Demo spins hand out a synthetic key once per run, then none are left.
Tests: shared PerksTest (15), SpinGameTest (14), PointActivitiesTest (23), the check-in cases of WavesGapsTest; Android PerksFlowsTest (5); iOS PerksTests (4), PerksUITests (2).
In-app purchases
RN providers/iap (expo-iap 4.6: Play Billing 9 and StoreKit 2), containers/inAppPurchaseContainer.tsx, screens/boost, screens/accountBoost, the spin game's pack, registerAccountModal's paid account, parsePurchaseUrl, ecency.ts purchaseOrder, checked against ePoints' PurchaseOrderResource and purchase worker. Shared: app/Store.kt (the store seam), app/Purchases.kt (PurchaseService, the money rules), app/StoreScreens.kt (StoreScreenModel), app/DemoStore.kt, api/ecency/PurchaseApi.kt. Android iap/PlayStore.kt (Billing 9.1.0), ui/StoreScreens.kt; iOS App/StoreKitStore.swift, Screens/StoreViews.swift, EcencyApp/Store/Products.storekit.
env.store = PlayStore(context) { activity } // or StoreKitStore(), DemoStore(...) in fake-data runs; StorePlatform.None sells nothing
env.purchases.start(); env.purchases.onForeground()
env.storeScreenModel(StoreScreenKind.POINTS, username, productId) // start(), buy(id), confirm(), dismissAlert()
Products (RN's SKUs, all consumables):
099points 199points 499points 999points 4999points 9999points(Get Points, highest price first, "N POINTS" from the store title, "BEST DEAL!" and "POPULAR!", then the FREE POINTS row that opens the spin game),999boosts(Get Account Boost, "Boost+ | {HP of 553311 VESTS} HP"),499spins(the spin game's "5 SPINS" when none is left; a delivered pack reads the status again) and999accounts(register: "Buy Account - {price}", "Claim Paid Account" when one waits on the device; a purchase link hides the free card). Products the store does not price are not shown.Order (RN, unchanged on the wire):
POST /private-api/purchase-order {platform: play_store|app_store, product, receipt, user, meta?}plus the signed-in account'scode(RN's interceptor; ePoints ignores it); receipt = Play purchase token or StoreKit 2jwsRepresentation;user= the screen's account (a link or the QR flow) or the signed-in one; a paid account sendsuser= signed-in account or "ecency" andmeta {username, email, referral}. 60 s bound; 3 tries 1 s then 2 s apart; a timeout stops (outcome unknown). ePoints' worker verifies every order with the store (an App Store JWS against Apple's root certificates, whatever the device said), delivers, and acknowledges Play purchases itself. Its answers and what the app does:Answer Meaning App 201 order stored (a failed order of the same buyer is reopened with 201) finish, success, balance or Pro refreshed 409 receipt already stored: delivered once, or it will be finish, as delivered (warning to Sentry) 422 {"reason":"receipt_held","order":<id>}held for review keep unfinished, "This purchase is held for review. Contact [email protected] with order #." (the buy's alert; at recovery a toast, once per order id, purchases.heldTold), and a lasting notice (below); released, a later resend gets 409 and finishes it400, any other 422 refused (unknown product...) keep unfinished, failure shown, resent later 503, no answer, timeout not known keep unfinished, resent later Money rules (
PurchaseService): finish (Play consume, StoreKit finish) only after Ecency accepted; a failed finish is no failure (retried at the next recovery). A pending payment (Play PENDING, StoreKit.pending, Ask to Buy) is never posted and never shown as paid ("Your payment is pending..."); it is delivered when the store reports it paid. A 409 is delivered as a 201 is (RN): the purchase is finished, the screen shows its success, and a warning goes to Sentry, so a purchase whose 201 was lost ends at the next post instead of looping. An order without a known outcome (a timeout) stays unfinished and is posted again silently (30 s, up to 3 times a run, then at each start and foreground) while the user sees "Your purchase is being processed...". An App Store transaction StoreKit could not verify (UNVERIFIED) is reported astransaction-validation-failed(scrubbed, no receipt; once per transaction,purchases.unverifiedReported, the newest 16 kept) and ordered like any other with its signed transaction: Ecency's worker verifies every App Store order itself (the JWS against Apple's root certificates), so a forged one ends FAIL with nothing granted and a genuine one whose device check failed (aninvalidDeviceVerificationafter a restore) is delivered. Nothing is delivered on the device's verdict, and like every purchase it is finished only on 201 or 409 (a revoked or forged one is refused by ePoints and stays unfinished). One receipt is never posted twice at once. The target of every purchase is saved before the sheet opens (purchases.intents; a wipe removes them), so an interrupted purchase goes to the account it was bought for. An earlier purchase of the same product still on the device keeps its saved target: a paid one is delivered to that account instead of buying again, a pending one blocks a second purchase, and the user is told when that account is another one ("An earlier purchase of this product is being completed for @user first."). A saved target is bound to its purchase the first time that purchase is processed, so a later buy of the same product never changes whom it goes to. An Ask to Buy request (StoreKit's.pending, never listed inTransaction.unfinished) keeps blocking a second purchase across recovery until StoreKit reports its transaction, or for 48 h. On the App Store a purchase is known on the device by its transaction id (a re-signed receipt is not a new order; marks an earlier build kept by the receipt's hash still count) and one Ecency accepted is finished without being posted again, without touching any saved target, and never blocks a new purchase. A refunded purchase drops its saved target. A paid account's saved details survive a transient store error (network, store service) and go with a terminal one. Every unfinished paid purchase is posted again at start (StoreKit's transaction listener runs from launch), on foreground and after an account change; a revoked one is finished without an order. A paid account's name is checked against the chain rules before the sheet and before the order. A buy of a product already busy (another buy, or a recovery still sending an earlier purchase of it) is dropped:PurchaseService.buyreturns false and no outcome comes for it. The store screens and Pro draw their spinner fromPurchaseServiceState.busy, which ends with the busy purchase's own outcome; the register screen's paid card ends its spinner at once and alerts "Your purchase is being processed..." (#3751,PurchasesTest.aClaimTappedWhileARecoveryHoldsThePaidAccountEndsItsSpinner,aBuyWhoseProductTurnedBusyDuringTheNameCheckEndsItsSpinner,aPackTappedWhileARecoveryHoldsItIsToldDroppedAndTheSpinnerFollowsTheRecovery).Held for review (issue #3612): every held order is listed in
PurchaseServiceState.heldOrders(HeldPurchase(order, productId), one per order, oldest first) from the 422 until a resend of that purchase is accepted (201 or 409), it is refunded, or the user dismisses its notice (PurchaseService.dismissHeld(order), kept inpurchases.heldDismissed, the newest 16; a later 422 of a dismissed order lists nothing; the purchase itself stays unfinished and is still resent). The list is kept inpurchases.heldNotices(purchase key hash, order number, product and the account it is for; the newest 16), so it outlives a restart while the store or Ecency cannot be reached; a notice goes once a store read answers without its purchase (finished or refunded elsewhere), and a wipe clears them. A notice belongs to the account on this device its order credits and is shown (and dismissed) only while that account is signed in; one that credits no account here (a new account's purchase, a gift) shows for every account. Perks (above the quests) and Settings (above General) show one notice per order (HeldPurchaseCopy): "Purchase held for review", the order message, "Dismiss" and "Contact support", a mail to [email protected] with the subject "Purchase held for review, order #" (no mail app: RN's feedback failure toast). AndroidHeldPurchaseNotices(StoreScreens.kt), iOSHeldPurchaseNotices/HeldPurchaseSection(HeldPurchaseViews.swift), the warning box colours. Debug:-demoHeldPurchase <order>(iOS) /--es demoHeldPurchase <order>(Android) leaves an unfinished demo purchase that the demo order answers with 422receipt_held.Errors (RN providers/iap/errors.ts): a cancel is a breadcrumb only, and so is Play's dropped store connection (
SERVICE_DISCONNECTED, mostly store test devices; the user still gets the warning, and it never hides a real service error after it:PurchasesTest.aDroppedStoreConnectionIsABreadcrumbNotAnIssueButStillTold,aDroppedConnectionNeverHidesAServiceErrorRightAfterIt); each store code is its own Sentry issue (fingerprintiap+ code, tagsiap.stage,iap.code,iap.product,iap.platform), one failure delivered twice within 5 s is told once; a store call answeredSERVICE_DISCONNECTED(Play dropped its service after the app connected, which nothing tells the app) reconnects and is made once more, one connect at a time (Play refuses a secondstartConnectionwhile one runs); a dropped service said any other way (a retry that drops again, Play's purchase listener, a purchase sheet that could not open: a sheet is never opened again by itself) makes the next store call connect first (PurchaseService.connected,PurchasesTest.aStoreThatDroppedItsServiceIsReconnectedBeforeTheNextQuery, #3703); Play's billing unavailable shows RN's "old version of Google Play"; Get Points toasts "Points purchase failed\n{message}", the other screens alert "Warning".Links:
https://ecency.com/purchase?type=boost|points|account&username&product_id&email&referral(Android intent filter/purchase): Account boost, Get Points (asks "Confirm Purchase @user" / "Buying {points} for {user} at {currency} {price}" once; not restored after process death), or register selling only the paid account.Local testing, never a real purchase: Xcode runs use
Products.storekit(scheme StoreKit configuration; synthetic products, nothing charged); the iOS unit tests drive StoreKit throughSKTestSession(on a fresh simulator the session is opened in a run of its own first, "Device tests") (purchase, Ask to Buy, refund, an unverified transaction through the simulated verification error (posted, finished only on Ecency's answer), a 422receipt_heldthroughdemoOrderBody, a lost 201 answered 409 throughDemoAuthServices.demoOrderLostanddemoOrderStatus). The refund's push throughTransaction.updatesis not asserted (the test session does not always deliver it; the updates loop is covered by the Ask to Buy test): the refund test checks the recovery path,Transaction.unfinishedread as REVOKED and finished without an order by a restarted service. Fake-data runs (-fakeData YES, Android--ez demoAuth true) useDemoStore: it completes, leaves pending or cancels a purchase offline and the order goes to the demo answers. Debug: Android--es openScreen getPoints|accountBoost|getPoints:<user>:<product>, iOS-openScreenwith the same values.Store setup: v4 ships as the update of the RN app (its app ids), so the store products, their prices and ePoints' verification of the package and bundle id already exist; a separate preview app id would need all of that again, or store purchases off. ePoints' purchase-order contract: 409 only when a row for the receipt exists, 503 for any other database error, a FAIL order of the same buyer, product and platform reopened with 201, App Store orders deduped by
transaction_idbefore fulfilment. This app also keys its own marks on the transaction id and never posts an accepted transaction again.
Differences from RN
- Pending payments are not posted; an unverified App Store transaction is posted for Ecency to verify (RN's OpenIAP dropped it and left it unfinished); recovery delivers to the saved target, not to whoever is signed in; iOS recovery reads
Transaction.unfinished(RN's list missed consumables). - A cancelled sheet shows nothing (RN's Get Points toasted "Points purchase failed" and register alerted "Fail!" on a cancel). Get Points shows its toast without RN's extra "Warning" alert on top; Account boost alerts a failed order (RN showed nothing).
- New copy where RN has none: the pending notice and "Your purchase is being processed..." for an order whose outcome is not known yet; the held for review notice (ePoints' 422 is newer than RN).
- The link's confirmation is an alert with the account's ribbon (RN's action sheet with the avatar); Account boost scrolls on small screens.
- Account binding (not RN): every purchase carries the account it is for as a token (
PurchaseService.accountToken, a SHA-256 name-based UUID v8 of the lowercased name, no personal data): PlayobfuscatedAccountId, StoreKitappAccountToken, back asStorePurchase.accountToken. Who an order credits (creditedUser): the target saved with that purchase on this device, else the account the token names among the accounts on the device (an interrupted purchase never goes to whoever is signed in when it names another of them), else the newest saved target of the product (only one of the token's account), else the signed-in account; a token naming no account here (and no saved target of its account) goes to the signed-in account with a breadcrumb. A saved target binds only to a purchase of its own account's token. A buy that finds an earlier unfinished purchase of the product credited to another account (by its saved target or token) tells the buyer ("being completed for @..."), saves no target of its own and shows no success for that delivery. Recovery at start waits for the accounts to load (iOS starts purchases before the session).
Tests: shared PurchasesTest (39), CrashAndAnalyticsTest (8); Android PurchaseFlowsTest (11), the held notice in SettingsFlowsTest and the purchase cases of PerksFlowsTest, RegisterFlowsTest; iOS PurchaseTests (9, StoreKitTest), PurchaseUITests (5).
Ecency Pro
Pro by in-app purchase, over the purchase service above (same order contract, money rules and recovery). Shared app/Pro.kt (ProModel, ProCopy), ProMembersModel.activate (ProfileSupport.kt); Android ui/ProScreens.kt; iOS Screens/ProViews.swift. Web wording from vision-next pro.* (features/pro).
Product
1999pro(PurchaseSkus.PRO, webPRO_SKU): $19.99 for 12 months, buying again while a member extends by 12 months (Ecency's Pro fulfilment). Play: a one-time in-app product, consumed after Ecency accepted the order like every SKU. App Store: a Non-Renewing Subscription inProducts.storekit;StoreKitStore.sellstakes it as non-renewing or consumable (both are finished after the order and wait inTransaction.unfinisheduntil then), so either store setup works.Perks card (above "Use your points", signed in only): non-members "Go Pro for {store price} a year. ..." (no price: the plain text), members "You are a Pro member.". Membership is the badge's roster (
ProMembersModel,GET /private-api/pro-members).Sheet: title, web's subtitle and the four benefits (verified badge, free blog at yourname.blogs.ecency.com, supports Ecency, early access); the buy button with the store's localized price ("Get Pro for $19.99 a year", members "Extend by 12 months for $19.99" with a note); none when the store does not sell it ("not available from the store right now"). No link-out and no copy pointing to buying elsewhere. A price the store could not be asked for (offline, its service:
StoreError.isTransient) is not "not sold"; a store that cannot sell here (no or old Play billing, an unsigned build) still says unavailable. The state carries over an account change. For the transient case the sheet says "We could not load this. Please try again." with Try again (ProState.priceFailed,ProTest.aFailedPriceReadSaysSoAndRetryReadsIt, #3703).Purchase: for the signed-in account only (
PurchaseTarget(user = signed-in), its account token in the transaction, no gifting); refused while any Pro buy is under way (another account's included). Accepted order: "Payment received. Activating your membership." until the account is on the roster, then "Welcome to Ecency Pro" (an extension: "Payment received. Your Pro membership is being extended by 12 months.", since the roster already lists the account and cannot show the new expiry). The roster is read past the API's 5 minute cache at once and every 30 s, each waiting account for at most 12 reads, several accounts together (Ecency delivers from a queue and edge caches the list), for every delivered1999proincluding recovered ones, by the account it was credited to. What happened to an account's latest Pro purchase (pending, processing, delivered) is kept app-wide (ProPurchases), so a payment that settles later, a recovered purchase or an outcome that landed while Perks was closed shows when the sheet opens; it is cleared once the success was seen. Failures and cancels as the other purchase screens (a cancel shows nothing and orders nothing); another account's outcome never shows on the signed-in account's sheet. An interrupted purchase is delivered at the next start to the account it was bought for (saved target, as Points).Pro prices of perks: neither web nor the SDK has a Pro price on the client. AI costs and free allowances are the server's answers (
ai-assist-price,ai-generate-price,ai-transcribe-price), shown as answered, so a Pro allowance shows once the server applies it; the streak freeze label is the SDK's fixedSTREAK_FREEZE_PRICE(300, as web) while the server prices the buy. A Pro freeze price needs the SDK and server first.Debug: fake-data runs sell
1999profromDemoStore; a demo Pro order puts its account on the demo roster.-demoNoPro YES(iOS) /--ez demoNoPro true(Android) empties the demo roster (spike-alice is Pro by default).Store setup: Ecency verifies each store order against its list of store products, which carries
1999pro. The app finishes a purchase (Play consume, StoreKit finish) once Ecency accepts the order, so a product is offered in a store only after that list carries it. The products: a one-time in-app product on Play ($19.99) and a Non-Renewing Subscription on App Store Connect (review notes and screenshot).Refunds: a refund through Stripe ends the membership; store refunds (App Store
REFUNDnotifications, Play voided purchases) do not yet.End date (#3636): the roster has no expiry, but Ecency's Points API (
POST /private-api/points {username}, the balance read the app makes anyway) answerspro: {active, expires}(ISO 8601 with its offset). A member sees "Your membership runs until {date}." (native.pro.member_until, the date throughLocaleFormat.date) on the card and in the sheet; read once per account and again after a delivered purchase (an extension moves it); only the newest read lands (an older one is cancelled, so a read from before an extension never replaces the new date); an answer for an account no longer signed in is dropped; a failed read is tried again (3 tries, 5 s apart); no date when inactive, unreadable or failed every time. Web shows no end date; this is the app's own.Free blog (#3636, web
features/pro/pro-blog-claim.tsx): a member's sheet asks the hosting API whether the blog exists (publicGET /v1/tenants/{username}, webhostingApi.tenant), once per account. An existing blog shows "Your blog is already set up", its address ({username}.blogs.ecency.com) and Open (the browser); none, an abandoned one or a failed lookup (web fails open) shows "Claim your free blog". That opens a small form: blog title and description prefilled from the account's profile (name,about, posting_json_metadata first; only empty fields, capped 100 and 500 as web) and editable, then "Claim blog". No template, accent or font pickers: the blog starts on the default look, which the intro says can be changed later; nothing links out to buy. The claim isPOST {Ecency}/api/hosting/claim-blog {code, title?, description?}(EcencyPrivateApi.relay, the account's access token ascode, blank fields left out, resent once only after a 401 that renewed the session); Ecency checks the Pro roster and returns an existing blog unchanged (created: false: "Your blog is already set up", else "Your blog is ready"), the address fromtenant.blogUrl(https only) or the default one. One claim at a time; an answer (lookup, prefill or claim) for an account no longer signed in is dropped. Failures stay in the form asAppError: 403 "Ecency Pro membership is required to claim a free blog.", 502/503 "Blog hosting is not available right now. ...", 401 "Please sign in again ...", no answer the network message, anything else "Could not claim your blog. Please try again.". Fake-data runs answer both offline (DemoAuthServices.demoBlog: no blog until claimed, a demo non-member's claim is refused).
Not built yet
- Claiming the free blog (#3636): web's claim (
ProBlogClaim,/api/hosting/claim-blogwith the account's access token) is a customise step (template, accent, fonts, title and description prefilled from the profile, an existing blog probe) before a one-time claim; a native entry waits for a decision between porting that flow and a plainer claim.
Tests: shared ProTest (30: stale pending, token binding, earlier purchase of another account at buy, account switch, settled pending, kept outcomes, multi-account activation, the end date per account); Android ProFlowsTest (10, with the badge cases) and the token case of PurchaseFlowsTest; iOS ProTests (3, StoreKitTest), ProUITests (6). Fake data: demo members end on 27 July 2027 (DemoAuthServices.DEMO_PRO_EXPIRES).
Settings
RN screens/settings (screen and container), constants/options (currency, language, nsfw, theme, imageServer), providers/ecency/supportBeneficiary.ts, utils/{settings,storeReview,sendEmail,autoLocale}.ts, screens/emailDigests, SDK support-settings and newsletter calls. Shared app/SettingsModel.kt (SettingsCopy, SettingsOptions, StoreListing), app/EmailDigestsModel.kt, legacy/LegacySettings.kt, NewsletterApi.unsubscribeAll; Android ui/SettingsScreens.kt; iOS Screens/SettingsViews.swift. The screen follows RN's rows in RN's order.
env.settings.start(deviceLocale) // at launch, after env.prefs: saved values apply at once, the RN import runs in the background
env.settings.onShow(); onHide() // the screen: server list, support settings (after queued saves)
env.settings.setCurrency("eur"); setLanguage("de-DE"); setNsfw(NsfwMode.HIDE); setTheme(ThemeMode.DARK)
env.settings.setImageServer(url); selectServer(url)
env.settings.setSupportBeneficiary(on); setSupportBeneficiaryPercent(p); setSupportCuration(on); setSupportCurationPercent(p)
env.settings.contentLanguage // translation target and reader language (RN appLang)
env.emailDigestsModel() // start(), open(type, target), stopAll(email)
- General: Currency (24, stored lower case as
settings.currency, which the wallet reads), Language (39; at the first start the device locale, mapped like RNmapToRegisteredLocale, is saved once, as RN autoDetectLocale; RN's imported language replaces it, except RN's initial en-US: an RN store holding en-US counts as a choice only when RN's ownlocale_auto_detectedkey is set, otherwise the detected language stays), Server (groomed names, "Checking..." and a spinner whileHiveNodeSettings.selectchecks it, RN's three toasts), Image Server (RN's three; the proxy and the body renderer switch at once, toast "Successful"), NSFW (nsfw, read by feeds and waves at their next page), Appearance, Show Images, PIN code, Finger Print / Face Unlock, Reset Pin Code - App icon (not in RN): seasonal icons on or off and an icon picked by hand (see App icons)
- Push Notification card (see Notifications)
- Support Ecency (signed in, only after a valid load): the two toggles (5 % when turned on) and their presets (1/5/10/25, 5/10/25/50/100); both percents sent every time (
support-settings-update), optimistic, in order, a superseded save not sent, only the newest operation applies its answer, a failure goes back to the last confirmed values with "Fail!", an account change hides the card and loads the new account's (while the screen shows), loaded again when the screen shows (the editor chip saves too) - Rate Ecency (Android Play app, else the web listing; iOS the App Store page Apple's lookup names for the bundle, on its review form, else RN's web listing), Send Feedback (
mailto:[email protected], RN's subject and body with account, version (build) and device, qs encoding; RN's two toasts) - Email digests (signed in):
AppScreen.EmailDigests(gated): subscriptions grouped by address, " • ", "Manage" opens the digest sheet, "Stop all" confirms thenPOST /api/newsletter/unsubscribe-all {email, code}with RN's toast or alert, "Get more by email" offers own and the Ecency newsletter; the list loads again when the sheet closes; 503 and other errors with RN's texts - Manage Authorities, Delete Account
- Chat Privacy (signed in, after Language): Everyone / Only people I follow / No one (disable DMs), read when the screen shows and saved at once (
GET/PUT /api/mattermost/me/dm-privacy) with RN's two toasts (see Chats) - Not in RN's settings, so not here: clear cache, about and privacy links, default footer (dead redux field)
RN settings import (once per install, settings.legacyImported; on iOS the RN storage reader is locked per call because the account migration's cleanup rewrites it at the same time): LegacySettingsReader reads RN's settings key (server) and persist:root application (currency, language, nsfw as string or number, colorTheme, hidePostsThumbnails, imageServer, isNotificationOpen, notificationDetails). Only values from RN's option lists are taken, and only into settings this app has no value for yet; the push switches move together. Storage that cannot be read now is tried at the next start; absent storage or bad data counts as done. After the import the theme, image proxy, node pool (HiveNodeSettings.applySaved), push switches and "Show Images" reload. No secret is read.
Differences from RN
- The language choice switches the app at once (catalog, direction; see Localization, app language) with no restart prompt (RN asks to restart when the direction flips). It also drives content features (translation target, reader language).
- A stale server stops the spinner and says "Server not available" (RN leaves its spinner on and shows no toast).
- iOS shows the cards as form sections, dropdowns as menu pickers, and the PIN rows as buttons with On/Off (RN latching toggles); Android draws RN's cards, bordered dropdowns and switches.
- A theme saved by an earlier preview build (platform key
themeMode) moves into the shared settings once. - Rate Ecency on iOS needs Apple's lookup to name this app's page; the lookup is capped at 5 s; offline, slow or before the listing exists it opens RN's web listing (
StoreListing.IOS_WEB), Android falls back to the Play web listing. - "Finger Print / Face Unlock" shows only when the device has biometrics enrolled (RN shows it whenever the PIN is on).
- Push registrations of one account go out one at a time and read the switches when their turn comes, so the RN import (or a quick toggle) during the first registration is always the last write.
Debug: Android --es openScreen settings|emailDigests, --ez demoDigests true; iOS -openScreen settings|emailDigests, -demoDigests YES (two synthetic subscriptions; demo support settings keep their values for the run).
Tests: shared SettingsModelTest (options, locale mapping, feedback URL, review links, device settings, image proxy swap, server toasts, support settings rules, the RN import: full, existing values win, invalid values, unreadable and absent storage) and EmailDigestsModelTest; Android SettingsFlowsTest (and the settings cases of ShellFlowsTest, NotificationFlowsTest, LockFlowsTest); iOS SettingsTests, SettingsUITests, ShellTests.testThemeChoiceIsSaved.
App icons
Seasonal launcher icons (#3656): for a few days around a celebration the Ecency heart gets a seasonal tile, colour and one small object, then goes back to the everyday icon. Not in RN. Shared app/SeasonalIcons.kt (LauncherIcon, SeasonalCalendar, IconAudiences, SeasonalIcons, LauncherIconModel, env.launcherIcons); Android LauncherAliases.kt, ui/AppIconSettings.kt; iOS App/LauncherIconSwitcher.swift, Screens/LauncherIconViews.swift (the App icon section of Settings and its list).
- Celebrations. Global, for everyone: New Year, Valentine's Day, Hive Day (Hive's launch on Mar 20, 2020, with the Hive mark), Earth Day, Bitcoin Pizza Day, Programmers' Day, the football tournament and the summer games (a plain ball and a plain medal: no tournament or Olympic names, marks or rings). Regional, from the phone's own region and language settings (never its location, no network): Lunar New Year, Ramadan and Eid, Nowruz (Central Asia, Iran, Afghanistan, Azerbaijan, Albania, Kosovo, or a Persian, Tajik, Uzbek, Kazakh, Kyrgyz, Turkmen, Azerbaijani or Kurdish phone anywhere), Holi, Mid-Autumn Festival, Diwali, Halloween, Black Friday, Christmas. The lists of regions and languages are
IconAudiences. Cyber Monday is not built. - Windows (
SeasonalCalendar, the one place they are decided): New Year Dec 31 to Jan 2; Valentine's Day Feb 13 to 14; Hive Day Mar 20; Nowruz Mar 20 to 23; Earth Day Apr 22; Bitcoin Pizza Day May 22; Programmers' Day the 256th day (Sep 13, Sep 12 in a leap year); Halloween Oct 29 to 31; Black Friday the day after the US Thanksgiving (fourth Thursday of November) to the Sunday; Christmas Dec 20 to 26; Lunar New Year the eve to the Lantern Festival; Ramadan and Eid the evening before the first fast to Eid al-Fitr + 3 (the third day of Eid where moon sighting puts it a day after the Umm al-Qura date); Holi Holika Dahan and Holi; Mid-Autumn the day before to the day after; Diwali Dhanteras to Bhai Dooj; the tournaments their match days. Lunar and lunisolar days come from a table with its sources (2026 to 2029 now); past the table a lunar celebration does not show rather than on a wrong day, so extend it before its last year (SeasonalIconTestfails when the next three years are not covered). - Overlaps, one fixed rule (
SeasonalIcons.pick, the same answer on every launch): regional before global, regional ones in their region's order (Ramadan and Eid first; Singapore puts Lunar New Year first; Iran, Afghanistan and Tajikistan put Nowruz first, so in 2026, when Eid al-Fitr is Mar 20, Nowruz shows there and Eid does not), then the earlier. A celebration keeps only its days at least 3 plain days from one already kept, so a phone never changes icon twice within a few days (iOS shows a system notice on each change): in Malaysia in Feb 2027 Ramadan and Eid shows and Lunar New Year does not; in Singapore on a Malay phone Lunar New Year shows to Feb 20, 2027, then Ramadan and Eid from Feb 24; in Iran in 2026 Ramadan shows to Mar 16, then Nowruz; in India on Mar 20 to 22, 2027 Holi wins over Hive Day; on a Chinese phone Mid-Autumn (Sep 14, 2027) wins over Programmers' Day (Sep 13). - No server switch: the days come only from
SeasonalCalendarin the app, and anyone can turn seasonal icons off in Settings; a wrong date is corrected in the next release, well before it is due (the table runs to 2029). - Settings: "App icon" (after General): seasonal icons on or off, and every icon to pick by hand, the everyday one included. On iOS the App icon row names the current icon and opens a list of every icon with its preview, the current one checked; a tap picks that icon (the current one too, as on Android) and the list stays open (a row of the app's own: the system picker row drew its title in a grey the contrast audit failed). Picking an icon turns seasonal icons off; turning them on again follows the rule. Saved in the preferences (
launcherIcon.seasonal,launcherIcon.picked). - iOS: alternate app icons (
Assets.xcassets/AppIcon-<key>.appiconset, light, dark and tinted, all included byASSETCATALOG_COMPILER_INCLUDE_ALL_APPICON_ASSETS). iOS shows a system alert on everysetAlternateIconNameand offers no way to hide it; seasonal icons are still on by default, as on Android (the owner's call: the notice comes twice per celebration), and Settings turns them off. The shared model keeps the one-question mode (asksFirst, "Show seasonal icons?") unused. Switches happen only while the app is active (when it becomes active, and on a Settings change). The Settings picker works either way. Fake-data runs never switch by themselves. Today is read as a Gregorian day in the phone's time zone (LauncherIconSwitcher.today, AndroidLauncherAliases.today), whatever calendar the phone shows (the table is Gregorian; a Persian, Islamic, Buddhist or Japanese calendar setting gave other years and days). A change the system refuses reaches Sentry as a warning (launcherIcon.set). The system icon name (alternateIconName, a synchronous LaunchServices call that hung the main thread for 2 s on a return to the foreground, Sentry 3S5) is read once per run: only the app sets its icon, soLauncherIconSwitcherremembers what it set since and compares against that; an apply while a change is in flight compares against the icon asked for and skips. The system answers a change later, so a refusal forgets the remembered icon and, when it answers the last request (each change asked of the system has its own number: a refusal of an earlier request, even for the same icon, is ignored), applies again at once, reading the system once more; a refusal that repeats waits for the next foreground (at most one retry per foreground, never a loop), so Settings never shows an icon nothing will try to set again. - Android: on by default as on iOS (Android shows no notice when the icon changes); Settings turns them off. One
<activity-alias>ofMainActivityper icon (.Launcher<key>, adaptive icon with background, foreground and monochrome layers), exactly one enabled;MainActivityitself has no launcher entry. The alias changes withDONT_KILL_APPinMainActivity.onStop(the app out of sight, not for a rotation, and not while something the app opened is in front: a picker, the camera, the share sheet, a Custom Tab or the browser, tracked by overridingstartActivityForResultandstartIntentSenderForResult, since a switch can end the task while a result is awaited), the new one enabled before the old one is disabled. Links (ecency://,hive://, the verified ecency.com app links), shares, widgets and notifications keep targetingMainActivity, so a switch never changes where they go; services that open the app use the package's launch intent, which follows the enabled alias. Some launchers rebuild or move the home screen entry when the alias changes. - Artwork:
scripts/icons/seasonal_icons.pyholds every design (the real Ecency mark, the Hive mark for Hive Day) and writes the Android vector drawables and adaptive icons, the manifest's alias block (between theseasonal-iconsmarks), the iOS icon sets and the 120 px Settings previews (PNGs drawn byscripts/icons/rasterize_svg.swift, macOS);--checkcompares the text files. The Ramadan and Eid, Diwali, Holi and Nowruz icons get a review from someone of each community before release. New artwork needs a release; the server can only stop or move what ships. - Never remove or rename an alias once shipped: Android forgets the state of a removed component, and removing the one a phone has enabled leaves the app with no launcher entry (Default is disabled there). Retire an icon by keeping its alias with the everyday artwork (
LauncherAliasesTest.everyAliasEverShippedIsStillTherelists every shipped name). Notifications openMainActivityitself (LauncherAliases.openApp), never the package's launch intent, which names the alias enabled at the time. - Add a celebration: a
LauncherIconentry (a newkey, never rename one) with itsregionalflag and copy (native.app_icon.name_<x>); its days inSeasonalCalendar.windows(a table with sources for a moving date); for a regional one its regions and languages inIconAudiencesand its place inDEFAULT_ORDER; its design inICONSofseasonal_icons.py, then run the script; its two drawables inlauncherLayers(ui/AppIconSettings.kt); thencd iosApp && xcodegen generate. The tests below check every icon has an alias, an alternate icon and a preview. - Debug: iOS fake-data runs
-launcherIconDay 2027-03-20(with-launcherIconRegion DE -launcherIconLanguage de) run the rule for that day. - Tests: shared
SeasonalIconTest(global and regional days, Feb 2027 and Mar 20 to 23, 2027, the 3-day spacing, Black Friday's days, Nowruz in Iran and Eid + 3, the table's coverage, seasonal off, the iOS question); AndroidLauncherAliasesTest(one alias per icon, exactly one enabled, switched only in the background, links and shares still openMainActivity) andSettingsFlowsTest.theAppIconCardPicksAnIconAndTurnsSeasonalIconsOff; iOSLauncherIconTests(no switch before the answer, a declined question, the picker sets and clears the alternate icon, nothing while inactive, the system icon read once per run and again only after a refusal, a refusal that comes after a foreground skipped the in-flight change applying again, one retry per foreground, a refusal of a replaced change or of an earlier request for the same icon ignored, every icon and preview in the bundle) andSettingsUITests.testTheAppIconRowOpensEveryIconWithTheCurrentOneSelected.
Crash reporting
RN App.tsx and utils/sentryUtils.ts. Android crash/SentryReporting.kt (sentry-android-core and -ndk 8.20.0, started in EcencyApplication, auto-init off in the manifest); iOS App/CrashReporting.swift (sentry-cocoa 8.58.4 over SPM, started in the App's init); shared app/CrashReports.kt (CrashReporter, CrashScrubber, IapErrors).
- DSN: RN's project (the DSN in RN
App.tsx, sharedCrashDsn.DEFAULT; a DSN only allows sending events, so it is public like RN's). Build settingecency.sentryDsninlocal.properties(Android alsoECENCY_SENTRY_DSN), which CI writes from the optional secretNATIVE_SENTRY_DSN: empty is RN's project in release builds and nothing in debug builds,offturns reporting off, any other value must be an https DSN or nothing is sent. - As RN:
sendDefaultPiifalse, no tracing, no session replay, errors at Sentry's default sample rate (all), release<app id>@<version>+<build>with the build number as dist, environmentproductionordebug, anddevelopmentfor a release built without CI's build number (Android build 0, iOS project.yml's "1": a laptop or an emulator, so its reports never mix with the testers';SentryMappingTest.aLocalReleaseBuildReportsUnderDevelopment, iOSCrashReportingTests, #3704). Failed HTTP answers are not turned into events (RN does not). - Scrubbing (every event and breadcrumb,
beforeSend/beforeBreadcrumb): RN's WIF and Bearer/Basic patterns plus Hive master passwords (P5and base58), JWT-shaped tokens, long hex (keys, signatures), query and form parameters and JSON fields named code, token, key, memo, pin, password, signature, receipt, email and the vault's field names (postingKey, activeKey, memoKey, ownerKey, hiveAuthKey, hiveAuthToken, masterPassword), also a JSON value cut off mid-way (a parser's excerpt) and a long token right after such a name in free text, e-mail addresses; breadcrumb data, extras and named contexts recursively (depth 6), values under secret keys dropped whole, the fingerprint, request headers, cookies and body size removed (the SDK keeps no request body), an iOS exception mechanism's description scrubbed and its data (an NSError's userInfo) dropped, no user. The scrubber is total: a failure returns a placeholder instead of the text, andbeforeSendnever throws. RN's benign errors are dropped (cancellations, wrong PIN, invalid credentials, a cancelled signing). - Reported from shared code: store errors and order failures (IapErrors), a 409 taken as recorded (warning), the error boundary's catches, and every handled failure (below). Fake-data runs report nothing. Nor does Android in Firebase Test Lab (Play's pre-launch report; the system setting
firebase.test.labistrue): Sentry never starts there, since its crawler opens libraries' exported activities (Glance's trampoline, Billing's proxy) without their extras (SentryTestLabTest; ECENCY-MOBILE-3R8, 3R9).
Chain refusals
Shared api/broadcast/ChainRefusal.kt (issue #3660; not RN, whose handleChainError copy was never shown): what hived refused, read from any text a failure carries (the node's message first, then only the assertion format texts of its data, never the transaction data quotes, so a post's own words never decide; HiveSigner's error_description; a HiveAuth wallet's reason; the whole cause chain), with hived 1.28.8's own assertion texts as the patterns. hived quotes the C++ condition before its words (comment_cashout->has_replies(): ...), so no pattern names a condition and an unknown refusal is quoted without it. Each refusal has copy that says what happened and what to do: Resource Credits; the post (5 minutes), comment (3 seconds) and edit (one per block) cooldowns; a vote identical or too small; paid out; delete with votes or replies; a title over 255 bytes; an empty body; text that is not UTF-8; beneficiaries refused, or set after votes; a payout raised; not enough funds; rewards already claimed; HiveSigner without posting permission; a missing posting, active or owner authority. BroadcastException.from turns a node error into its typed exception (Refused for those with no type of their own); AppError reads HiveSigner and HiveAuth failures the same way, says a HiveSigner login expired (invalid_grant, unauthorized_access) or keeps a HiveAuth wallet's own reason. AuthFallback decides the auth upgrade by BroadcastException.MissingAuthority's type, never its copy. A failure mapped again (an AppException holding an earlier AppError) keeps the code its report was sent with. An unknown refusal shows "The Hive network refused this:" and the node's words (150 characters); a failure of the app itself shows "Something went wrong. Please try again." once, never wrapped in another "Something went wrong". A transaction over 64 KB names its size and the limit. The editor checks the title in bytes before signing (EditorMeta.MAX_TITLE_BYTES): emoji and many scripts take 2 to 4 bytes a character. It also refuses a new or scheduled post whose first tag hived cannot take as its parent_permlink (EditorMeta.isChainPermlink: a-z, 0-9 and "-"), with the tag rule shown under the tags (editor.limited_characters); RN sent it and the chain refused the post with "Invalid permlink character" (Sentry ECENCY-MOBILE-3SV, 3VB). After a lost answer, when the post may be out already, the retry still asks the chain first: the update it offers keeps the parent the chain holds, and only a new post with that first tag is refused (EditorModelTest.aFirstTagTheChainCannotTakeStillOffersToUpdateAPostAlreadyOut). Later tags only go into json_metadata and never block (EditorModelTest.aFirstTagTheChainCannotTakeIsRefusedBeforeAnythingIsSigned).
- Vote too small also covers hived 1.28's "does not have enough mana to vote" (and downvote), from the node and HiveSigner alike: reported as the user's own refusal with the vote too small copy, no error code (Sentry ECENCY-MOBILE-3S0, 3S1;
ChainRefusalTest).
Handled errors
Not RN, which calls captureException at some call sites only: every failure the app shows or swallows goes to Sentry, so a broken publish, vote or read is an issue instead of a toast nobody hears about. Shared app/ErrorReports.kt; one per process, installed by AppEnvironment over its crashReporter (nothing is sent before the platform sets Sentry, and nothing in tests unless a test sets a recording reporter).
- Handled:
AppError.from(e, where)andAppError.fromBroadcast(e, where)map a failure for the UI and report it.whereis a short stablearea.actionliteral naming the place in the code (editor.publish,editor.schedule,post.vote,wallet.load,chats.load,session.logout), never built from data. A model that only decides by the kind usesAppError.kindOf(e), which reports nothing. Helpers that turn a failure into text take the caller'swhere(ChatsModel.message(e, fallback, where)). - Quiet:
ErrorReports.quiet(e, where)for a failure the app swallows on purpose (a quiet refresh, a best-effort background read, a side request whose screen goes on without it); tagquiet=true, level warning. A lost connection (ErrorKind.NETWORK) is not sent at all: offline, every quiet refresh would fail the same way. Nor is a refused Ecency session (HTTP 401): the user is asked to sign in again andauth.renewTokensays why. Nor, while the store is closed until the phone unlocks, a quiet read the app runs again after the unlock (sendJournal.read,legacy.readNameswith the lock's start,push.accounts; ECENCY-MOBILE-3NR, 3NS, 3QZ); a shown failure of a start (session.start,appLock.start) stays the expected warning. - iOS: a Swift
catchreports throughReports.handled(error, where:)/Reports.quiet(error, where:)(App/CrashReporting.swift) orErrorText.message(error, where:); a Kotlin exception goes as itself, a Swift error by its type, its domain and code and its description (ErrorReports.foreign) with the catch site's stack. The URL loading system's offline and timeout codes count asNETWORK(a warning when shown, nothing when quiet). A start that fails before the environment exists goes to Sentry as an event built from the error's type, domain and code (never the bridged NSError and its userInfo). - Never reported: cancellations (
CancellationException, SwiftCancellationError,ErrorKind.CANCELLED, a cancelled URL load) and RN's benign errors (CrashScrubber.ignores). - Out-of-RC counts (#3727,
RcShortfall): every time an account runs out of Resource Credits is also one event of its own, messagerc-shortfall: <stage>/<op>(the stage and op in the message too, so Sentry's dedupe never drops a rejection right after its pre-check) at level info with the one fingerprint["rc-shortfall"](one grouped issue, never an error alert), taggedrc.stage(rejected: the chain refused a broadcast, fromErrorReports.handledwithRESOURCE_CREDITS;precheck: the editor's estimate warned, once per account and op per UTC day on the device, kept in the preferences as the web app keeps it per browser, so these approximate users a day; the day is marked only once a reporter took the event, so one held back by the run's cap or sent before reporting was set up counts again) andrc.opfromwhere(post,comment,vote,reblogincluding the community reblog after a publish,transferfor every wallet operation,other; the web app's rules). No account: the Sentry user stays cleared. A failure handled twice is one event; others are counted, not throttled, up to 200 a run. Neither native Sentry SDK drops a repeated message event (Android's duplicate filter only drops the same exception object, iOS has none), so the web app's Dedupe exemption has no native counterpart. The web app sends the same (vision-web#2196, #2199), with the account as Sentry user; native sends none. Both adapters map levelinfoto Sentry's info.RcShortfallTest,RcPrecheckEditorTest.aWarningIsCountedOncePerAccountWhileTheAuthorTypes,SentryMappingTest.anOutOfRcCountIsAnInfoMessageWithNoUser,CrashReportingTests.testAnOutOfRcCountIsAnInfoMessageWithNoUser. - Levels: warning with tag
expected=truefor what is not a bug of the app: no connection (NETWORK), the store closed until the phone unlocks (SecureStoreException.UnavailablewithuntilUnlock, thrown only by the iOS store's own refusal while the launch check waits for the first unlock; it has its own text, so its grouping and throttle never cover a later storage error; a Keychain call refused with the same status stays an error), the user's own sign-in mistakes (wrong password or key, unknown account, a public key pasted, an expired or revoked HiveSigner login, an Ecency session refused with 401 after the renewal), the chain's per-user refusals (ChainRefusal.isUsersOwn: cooldowns, Resource Credits, paid out, a vote already cast or too small, a title too long, not enough funds, a missing authority) and the app's own refusals (anAppExceptionwithout a cause). Everything else is error; a refusal that points at the app (beneficiaries out of order, text that is not UTF-8, payout options changed after the fact) stays an error. Also expected: a search the API could not answer (no answer, 5xx, 408, 429:NETWORK, and the reader sees the network message), a chat refusal in the server's own words (a 4xx withserverText), a signup the server refused in its own words (SignupException, a 4xx with a message, which the alert shows; without one, a 5xx or no answer stays an error) and an image upload the host refused for the account (a 403 whose JSON error is the host'sdeplorable,ImageUploadRefused; never retried, "The image server does not accept uploads from this account."; any other 403 stays an error; ECENCY-MOBILE-3S4). Not reported at all: a ranked feed whose tag or community does not exist (it shows "There are no posts with this tag yet." or "Community not found.",FeedState.notFound) and the update check's 403 and 429 (GitHub's limit for unauthenticated calls) (#3701). Warnings and errors are throttled apart: an expected warning never holds back an error of the same shape (#3706). - Error code (issue #3660): an error (not a warning) gets a six character code from its fingerprint (
ErrorReports.codeOf, FNV-1a in base 32 without I, L, O, U), sent as the tagerror_codeand carried byAppError.code. Screens showAppError.text, the message then "Error code: XXXXXX", and such a toast stays 8 seconds (UiMessage.ERROR_TOAST_MILLIS,UiMessages.toast(error)), so a tester's screenshot finds the Sentry issue by its tag. The code depends only on the fingerprint and is free of user data. It is shown only when its report went out: the same when a repeat was throttled; none before the platform set Sentry, nor over the run's cap for a fingerprint not sent; one exception shown at a second place keeps the code of its one report. - Grouping: an explicit fingerprint
["handled", where, kind, exception type, message], never the stack of the reporting site (one site would make one issue of every failure, the web's feedback toast lesson). The message is scrubbed, then addresses, URIs, file paths, quoted names, account names (withoutNames), hex and numbers are replaced and it is cut to 120 characters. Text in the device or app language stays out so one bug is one issue in every language: nothing for catalog copy (a classified broadcast failure, anAppException, aChatApiException) and for a lost connection (Darwin's NSError text), a Swift error's domain and code instead of its description. Tagshandled=true,where,error.kind,exception; the named contexthandledholds the exception's own stack trace as frames and type names only (first 40 lines): neither the exception's nor any cause's message, since a parser's message quotes the text it read. - Floods: one event per fingerprint per 5 minutes; per run at most 50 errors and, counted apart, 30 warnings, so offline noise never uses up the room a later error needs; the same exception (by identity, an
AppException's cause included, the last 16 held) once however often it is mapped. The clock is the environment's, so tests move it. - Privacy: everything goes out as a
CrashReportthrough the platform'sbeforeSend, which scrubs the exception value, tags, the fingerprint and every context value (keys, passwords, tokens, memos, PINs, codes, e-mail addresses); the message sent (the issue's title) has its URLs, URIs (content://, file://) and absolute file paths replaced by<url>and<path>and its account names by<user>as the fingerprint has (ErrorReports.withoutNames: @names, and the account named by hived or HiveSigner in "Account x already submitted", "Account: x has", "Account x does not exist", any case; ECENCY-MOBILE-3R6) and a quoted name by<q>(a name shaped word in double, single or back quotes that is no JSON key, so JSON, longer identifiers and a sentence's apostrophes stay), after the secrets were scrubbed, so an e-mail address goes whole;whereand the tags hold no user data. Failures over secret storage keep the failure under them as its type only, never as a cause:SecureStoreException.Corrupted(causeType) and the RN import'sLegacyImportError.StorageUnreadable/Malformed. - Catches: every broad
catch(Exception,Throwable,Error,RuntimeException,IOException,IllegalStateException,IllegalArgumentException) in shared commonMain, androidMain and iosMain and the Android app, and every Swift catch-all (catch {,catch let error {) in the iOS app, rethrows unconditionally (its last statement is athrow), maps throughAppError.from/fromBroadcast, reports throughErrorReports(SwiftReports.*,ErrorText.*(..., where:),AppError.companion.from) or a known helper given a where literal (ChatsModel.message), or carries a// not reported: <reason>line for a genuinely expected outcome (untrusted chain JSON, a feature probe, a retry loop that reports when it gives up, a fallback to the next signing method, the reporter itself). A conditional rethrow must also report or say why not. build-logicErrorReportLintTestfails on a catch that does none of these and on a report without a stable where literal.runCatchingand Swifttry?are not scanned: they stay for fallbacks whose failure is the answer. - Symbols (docs/release-builds.md, "Crash symbols"): the store workflows upload the Android R8 mapping and the iOS dSYMs to the same project with
SENTRY_AUTH_TOKEN, as RN did. Android events carry the mapping id CI generated (BuildConfig.PROGUARD_UUID, SentryproguardUuid); iOS dSYMs match by their own image ids. Release builds keep the names of the app's own exception classes (-keepnames class com.ecency.** extends java.lang.Throwable,ProguardRulesTest): handled reports are named by the class and carry no frames for the mapping to restore.
Analytics
RN providers/plausible and usePlausibleTracker: one Plausible pageview per opened post (POST {host}/api/event {name: "pageview", url: "app://<android|ios>.ecency.com/<post url>", domain: "ecency.com", force: true}, RN's user agent Ecency/<version> (<OS> <version>; <model>) Version/4.0 Chrome/<version> Mobile), fire and forget, nothing while the lock hides content. No key exists for this endpoint. RN has no opt-out, so neither has this app. Host: ecency.plausibleHost (Android also ECENCY_PLAUSIBLE_HOST): empty is RN's https://pl.ecency.com in release builds and off in debug builds, off turns it off, anything but a bare https host turns it off. The SDK's spin-rolled activity is not sent (RN posts it with an empty url and domain).
Localization
The catalog, formatter, plural rules and generator live in the shared core, and the language setting drives them: the app language, its layout direction and the OS per-app language switch all follow one setting. Shared copy (copy objects, models, error and enum texts), both apps' screens, numbers, dates and times, and the strings the OS reads (widgets, notification channels, permission prompts) all read the catalog in the app language.
How a key flows
- Source:
src/config/locales/en-US.json(the Crowdin source, ICU MessageFormat,{name}placeholders). Crowdin writes the 38 translations next to it (crowdin.yml). Crowdin syncs this exact path, so the locale files never move. - Build:
:shared:generateL10n(included buildbuild-logic,L10nGenerator, no Node) reads everysrc/config/locales/*.jsonandshared/l10n/cldr-plural-rules.jsonand writes intoshared/build/generated/l10n(not committed; part of commonMain for Android and all iOS targets):- Kotlin
L: one accessor per en-US key, nested as the JSON (L.settings.language,L.post.a11yVotes(count = 3)). Keys are camel cased (chain-errorischainError, a leading digit gets_, Kotlin keywords get a trailing_, a later sibling that collides keeps its raw key). Parameters come from the English message:Stringfor text and select,Intfor plural,Doublefor number. A placeholder added or renamed in en-US changes the signature, so call sites fail to compile instead of showing{name}. A broken en-US message fails the build, and so does syntax the formatter does not render (selectordinal, number styles such as{x, number, percent}, dates). The tree is@HiddenFromObjC, so the iOS framework links only the accessors Kotlin code uses. - Swift
L(shared/build/generated/l10n/swift/L.swift): the same keys as nested enums for the iOS app (L.Settings.language,L.Post.a11yVotes(count: 3)withIntfor plural andDoublefor number, Swift keywords in backticks such asL.Alert.`continue`), calling the exportedL10n.text(index:)/formatArgs(index:names:values:). The app's "Build Kotlin shared core" phase copies it toiosApp/Generated/L10n.generated.swift(gitignored, an optional source inproject.yml), so a clean checkout and CI build it with the framework. - One object per language with its messages as string constants (only those that differ from English; en-US holds all), decoded the first time the language is used.
L10nPluralRules: the CLDR plural rules of the 39 languages compiled to Kotlin.
- Kotlin
- Runtime:
L10n(sharedl10n/L10n.kt) holds the current language as aStateFlow(L10n.language,setLanguage(id),isRtl) and resolves each message once per language. A missing key, a translation that does not parse, or one that uses a placeholder English lacks shows English for that key. A translation may leave placeholders out (react-intl formats it, so ja-JP's monthly posts message without{suffix}shows as in RN). One that fails while formatting (an argument of the wrong type) shows English too. Formatting never throws.setLanguagematches ids like RN's mapToRegisteredLocale (ru,ru_RU,pt-BRto pt-PT,zh-Hant-TWto zh-TW; unknown is English).L10n.byKey("wallet.$type")covers RN's run time key names.
Why generated constants rather than bundled JSON resources: they need no resource plumbing (the iOS framework is static and has no bundle; Android and both test targets read them as plain code), no JSON parsing at run time, and only the current language is decoded. Decoding one language table takes about 0.1 ms on the JVM host and 0.2 to 0.3 ms on the iOS x64 simulator (debug), all 39 together 3.5 ms and 12 ms; nothing is decoded at app start until the first message is read. The 39 tables hold 1.6 M characters (2.1 MB UTF-8). The arm64 release framework (static) grows by 2.7 MB of string data and 0.06 MB of code (Kotlin L is not exported; Swift L compiles into the app), 2.9 MB in all or 0.65 MB gzip; the Android debug APK grows by 0.8 MB (2.2 MB of dex; R8 drops unused accessors in release builds).
Adding copy
- Add the English text to
src/config/locales/en-US.jsononly, under the fitting group, even for native only copy (one Crowdin source). Never edit the other 38 files by hand: Crowdin writes them and the next pull overwrites local edits. The one exception is a seed made by a script and uploaded to Crowdin (tools/l10n/seed-native-plurals.mjs, below). RN keys go under the fitting RN group; native only copy goes undernative.<area>(native.ios.<area>,native.android.<area>for one platform). - Write it as ICU MessageFormat:
{name}placeholders, a choice as{kind, select, a {..} other {..}}. Noselectordinal, number styles or dates (the native build refuses them). An apostrophe before{,}or#starts a quote (''for a literal one there). - Counts are ICU plurals in a native key (
{count, plural, one {# vote} other {# votes}},{count, plural, one {# day} other {# days}}; English needsoneandother, translators add the forms their language needs). Not in an RN key: RN runs on Hermes, which has noIntl.PluralRules, so react-intl shows a plural message as its raw pattern (RN'spost.a11y_*plurals already do). RN keeps its English hacks until it is retired. - Use the generated accessor,
L.<group>.<key>:L.group.key(count = n)(Kotlin) orL.Group.key(count: n)(Swift); a plural argument isInt, so passing a string does not compile. - Never change RN's English under an existing key for native's sake; add a new key instead. A typo fix keeps its translations as unapproved (
update_optionincrowdin.yml). - After a merge to
development,crowdin-upload.ymlsends the new source to Crowdin; translations come back throughcrowdin-download.yml(thesync-translationslabel or a manual run), as one PR. Until then the new key shows English in every language.
Key choice and RN key reuse
- A native text that is word for word an RN en-US message with the same meaning (same text and same meaning, in the same context) reuses that RN key, so its translations come along (about 1050 keys, placeholders renamed to RN's). The same English with another meaning (a load-more "More" against RN's emoji "More", a poll's "Vote" button against a wallet activity) gets its own key.
- A text native reworded, or native only copy, gets a key under the top level
nativegroup ofen-US.json, one subgroup per copy area (native.wallet,native.chat_thread,native.app_error, ...): one clear place for Crowdin, no clash with RN keys, and RN ignores it (about 470 keys). RN's English is never changed. shared/l10n/rn-reuse.jsonrecords each reused key with the English native showed. build-logicRnReuseTestfails when RN's English under a recorded key changes (a reuse must not reword native) and when Kotlin code (shared and Android) reads an RN key that is not recorded; record a new reuse there after checking the texts match. Keys read at run time (L10n.byKey("notification.$key"),post_dropdown.$id) are recorded by hand;RnReuseTestalso derives the run time key families (NotificationFormat.COPY_KEYS,PostMenuItemids) from the sources. It also maps the SwiftLaccessors back to keys (from the generated L.swift's doc lines) and fails on an RN key the Swift code reads unrecorded.- Never reuse an RN key whose English fakes a plural (
{suffix},attempt(s), a count before a fixed plural noun): native reads its own plural keys undernative.plurals(see Crowdin). - Messages are whole: fragments built by concatenation are one message with placeholders; counts use ICU plurals (
{count, plural, one {# view} other {# views}}); lists of role names join throughCopyLists.and. Label rows keep RN'slabel: valuelayout, a colon between two catalog texts.
Reading copy when shown
- Copy is read when shown: copy objects are getters (
val X: String get() = L...), lists and maps of labels are getters or map to lambdas, enum labels are lambdas behind alabel/titlegetter, so a live language switch reaches everything. Never a storedval,by lazy,static let, enum constructor argument orMutableStateFlowinitial value. Swift sees the same properties. CopyCatalogTestreads every copy getter, function and enum label in English, switches toen-XAand fails on any English left. build-logicCachedCopyTestscans commonMain for cached reads (object levelval x = L...,by lazy, enum constructor arguments,MutableStateFlowinitial values) without a list of copy.SwiftCopyLintTestdoes the same for astatic letor file levelletthat reads the catalog.- Copy is presentation only: code never decides by comparing catalog text (the language can change between producing and checking). Unknown chat authors stay null (
ChatQuote.username,ChatMessageItem.authorName) and show "Unknown user" through a getter; an undecided send isAppError.undecided; a refused profile read isProfileWrites.ReadRefused; a swap's end isTradeOutcome. Key roles show throughCopyLists.rolewhileKeyRole.valuestays the chain word. The biometric offer names Face ID or Touch ID throughnative.ios.lock.offer_titleinstead of replacing "biometrics" in the English; a drafts confirmation knows it moves by a flag.CopyIdentityTestandChatModelsTest.aReplySendsTheAuthorsNameWhateverTheLanguageswitch language between the two steps. - Text built in a model keeps the language it was built in until the model rebuilds it (most screens rebuild on a switch). Display texts of list rows (
VoterRow.rewardText,percentText,CoinActivity.displayValue) are computed when the row is built.
Text that stays English or literal
- Text that leaves the app stays RN's fixed English: the
messageof the answers to an app that opened an ecency:// link (CallbackText, RN useLinkProcessor word for word), the dApp page answers, the tip memo and other chain text. Deliberate difference from RN: a cloned draft's title "Copy of {title}" is in the app language (user content the user sees, not a protocol field; RN writes English). - Left as literals on purpose: chain and protocol strings (amounts such as
0.000 HBD, tickers, operation names, HTTP verbs, dApp bridge answers to the page, includingBridgeGuardsrefusals, HiveAuth app metadata), server error matchers, exception and log messages that never reach the UI unmapped, brand and dApp names, language autonyms, debugtoStrings, the editor's markdown templates and upload placeholder. - Not localized in the screens: test tags (a fixed id such as
draftsTab:Drafts; Android's tabs, pills, option sheets, stats and key rows take enum names:searchTab:PEOPLE,tab:CREATED,option:MARK_READ,stat:views,key:POSTING),accessibilityIdentifiers, brand names, tickers, chain and file formats, outbound text (link callbacks, device names, analytics), Apple's names Face ID and Touch ID, debug screens.
Screen copy
Shared copy objects:
- Text both apps' screens show word for word lives in shared copy objects, read when shown:
UiCopy(app/UiCopy.kt, generic words: Cancel, Delete, Retry...),EditorUiCopy,ReadingUiCopy,ChatUiCopy,ProfileUiCopy,WalletUiCopy,AuthUiCopy,ShellUiCopy(ScreenCopy.kt), and the sign-in screens'LoginCopy,HiveAuthCopy,AccountCopy,WelcomeCopy,BrowserCopy(AccountCopy.kt). Keys follow the key choice rule (RN key when the English is the same, recorded inrn-reuse.json; elsenative.ui.*per area). Swift reads them asEditorUiCopy.shared.ADD_CHOICE,UiCopy.shared.CANCEL,EditorUiCopy.shared.cost(cost:),LoginCopy.shared.TITLE. - Text only Android shows (biometric prompt, Play Billing, image saver errors) is
AndroidCopy(native.android.*). - Messages are whole (
ChatUiCopy.editedAt(time),ReadingUiCopy.tabSelected(title),StakeCopy.alreadyDelegatedTo(recipient, hp)); counts shown on screen go throughLocaleFormat.integeror an ICU plural (EditorUiCopy.wordsCount). - Shared copy never names a member after an Objective-C macro (
YES,NO): the framework header would not compile, so the editor's areYES_BUTTONandNO_BUTTON(ObjcNamesTest). ScreenCopyTestreads every shared screen copy in English and inen-XA.
Android screens:
- Windows:
ui/Windows.ktdefinesAlertDialog,ModalBottomSheet,DropdownMenu,DialogandPopupwith the Material and platform names and the parameters the app uses, each slot insideFollowAppLanguage, so an open window switches with the language. Screens incom.ecency.app.uiget them by the plain name (a same package declaration wins over star imports).AppLanguageTest.theAppsWindowsFollowASwitchWithoutAnyCodeOfTheirOwncovers them. - Literal lint: see Literal lints and allowlists.
iOS screens: every text a SwiftUI screen shows or VoiceOver speaks comes from the catalog.
- Sources: the copy the two apps share is a shared copy object. iOS only copy reads the generated Swift
L: an RN key when native's English is RN's word for word (L.Post.a11yVotes(count:),L.Schedules.pending, recorded inrn-reuse.json), else a key undernative.ios.<area>with native's wording (L.Native.Ios.Vote.failed). - Catalog strings are Swift
Strings, soText(copy),Button(copy),.navigationTitle(copy)take SwiftUI's verbatim (StringProtocol) initializers and nothing is looked up again as aLocalizedStringKey. - Whole messages:
L.Native.Ios.Card.payoutDeclined(payout:);SignInActiongives one message per action instead of "Sign in to " + a verb; counts are plurals ("1 reply", "1 reblog"). - Live switch: the root rebuilds with
.id(language), so nothing may hold copy across it: lists of labels are computed (CommentSortLabel.all, the tag feed's sorts, the welcome lines), never astatic let. - Numbers and dates: counts through
Fmt.intand whole percents throughFmt.percent(App/Fmt.swift, overLocaleFormat;Text("\(n)")would format with the device locale), dates throughLocaleFormat(drafts and schedules show their time withdateTimein the device's time zone, on both apps: AndroidshownDraftDate; both read the server's zone-less times as UTC). System pickers (DatePicker) follow\.locale, whichLanguageRootsets. - Literals are listed with a reason in
iosApp/l10n-literals-allowed.txt(tab separated, as Android's list): brand and mascot names (Ecency, Esie, GIF), queue labels, URL prefixes, crash report text, chain tickers and RN's already delegated fragment, debug and fake data screens. - Existing UI tests run in en-US and keep their English.
Literal lints and allowlists
- Android: build-logic
UiLiteralLintTest(runs in:build-logic:test) scansandroidApp/src/mainfor string literals that read like copy (words with a space, a capitalised label, and any text in a text slot:Text(..),Text(text = ..),label,placeholder,supportingText,title,message,textand accessibility labels) outside test tags, logs, annotations, comparisons and animation labels, and fails on any that is not inandroidApp/l10n-literals-allowed.txt. Known gap: a single lower case word passed outside a text slot (a custom composable'slabel: String = "or") and text built at run time are not seen. The same test fails on any import of a Material or platform window (aliased, or theui.window.*star import) or a fully qualified call to one outsideui/Windows.kt. - iOS: build-logic
SwiftCopyLintTestscansiosApp(app and extensions) for a literal with a letter as the shown argument ofText,Label,Button,Toggle,Picker,TextField,Section,Menu,Stepperand the like (verbatim:included), ofnavigationTitle,alert,confirmationDialog,accessibilityLabel,accessibilityHint,accessibilityValue, and the value of copy arguments (title:,message:,label:,placeholder:,prompt:,action:, ...). It fails on an allowlist entry that matches nothing, and on astatic letor file levelletthat reads the catalog. - Allowlist rule (both): add a line
File.kt<TAB>literal as in the source<TAB>why(iosApp/l10n-literals-allowed.txtfor Swift) only for text that is not copy (a brand, a ticker, an id or format, an exception that never reaches the screen, a debug screen); copy goes to the catalog. A stale line fails too.
Formatter (IcuMessage)
- Supported:
{x},{x, number},{x, plural, =N {..} one {..} other {..}}with#(in the plural's own sub-messages, not in a nested select, as ICU4J and formatjs) andoffset:N,{x, select, ..}, nesting. Numbers in#,{x, number}and a number in{x}are written in the app language byLocaleFormatter, grouped, at most 3 decimals, as ICU and formatjs. The plural form follows the message's own language, so an English fallback picks English forms with German digits: "1.234 votes". - Apostrophes follow ICU's DOUBLE_OPTIONAL mode (react-intl's):
''is', a quote starts only before{,}or#in a plural, sol'amistays literal. selectordinal, number styles and dates are refused: the build fails on them in en-US, and a translation using them shows English.- In an RTL language every substituted text value is wrapped in FSI..PDI (
Bidi.isolate), so@useror1.000 HIVEinside Arabic keep their own direction.
Plurals
- Plural rules source:
shared/l10n/cldr-plural-rules.json, ICU4J 79.1 (CLDR 49)PluralRules.forLocale(id).getRules(keyword)per RN locale id (pt-PT has its own rule, unlike pt). To refresh: print the same with a newer ICU4J and bump the version inlibs.versions.toml(icu4j, test only);IcuOracleTestfails until file and library agree and writes the fresh file toshared/build/cldr-plural-rules.json. - Seeded translations that keep a plain
{count}where English has a plural are valid and show as before; translators add the plural forms in Crowdin.
Pseudo locales
PseudoLocales: en-XA accents and pads every message by 40% in brackets, ar-XB forces RTL text (RLM then RLO, as Android's own ar-XB) and turns on RTL. Tests install them directly; debug builds take them by a launch argument (--es pseudoLocale ar-XB on Android, -pseudoLocale ar-XB on iOS, L10n.usePseudo), over the saved language and without touching the OS per-app language. Release builds never call it.
Rejected translations
Rejected translations (a placeholder English lacks, or malformed ICU) are reported by L10nCatalogTest (printed as l10n rejected:, not pinned, so a Crowdin sync cannot break the build) and show English. Known ones to fix in Crowdin: el-GR post_poll.interpretation_token (translated placeholder name; should be • Ερμηνεία ψήφου με βάση το {token}) and pt-PT transfer.confirm_summary (malformed @{delegator{delegatee}}; should be Delegar {hp} HP ({vests} VESTS) A @{delegator} de @{delegatee} ). bg-BG profile.joined drops {time} and shows without the date (as in RN; should be Се присъедини преди {time}).
App language
- One source of truth:
SettingsModel's language (settings.language) setsL10nat start (before the first frame), on a picker change, after the RN settings import and when a system setting is adopted. The apps turn this on withAppEnvironment.drivesLanguageCatalog; tests leave it off unless they test it, since the catalog is one per process. - First start with nothing saved: the device language through
LocaleMatch, saved once (settings.localeDetected), English when the app lacks it; RN's own choice wins over that detection at the import (RNautoDetectLocale). - Compose:
AppLanguageRoot(around the theme inEcencyApp) providesLocalAppLanguageandLocalLayoutDirection. The local is static, so a change recomposes everything below the root while remembered state stays; the activity handleslocale|layoutDirectionitself, so nothing restarts. A separate window (Dialog, sheet, popup, menu) composes on its own: the app's windows come fromui/Windows.kt(see Screen copy), which puts their content insideFollowAppLanguage. - SwiftUI:
LanguageRoot(inEcencyApp.swift) sets\.appLanguage,\.localeand\.layoutDirection, and rebuilds the navigation root with.id(language): SwiftUI does not track catalog reads, so screens are built again (the path, sheets and models inAppContainerstay; screen local state does not). The first frame of the screens waits until the language is final (SettingsState.languageSettled: at once, or on the first native start after the RN import has applied its language, at most 1.5 s), so the import never rebuilds a screen the user already opened. - Direction: right to left for ar, fa and he, whatever the device's direction; ku-TR is Latin script and stays left to right.
OS per-app language
- Both ways (
SystemLanguage, ruleLanguageSync): Android 13+LocaleManager.applicationLocaleswith the generatedres/xml/locales_config.xml(generateL10nResources, build-logicSystemLocales, from the 39 locale files, not committed; manifestandroid:localeConfig), synced at start and on every resume. iOS: the app's ownAppleLanguagesdefault, which Settings > Ecency > Language writes; the language appears there because the app declares the 39 languages (CFBundleLocalizationsinproject.ymland an emptyLocalizations/<tag>.lprojeach,AppLanguageTestschecks both against the catalog); synced at start (iOS ends the app when that setting changes). The picker writes it too: iOS applies it to the bundle (system texts) at the next launch, the app's own copy switches at once. Debug demo and fake-data runs leave the OS setting alone. - OS tags (
L10n.systemTag): the bare language ("de"), except zh-Hans, zh-Hant, sr-Latn and pt-PT; each maps back throughLocaleMatch. What the app writes (LanguageSync.tagToWrite) is the device's own tag when it is the same language and extends that tag (en-GB, fr-CA, zh-Hant-TW), so the platform's dates, times and numbers keep the device's region; else the system tag (a pt-BR device gets pt-PT). Both read back as the same language, so a sync never writes twice. - The sync rule. A device language change only changes the device's languages; the per-app setting keeps what the app wrote, so the saved choice stands (RN detects once). A per-app change is told apart by
settings.languageSynced, the app language last written to or adopted from the OS: a per-app language that maps to one of the 39 and is neither that nor the saved one was set by the user in the system settings (or before the first start, which Android allows) and is adopted. A per-app setting cleared after the app had set one ("System default") puts the app in "following the system" (settings.languageSynced=system, unlike absent = never synced): the device language, mapped (English when unknown), becomes the language, nothing is written back so the system keeps showing "System default", and later device language changes are followed; a language picked in the app or in the system settings ends it. Otherwise the saved language is written when the OS shows another (first sync, picker, RN import, an unknown tag). Comparison is by mapped id, so "iw" or "zh-Hant-TW" read back count as the same language.
Right to left
- What mirrors: everything laid out with start and end (rows, paddings, alignment,
offset(x:)), tab strips and horizontal scrollers, the image pager, swipe directions, progress bars and value sliders (vote weight, power down percent), chat bubbles (own messages on the trailing side) and icons markedAppIcon.isDirectional(AndroidautoMirrored, iOS symbols that flip). - What stays left to right in every language (Android
LeftToRight,ltrFieldStyle): the balance chart (time runs left to right, y axis pinned left, opened at the newest end), the PIN keypad (1 2 3 from the left, as the system pads), media transport and scrubbers on Android (Material: playback is not mirrored; the Speak voice player and the Listen player), code blocks, and fields for usernames, keys, amounts, numbers, URLs and emails (the "@" before a username field stays on its left). - Text direction (Android): text takes the direction of its first strong letter (
TextDirection.Contentin the theme's typography andLocalTextStyle). Compose otherwise forces right to left on every text without a direction in an RTL layout, so "@alice" would show "alice@" and "1.000 HIVE" would show "HIVE 1.000". ATextStyle(...)built from scratch does not inherit that, andBasicTextFieldignoresLocalTextStyle, so every ComposeTextStyle(...)in the app names itstextDirection(build-logicTextDirectionLintTestfails otherwise):Contentfor text of any language (editor title, tags and body, chat composer, search bars),Ltrfor machine text. - RTL catalog messages start with one RLM (
L10n.format, also the iOS widget formatter), so a translation that opens with a Latin word ("HIVE ...", "PIN ...") still lays out right to left. An English fallback does not get it. The iOS permission prompts get it too (build-logicSystemStrings.rtlMarked): iOS lays a prompt out by its first strong letter, and several Persian and Hebrew prompts open with "Ecency". The Android widget picker labels do not carry it (none of them opens with a Latin word today). - Post bodies follow their content, not the UI (
List<Block>.isRtlContent(), HTMLdir="auto": the first strong letter, skipping mentions, tags, digits of any script and combining marks; RTL scripts outside the BMP such as Adlam and Hanifi Rohingya count): an English post reads left to right in Arabic, an Arabic post right to left in English; the quote bar and list markers sit on the body's start. HTMLleftandright(text-left,data-align) stay absolute (BlockStyle.Align.Left,End= right). - Mixed direction: placeholders in catalog messages are isolated by the formatter; values the UI puts next to catalog text outside a message ("From: @alice", "Balance 1.000 HIVE", a transaction id) go through
Bidi.inUi, which isolates them while the language is right to left. - iOS: the direction is set twice, in the SwiftUI environment and as the window scene's direction override (
UIKitDirectioninAppLanguage.swift), which reaches sheets, covers, alerts and the lock and auth windows live (SwiftUI does not pass the environment into them; reading an override never set throws, so it is read only once set). Machine fields useleftToRightField(), values beside labelsbidiValue(). Sliders, progress bars and media scrubbers mirror, as the HIG asks and the system player does; the play triangle does not. SwiftUI Text takes its own first strong direction, so the Compose text direction trap does not exist there. - Large text and pseudo locales: the main screens are checked in
ar-XBanden-XAat the largest font scale (Android 2.0, iOS AccessibilityXXXL). On Android the editor header turns Save and Preview into their icons when their label does not fit (LabelOrIcon). On iOS rows fall back throughViewThatFitswhere words would break or clip (reply as an icon, stacked follower stats, the wallet actions as a 2 by 2 grid, the balance under the asset name), and sheets and windows mirror. A wallet action's accent circle grows with its white glyph (QuickActionIcon, both capped at the first accessibility size; #3658: the glyph used to outgrow a fixed 42 pt circle onto the card).
Formatting numbers, dates and times
Ages, dates and numbers follow the app language; chain amounts are POSIX.
LocaleFormat(current language, read on every call) andLocaleFormatter.of(id)(one language; tests, SwiftLocaleFormatter.companion.of(languageId:)), sharedl10n/LocaleFormat.kt:decimal,fixed,toFixed,integer,posix(an already rounded POSIX text),percent,fiat,token,compact,assetText/amountsIn(chain asset text shown), dates by pattern (dateShort"3/5/2024",date"Mar 5, 2024",dateLong"March 5, 2024",time,dateTime,weekdayDateTime,MONTH_DAY; device time zone throughlocalOffsetMillis, expect/actual),relative("vor 3 Stunden"),now,duration("3 Jahre"),age("3h"). Display only.- Pure Kotlin over vendored CLDR data, not platform formatters: both platforms and every test target give the same text (Android's
java.textand iOS's Foundation differ in CLDR version and details, and Robolectric host tests would run the JDK's), and it is checked. Data:shared/l10n/cldr-formats.json(ICU4J 79.1, CLDR 49: digits, symbols, grouping, percent affixes, short compact patterns, the 7 date skeletons resolved to patterns, Gregorian month, weekday and day period names, relative, wide and narrow unit patterns; plural forms equal tootherdropped). 106 KB, compiled by the generator (FormatDataGenerator, fails the build on a date field the runtime does not format, such asB, or incomplete data) into one minified JSON text per language, decoded on first use: 0.4 to 0.6 ms per language on the JVM host and the iOS x64 simulator (debug), 16 ms for all 39. To refresh: bumpicu4jand copyshared/build/cldr-formats.json, whichCldrFormatsOracleTestwrites when the vendored file differs. - Choices: digits are the language's CLDR default numbering system, as the platforms and RN's Intl use for that locale: Arabic-Indic for ar-SA, Persian for fa-IR, Bengali for bn-BD, ASCII for the others (hi-IN's CLDR default is Latin). Grouping as CLDR, minimum grouping digits included (bg, es, et, hu, pl, pt-PT write 1234 but 12 345; ICU4J's older MessageFormat and RelativeDateTimeFormatter ignore it, Intl honours it). Rounding half away from zero on the exact binary value (JS toFixed, Intl). Gregorian calendar in every language (CLDR defaults ar-SA to Islamic, fa-IR to Persian, th-TH to Buddhist). 12 or 24 hours as the language's CLDR default, not the device setting; time pickers use the same clock (
LocaleFormat.uses24Hour). sr-CS formats as sr-Latn (the RN file is Latin script). Num.fixedrounds half away from zero on the exact binary value at any number of decimals (JS toFixed; checked against BigDecimal HALF_UP over 3000 values and 0 to 10 decimals). Chain callers (the dApp bridge's HP to VESTS at 6 decimals) match RN's toFixed.- Platform sites: Android
java.text.DateFormat,SimpleDateFormatdisplay,DateUtilsandString.formatnumbers, iOSDateFormatterdisplay,.formatted,RelativeDateTimeFormatterandString(format:)numbers go throughLocaleFormat(parsing and API formats keepen_US_POSIX/Locale.US).
Differences from RN and parity:
- Where RN uses
Intl(walletformatAmount, balance analytics) numbers are grouped; where RN printstoFixed(payouts, vote value, voters, trade rate, HP figures) they aretoFixedin the app language (separator and digits, no grouping), so en-US text stays RN's byte for byte. Fiat keeps RN's symbol in front in every language. - en-US keeps moment's English for
FromNow("a few seconds ago", "an hour ago"); other languages write the same buckets with CLDR relative times ("now" for the few seconds). Card ages (TimeAgo) are CLDR narrow units in every language (en: "now", "5m", "3h", "2d", "4w", "1y"). - Compact numbers keep RN's magnitudes and rounding where the language abbreviates that magnitude with one digit, else CLDR's (ja "12.3万", de has no thousands and writes the whole number); en's thousands suffix is CLDR's "K" (the balance chart used "k").
- The chain asset text in wallet history rows shows localized (
CoinActivity.displayValue) whilevaluestays POSIX (a repeated transfer reads it); voters likewise (rewardText,percentText).
Chain bound text stays POSIX:
Num,Amounts,Assetand the operation builders never read the language (ChainPathsStayPosixTestscansapi/broadcast,hive,auth,secureand the dApp bridge for any use of the formatter).Asset.parse, the dApp bridge amounts and the custom_json builders (WalletOps.pointTransfer,engine) accept ASCII digits with a '.' only, so a display string ("1.000,5", "١٫٥") throws instead of being signed. Confirmation texts that quote what is signed ("Swapping 4.000 HIVE for 1.000 HBD") stay POSIX too.- Typed amounts: every amount field (transfer, recurrent executions, swap, tip, stake) reads the keyboard of the app language through
Amounts.typedText: any Unicode decimal digit becomes ASCII, and the Arabic decimal separator "٫" and a comma (RN, every language) become '.'. A typed number has no grouping, so the one separator is the decimal point; a text with two kinds of separator ("1.000,5", "1,000.5") or the Arabic thousands separator "٬" is ambiguous and refused (the field keeps its text). Field text (StakeMath.hpText, max, use balance) stays POSIX; its display twin (hpDisplay) localizes.ChainPathsStayPosixTestalso checks that the amount composers (TransferModel,WalletActionModels,StakeModels) reach the display formatter only from their listed display members. ChainAmountsLocaleTestreruns the wallet broadcast suites, the wallet golden vectors and the hive-uri tests in ar-SA, de-DE, hi-IN, fa-IR and bn-BD with unchanged expected JSON.
OS-read strings
What the system shows outside the app's screens is generated at build time from the same locale files (not committed) and listed in shared/l10n/system-strings.json (which key each shows; keys under native.widget, native.widgets, native.system, native.permission, or reused RN keys such as notification.notification and post.listen). Each language shows its translation under the catalog's rule (build-logic SystemStrings.resolve: set, parses, no placeholder English lacks), else English, so every file holds every string.
- Android,
:androidApp:generateL10nResources(build-logicSystemStrings.android, withlocales_config.xml):strings.xmlinvalues(English) and one folder per language from its OS tag (values-de,values-pt-rPT,values-b+zh+Hans,values-b+sr+Latn,values-b+fil, legacyvalues-iwandvalues-in; barevalues-pt,values-srandvalues-zhhold whatLocaleMatchpicks for a device no region or script folder matches, such as pt-BR, Cyrillic sr-RS or zh-SG), for the widget picker labels and descriptions the manifest and provider infos name. Escaped for aapt (apostrophes, quotes, a leading@or?, XML entities,formatted="false"with%, quoted white space).app_namestays "Ecency" in every language (brand,translatable="false"). - Android run time text reads the catalog in the app language instead of resources (that follows the in-app language below Android 13 too): the notification channel names and descriptions (
SystemChannels), the dictation and "Listen paused" notifications and Listen's skip buttons, and the Glance widgets.SystemLanguageSurfacesrenames the existing channels (never creates one) and redraws every widget when the language changes; a widget drawn in a process the app has not started in reads the saved language (WidgetLanguage), else the device's. Listen's skip button names are set when its service starts. - iOS,
:shared:generateAppleL10n(SystemStrings.apple, intoshared/build/generated/l10n/apple):<tag>.lproj/InfoPlist.stringsper language (the permission prompts: Face ID, camera, photo library, microphone; equal to the in-app catalog's message, so an ar, fa or he translation starts with RLM), which the app's "Localized system strings" phase converts to binary and copies into the bundle's lproj folders before signing;project.ymlkeeps the English base (a build-logic test holds it equal to en-US). iOS shows them in the app's language from Settings > Ecency > Language, which the picker writes (applied at the next launch).CFBundleDisplayNamestays "Ecency". - iOS widget extension: it runs in its own process and does not link the shared framework. Its messages, the plural rules and the digits and grouping of every language come as Swift data (
WidgetL10nData.generated.swift, copied by the widget target's "Widget copy" phase, gitignored), formatted byWidgets/WidgetL10n.swiftas the catalog does (own message or English with English plural forms, language digits, bidi isolates in ar, fa, he). The app hands its language over through the App Group (Widgets/languagebeside the snapshot,IosWidgetStore.handOver, then the timelines reload); before the app ran, the extension matches the device language asLocaleMatch. The gallery name and description follow when WidgetKit asks the extension again..xcstringsis not used for the extension: a bundle lookup follows the device's language, not the app's, and the plural rules would be Foundation's rather than the catalog's. The share and notification service extensions show no text of their own (only the brand as display name), so they get none.
Crowdin
crowdin.yml(repo root): the one sourceen-US.json(plain key-value JSON, auto detected; Crowdin reads the ICU inside values by itself, there is no per-file ICU switch),preserve_hierarchy, andupdate_option: update_as_unapproved(a changed English string keeps its translations, marked for review; without it Crowdin deletes them). Docs: https://support.crowdin.com/developer/configuration-file/ (Changed Strings Update), https://support.crowdin.com/icu-message-syntax/.- Native plural keys: the 23 RN messages with fake plurals that native shows are
native.plurals.<RN key path>in en-US (native.plurals.notification.monthly_postsfornotification.monthly_posts, KotlinL.native.plurals.notification.monthlyPosts(count = n)), with real ICU plurals and the RN placeholder names; they are not inrn-reuse.json. RN's keys and texts are untouched (RN cannot format plurals). Native only copy that counts (native.ui.auth.pin_digits,native.editor_extras.day_streak,native.chat_sheets.new_group_hint,native.broadcast_errors.too_large) is a plural in place. When RN is retired, delete RN's fake plural keys (the RN paths listed intools/l10n/seed-native-plurals.mjs) together with the other RN only keys. - Seeded translations:
node tools/l10n/seed-native-plurals.mjs(from the repo root;--checkto only report;--seeded-out <dir>also writes just the seeded keys) fills each language's missingnative.plurals.*key from its translation of the RN key (a key whose text is the English source counts as missing: that is what Crowdin exports after en-US changed a key and its translation was dropped). The seeded keys reach Crowdin by a manual run ofcrowdin-upload.ymlwithnative_pluralson: it uploads only each language'snative.pluralssubtree, so nothing else in Crowdin changes and an approved translation there still wins; run it right after a merged Crowdin download, so an unapproved edit made in Crowdin since then is not replaced:{count} word{suffix}becomes a plural with that word in every CLDR form of the language,failed attempt(s)style text becomes{count, plural, .. {# <text>}}(RN showed the count before it), anything else is copied as it is (a plain{n}is valid ICU and shows as before). Skipped and so English: untranslated keys (equal to RN's English), ru-RUcheckin(stem before{suffix}), uk-UAcheckinandmonthly_posts(the suffix was the noun itself). A key Crowdin already translated is never overwritten, so the script is safe to rerun. Crowdin refuses a seeded text without plural forms (a plain{n}copy), so those keys (9 in every language, 11 in he, ja and ko as of November 2026) come back as English from each download;crowdin-download.ymlruns the script onl10n/crowdinafter every download and pushes the reseed as a second commit on the translations PR. - Crowdin project setup (project 340925; nothing here is automated): Settings > QA checks has "ICU syntax" turned on (marks broken plural or placeholder syntax in the editor). Before seeding, the repo must equal Crowdin: run
crowdin-download.yml(or label a PRsync-translations) and merge its PR, then start the seed from those translation files (git checkout development -- src/config/locales/ ':!src/config/locales/en-US.json'drops a stale seed). A push todevelopmentrunscrowdin-upload.yml: newnative.*keys arrive as new source strings and RN's strings are unchanged. Seeded translations are uploaded once, from a checkout of the merge commit:crowdin upload translations --branch development --dryrunfirst, then without--dryrun, ideally one language at a time (-l ru, the Crowdin language id), before translators work on the new strings (identical translations are skipped only while the repo still equals Crowdin, so only the new native keys gain text). Afterwards pull again and read theL10nCatalogTestreport (l10n rejected:lines), and ask translators to add plural forms (Editor > Advanced filter > String type ICU; Copy Source fills the forms of each language).
Tests
- Generator:
./gradlew :build-logic:test(also part of:shared:check):L10nGeneratorTest(typed accessors, naming, tables, determinism, the real files),MessageArgsTest,PluralRuleCompilerTest,RnReuseTest,CachedCopyTest,UiLiteralLintTest,SwiftCopyLintTest,TextDirectionLintTest,FormatDataGeneratorTest,SystemLocalesTest,SystemStringsTest(folder mapping, Android and Apple escaping, the translation rule, all 39 languages give every file and string, the project's English base equals en-US, the manifest names only generated strings). - Catalog and formatter: shared
IcuMessageTest,PluralRulesTest(golden categories per language family),L10nCatalogTest(switching, RN style id matching, fallback for missing, malformed, mistyped and extra placeholder messages, dropped placeholders allowed, every message of every locale formats, RTL isolation, pseudo locales, decode cost,aDebugPseudoLocaleHoldsAgainstTheSettingsLanguageUntilEnded),CopyCatalogTest,ScreenCopyTest,CopyIdentityTest; Android hostIcuOracleTest(plural rules and formatter against ICU4J for all 39 locales). - Formatting: Android host
CldrFormatsOracleTest(vendored data is ICU4J's; numbers, percent, compact, every date pattern in three time zones, relative times, durations, ages and message numbers against ICU4J for all 39 languages) andChainPathsStayPosixTest; sharedLocaleFormatGoldenTest(en, de, ru, ar, ja, hi goldens on every target, plural interplay, the facade, edge cases),DisplayFormatsLocaleTest(each converted shared site in other languages),ChainAmountsLocaleTest,BalanceAnalyticsTest.labelsAndNumbersFollowTheAppLanguage; iOSWalletTests.testCopyAndFormattingandProfileTests.testJoinDateFollowsTheLocale; AndroidSettingsFlowsTest.languageRowTitleComesFromTheCatalog, iOSSettingsTests.testLanguageRowTitleComesFromTheCatalog; iOSCopyLanguageTests(labels read again after a switch,Fmtand the card label in de-DE and ar-SA, the iOS only plurals, draft dates). - App language: shared
LanguageSyncTest(every branch of the rule, tag round trip, RTL set, a device tag in another script is not written: ku-Arab-IQ choosing ku-TR writesku) andSettingsModelTest(catalog and OS follow the setting, adoption, device change ignored, restart, "System default", RN import reaches the OS, tests without the switch stay English); AndroidAppLanguageTest(live switch recomposes a plain child, a lazy item and a dialog with state kept, RTL for ar, fa, he, LTR for ku-TR,LocaleManagerround trip) andSettingsFlowsTest.pickingALanguageSwitchesTheCopyLive; iOSAppLanguageTests(live redraw, direction, bundle languages, app onlyAppleLanguages, picker writes it, pseudo RTL root). - RTL: shared
BlocksTest.bodyDirectionFollowsItsFirstStrongLetter,BlockBuilderTest.styleClasses; AndroidRtlLayoutTest(body direction both ways, quote side, chart axis, keypad order, voice player, field and theme text direction, isolation, draft dates under an RTL root); iOSRtlLayoutTests,PostRenderTests, UIRtlUITests(mirrored tab bar with-AppleLanguages (ar)and with-pseudoLocale ar-XB, launch arguments only). - OS-read strings: Android
SystemStringsFlowsTest(each of the 39 languages reads its generated widget labels through the system's resource lookup, equal to the catalog; widget text and digits follow the app language; the cold-process widget language; channels renamed on a language change; the dictation notification); iOSWidgetL10nTests(the widget table equals the shared catalog for every message, count and language, digits, RTL isolation, parser quoting, device language matching equalsLocaleMatch, the App Group hand-off read on the extension's code path, InfoPlist.strings of every language in the app bundle).
Shared UI
Toasts
UiMessages, iOS MessagesOverlay, Android ToastView. Every toast is centred at the bottom, one line or several (RN toastNotification: 100 pt up, 22 pt corners, at least 1/1.9 of the width). The iOS host fills the width itself, because GeometryReader places its content top leading and the toast would otherwise be as narrow as its own content. Every toast goes through the shared channel; Android's AppHost.toast and "No browser available" use no system Toast (only the debug renderer demo, which runs without the app, does).
Toasts live in a window of their own, so a toast posted while a sheet is open shows on top:
- iOS
ToastOverlay: a passthrough window at.alert + 0.5(above sheets and signing prompts, below the lock window) that takes only touches on the pill. It binds to the first scene once (the app has one scene). iOS keeps tap to dismiss (a deliberate difference from RN). - Android
ToastWindow: a non-focusable, non-touchable app window added per toast through the activity's window manager (it stacks above sheets and dialogs opened before it), lifted by the keyboard height the app window reports when the toast appears, composed only where the app content is (never over the lock). Android toasts are not tappable, as in RN (applicationScreen.tsxgives the toast noonPress). Android announces each toast to TalkBack from the app's view (TalkBack does not reach a window that takes no touches), and falls back to drawing the toast in the content if the system refuses the window. - Debug: iOS
-demoToast <text>, Android--es demoToast <text>.
Side menu
- A 16 pt gap replaces RN's divider.
- The footer group (QR, Refer, Docs, Settings, Logout, version) is pinned to the bottom; the main group starts at the top and scrolls on its own.
SideMenu.pinsFooterkeeps one row (56 pt) for the main group; below that (a landscape phone, the largest text on a small phone) the whole menu scrolls as one so nothing is cut off. The footer is measured in the same layout pass that makes this choice (a customLayouton both platforms), so it never flips after the first frame. - Header: the picture is cut to the drawer. On iOS
DrawerHeaderBackgroundclips a view with the header's frame, becauseclipped()on ascaledToFillimage clips to the image's own frame and the 2.3 : 1 picture would run past the drawer's edge over the scrim. On Android the header grows with the account lines at large fonts, and the drawer widens with the font scale as on iOS (at most 85% of the screen, 92% from 1.5x, where the rows drop their icons).
Tests: Android ShellFlowsTest (toast centring, pinned footer on a 320 x 640 dp screen, one scroll on a landscape screen, header inside the drawer, Arabic at 2x); iOS ShellUITests (toast frame midX within 3 pt of the screen's, side menu at XXXL text), LayoutPolishTests (drawn with ImageRenderer: the header no wider than the drawer in both directions), LayoutPolishUITests (screenshots with TEST_RUNNER_POLISH3_SHOT_DIR).
Esie (the mascot)
Esie is drawn natively from vectors on both platforms: native vectors, no Rive, no WebView, no animation library.
- Art:
tools/esie/art/esie.svgis the approved master (named parts in z-order, generated bybuild.pyfrom the tracedpaths.json),motion.cssthe approved motion,reference/*.pngthe approved renders. - Shared data:
tools/esie/esie_to_kotlin.pyconverts the master intoshared/.../esie/EsieArtData.kt(one layer per shape: absolute M/L/C/Q/Z path, chain of named parts, solid or gradient fill with its bounding box matrix, stroke, clips, opacity; a translucent group of like shapes, the head shade, is one layer so its opacity applies once; the master's soft blur is left out, about 1 dp at these sizes and costly). After an art change:python3 tools/esie/esie_to_kotlin.py tools/esie/art/esie.svg shared/src/commonMain/kotlin/com/ecency/core/esie/EsieArtData.kt - Shared rig:
EsieRig.fill(spec, elapsedMs, buffer)writes, without allocating, each layer's opacity and the matrices before and after its clip into the view'sEsieFrameBuffer(iOS copies it out in one call);EsieRig.frameis the readable version for tests.EsieMotionholds the durations and keyframes;EsieRig.viewport(mood)the framing, sampled from the rig over every cycle so the hop, jolt and wave never clip, and baked intoEsieViewports(EsieViewportsTestresamples and prints new values after an art or motion change). Moods: rest, thumbs up, wave, happy (waving, closed eyes, one hop), sad (brows, lids, tear, sigh), thinking and surprised (for Esie AI), plus a talking mouth. - Cost: at most 30 frames a second (
EsieRig.FRAME_MS), and after 30 s with the same spec (SETTLE_MS) each cycle runs on to its next start and holds there (no jump; the tear has run off, the thought dots are even), then fromSETTLED_MSshe only blinks:nextFrameDelayMssleeps until the next blink and gives a short burst of frames through it. Any spec change starts over. Reduce motion is the shared motion level (AndroidLocalMotion, iOS\.motion, so the-reduceMotion YESdebug flag reaches her): a still pose with no frames at all; a talking mouth still swaps on its 140 ms beat. - Views: Android
EsieView(Compose Canvas on the framework canvas; frames only while composed and resumed), iOSEsieView(SwiftUI Canvas in a TimelineView driven by the rig's schedule, paused off screen and in the background, keeping its time; a new spec resets it). Decorative (hidden from TalkBack and VoiceOver) unless given a label; test tag and accessibility identifieresie, mood in theEsieMoodKeysemantics (Android) or the accessibility value (iOS, exposed with-fakeDatafor the UI tests). - Placements (
EsiePlacement, same mood and size on both):- Empty lists rest: feed, profile posts and waves, bookmarks, notifications, followers, communities, search, drafts and schedules, chats, voters, reblogs.
- Failed loads and the error screen are sad (
ErrorBlock/EsieMessageBlockon Android,ErrorStateViewon iOS; offline failures arrive as network errors there). - Success moments are happy: a won spin, a finished quest tier, and on Android the "Post published" dialog (the iOS one is a system alert). On the spin screen she is 64 so the pack and the countdown stay on short phones.
- Welcome (at most 40 % of the width) and login wave three times, then rest.
- The account boost screen shows her thumbs up (
PROMO, 160). No other mascot picture is used in either app: not the welcome screen'slove_mascotimage, nor a coin mascot on the boost screen (boost_logo, RNesteemcoin_boost.png). - Inline footers ("No more posts", load-more errors) and sheets stay without Esie (iOS
ErrorStateView(esie: nil)for such rows).
- Debug gallery of all moods: Android
--ez esieGallery true, iOS-esieGallery YES. - Tests:
EsieTest(shared: settle rule, frame buffer, viewport over whole cycles),EsieFlowsTest(reduce motion, narrow welcome),PerksFlowsTest(short phone spin),LoginFlowsTest(Android),EsieTests(motion level, schedule),EsieUITests(-reduceMotion YES) (iOS).
Motion
One motion system, its numbers in the shared core (shared/.../app/Motion.kt: MotionTokens, MotionPolicy), mapped once per platform: Android ui/Motion.kt and ui/Skeleton.kt (Compose specs, LocalMotion), iOS App/Motion.swift (SwiftUI animations, \.motion). Screens never hold a literal duration or curve.
Tokens: PRESS_MS 90, SHORT_MS 150 (icon swaps, colours, counters), MEDIUM_MS 250 (enabled states, content replacing a skeleton), PAGE_MS 300 (screens), PAGE_FADE_MS 150 (the reduce motion crossfade), SHIMMER_MS 1200, SHAKE_MS 400 (SHAKE_DP 12, 3 cycles), DONE_HOLD_MS 900; curves Material 3 STANDARD, EMPHASIZED_DECELERATE, EMPHASIZED_ACCELERATE; springs POP (damping 0.45, stiffness 500) and SETTLE (1.0, 700), iOS uses responseSeconds (2 pi / sqrt(k)); POP_SCALE 1.25, PRESS_SCALE 0.98, PRESS_DIM 0.06, SHARED_AXIS_DP 30, FADE_THROUGH_SCALE 0.92.
Reduce motion (MotionPolicy.level): iOS accessibilityReduceMotion; Android has no switch of its own, so "Remove animations" (animator duration scale 0, followed live) turns motion off. FULL moves, pops and shimmers; REDUCED keeps fades only (page moves become crossfades, no pops, shakes, bounces, shimmer or press growth); NONE lands every change at once. Debug launch arguments on iOS: -reduceMotion YES, -disableAnimations YES.
Where it is used:
- Screens: Android pushes and pops with Material shared axis X and switches tabs with fade through (
AnimatedNavHost,tabTransform); back that pops a screen is predictive (PredictiveBackHandlerseeks the pop, cancelling springs back;enableOnBackInvokedCallbackin the manifest), other backs (menu, Feed tab) keep the plain handler. A popped screen's models close when its exit transition ends (Navigator.settle). iOS keeps NavigationStack's push and edge swipe back, also on screens with their own header (SwipeBackEnabler: chat thread, dApp browser, QR scanner; not where back is hidden on purpose). On iOS 18 a feed card's image zooms into its post (heroSource/heroDestination,.navigationTransition(.zoom)); iOS 17 and reduce motion keep the system push. - Vote: spinner while in flight, then the icon pops back in filled (Android
AnimatedSwapandpopOnChange; iOS one SF Symbol with.symbolEffect(.replace)and a.bouncewhen the vote lands), the vote, comment and reblog counts roll (AndroidAnimatedCounter, iOS.numericText). Haptic on vote. - Toggles: follow labels pop (profile, quick profile), favourite pops and recolours, bookmark and reblog from the post menu tap a light haptic; copy link plays the success haptic.
- Tabs and filters: the selected tab icon fades its colour and pops (Android) or bounces (iOS); feed filter pills fade their fill.
- Create button: sinks while pressed and springs back (Android
pressScale, iOSPressScaleStyle), ripple kept. - Sending: reply, wave PUBLISH and chat send turn into their own progress; chat shows a tick for
DONE_HOLD_MSwhile the next message can be typed; success haptic (AndroidrememberSendPhase/SendContent, iOSSendContent). - PIN pad: dots fill with a fade and a pop; a refused PIN shakes them with the error haptic (
MotionPolicy.pinRejected). - Pull to refresh: the platform indicators; Android's is the app's
PullToRefreshBox(the spinner's blue on a disc of the page colour, see "Themed backgrounds") and adds the light haptic (UIRefreshControl has its own). - Skeletons (one shimmer per platform,
SkeletonandBone): feed cards, the post body, the profile header, wallet rows, notifications and the chat list's first load. Spinners stay for unknown sizes and blocking work (load more, searches, sheets); on Android every one is the sharedSpinner(ui/Skeleton.kt). The shimmer runs only at full motion and while its container is on screen (lazy rows that leave are disposed; iOSTimelineViewpauses on disappear; Android checks its window bounds); Android feed cards fade in as they replace it (opacity only, no placement animation). - Tap feedback: Android keeps Material ripples from the touch point; icon-only controls (header icons, back arrow, card options) use an unbounded ripple (
iconClickable). iOS cards usePressableStyle: a soft tint grows from the touch point (TouchPoint, a window recognizer that only observes) and the card sinks slightly; reduce motion keeps a plain dim.
Haptics are light and few (HapticEvent: vote, toggles, success, wrong PIN, refresh), never on every tap, and follow the system's own setting, not the motion level.
Deliberate choices: Android has no shared element from card image to post: the post screen has no hero image (the body starts with text or its first image at a different size), so shared axis is the honest transition; iOS's zoom does not need a matching element, so it is used there. iOS avatars open the quick profile sheet (RN behaviour), so there is no avatar to profile zoom on cards. The header account pill keeps its click order (clipping it first breaks its tap), so its ripple is rectangular.
Tests: shared MotionTest (levels, policy, tokens, spring response, shake keyframes, PIN rule, haptics); Android MotionFlowsTest (haptic constants per SDK, popped models held until the transition settles, push and pop at every motion level, predictive back seek, cancel and commit, vote state landing at every level, shimmer only at full motion and on screen, send phases with the success haptic, system duration scale); iOS MotionTests (levels and flags, fades and pops per level, springs, send phases, shake, swipe back rule, vote symbols, shimmer phase, menu toggles, haptics) and MotionUITests (swipe back from the chat thread, open a post and swipe back at full and reduced motion).
Launch screen
RN uses react-native-bootsplash: its logo on the page colour (white, dark #1E2835), faded out when the app is ready (RNBootSplash.hide({ fade: true })). Native does the same with no animation library:
- Android: androidx core-splashscreen (1.0.1, Kotlin 1.x).
MainActivitystarts onTheme.Ecency.Starting(res/values/themes.xml):windowSplashScreenBackground@color/splash_background(values-nightfor dark),windowSplashScreenAnimatedIcon@drawable/splash_logo(the Ecency mark, RN EcencySourceBadge's path, 100 dp in a 288 dp icon as RN's bootsplash logo, brand blue#004BD8in both modes as RN), thenTheme.Ecency(Theme.Material.NoActionBaron the page colour, see "Themed backgrounds").installSplashScreen()runs beforesuper.onCreate; the exit listener fades it out (LaunchSplash.fadeOut). - iOS:
UILaunchScreeninproject.yml(LaunchBackgroundcolour set, light and dark;LaunchLogo, RN's BootSplashLogo PNGs, 100 pt).LaunchSplashCoverdraws the same over the first frame (in the system appearance, as the launch screen does) and fades it out; it takes no touches and VoiceOver skips it. - The fade is
MotionTokens.SPLASH_FADE_MS(220 ms, RN bootsplash's), kept under reduce motion (a fade), none when motion is off. - Tests: shared
MotionTest; AndroidLaunchSplashTest(theme, dark colour, fade, animations off); iOSLaunchSplashTests(Info.plist names existing assets, both colours, fade per motion level).
Themed backgrounds
Every screen, sheet, dialog and state (content, skeleton or spinner, empty, error, pull to refresh, a push or pop between screens, the window behind them) draws the app theme's page colour (EcencyColors.background: white, dark #1E2835) and follows a theme change at once, no restart. On iOS that includes Increase Contrast, which keeps the page colours; never a system black, white or grouped grey.
Android
- One way to theme a page: the app's root draws the page colour under every route;
EcencyThememaps every Material surface to it (background,surface,surfaceContainerLowest,Low,High,surfaceBright,surfaceDim, andsurfaceTint, so tonal elevation mixes nothing in), so sheets (ModalBottomSheet), dialogs (AlertDialog) and anything else Material draws are on it too. Tracks and filled fields (surfaceContainerHighest,surfaceVariant) takelightBackground, so a switch or progress track still shows; menus (surfaceContainer) keeplightBackgroundin dark mode, a popup that lifts off the page. Material's default values (purple grays, a lighter dialog and refresh disc in dark mode) are not used. - The window:
Theme.Ecency(res/values/themes.xml, after the launch screen) is on the system mode's page colour, thenEcencyAppsets the window background to the app theme's (Window.setBackgroundDrawable) and again on every theme change. This colour shows before the first frame, around the keyboard and in system window animations. - Settings: one page colour from the top bar down; the cards' blue titles mark the sections. Refer and earn is on the page colour too.
- Loaders: one
Spinner(ui/Skeleton.kt: the theme's text blue, or white on a filled button or over media, a stroke by size, no track); no ad hocCircularProgressIndicator. Skeletons areSkeletonandBone. Pull to refresh is the app'sPullToRefreshBox(same file): the spinner's blue on a disc of the page colour. - The platform date and time pickers (the editor's schedule and poll end) open in
Theme.Ecency.Picker.Lightor.Darkby the app's theme (pickerTheme), not the window's theme (which would be dark in a light app). - Deliberately not the page colour: media and cameras are black in both themes (the image viewer, the video player sheet, the shorts reel, the QR scanners), scrims over a page (the side menu, the dApp bridge at work), the swipe to read action under a notification, cards and filter strips in the theme's
lightBackgroundandgrayBackgroundtokens, RN's striped community rows, and web pages (HiveSigner, dApps), which draw their own. - Tests:
UniformBackgroundTestrenders every route (the five tabs and 37 pushed screens) light and dark, loaded or failed and while every call is held (TestNode.holdAll,TestAuth.holdAll), and halfway through each push: no full width band of another colour 3 dp or taller outside tagged content (skeleton*,filterStrip,filterBar, striped rows), at least 60% of the page edges on the page colour, the window on it too; a live switch from light to dark and back on Settings and a loading feed; the Material surfaces per theme; the pull to refresh indicator's arc and disc; the pickers' theme colours.ThemedStatesTest(empty states),ChatsThemedBackgroundTest(chats list and thread),LaunchSplashTest(the window theme, light and dark). build-logicThemedBackgroundLintTestfails on an ad hoc spinner, Material's pull to refresh,MaterialTheme.colorSchemeoutsideui/Theme.kt, aScaffoldwithoutcontainerColor = colors.background, a sheet or a full screen container in another colour (an allowlist with the reasons above), and a platform picker without the app's theme. Screenshots:BG_SHOT_DIR=<dir>saves every frame the Android tests check as PNG.
iOS
One way per surface:
- Pushed screens get the background from
RootView(also while they slide in). - Lists and forms use
.themedList()(ThemedForm,.themedRow(),.listStateRow()for loading, empty and error rows). - Sheets and full screen covers use
.themedSheet/.themedFullScreenCover: the presentation background, under the grabber, the corners and the keyboard, and the presenter's theme (nested sheets would otherwise show the system sheet colour). - RN's filter strips, zebra rows and card separators stay on the theme's card colour (
lightBackground). - Black stays only behind pictures and video (image viewer, video and shorts players, QR camera), each marked
// media:. - Loaders: lists of rows use
RowsSkeleton, feedsFeedSkeleton, the postPostBodySkeleton, the profileProfileHeaderSkeleton; a page of unknown layout showsPageLoading, the one spinner, 48 pt under the top (ListLoadingRowin a List). - Debug hook:
-demoNetwork holdkeeps every fake Hive and REST call waiting (loading states),-demoNetwork failanswers each with a 503 (error states). - Tests:
ThemedBackgroundUITests(thetestEvery*sweep opens every tab, pushed screen, sheet and nested sheet, and the loading and error state of every screen that loads, in dark and light, and scans both window edges from the status bar to the home indicator for anything but the theme's two surfaces; the older cases check rows, empty states and the chats loading band exactly),ThemedBackgroundLintTests(a source scan: aListorFormwithout.themedList(), a raw.sheet(/.fullScreenCover(, the system background colours, grouped list styles, appearance proxies, and black without a// media:reason fail).
Accessibility
Android
TalkBack:
- Every
clickablenames its role (Role.Button,Tab,Switch,DropdownList,RadioButton); icon-only buttons carry a localized label (theGlyphdescription or the container'scontentDescription). Tabs (bottom bar, feed pills, profile, community, waves, wallet charts, comment sort, quest tiers, browser tabs) areRole.Tabwithselected. - List rows are one focus stop (
ui/A11y.kt): a feed card reads a summary (reblogger, title, author, community, age, badges, summary, votes, comments, payout), a double tap opens the post, and its taps (upvote, comments, author, community, voters, reblogs, tip, payout details, options, reveal) are custom actions. Comment and wave headers do the same for their row while the body after them keeps its links and images; notification and chat rows offer the avatar and options as actions. The small taps inside a merged row stay for touch and hide from TalkBack (LocalMergedRow,hideFromAccessibility); badges inside a merged row drop their own description (the summary says it once). The action lists are remembered per row, state and language; summaries are built only when TalkBack asks. A chat bubble's double tap opens its options (a plain tap does nothing, as RN). - Screen titles (
TopBar), sheet and dialog titles, settings cards and wallet sections are headings. Toasts, banners,MessageBlock/ErrorBlockand inline form errors are polite live regions; the PIN pad announces each digit. - Text fields read their placeholder as the hint (placeholder inside the
decorationBox). Settings dropdowns are one stop: "Language, English, drop down list", expand and collapse actions, the chosen itemselected. - Touch targets: Compose widens the hit area of a tap target smaller than 48 dp (
ViewConfiguration.minimumTouchTargetSize) without changing layout, where no neighbour or clip intervenes. So tiny glyph buttons get padding inside their click area (sideways only in single-line rows such as the chat editing banner, the browser tab chip and a split route, so the row keeps its height; on all sides where the row is already taller, about 30 dp of their own; the pinned-message unpin X keeps all-side padding: its row is the parent's tap and the vertical padding keeps the touch area off the text) and a gap to the next target or text (icon clusters 12 dp apart, a row's trailing X 12 dp from its amount, which a test checks).minimumInteractiveComponentSize()is not used because it grows rows (a search bar jumping when its clear button appears). Search bars sit in a stable 48 dp host.A11yFlowsTestscans the feed, the post with its comments and the signed-in tabs (andWalletFlowsTestan asset's details) for neighbours too close for a 48 dp area each (crowdedTargetsinA11yScan.kt: two targets of one window and one scrolling container whose 48 dp areas overlap); an avatar beside its name (one profile) and a card's name above its community (a byline of text links, WCAG 2.5.8's inline exception, as RN) are allowed by tag. So the wallet header buttons are 48 dp, a card's reblog sits 12 dp from its comments, the payout 8 dp from the vote, and the comment sort tabs are 48 dp each. - Button sizes (#3778): Material draws a button 40 dp tall; RN's MainButton was 50 to 56 and its ActionModal confirmations filled pills.
ui/Buttons.ktwrapsButton,OutlinedButtonandTextButtonunder the Material names (asui/Windows.ktdoes for windows): a filled or outlined button is drawn at least 48 dp tall unless the screen sets a height (a compact pill); a text button outside a dialog stays text (Material gives it a 48 dp touch area); inside anAlertDialogthe confirm action is a filled blue pill (adestructive = trueconfirm filled red) with white text, and the dismiss action a light pill, each at least 48 dp tall and 96 dp wide (two actions in one slot wrap in aFlowRow). A dialog that lists its choices in its text (an RC shortfall's top up and boost, a draft's update or save as new) puts them inDialogChoices, filled pills one per line, and its cancel in the dismiss slot, so cancel is never the main button.ButtonSizeLintTestfails on the Material button reached past the wrappers and on a dialog confirm that colours its own text;ButtonSizeTestchecks the heights and the filled confirm. Wallet asset actions wrap and grow to fill each line, as RN'sflexGrow: 1, and an asset's summary rows that open a list (Hive Power's delegations) are 48 dp tall (WalletFlowsTest); comment avatars are 40 dp (RNcommentView).
Font size and display size:
- Text is
sp; containers holding text useheightIn(min = ...), never a fixed height (top bar, settings dropdown, chat search). Long labels wrap (settings values, search placeholders, the top bar title up to two lines with an ellipsis) or ellipsize on purpose. The editor header's Save and Preview switch to their icons when the label does not fit and back when room returns (rotation, split screen, a smaller font):LabelOrIconmeasures the label against the width it gets on every layout. - Checked at 360 dp wide and font scale 2.0 (Android 14 nonlinear scaling) in Robolectric with real font metrics; on the emulator with
font_scale1.3 and 2.0 and a larger display size (wm density). - Bold text (#2569, Android 12+): the system setting is the configuration's
fontWeightAdjustment(300), which Compose applies to every font it resolves.A11yFlowsTestsets it on the activity before the content and runs the cut text scan on the feed, post, settings, login and the signed-in tabs, at font scale 2 and (feed, tabs) at 1, afterboldTextReachesTheAppsTextshows the same text drawing wider with it.
Motion: LocalMotion follows "Remove animations" (see "Motion"); the side drawer crossfades or appears at once instead of sliding, the spin game's rings stand still.
Contrast (WCAG AA): RN's tokens fall short on white (#788187 3.97:1, #357CE6 4.06:1, #E63535 4.26:1, icon #C1C5C7 1.74:1). Light uses darkGray / darkText #67717A, blue #2E6BD4, red #D32F2F, icon #868F95; dark keeps fills that white labels read on (blue #2E6BD4, red #D32F2F) and adds blueText #7FB0F7 and redText #FF8F8F for text, links and small icons (dark Material primary is blueText), icon #8C959B. Post body links and danger text follow. Every buttonColors(...) names its contentColor (white on the blue and red fills); the dark scheme's own onPrimary is navy on its light blue primary.
Checks: build-logic A11yLintTest (every clickable, toggleable and selectable names a role; an icon-only or avatar-only tappable container or a clickable icon has a label; any blue / red fill token used outside a fill (a background, gradient, button container, track or the light scheme's primary; an animateColorAsState line ending in // fill marks an animated fill; borders are not fills, a 1 dp outline needs 3:1) fails, so text, icons, wrappers taking a colour, when branches and locals use blueText / redText; every buttonColors names its content color), TextDirectionLintTest (also TextStyle.Default and BasicTextField without a textStyle). Android A11yFlowsTest (native graphics, 360 dp): no action TalkBack reaches is unlabelled or roleless on the feed, post, settings, login, waves, notifications, wallet and chats; the merged card and its custom actions; tab roles; headings; the dropdown; LabelOrIcon switching back; the search bar keeping its height when the clear button shows; comment headers not inflated; no cut text at font scale 2.0 (a line wider or taller than its box, unless the last line is a deliberate ellipsis). The scans (A11yScan.kt) also run with real rows in NotificationFlowsTest, ChatFlowsTest (list and thread), WavesFlowsTest and WalletFlowsTest at font scale 2.0 and 360 dp. ContrastTest holds the tokens to 4.5:1 (text) and 3:1 (icons) in both themes.
iOS
Screen reading (VoiceOver, Switch Control), Dynamic Type up to AX5, Display Zoom and small phones, Reduce Motion, Bold Text, Increase Contrast and Smart Invert, on every screen.
Helpers (
App/Accessibility.swift):AdaptiveStack(an HStack that stacks at accessibility sizes,DynamicTypeSize.stacksRows),.largeContent(title, appIcon:)(the large content viewer for controls that keep their size: tab bar, header and toolbar icons, the editor's bottom toolbar),.tapTarget()(44 by 44 points),.touchArea()(a small control's frame grown to 44 by 44 points around its drawn size without taking more room, with.fillsTouchArea()on the button's label; see "Touch targets"),.keepsColorsInverted()(Smart Invert; everyLoadedImageViewand avatar does it),.onEscape(VoiceOver's two finger Z on custom overlays: drawer, banners, toast, signing overlay, lock prompts, scanner; system sheets have it already),.announces(text, attempt:, debounce:, sticky:)(attempt: ObjectAttempt(error)holds the failure, so its identity is never reused; sticky entries are kept per site and failure, so several rows at one site each speak once, and lapse after two minutes unseen) andAnnounce.post(errors and statuses shown in place: each time the view appears with the text and not again while it stays; a new failure with the same text announces when its identity changes;stickyfor lazy list rows, once per call site until the text goes away; validation that follows typing waits until it stays for a second; toasts and banners announce themselves),\.assistiveTechnology(VoiceOver or Switch Control on).VoiceOver: icon-only controls are labelled by their action, screen and section titles are headers, selected tabs, pills, segments and chips say so, toggles read as switches with their value. A feed card, wave, comment, notification, chat message, search result and list row is one stop with a summary, and its secondary actions (comments, voters, reblogs, tip, author, community, options, reply, react, copy, remove, each link inside a chat message, the leaderboard's earn tip) are rotor actions (
accessibilityAction(named:)); the separate buttons and their identifiers stay for touch and UI tests. Decorative images are hidden.The Feed tab stays mounted under the other tabs so its lists keep their place, but with VoiceOver or Switch Control on it is unmounted: a hidden SwiftUI tree still exposes its explicit containers, scroll views and images. Debug
-assistiveTechnology YESforces that state (the accessibility UI tests use it). Known cost: those users find the feed at its top again after visiting another tab (the scroll position is not restored).Dynamic Type: text uses text styles or
.scaledFont(RN's point sizes scaled relative to a text style); readable text never uses a literal.font(.system(size:))(lint below). Rows stack at accessibility sizes, segment rows keep equal widths while labels fit and scroll sideways otherwise (FittingSegments), chips wrap (ChipFlow, a chip wider than the row wraps its text), sheets scroll and fixed detents grow (vote weight, share chooser), the drawer widens with the text, the editor's tag hint is a wrapping Text (a UITextField placeholder is one line). Controls that cannot grow (tab bar, toolbars, badges) cap their size and show the large content viewer.Motion: programmatic scrolls (
motion.scroll), the drawer, gallery zoom and the spin wheel follow Reduce Motion (see "Motion").Contrast: every text token meets WCAG AA (4.5:1) in light and dark. The changed colors are in one file,
App/ContrastPalette.swift, with RN's originals, the same values as Android, plus two iOS only colors that follow the same AA rule: RC text 0x0B7D59 (alsosuccessTextin light, for gains and done states) and the unread notification row 0xF3F7FD: light gray 0x67717A, blue 0x2E6BD4, red 0xD32F2F, icon 0x868F95; dark blue and red fills 0x2E6BD4 and 0xD32F2F under white text, andaccentText0x7FB0F7 anddangerText0xFF8F8F wherever blue or red draws text on the dark background. The root tint (AppTheme.rootTint) is the text blue, since it colors text buttons, links and navigation items; filled buttons use.buttonStyle(.prominentFill)(white onaccent, 5.04:1). Increase Contrast picksAppTheme.highContrast. A debug-forceDarkTheme YESruns the app dark whatever the setting (the dark audit). The widget extension compiles the same palette file.Simulator checks without touching device settings: launch with
-UIPreferredContentSizeCategoryName UICTContentSizeCategoryAccessibilityXXXL(or...XXXL,...L).Touch targets (#3778): every button the app draws is at least 44 by 44 points. Icons get
.tapTarget(); counts, amounts, avatars and pills that must keep their drawn size and place (footer counts and payouts, author and chat avatars, the replies pill, a chat message's options, the chat's "people joined" pill) get.touchArea(), whose frame reaches past the control's place, so neighbours must sit far enough apart that frames never overlap (the comment action row is spaced 12 points for it; an own chat message's options are 44 points wide but reach only 4 points up and down,maxVertical, 28 tall: the message's text ends 4 points above and the reaction pills' areas start 4 points below, and the frame stays centred so the glyph stays on the time's line). It keeps to the width offered, so a label that wrapped before still wraps. Rows that open something (the asset card's header, an asset's summary row that opens a list, a history row) are 44 points tall. An asset's actions (RN assetDetailsactionsContainer: wrapping,flexGrow: 1) are pills at least 44 points tall with 14 point text, in aChipFlow(fill: true): they wrap onto lines and each line's pills share its width, so every line runs edge to edge; a long label wraps at the largest sizes.ControlSizeUITestschecks every button on the post with comments, the wallet, an asset and a chat thread (no frame under 44 by 44, no two frames overlapping; the system navigation and tab bars left out; allowed by identifier, each with its reason: the two text links of a card's or comment's byline, the author's name above the community or category, one line of text tall each, WCAG 2.5.8's inline exception and RN's byline, the avatar beside them a 44 point target to the same profile; and an own chat message's options, 28 tall, at least WCAG's 24), the 24 point chevron and 40 point avatar of comment and wave rows and the profile's comment rows (drawn pixels), the actions' lines, a comment's and a wave's vote count opening its voters, and an own message's options glyph on the time's line clear of the text above.Card and wave footers pick one row or wrapping lines by the text size and width (
AccessibleFooter.wraps, throughAnyLayout, so the vote button keeps its state), not by ViewThatFits.A new combined element (one VoiceOver stop over several texts) hides its texts from the audit's contrast check: add its color pairs to
AccessibilityTests.testTextOnOtherBackgroundsMeetsAA.Audit exclusions (
AuditExclusions, each with its reason, by named identifier only): the status bar and keyboard; "partially unsupported" Dynamic Type (the heuristic flags@ScaledMetricsizes and deliberately capped controls; "unsupported" still fails); contrast on disabled controls (WCAG exempts them) and on a listed set of identifiers whose colors compute at or above 4.5:1 but read lower on anti-aliased glyphs; the card summary's five line preview; a paragraph whose link makes it a short hit region; the empty chats search field's text container; on SwiftUI nodes the audit cannot resolve to an element, up to 3 contrast readings per screen (their colors are unit tested) plus one per static text the tab bar covers (textsUnderTheTabBar: content scrolled under the glass bar, which the audit reads through the glass and cannot name; on the wallet the fourth asset card's five texts at launch, #3651; capped per screen at the measured count,underTheBarMeasured: feed 1, waves 2, wallet 5, notifications 2, since the audit names no node for these readings), and, for clipping and Dynamic Type issues there, a bounded allowance per screen and description (unresolvedAllowance, the measured counts: feed 2 clipped and 3 fixed size, feed AX5 1, profile AX5 3, closed profile AX5 1, communities AX5 2, settings AX5 3, vote sheet AX5 3, post AX5 1, notifications AX5 4 (rows cut by the tab bar, one more since the Unread chip); none elsewhere, the dark and Bold Text runs included). It is not identification: the audit names no node and every such issue shares one generic description; the likely sources are unattributable system items (tab bar icons, the navigation bar at AX5) and the feed cards' deliberate five line summaries. They are printed every run and one more than allowed fails.Tests:
AccessibilityTests(ScaledFont grows at AX5, AdaptiveStack stacks only at accessibility sizes, ChipFlow keeps a long chip inside the row, 44 pt targets, the WCAG ratio helper, text tokens AA in both themes, the announcement log, and a source lint that fails on a literal point size in any spelling (.font(.system(size:)),Font.system(size:),UIFont.systemFont(ofSize:),.custom(_, size:)withoutrelativeTo:) unless the line draws only anImage, a widget symbol or an emoji glyph, or saysfixed size:and why);AccessibilityUITests(Xcode'sperformAccessibilityAuditon feed, post, waves, wallet, notifications, chats, profile, communities, search, settings, login and editor, at the default size and at AX5, and six of them in dark mode; tab labels, traits and size at AX5; the feed card one stop inside the screen at AX5; the German tag hint wraps at AX5; the hidden Feed tab out of the tree, which fails together with the audits if the Feed tab is put back under the other tabs). The audit reads pixels at frames it took earlier, so it runs only on a still screen (two screenshots 0.5 s apart within 250 changed pixels of the sampled quarter, Esie, the chats list's Esie button included (looked up on every poll: it shows once chat connects), and the status bar left out) and runs again when the screen after it differs from the one before (an image that loaded mid audit moved a card's title); contrast readings on text scrolled out of its scroll view (the AX5 profile summary, capped at 70 % of the screen) are not counted.Chat channel names at accessibility sizes (#3636): the row's name (
ChatRowName) wraps to at most three lines, between words only. Text breaks a word wider than its line inside the word (at AX5 "Photography" is about 250 pt), so when the name's widest word does not fit, the name takes one line with an ellipsis instead (aViewThatFitswhose wrapping child is ideally as wide as that word). The favourite star and the muted mark sit under the name there (AdaptiveStack), so they stay in view. Android keeps the name on one line with an ellipsis at every size, the star after it (weight(fill = false)). Tests: iOSAccessibilityTests.testALongChannelNameAtAX5KeepsWholeWords, AndroidChatFlowsTest.aLongFavouriteChannelNameAtFontScale2KeepsWholeWordsAndTheStar(a 40 character name). Debug:-demoChatName "<name>"(iOS),--es demoChatName <name>(Android) renames the favourite demo channel.Bold Text (#2569): the audits above run again with Bold Text on, at the default size and at AX5 (
testAuditMainScreensWithBoldText*), aftertestBoldTextReachesTheAppsTextshows the setting reaches the app's text. The debug launch argument-boldText YESsets the bold legibility weight for the app only, as the system setting does: the windows' trait override (UIKit) and the SwiftUI environment (ThemeChoice). A simulator's own Bold Text switch is not set from a test.
Messages arriving in an open chat are not announced (it would be noisy).
Icons
One icon list, native pictures per platform. Shared app/AppIcon.kt: AppIcon names every icon by meaning (CLOSE, VOTE_UP, WALLET), with isDirectional for icons that mirror in right to left layouts; models carry AppIcon, never a platform or RN icon name (AppTab.icon, SideMenuItem.icon, CommunityManageAction.icon, quest and spend rows, wallet history rows). scripts/icons/icons.tsv lists every entry with its Material Symbol and SF Symbol names (outlined at rest and the filled form): the Android drawables are generated from it and both maps are tested against it.
- Android: Material Symbols Outlined, weight 400, as vector drawables
res/drawable/ic_<icon>.xmlandic_<icon>_fill.xml, converted from the official SVGs (google/material-design-icons, Apache 2.0,scripts/icons/NOTICE) byscripts/icons/material_symbols.py; directional ones carryandroid:autoMirrored.ui/AppIconMap.ktmaps entries to drawables; draw withGlyph(AppIcon.X, tint, size, filled = active). - iOS: SF Symbols available on iOS 17, mapped in
Screens/AppIconMap.swift(icon.symbol(filled:)); draw withImage(appIcon: .x, filled:),Label(title, appIcon:)orUIImage(appIcon:), sized with.scaledFont(...)or a text style so they follow Dynamic Type. Directional icons use the backward / forward symbols, which mirror on their own. The widget extension does not link the shared core:Widgets/WidgetSymbols.swiftholds its three symbol names, andWidgets/WidgetWavesMark.swiftdraws the Waves mark from a copy of theWavesMarkpath (the New Wave buttons and the round lock screen widget; the one-line inline widget shows the compose symbol, since inline widgets draw only text and images). - Outlined at rest, filled for an active, selected or toggled state (the selected tab, a favourite, a done quest, a Pro badge, media controls). Never mix Material Rounded or Sharp in.
- Custom: the Waves mark (
WavesMark, one shared path drawn by both platforms), the Ecency logo mark (EcencyLogoMark: RN's EcencySourceBadge path and view box unchanged, read into cubics in shared code; AndroidEcencyLogoMarkVector, iOSEcencyLogoMarkShape),UpvoteGlyphand its SwiftUI twin, the PNG brand images. No text or emoji character stands in for an icon. - Add an icon: add the entry to
AppIconand a row toicons.tsv(pick the Material Symbol on fonts.google.com/icons, Outlined; the SF Symbol in the SF Symbols app, available in iOS 17), runpython3 scripts/icons/material_symbols.pyfrom the repository root, add the drawable lines toui/AppIconMap.ktand the symbol lines toAppIconMap.swift. An icon-only control takes its accessibility label from its action, not the icon name. - Debug gallery of every icon: Android
--ez iconGallery true, iOS-iconGallery YES. - Tests: shared
AppIconTest,AppIconListTest(the list is exactly the enum); AndroidAppIconTest(every entry resolves to a 24 dp vector, filled where the list says, mirroring as declared) andAppIconSourceTest(no icon drawn outside the maps on either platform, no text or emoji icons, widget names listed, the widget Waves mark equal toWavesMark, every SF Symbol exists on iOS 17 per the Mac's symbol catalog); iOSAppIconTests(every symbol draws, outlined and filled).
Media picking (images and videos)
One layer for the only two upload kinds, used at every surface (editor uploads and its gallery, waves composer, chat attachment, video upload and its thumbnail, profile avatar and cover). A deliberate improvement over RN, whose picker options were a compromise (RN #3564, #3561).
- Shared (
app/MediaPicking.kt):MediaSurface(kind and how many at once per surface) andMediaTypes, the one allow-list: JPEG, PNG, GIF, WebP, HEIC/HEIF images; MP4 and MOV videos. Anything else is refused with a message naming what is accepted. Images keep the existing preparation (upright, at most 1920 px, every metadata block dropped, GPS included; HEIC and WebP become JPEG; an animated GIF goes as it is and must fit the 30 MB upload limit). Videos have no size limit of their own (tus to 3Speak). - Android (
MediaPicker.kt): "Choose from Library" is the system photo picker where the platform has it (SDK 33+, or 30 to 32 with R extension 2), elseACTION_OPEN_DOCUMENTwithEXTRA_MIME_TYPES; "Choose from Files" is alwaysACTION_OPEN_DOCUMENT. NotPickVisualMedia.isPhotoPickerAvailable: it also counts the Play services backport, which fails on Android 10 and older and on Go devices. No storage permission. Images are read at once into memory by the preparation; a picked video is copied into the app's cache before upload, so a withdrawn grant cannot break a running upload. - iOS (
App/MediaPicking.swift): PHPicker (no library permission) asks the item provider for an allowed type only and reads the current representation (our pipeline converts HEIC); an iCloud-only item shows its download with a cancel (MediaLoadingOverlay) and a failure message. "Choose from Files" isfileImporterlimited to the same types, one importer per screen. Camera capture stays its own action. The library is the system photo picker (PHPicker); there is no recent photos strip, which would need a library permission. - Image source chooser (
MediaSourceMenus, iOSMediaSourceViews.swift, AndroidMediaSourceChooser.kt): where an image comes from is a compact sheet sized to its content: one row per route with an icon tile, the surface's own title and a short line under it (MediaSource.subtitle), then Cancel. A pick closes the sheet, then opens the picker (iOS waits for the sheet to go).- Routes per surface: profile avatar and cover (gallery, camera where there is one, files, image link); chat attachment and video thumbnail (library, files).
- The editor's uploads sheet shows the same options as tiles (gallery, files, camera, paste when the clipboard has an image); the waves composer and the quick reply open the same sheet from their one Image button (the tiles and the gallery, no "+").
- Accessibility text sizes (Android from 1.5x) drop the icons and use the rows. VoiceOver reads the title with the line as a hint (TalkBack: the tile's click label).
- Tests: shared
MediaPickingTest; AndroidMediaPickerTest(picker choice, document picker intent, filtering, video copy),MediaSourceChooserTest; iOSMediaPickingTests(types, refusals, HEIC to JPEG without location) plus the metadata stripping tests.
Never commit
Signing keys, keystores, provisioning profiles, google-services.json, GoogleService-Info.plist, .env files, API tokens, DSNs or any real account keys. .gitignore blocks the common ones; review every diff anyway, this repo is public.
Known RN bugs fixed in native
- #3535 signing: an
account_updateoraccount_update2that setsowneris an owner operation (never signed, refused on links and in the dApp bridge); acustom_jsonwith both authority lists is refused as unsupported (one key signs); the HiveAuth key type follows the operation's fields. - #3600 key entry: a pasted public key and a private key of another role get their own messages.
- #3599: "Reported" only when the report went through; AI Recap is copy only; avatar sizes by name (
small,medium,large, the names the website requests, so both share the CDN cache); bare/createdapp link; "Communities" search tab; the Manage Authorities button reads "Open". - #3460: the translate
/detectcall only for a signed-in reader. - #3586: an API-flagged wave under "Always warn" stays listed with readable text and covered media, revealed per wave; "Always hide" leaves it out. Its thread screen keeps the cover when it was opened from a list this session. Known gap: a wave opened by a link is not listed and the post API carries no flag, so it opens uncovered, as every post screen does (NSFW covers live on list cards).
- #3527: publishing waits for a draft save in flight.
- #1019: avatars that are buttons on their own have screen reader labels.
- #3579: link callbacks pass an allow-list (
https://hostor an app's ownscheme://), system and browser schemes refused. Deliberate differences:http://localhostdevelopment callbacks and authority-less app callbacks (app:///path) are refused too. - #3564, #3561: the media picking layer.
- #2627: a cold start link under the welcome screen opens after the terms are accepted (iOS queued it; Android kept it).
- #2672: the server picker marks the saved server (iOS had no mark; Android compared exact strings).
Jelajahi proyek terkait
Memuat…