Skip to content

Explore tab ​

What the person sees. The bottom bar's search tab (ExploreScreen): a search field over a grid of posts.

What you do. The tab is where a search starts. Its data is the accounts the search field offers as recent. The Explore grid is not available. The search field itself, with typing, suggestions and results, is the search area.

Every example starts from session.json, the session Your first program saved, and names the screen it expects (screen: FeedTimelineScreen). The examples show the success path: errors are answered as in Errors, and challenges by your otherwise constant (Challenges: answer them once with otherwise).

ts
import { AndroidIgpapi, FeedTimelineScreen } from '@igpapi/android';
import { Effect } from 'effect';
import { readFile } from 'node:fs/promises';

// A checkpoint read back from your storage (see "Keep a session").
const saved = JSON.parse(await readFile('session.json', 'utf8'));

The matrix ​

#The person...Starts onActionsResult
1Opens the search tab and sees the recent accountsthe feedopenSearchTab(), data.recentThe Explore tab; its enter fetches the recent accounts and the null state
2Taps the search fieldExploreopenSearchInput()The search field with the recent accounts; nothing is sent
3Taps a recent accountthe search fieldthe recent account's openProfile()That account's profile

Typing in the field, the suggestions and the results are in search. What this screen does not offer. The Explore tab has no action that goes back to the feed; the feed tab of the bottom bar is offered by your own profile (openFeedTab()), and from Explore you continue with the feed handle you already hold. The bottom bar's search tab is what the app calls Explore, and openSearchTab() opens it.

The scenarios ​

1. Open the tab ​

The tab edge always lands on the Explore tab, the tab's root, so the answer needs no guard; screens left open over it are closed, as the app does on a tap of the selected tab.

ts
// Open the Explore tab and read the accounts its search field lists as recent.
const recent = await AndroidIgpapi.launch({
  checkpoint: saved,
  screen: FeedTimelineScreen,
  main: feed =>
    Effect.gen(function* () {
      // The tab edge lands on the Explore tab, the tab's root.
      const tab = yield* feed.openSearchTab();
      return tab.data.recent.map(account => account.username);
    }),
});
console.log(recent);

2. Tap the search field ​

ts
// Tap the search field of the Explore tab: the field opens with the recent accounts and sends nothing.
const field = await AndroidIgpapi.launch({
  checkpoint: saved,
  screen: FeedTimelineScreen,
  main: feed =>
    Effect.gen(function* () {
      const tab = yield* feed.openSearchTab();
      const search = yield* tab.openSearchInput();
      return search.recentAccounts.length;
    }),
});
console.log(field);

3. Open a recent account ​

ts
// Open the profile of the first recent account from the search field.
const profile = await AndroidIgpapi.launch({
  checkpoint: saved,
  screen: FeedTimelineScreen,
  main: feed =>
    Effect.gen(function* () {
      const tab = yield* feed.openSearchTab();
      const search = yield* tab.openSearchInput();
      const account = search.recentAccounts[0];
      if (account === undefined) return undefined;
      const opened = yield* account.openProfile();
      return opened.data.username;
    }),
});
console.log(profile);

The pages of this site are the README files of the repository. The API reference is generated from the source.