@@ -45,6 +45,9 @@ public class SetupProgressActivity extends AppCompatActivity implements org.iiab
4545 * ("books" -> BooksDownloadsFragment, "zim" -> ZimPreparingFragment). */
4646 public static final String EXTRA_OPEN_STREAM = "openStream" ;
4747
48+ /** ADFA-4988: hint from a content confirm — open this stream's detail iff it is the only active one. */
49+ public static final String EXTRA_HINT_STREAM = "hintStream" ;
50+
4851 private static final long READY_POLL_MS = 2000L ;
4952 private static final long REDIRECT_MS = 3000L ;
5053 // ADFA-4900: if the maps module queue never reports RUNNING/DONE this long after hand-off, treat
@@ -134,13 +137,28 @@ protected void onCreate(@Nullable Bundle s) {
134137 // so a proot-only install could finish without the index ever updating to Finish/redirect.
135138 ModuleQueueRepository .get ().state ().observe (this , st -> render ());
136139
137- // ADFA-4987: a download notification tapped -> land on that stream's detail (not the legacy UI).
140+ // ADFA-4987: a download notification tapped -> force that stream's detail (not the legacy UI).
141+ // ADFA-4988: a content confirm hints its stream -> open its detail only when it is the sole
142+ // active stream, otherwise show the index.
138143 if (s == null ) {
139144 String openStream = getIntent ().getStringExtra (EXTRA_OPEN_STREAM );
145+ String hintStream = getIntent ().getStringExtra (EXTRA_HINT_STREAM );
140146 if (openStream != null && !openStream .isEmpty ()) openDetail (openStream );
147+ else if (hintStream != null && !hintStream .isEmpty ()) openHintedStream (hintStream );
141148 }
142149 }
143150
151+ /** ADFA-4988: open the just-confirmed REST stream's detail directly when it is the ONLY active work;
152+ * otherwise keep the index. The hinted stream may not have registered its session yet (it just
153+ * started), so trust the hint and inspect only the OTHER streams, which started earlier. */
154+ private void openHintedStream (String hint ) {
155+ boolean otherProot = mapsInSession () || moduleInSession ();
156+ boolean otherZim = !"zim" .equals (hint ) && (ZimDownloadService .hasSession () || ZimWishlist .size (this ) > 0 );
157+ boolean otherBooks = !"books" .equals (hint ) && (BooksDownloadService .hasSession () || BooksWishlist .size (this ) > 0 );
158+ if (otherProot || otherZim || otherBooks ) return ; // several streams -> keep the index
159+ openDetail (hint );
160+ }
161+
144162 @ Override
145163 protected void onResume () {
146164 super .onResume ();
0 commit comments