Repository navigation
Conversation
Add the Full screen button to the player's top bar. Full screen covers the whole window with the system bars hidden, puts Close full screen and the Cap's title on the left, the speed on the right and the timeline at the bottom in its light style, and turns to landscape when the video is wider than 1.05:1, as FullscreenPlayer in CapPlayer.swift does. Back, Close or a downward drag of more than 120dp leaves it and gives the orientation back. The player keeps playing while full screen, and a screen that stops showing it only pauses it once nothing else does, after the swap between the inline and full screen surfaces has settled. The activity now handles orientation and size changes itself, so turning the device keeps the screen and its video in place.
Let the activity go into Picture in Picture with the video that is on screen. On Android 12 and later it enters by itself when someone leaves the app while a video plays, the counterpart of canStartPictureInPictureAutomaticallyFromInline; on Android 10 and 11 leaving the app does the same through onUserLeaveHint. The player's top bar gets the Picture in Picture button outside full screen, where the device supports it, as on iOS. The window gets the video's aspect ratio, clamped to what the system accepts, and the player's place on screen as the source rectangle. In Picture in Picture the app draws only the video over its screens, so the open Cap and the tab are where they were on return, and closing the small window pauses playback.
Give the open Cap's player a Media3 media session, the counterpart of NowPlaying in CapPlayer.swift. The system media notification, the lock screen, headset buttons and the Picture in Picture window then show the Cap's title and owner with play, pause, 10 second skips and a seek bar, and tapping the notification returns to the app. The newest open Cap owns the session; it ends when that Cap's screen goes. The session lives in a MediaSessionService of type mediaPlayback, which keeps playback alive while the app is in the background. The service is not exported: the system's own controls reach the session through its notification, and no other app needs to bind to it. Adds media3-session 1.11.1, which brings AndroidX Media 1.7.0 and Lifecycle Service 2.10.0, all Apache 2.0; the README now counts 180 artefacts.
Port the WebVTT parser, the half-open cue lookup and the phrase splitting to capkit. The detail model fetches the transcript through the media client once playback is known and keeps the iOS reasons when there is none. The player draws the active phrase over the picture, raised above the full-screen controls, and a toggle in the top bar remembers the choice in DataStore under captions.enabled.
A locked Cap now shows the password gate instead of the access screen. The trimmed password goes to the unlock endpoint, the returned video access token is kept in memory by capkit, and the Cap reloads with it. A wrong password and too many attempts each say what happened.
While the video, its transcript or its AI summary is still being made, the detail model fetches the Cap again after six seconds, attaches the video once it is ready and loads the captions once the transcript completes. Polling stops as soon as nothing is pending.
The first time a Cap the viewer does not own starts playing, the app posts one view with a session id that stays the same for the life of the process, as the iOS app does.
A cap://s/<id> link, at launch or while the app is open, switches to the Caps tab and opens that Cap on top of the library, starting at ?t= and carrying ?comment= for the comments to come. The link waits while the app is signed out, as on iOS. Adds the device tests for this PR: play and pause, a chosen speed kept across a relaunch, the password gate with a wrong and a right password, and a link that opens at 30 seconds. The fixture relay now forwards the video access header.
The mobile playback endpoint answers a segmented Cap with kind "hls" and a URL such as /api/playlist?videoId=...&videoType=segments-master. The player built its media item from the URL alone, and with no .m3u8 in the path ExoPlayer took it for a progressive file and could not play it. The detail model now keeps the playback kind beside the URL, and the player gives an HLS item the application/x-mpegURL MIME type so the HLS media source handles it. MP4 items still carry no MIME type and are recognised from the file as before.
The detail models were only cleared when a detail screen asked for a model under a different session. Signing out left every open entry alive: its player, its media session through NowPlaying, and its processing poll kept running until the next sign-in opened a Cap. SessionModel can now run a block when its scope ends, which happens when the session holder signs out or switches account. The detail models register for the session they serve and release every entry when it ends.
The playback endpoint only returns a transcript URL once the VTT file exists, so a Cap opened while its transcript is being written gets none. When the processing poll later saw the transcription complete, the detail model tried the transcript again with the URL it already had, found none, and said the Cap had no transcript. When the poll sees the transcription complete and the playback is already attached without a transcript URL, it now asks for the playback again and takes only the transcript URL from it. The video URL, and so the player, are left as they are. The polling test served a transcript URL while the transcription was still processing, which hid this. It now serves one only after the transcription completes, and checks that the video URL is unchanged.
A ready Cap whose playback request failed was marked as failed, and a later refresh that attached a valid video URL left the mark in place, so the detail screen kept showing the failure over a working video. Accepting a valid video URL now clears the failure.
Only the inline player registered itself as the Picture in Picture candidate. Going full screen removed the inline player, which unregistered it, and the full-screen player never registered, so leaving the app from full screen no longer entered Picture in Picture. Every player surface now registers, so the full-screen player takes over from the inline one and hands back when full screen closes. While Picture in Picture is showing, the full-screen dialog steps aside as the inline player already does, so its window does not cover the Picture in Picture view, and it returns when the activity leaves Picture in Picture.
setPublic launched each change of who can view a Cap as its own request. Two quick changes could reach the server out of order: if the request to make a Cap public was slow and the user then made it private, the private request could be saved first and the older public one last, so the Cap stayed public while the library showed it as private once the newer answer was shown. SessionModel now keeps a mutex per Cap and sends that Cap's visibility changes one at a time, in the order they were made. The library still shows the newest choice at once, and CapEdits still decides which answer is shown, so an older answer never replaces a newer choice. CapActionsTest holds the first request at the loopback server, makes the second change, lets the second reply go first and checks that the server received the public change before the private one, and that the library and toast end on the private choice. It fails without this change and passes with it. The tests that held one change while another was answered now expect the later change to wait for the earlier one.
pausePolling cancelled the poll that was running, but a list request already in flight called schedulePolling when it arrived, and a list with processing Caps started a new poll. Leaving the library while it loaded could so leave status requests running behind another screen. LibraryModel now remembers that polling is paused. pausePolling sets it, loadIfNeeded clears it when the library is shown again, and schedulePolling starts nothing while it is set. LibraryModelTest holds the list reply, pauses, releases it and checks on virtual time that no status request follows. It fails without this change and passes with it.
The server pages the library first and then drops Caps whose owner is blocked, so a page can come back empty while hasMore is still true. An empty first page left no card to ask for the next page, and an empty later page ended the paging, so Caps further down were never shown. LibraryModel now asks for the next page straight away while a page added nothing to the list and the server says there is more. After an empty first page it loads on until something shows. Paging still ends when the server's page number stops moving on, so a server that keeps answering the same page cannot make it ask for ever. LibraryModelTest covers an empty first page, an empty later page, and an empty page that does not move on. The first two fail without this change.
When the processing poll saw the transcription complete and asked for the playback again to get the transcript URL, a failed request left the transcript marked as missing. A refresh could not recover it, because the playback is only requested while no video is attached. A refresh now asks for the playback again when the video is attached, the transcription is complete and there is still no transcript URL. As in the poll, only the transcript URL is taken from the reply, so the player is left as it is.
…ap fails When a poll found a Cap that had finished processing, it refreshed the list and ended the polling, because a successful refresh starts a new poll for whatever is still processing. When that refresh failed, nothing started a new poll, so the other Caps stopped showing progress until the library was loaded again. load now says whether the list arrived, and a poll only ends when it did. After a failed refresh the backoff goes on and keeps asking about the Caps that are still processing. LibraryModelTest finishes one of two processing Caps, fails the refresh, and checks that the next poll still asks about the other one. It fails without this change.
A segmented Cap plays from /api/playlist on the Cap origin, and the media client sent those requests only the API key. After a password unlock the playlist therefore had no proof of the password, even once the server accepts the token there. The media client now takes its same-origin headers from the API client, which adds the unlocked Cap's access token to /api/playlist requests for that Cap's videoId, as it already did for the Cap's thumbnail. Requests to any other host still have the Authorization and X-Cap-Video-Access headers removed, so the signed segment URLs on storage get neither.
The server makes a folder in the user's active organisation at the moment it gets the request. While a switch of organisation was still in flight, the New folder action stayed available and saveFolder sent the request anyway, so the folder could land in the new organisation while the app put it in the old one's library. New folder is now hidden while the organisation is changing, and saveFolder sends nothing until the switch has ended. NewFolderTest holds the switch at the server and checks that no folder request is sent and no new draft can be opened until it ends. It fails without this change.
… and sharing The first page of each library is saved so that it can be shown at the next launch before the server answers. A delete or a change of who can view only changed the list in memory, so after a cold start offline a deleted Cap came back and a Cap showed its old visibility. A list asked for before the change and answered after it also saved the old Cap again. LibraryModel keeps the last first page with the moment it was asked for, and saves it through CapEdits, the same filter the list on screen uses, so a deleted Cap stays out and only answers newer than the page change its visibility. SessionModel saves it again after a delete, a visibility change the server accepted, or one it refused. CapActionsTest holds a refresh, deletes or changes a Cap, lets the older list arrive and checks the saved page each time. It fails without this change.
…pages After a delete or a change of who can view, SessionModel saves each library's first page again. That save waits for the cache, and while it waited the loop was still walking the live map of libraries. A screen that opened a library in that moment, or an organisation switch that cleared the map, made the loop throw ConcurrentModificationException out of a scope with no handler, so the rest of the libraries kept the deleted Cap and the toast never came. The three loops that save pages now walk a copy of the libraries. CapActionsTest blocks the cache behind a named pipe, opens a third library while the delete is saving the first one, then lets the cache go. It checks that both open libraries and both saved pages lose the Cap. It fails without this change.
… it arrives When a Cap finished processing and the refresh that followed failed, the next poll found nothing processing, ended the polling and never asked for the list again. The finished Cap kept the row it had while processing until the library was loaded again. LibraryModel now remembers that a refresh is owed when a poll finds a finished Cap, and every later poll asks for the list again until one arrives, on the same backoff, whether or not other Caps are still processing. LibraryModelTest finishes the only processing Cap, fails the first refresh and checks that the next poll loads the list and the row shows the server's Cap. It fails without this change. The test for a failed refresh with another Cap still processing now also expects the refresh to be tried again on the next poll.
Ports CommentThreads from the iOS CapKit: only text comments form threads, a reply to a reply joins its top-level thread, replies whose parent is missing are hidden, and roots and replies run oldest first with the id breaking ties. A parent chain is followed at most 16 steps, so a cycle hides its comments instead of looping. Ports the two threading tests from SocialTests.
The Cap screen's scrolling content is now a lazy list: the header, then the Comments section, with a pinned section selector once there is more than one section. Comments show as threads with the count, a sort menu (Oldest first, Newest first, Video order), the empty state, and rows with the avatar, name, relative time, a timestamp chip that plays from that moment and lights up while it is playing, and text whose web links open. A long press offers Copy text and Play from m:ss. The section is hidden when the owner turns comments off. Ports viewerDecodesDefensively from SocialTests.
Adds the composer under the Comments section. Focusing it pauses the video and pins the comment to the playback time once, unless the video is at its first half second or the Cap is a screenshot; the clock chip offers Pin to m:ss and Don't pin to a time. The placeholder asks the viewer to respond to the owner by first name, or to add a comment on their own Cap. Drafts are trimmed and capped at 2,000 characters. Sending is optimistic: the comment appears at once as Sending… and is swapped for the server's copy. If the server refuses, it goes away and the draft and its moment come back, with the error as a toast. With the keyboard up on a short screen the video and timeline step aside, using the iOS rule (column height under the video height plus 150, or 200 below 390 wide). The shell now consumes the bottom bar's insets, so content that pads for the keyboard no longer pads for the bar twice. Adds device tests for Sending… becoming the server comment and for a failed send restoring the draft.
Each comment gets a Reply button, a Reply item in its long-press menu and a Reply accessibility action. The composer then shows Replying to <name> with a cancel button, asks to reply to the author by first name, drops the timestamp pin and sends with parentCommentId. Replies never carry a moment, as on iOS. A failed reply keeps the comment it answers. Threads with more than three replies show the first two and Show N more replies, unless the highlighted comment is among them. A comment opened from a cap://s link's ?comment=, or the thread a new comment or reply landed in, is scrolled into view and tinted for 3 seconds. When the video steps aside for the keyboard, the list moves to the reply being written, or to the sections if the header was showing.
Your own comments get Delete in their long-press menu and as an accessibility action. It asks Delete this comment? first, adding Replies to it will be hidden too. for a top-level comment. Once the server agrees, the comment and its direct replies leave the list and Comment deleted shows; a refusal keeps the comment and shows the error.
Adds the reaction bar under the header with the share page's six emoji in its order (React with <emoji>, with a light haptic). A reaction shows at once, is pinned to the playback moment when past the first half second, and is taken back with a toast if the server refuses. Reactions rise over the picture as bursts: when one is added, and when playback steps over a reaction's moment (forward steps under 1.5 s while playing, at most three per step, at least 80 ms apart, twelve on screen at most). The bursts draw inside the video in the inline and full screen players, and over the thumbnail when there is no video. The Comments section starts with reaction totals, most first, and tapping one plays from the earliest of them. Nothing shows when the owner turns reactions off.
Ports TimelineMarkers from the iOS CapKit: timed comments and reactions are bucketed along the video, skipping anything without a usable time and text that is not a thread, with late moments clamped to the end. A marker keeps its ids, up to three authors, its emoji and counts, and leads with its most common emoji when it holds only reactions. Above the scrubber, a few moments show as 26 dp badges (an author's avatar or the emoji, with a count above one). A busy Cap shows a density chart instead, accent for comments and orange for reactions, with badges on the three busiest moments at least 32 dp apart. Tapping a marker plays from it and, when it holds a comment, opens Comments with the first one highlighted. Ports markersBucketNearbyMomentsAndSkipUntimed from SocialTests, and takes the marker model and its extra clamping and ordering cases from the earlier capkit branch, where they were checked against output recorded from the Swift code.
Contributor
Author
|
@greptileai review |
…age read A page read that started before a change on the page sent the page's title, password state and sharing to every library. If the Cap was made private or public from the library while the read was out, the library went back to the page's older choice. Such a read now updates the libraries with the server's fields only and leaves the title, password state and sharing each library already shows.
Contributor
Author
|
@greptileai review |
Storage answering 408, 429 or a 5xx was reported as a rejected upload, and the upload worker only retried transport errors, so a busy or throttled bucket deleted the staged file and failed the upload. An upload error now says itself whether it can be retried, storage's 408, 429 and 5xx included, and the worker keeps the file and retries those with its exponential backoff.
NewerVersionAvailable asks Maven Central for the latest version of each dependency, and with warnings treated as errors the Android check fails on the day a release lands, as it did for Kotlin 2.5.0 against the 2.4.21 the app pins. It is turned off so the check only depends on the code. GradleDependency and AndroidGradlePluginVersion do not fire on this project, so they stay on.
…one is checked The test checked the library still showed the newer choice once the older sharing request had finished, but the newer request starts as soon as the older one frees the Cap's lock, and its refusal could land before the check and roll the library back. The refusal is now held until the older answer has been checked, then released.
Contributor
Author
|
@greptileai review |
This branch has not been deployed
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.
Stacked on the analytics PR (#4761), which sits on the earlier Android PRs. Only the top 13 commits are new here, from
588eb2f0donwards, including merges of the analytics PR atdacb7306fand091f9bfbfand three fixes from review. Once the PRs below merge this shows only its own diff.This PR adds Live Updates, the Android counterpart of the iOS Live Activities.
What is in it
The Android counterpart of the two iOS Live Activities (upload progress and screen recording), built on the upload notifications from the upload PR. Someone uploading a file or importing from Loom now sees the same phases and wording as on an iPhone, in the shade and, on Android 16 QPR2 and later, as a promoted Live Update with a status bar chip.
Notificationslives in the app's services and owns two low importance channels, "Uploads" and "Screen recording".Notification.ProgressStyle, indeterminate while preparing or finishing, with its percentage as the chip text. Promotion is requested on Android 16 QPR2 (API 36.1) and later, which needsPOST_PROMOTED_NOTIFICATIONS. Earlier versions keep the plain ongoing notification with a progress bar.cap://s/<id>once the Cap exists, and the app before then. The recording notification and its Stop action opencap://record/stop, the iOS activity's link.RecordingUploadFeedis a small interface for the recorder side: each update names the Cap, its title and its phase, and the upload centre shows it as an "Uploading recording" notification with the same throttle, stale state and dismissal.RecordingUploadFeed, and the screen recorder PR posts the recording notification and acts oncap://record/stop.Screenshots
On the emulators at
38847eef8. A fixture upload finishes too quickly to catch every phase, so each one was posted through the app's ownNotificationsbuilder from a test harness that is not part of this PR; the real upload path is covered by LiveUpdateShadeTest. API 37 shows the promoted Live Update with its chip, and API 29 the plain notification with a progress bar.Where it differs from iOS, on purpose
Fixes from review
The analytics PR is merged in. It comes in at
dacb7306f, with the settings layer it now carries, and again at091f9bfbfwith its own fixes from review, through a merge rather than a rebase, so the commits the device runs below were made on stay in the branch.The Loom import phases follow the shared import checks. The upload PR's
watchLoomImportalready removes the import notification when its checks run out, and its upload queue stops every watch when the account changes. The Live Update phases for an import now run inside those checks throughfollowLoomImport, so LoomImportWatchTest can run them against a local server.An upload whose storage link cannot be renewed is kept. The upload PR renews an expired storage link through
/api/mobile/uploads/:id/target, which feat(web): re-sign a mobile upload's storage target #4744 adds. Against a server without that route the renewal answers 404, storage refuses the old link with 403, and the worker used to delete the saved upload and fail it for good. It now keeps the upload and leaves WorkManager to try again, so the upload goes through once a server with feat(web): re-sign a mobile upload's storage target #4744 can renew the link. A renewed link that storage also refuses still fails as before. UploadTargetRefreshTest gains one test, and its test for a server without the route now expects the upload to be kept for another try.The preparing notification stays until the worker takes over. It was removed as soon as the upload was queued, so while Android held the worker back, for example until there was a network, nothing showed that an upload was waiting. It now stays until the worker reports progress, which it does after posting its own notification, or until the work ends. Once the Cap exists the notification is tagged with the Cap's ID rather than a random one, so the worker clears it when it shows its own notification or finishes, even if the app was closed in between. UploadTest gains two tests for this.
Depends on
/api/mobile/uploads/:id/target, which feat(web): re-sign a mobile upload's storage target #4744 adds. Without it a late upload is kept and tried again rather than lost, but it cannot finish until feat(web): re-sign a mobile upload's storage target #4744 is deployed.Tests
:capkit:test: 232 tests, 1 of them new in this PR.:app:testDebugUnitTest: 472 tests, 10 of them new in this PR. Another 8 come in through the analytics PR: 6 from the settings commits and 2 from its fixes from review. LoomImportWatchTest (2): an import that never finishes is cleared after the last check, and a finished one stays as done. LiveUpdateTest (6): every kind and phase, fresh and stale, maps to the iOS status line; percentages round and stay in range; the screen recording wording; thecap://slink; the 2 percent or 2 second throttle; and the 45 second stale state, on virtual time.Device runs,
connectedDebugAndroidTestonce per API against the fixture server:0ac84d286: 85 tests, 81 passed. LiveUpdateShadeTest failed, in the run and when the class was run again: the notification was posted with the right title and text, but the test looked for it before the shade had finished opening.38847eef8makes it wait for the text in the shade, and with that it passes on API 37. The other three failures are CapDetailTest playback tests: playAndPause and aShareLinkWithATimeOpensTheCapThere timed out waiting for Compose to go idle, and aChosenSpeedIsKeptAfterTheAppIsOpenedAgain found no "Playback speed 1×" button. They failed the same way when run again, and this PR does not touch playback.38847eef8: 85 tests, 85 passed, LiveUpdateShadeTest included.Checked
./gradlew spotlessCheck :capkit:test :app:testDebugUnitTest :app:lintDebug :app:assembleDebug :app:assembleRelease :app:assembleDebugAndroidTestpasses on the last commit,6cb746a47: capkit 232 tests and JVM 472 tests with no failures, and no lint errors or warnings. It also passed on the earlier merge,788ae5167, and before it, on38847eef8.Not checked
Notifications.postand a manual check.Confidence Score: 5/5

The latest changes appear safe to merge; no new actionable issue was found.Summary
Adds Android upload and recording notifications, with progress, background wording, completion messages, and promoted Live Updates on supported versions.
Reviews (9) · Last reviewed commit: "Merge branch 'feat/mobile-android-analyt..." · Reviewed by Greptile