Expose the pro auto-renewing config key to Kotlin - #49
Draft
mpretty-cyro wants to merge 1 commit into
Draft
Conversation
libsession PR #121 adds the `A` / auto_renewing user-profile key, but it is core-only — this wrapper had no binding for it, so clients could not read or write it. Adds the JNI pair and the Kotlin declarations, following the existing ProAccessExpiry shape. The accessor is presence-only and the doc comment says so at the API boundary rather than only at the call site: set_pro_auto_renewing(false) ERASES the key, so `false` and "never written" are the same state through this getter. That is #121's encoding surfacing here, not something introduced by the binding, and it is where the next reader will meet it. Pins the libsession-util submodule to 8e5634b8, the head of #121, which is UNMERGED — so this commit cannot merge until #121 does. It is also not the identically-subjected pro-auto-renewing-config-pfs commit, which rebases the same change onto the PFS track. Verified in the built APK across all four ABIs rather than by a successful compile: a JNI signature mismatch is invisible at compile time and only traps at runtime.
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.
LibSession-Util-Android@feature/pro-auto-renewing-glue→ basemain(a00aa4a).One commit, 4 files: a JNI pair, two Kotlin declarations, and a submodule pin bump.
🔴 Cannot merge until libsession-util #121 merges
The
libsession-utilsubmodule is pinned to8e5634b8, which is the head of jagerman's#121 — an OPEN PR. Merging this
first would pin the wrapper to a commit that isn't on
dev.A reviewer looking at a glue diff has no reason to have #121 in mind, so it is stated here as well as
in the commit message.
Not the
-pfsbranch.JasonFork/pro-auto-renewing-config-pfscarries an identical commitsubject with a different sha and is not a descendant — it rebases the same change onto the PFS
track, dragging that line in with it.
gh pr view 121 --json headRefOidconfirms8e5634b8.Merge order: #121 → this → a
LibSession-Util-Androidrelease → the Android client'slibsessionUtilAndroidVersionbump → the client PR (session-androidfeature/pro-status-refresh-unification), which is what needs these accessors.Why this exists
#121 adds the
A/auto_renewinguser-profile key to core only. This wrapper had no bindingfor it, so nothing on the client side could read or write it — "the core PR is merged" is not the same
as "the accessor is reachable from Kotlin". The client work needs to persist
auto_renewingintosynced config alongside the access expiry, so a linked device has the account state without its own
fetch.
Follows the existing
ProAccessExpiryshape exactly: twoextern "C"functions, two interfacemembers, two
externaloverrides. No new pattern.Known limitation — inherent to
A, surfaced hereAis presence-only.set_pro_auto_renewing(false)erases the key rather than storing zero,so through this accessor a stored
falseand "never written" are indistinguishable —getProAutoRenewing()returnsfalsefor both.That is #121's encoding, not something this binding introduces, but this is where a Kotlin caller
meets it, so it is documented on the accessor itself rather than only at the call sites. Callers that
need to tell the two apart cannot, through this API.
Not included, and conditional: a mirror of
user_profile_has_pro_auto_renewing()— the predicatethat does distinguish them. It exists on an unpushed libsession branch and is only needed if the
client's startup gate is ruled to bootstrap a fetch when
Ahas never been written. This PR doesnot call it and is complete without it. If that ruling lands it is a further ~20 lines here, the
same shape as the pair below.
Verification — and what it does not rest on
A JNI signature mismatch is invisible at compile time and traps at runtime, so a green build is
not evidence for a change of this kind, and a reviewer cannot see the binding is correct from the
diff. Checked against the built artefact instead —
app-play-debug.apk, all four ABIs:APK built from this branch with the consuming client change, 30 seconds before the check.
:app:assemblePlayDebuggreen; the client's suite is 217 tests / 0 failures against it.The leg not run: there is no unit test for the binding in this repo. No JVM test here can load
libsession_util.so, which is why the evidence is a symbol check on the real artefact rather than atest. Stating it rather than letting "verified" cover a check that wasn't possible.
Reviewer notes
int-returning..._opt()sentinel shape that circulated earlier is not what this uses.On Android the natural binding — mirroring the accessor directly above it — would be
static_cast<jboolean>(-1)=255=JNI_TRUE, so "never stored" would silently reach Kotlin as"auto-renewing".
jbooleanisuint8_t; the narrowing is legal and produces no diagnostic. Thesentinel was dropped from #121's follow-up on that evidence.
t/Tbump on the write path:auto_renewingis backend-derived state likeE,IandR,not a user profile edit, and libsession omits the bump for it deliberately.