Setup-tab BuildConfig wiring + .env policy + build-stamp logging#1
Merged
Conversation
[tf-dev branch: Taras's local testing work; do not merge without review] When the Setup tab is opened, the form defaults to: - baseUrl = prod (api.chat.ethora.com/v1) - xmppHost / xmppConference = prod - appId = 646cc8dc...f2d (the BASE app, not the developer's own app) - email = colod20205@exweme.com / password = 12345678 (dev-team literal) - authMode = email/password Result: after running @ethora/setup against Cloud QA, the sample ignores the .env that setup wrote and tries to log into prod with leftover dev-team credentials — Connect returns 401. Only jwtToken and singleRoomJid were already wired to BuildConfig, so the other fields dangle. Changes: app/build.gradle.kts — add three buildConfigField entries so the envOrDefault() pipeline can inject them from .env: ETHORA_APP_TOKEN, ETHORA_USER_EMAIL, ETHORA_USER_PASSWORD. Existing env consumer in @ethora/setup is being updated in the same-named branch on that repo to write them. MainActivity.kt (PlaygroundSessionState) — replace every hard-coded default string with the corresponding BuildConfig.* constant. authMode defaults to JWT_CUSTOM when ETHORA_USER_JWT is non-empty, so a 'setup + run' flow lands on a connectable session without manual field edits. AndroidManifest.xml — add android:windowSoftInputMode="adjustResize" on MainActivity. Likely cause of the reported scroll issue: without it, the soft keyboard overlaps form fields instead of resizing the window, so fields under the keyboard become unreachable.
[tf-dev branch] Problem: PlaygroundSessionState.load() blindly re-applies any previously saved JSON, so a build that introduces new BuildConfig-backed defaults (like the ETHORA_APP_TOKEN / ETHORA_USER_EMAIL / ETHORA_USER_PASSWORD additions in tf-dev) keeps showing the old saved values after an in-place reinstall. Developers have to 'adb shell pm clear com.ethora' for the new defaults to take effect — easy to miss and confusing. Fix: stamp a CURRENT_SCHEMA_VERSION alongside the JSON. On load(), only restore the saved JSON when the persisted schema matches; any earlier schema falls through to the fresh BuildConfig defaults. save() writes both keys atomically, so the first save after a fresh default path seeds the new schema. Developer edits are still preserved across restarts within the same schema. Bump CURRENT_SCHEMA_VERSION whenever PlaygroundSessionState's default set or semantics changes.
Inject SAMPLE_GIT_SHA, SAMPLE_GIT_BRANCH, and SAMPLE_BUILD_TIME (YY.MM.DD.HH:mm UTC)
as buildConfigField constants. MainActivity logs them as the first line on launch:
sample-chat-app build=<short sha> @<timestamp>UTC branch=tf-dev
Pasted logs and bug reports now self-identify the exact build they came from.
The buildConfigField reads via ProcessBuilder('git rev-parse'); CI builds
without git history fall through to 'unknown' without failing.
Note: the timestamp here uses java.time.* which is known to fail in some
Gradle DSL classpath setups (Gradle 8.9 + JBR 17). The follow-up commit
'fix(gradle): compute build stamp via git log' replaces this with a
git-log + ProcessBuilder approach that pins to the commit's own author
date and works on every classpath we've tested.
[tf-dev branch]
Prior attempts with java.time.* and java.text.SimpleDateFormat both
failed with 'Unresolved reference: text / util / time' in the
Kotlin DSL compilation pass. Root cause is Gradle's built-in 'java'
plugin extension — when applied transitively via the Android plugin,
the DSL script's top-level scope has a property named 'java' that
shadows the java.* package namespace, so 'java.text.SimpleDateFormat'
is parsed as '<java extension>.text' and fails to resolve.
Workarounds all required either top-of-file imports (which interact
awkwardly with the 'plugins {}' block position) or fully-qualified
\`_root_ide_package_\` paths.
Simpler + more useful: read the commit's own author date via
'git log -1 --format=%cd --date=format-local:%y.%m.%d.%H:%M' with
TZ=UTC in the child process env. This reuses the ProcessBuilder
pattern that already works for SAMPLE_GIT_SHA and SAMPLE_GIT_BRANCH,
and the timestamp now pins to the commit rather than to wall-clock
rebuild time — same build always stamps the same string.
Verified locally: commit 889583d stamps as 26.04.23.12:13.
Real .env files written by @ethora/setup contain endpoint URLs, app IDs, tokens, and test-user credentials — those must never be committed. Adds .env / .env.local / .env.*.local + google-services.json patterns to .gitignore and ships a placeholder .env.example so developers know which keys to populate manually if they're not using @ethora/setup. Implements the 'no Ethora default endpoints, no customer endpoints in SDK/sample source' policy.
This was referenced May 9, 2026
RomanLeshc
added a commit
that referenced
this pull request
May 11, 2026
Re-pin compileSdk/targetSdk to 35 (regressed after PR #1 merge)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Five commits cherry-picked from a local
tf-devbranch, focused on two themes:@ethora/setup's output actually reach the running sample. The Setup tab currently hardcodesbaseUrl = \"https://api.chat.ethora.com/v1\",appId = \"646cc8dc...\",email = \"colod20205@exweme.com\",password = \"12345678\"as defaults — so after running@ethora/setupagainst a developer's profile, the sample still shows dev-team credentials and the BASE app ID, ignoring the.envsetup wrote..env(which@ethora/setupwrites) was not in.gitignore, and the hardcoded defaults above are policy violations against the new "no Ethora default endpoints, no customer endpoints in SDK/sample source" rule.Commits
wire all Setup-tab defaults to BuildConfigPlaygroundSessionStatedefault inMainActivity.ktwithBuildConfig.ETHORA_*reads, plus matchingbuildConfigFieldentries inapp/build.gradle.ktsfor the new keys (ETHORA_APP_TOKEN,ETHORA_USER_EMAIL,ETHORA_USER_PASSWORD). AddswindowSoftInputMode=\"adjustResize\"toAndroidManifest.xmlto fix the Setup-tab keyboard-overlap scroll bug.schema-version the persisted Setup-tab stateCURRENT_SCHEMA_VERSIONnext to the saved JSON. After in-place reinstall with a new BuildConfig default set, old saved JSON falls through to the fresh defaults instead of permanently masking them. Without this, devs have toadb shell pm clear com.ethoraafter every@ethora/setuprun.stamp git SHA + branch + build time into logsSAMPLE_GIT_SHA/SAMPLE_GIT_BRANCH/SAMPLE_BUILD_TIMEbuildConfigFieldconstants.MainActivitylogs them as the first line on launch — pasted logs and bug reports now self-identify the exact build. CI without git history falls through to\"unknown\".compute build stamp via 'git log', not java.* packagesjava.time.*doesn't always resolve in Gradle's Kotlin DSL classpath (Gradle 8.9 + JBR 17 — thejavaplugin extension shadows thejava.*package namespace). Replaced withgit log -1 --format=%cd+ProcessBuilder(the same pattern already used for SHA / branch). The timestamp is now the commit's own author date, so the same build always stamps the same string.gitignore .env + add .env.example placeholder.env,.env.local,.env.*.local, andgoogle-services.jsonto.gitignore. Ships a.env.examplewith placeholder values + per-key comments so developers not using@ethora/setupknow what to populate.Why this matters now
After
@ethora/setupwrites a fresh profile's.env, the dev expects the sample to launch with that profile pre-filled. Today onmain, the Setup tab still shows dev-team credentials regardless — the.envis partially read (XMPP / JWT / ROOM_JID) but the rest is shadowed by hardcoded literals. Commits 1+2 close that gap.This PR is paired with two
@ethora/setupPRs (forthcoming):fix(presets): drop :5443 from XMPP WebSocket / BOSH URLs— the legacy port no longer accepts WebSocket connections post-chat.ethora.commigration; setup currently writes URLs that hang for 30s at TCP-connect.fix(android): write ETHORA_APP_TOKEN/USER_EMAIL/USER_PASSWORD to .env— extends setup'spatchSampleApp()to write the additional env keys this PR adds support for.Without the setup-side changes, the new BuildConfig keys land empty, which is harmless (the Setup-tab fields just open blank). With the setup-side changes, a fresh
setup → runflow opens a Setup tab fully pre-filled with the developer's profile.What I deliberately did NOT include
Several commits from the same
tf-devbranch are obsolete or need rework againstmain's current architecture:LogsTabCopy-all + selection —mainrefactoredLogsTabto delegate to the SDK'sLogsViewcomponent. If selection/copy is still missing in the user-facing experience, that's an SDK-side enhancement tocom.ethora.chat.ui.components.LogsView.ConnectionStatusBannerdiagnostic — entangled withmain's newEthoraChatProviderwrapper. Worth re-thinking as a toggleable dev-mode connection indicator inside the SDK rather than a sample-only patch.ConnectBar+ keep-alive tab dispatch (and the pairedzIndexhit-testing fix) — major restructuring conflict withmain'sEthoraChatProviderlayout. Some of the underlying issues (long-JWT scroll-clipping, two-clients-racing log pattern) may have been addressed differently — needs re-evaluation.includeBuildwith sibling auto-detect) —mainalready has a simplerincludeBuild(commented out) with note "Disabled while we're testing the JitPack-published v1.0.33 artifact end-to-end." Re-enabling this with auto-detect would override that decision. Worth picking up after v1.0.33 testing settles.mainis already on AGP 8.7.0 + Kotlin 2.3.0.Test plan
./gradlew :app:assembleDebugsucceeds (verify build-stamp constants populate).envis written and gitignored.env.env— old saved JSON does not mask new defaultssample-chat-app build=<sha> @<timestamp>UTC branch=<branch>