Skip to content

Open source Grok Bot alternative, Bring your own agent and subscription: message Claude Code, Codex, Gemini CLI, Cursor, Copilot and 40+ AI agents as bots on your own computer, from iPhone, Mac, Windows, Linux or terminal. Agent-agnostic and free. Also a Muse and Dots alternative. Built in Rust.

feat(apps): invite a GitHub star and an App Store rating at the fifth prompt

leepokaif816dfd8eb42
diff --git a/apps/desktop/e2e/queue.spec.ts b/apps/desktop/e2e/queue.spec.ts
index 42ef03ea..4db8345f 100644
--- a/apps/desktop/e2e/queue.spec.ts
+++ b/apps/desktop/e2e/queue.spec.ts
@@ -1,10 +1,6 @@
import { test, expect, type Page } from '@playwright/test'
-import { resolve } from 'node:path'
import { canSteer } from '../src/renderer/views/thread/queued-messages.ts'
-import { api, attach } from './sandbox.ts'
-
-// A scripted agent whose turn waits until a steered message joins it (host/tests/fixtures/steer_agent.py).
-const agent = resolve(__dirname, '../../../host/tests/fixtures/steer_agent.py')
+import { api, attach, steerBot, typeMessage } from './sandbox.ts'
type History = { entries: { kind: string; data: { text?: string; status?: string } }[] }
@@ -14,19 +10,12 @@ async function started(page: Page, botId: string, text: string): Promise<boolean
return entries.some((e) => e.kind === 'user' && e.data.text === text && e.data.status === 'sent')
}
-async function type(page: Page, text: string) {
- await page.locator('.composer textarea').fill(text)
- await page.locator('.composer textarea').press('Enter')
-}
-
test('a long queue scrolls, with its oldest message in reach', async () => {
const { browser, page } = await attach()
const name = `Long queue e2e ${Date.now()}`
let botId: string | undefined
try {
- const { bot } = await api<{ bot: { id: string } }>(page, 'createBot', {
- name, backend: 'custom', command: `python3 -X utf8 -u '${agent}' steer 120`, connectors: [], skills: [], notify: false,
- })
+ const bot = await steerBot(page, name, 120)
botId = bot.id
await page.locator('.roster-row', { hasText: name }).click()
await api(page, 'send', { botId, text: 'first' })
@@ -53,7 +42,7 @@ test('a long queue scrolls, with its oldest message in reach', async () => {
await expect(row('Waiting 1')).toBeInViewport()
// One typed here scrolls into view; the ones the computer got from elsewhere didn't.
- await type(page, 'typed here')
+ await typeMessage(page, 'typed here')
await expect(row('typed here')).toBeInViewport()
} finally {
if (botId) {
@@ -71,9 +60,7 @@ test('a message sent while the bot works waits above the composer, then goes out
try {
const { version } = await api<{ version: string }>(page, 'hello', {})
test.skip(!canSteer(version), `the sandbox host (${version}) can't steer yet`)
- const { bot } = await api<{ bot: { id: string } }>(page, 'createBot', {
- name, backend: 'custom', command: `python3 -X utf8 -u '${agent}' steer 30`, connectors: [], skills: [], notify: false,
- })
+ const bot = await steerBot(page, name, 30)
botId = bot.id
await page.locator('.roster-row', { hasText: name }).click()
const transcript = page.locator('.transcript')
@@ -81,7 +68,7 @@ test('a message sent while the bot works waits above the composer, then goes out
await api(page, 'send', { botId, text: 'first' })
await expect.poll(() => started(page, bot.id, 'first')).toBe(true)
- await type(page, 'second')
+ await typeMessage(page, 'second')
await expect(queued.filter({ hasText: 'second' })).toBeVisible()
await expect(transcript).not.toContainText('second')
await queued.filter({ hasText: 'second' }).getByRole('button', { name: 'Send now' }).click()
@@ -92,7 +79,7 @@ test('a message sent while the bot works waits above the composer, then goes out
await api(page, 'send', { botId, text: 'third' })
await expect.poll(() => started(page, bot.id, 'third')).toBe(true)
- await type(page, 'never sent')
+ await typeMessage(page, 'never sent')
await queued.filter({ hasText: 'never sent' }).getByRole('button', { name: 'Remove' }).click()
await expect(queued).toHaveCount(0)
await expect(transcript).not.toContainText('never sent')
diff --git a/apps/desktop/e2e/sandbox.ts b/apps/desktop/e2e/sandbox.ts
index 5945ffcd..bd7a5a13 100644
--- a/apps/desktop/e2e/sandbox.ts
+++ b/apps/desktop/e2e/sandbox.ts
@@ -7,6 +7,8 @@ import type { HostSnapshot } from '../src/shared/ipc.ts'
// Playwright loads specs as CommonJS here (the package has no "type": "module").
const root = resolve(__dirname, '../../..')
+// A scripted agent whose turn waits until a steered message joins it (host/tests/fixtures/steer_agent.py).
+const steerAgent = join(root, 'host/tests/fixtures/steer_agent.py')
/** This worktree's sandbox: its name, host port and DevTools port (`npm run dev -- --cdp` opens port + 10000). */
export function sandbox() {
@@ -32,9 +34,32 @@ export async function attach(): Promise<{ browser: Browser; page: Page }> {
.flatMap((context) => context.pages())
.find((p) => !p.url().startsWith('devtools://'))
if (!page) throw new Error('The sandbox app has no window open.')
+ await setPref(page, 'githubStarAsk', { kind: 'done' }) // Its sheet would cover what a test clicks.
return { browser, page }
}
+/** Sets a `pref` in the running window, which hears it as if another window had written it. */
+export async function setPref(page: Page, key: string, value: unknown) {
+ await page.evaluate(([key, value]) => {
+ localStorage.setItem(key, value)
+ window.dispatchEvent(new StorageEvent('storage', { key, newValue: value }))
+ }, [key, JSON.stringify(value)] as const)
+}
+
+/** A bot on the scripted agent, which waits up to `seconds` for a steered message. */
+export async function steerBot(page: Page, name: string, seconds: number) {
+ const { bot } = await api<{ bot: { id: string } }>(page, 'createBot', {
+ name, backend: 'custom', command: `python3 -X utf8 -u '${steerAgent}' steer ${seconds}`, connectors: [], skills: [], notify: false,
+ })
+ return bot
+}
+
+/** Sends `text` from the open chat's composer. */
+export async function typeMessage(page: Page, text: string) {
+ await page.locator('.composer textarea').fill(text)
+ await page.locator('.composer textarea').press('Enter')
+}
+
/** Opens Settings from the account panel, on its General page. */
export async function openGeneralSettings(page: Page) {
await page.locator('.sidebar-account').click()
diff --git a/apps/desktop/e2e/star-prompt.spec.ts b/apps/desktop/e2e/star-prompt.spec.ts
new file mode 100644
index 00000000..166598a1
--- /dev/null
+++ b/apps/desktop/e2e/star-prompt.spec.ts
@@ -0,0 +1,40 @@
+import { test, expect } from '@playwright/test'
+import { api, attach, setPref, steerBot, typeMessage } from './sandbox.ts'
+
+test('an installation past setup is invited to star, then once more at the fifth prompt', async () => {
+ const { browser, page } = await attach()
+ const name = `Star invitation e2e ${Date.now()}`
+ let botId: string | undefined
+ try {
+ await page.reload() // A sheet this window already closed would hold off: the count starts over here.
+ const bot = await steerBot(page, name, 120)
+ botId = bot.id
+ await setPref(page, 'promptsSent', 3)
+ await setPref(page, 'githubStarAsk', { kind: 'never' })
+ const first = page.getByText('Star Codync on GitHub')
+ await expect(first).toBeVisible()
+ await page.getByRole('button', { name: 'Not now' }).click()
+ await expect(first).toBeHidden()
+
+ await page.locator('.roster-row', { hasText: name }).click()
+ const second = page.getByText('Enjoying Codync?')
+
+ await typeMessage(page, 'fourth')
+ await expect.poll(() => page.evaluate(() => localStorage.getItem('promptsSent'))).toBe('4')
+ await expect(second).toBeHidden()
+
+ await typeMessage(page, 'fifth')
+ await expect(second).toBeVisible()
+ await page.getByRole('button', { name: 'Not now' }).click()
+ await expect(second).toBeHidden()
+ expect(await page.evaluate(() => localStorage.getItem('githubStarAsk'))).toBe('{"kind":"done"}')
+
+ await typeMessage(page, 'sixth')
+ await expect.poll(() => page.evaluate(() => localStorage.getItem('promptsSent'))).toBe('6')
+ await expect(second).toBeHidden()
+ } finally {
+ await setPref(page, 'githubStarAsk', { kind: 'done' })
+ if (botId) await api(page, 'deleteBot', { botId }).catch(() => {})
+ await browser.close()
+ }
+})
diff --git a/apps/desktop/src/renderer/lib/prefs.ts b/apps/desktop/src/renderer/lib/prefs.ts
index 87e4f067..3364cff4 100644
--- a/apps/desktop/src/renderer/lib/prefs.ts
+++ b/apps/desktop/src/renderer/lib/prefs.ts
@@ -78,6 +78,8 @@ export const prefs = {
onboardingDone: pref('macAccountOnboardingCompleted', false),
computerAccessSetup: pref<'ready' | 'later' | null>('computerAccessSetup', null),
starAsk: pref<StarAsk>('githubStarAsk', { kind: 'never' }),
+ /** Prompts this computer delivered, voice calls aside; they bring the second star ask. */
+ promptsSent: pref('promptsSent', 0),
appLanguage: pref<AppLanguage>('appLanguage', 'system'),
/** The working pill unfolds the turn's thinking and steps; off keeps the chat to its messages. */
thinkingDetails: pref('showThinkingDetails', false),
diff --git a/apps/desktop/src/renderer/lib/star-ask.test.ts b/apps/desktop/src/renderer/lib/star-ask.test.ts
index 02fa5052..5eb84c60 100644
--- a/apps/desktop/src/renderer/lib/star-ask.test.ts
+++ b/apps/desktop/src/renderer/lib/star-ask.test.ts
@@ -1,32 +1,32 @@
import assert from 'node:assert/strict'
import { test } from 'node:test'
-import { SECOND_ASK_AFTER, afterStarAsk, dueStarAsk } from './star-ask.ts'
+import { SECOND_ASK_AT, afterStarAsk, dueStarAsk } from './star-ask.ts'
-test('asks right away, then once more after a week, then never', () => {
+test('asks right away, then once more at the fifth prompt, then never', () => {
assert.equal(dueStarAsk({ kind: 'never' }, 0), 'first')
- const asked = afterStarAsk({ kind: 'never' }, false, 100)
- assert.deepEqual(asked, { kind: 'asked', at: 100 })
- assert.equal(dueStarAsk(asked, 100 + SECOND_ASK_AFTER - 1), null)
- assert.equal(dueStarAsk(asked, 100 + SECOND_ASK_AFTER), 'second')
- assert.deepEqual(afterStarAsk(asked, false, 100 + SECOND_ASK_AFTER), { kind: 'done' })
+ const asked = afterStarAsk({ kind: 'never' }, false, 0)
+ assert.deepEqual(asked, { kind: 'asked' })
+ assert.equal(dueStarAsk(asked, SECOND_ASK_AT - 1), null)
+ assert.equal(dueStarAsk(asked, SECOND_ASK_AT), 'second')
+ assert.deepEqual(afterStarAsk(asked, false, SECOND_ASK_AT), { kind: 'done' })
assert.equal(dueStarAsk({ kind: 'done' }, Number.MAX_SAFE_INTEGER), null)
})
-test('starring at the first ask skips the second', () => {
+test('starring ends the asks', () => {
assert.deepEqual(afterStarAsk({ kind: 'never' }, true, 0), { kind: 'done' })
})
-test('finishing setup records its invitation without an immediate duplicate or consuming the later reminder', () => {
- const skipped = afterStarAsk({ kind: 'never' }, false, 100)
- assert.equal(dueStarAsk(skipped, 100), null)
- assert.deepEqual(afterStarAsk(skipped, false, 101), skipped)
- assert.equal(dueStarAsk(skipped, 100 + SECOND_ASK_AFTER), 'second')
+test('reopening setup keeps the second ask waiting', () => {
+ const skipped = afterStarAsk({ kind: 'never' }, false, 0)
+ assert.equal(dueStarAsk(skipped, 1), null)
+ assert.deepEqual(afterStarAsk(skipped, false, 1), skipped)
+ assert.equal(dueStarAsk(skipped, SECOND_ASK_AT), 'second')
})
-test('starring from reopened setup during the cooldown ends all future asks', () => {
- const skipped = afterStarAsk({ kind: 'never' }, false, 100)
- const starred = afterStarAsk(skipped, true, 101)
+test('starring from reopened setup stays final', () => {
+ const skipped = afterStarAsk({ kind: 'never' }, false, 0)
+ const starred = afterStarAsk(skipped, true, 1)
assert.deepEqual(starred, { kind: 'done' })
- assert.deepEqual(afterStarAsk(starred, false, 102), starred)
- assert.equal(dueStarAsk(starred, 100 + SECOND_ASK_AFTER), null)
+ assert.deepEqual(afterStarAsk(starred, false, 2), starred)
+ assert.equal(dueStarAsk(starred, SECOND_ASK_AT), null)
})
diff --git a/apps/desktop/src/renderer/lib/star-ask.ts b/apps/desktop/src/renderer/lib/star-ask.ts
index 40353a0f..d4f2c7f5 100644
--- a/apps/desktop/src/renderer/lib/star-ask.ts
+++ b/apps/desktop/src/renderer/lib/star-ask.ts
@@ -1,24 +1,24 @@
-/** How long after the first ask the second one waits, for people who kept using Codync. */
-export const SECOND_ASK_AFTER = 7 * 24 * 60 * 60 * 1000
+/** The prompt sent from this computer that brings the second ask. */
+export const SECOND_ASK_AT = 5
/** Where the GitHub star ask stands on this computer. */
-export type StarAsk = { kind: 'never' } | { kind: 'asked'; at: number } | { kind: 'done' }
+export type StarAsk = { kind: 'never' } | { kind: 'asked' } | { kind: 'done' }
-/** Which ask is due now: the first one during setup (or after setup for existing installations), the second a week of use later. */
-export function dueStarAsk(state: StarAsk, now: number): 'first' | 'second' | null {
+/** Which ask is due now: the first one during setup (or after setup for existing installations), the second at the fifth prompt. */
+export function dueStarAsk(state: StarAsk, prompts: number): 'first' | 'second' | null {
switch (state.kind) {
case 'never':
return 'first'
case 'asked':
- return now - state.at >= SECOND_ASK_AFTER ? 'second' : null
+ return prompts >= SECOND_ASK_AT ? 'second' : null
case 'done':
return null
}
}
-/** Reopening setup preserves the reminder cooldown; choosing Star always ends asks. */
-export function afterStarAsk(state: StarAsk, starred: boolean, now: number): StarAsk {
+/** Reopening setup keeps the second ask waiting; choosing Star always ends asks. */
+export function afterStarAsk(state: StarAsk, starred: boolean, prompts: number): StarAsk {
if (starred) return { kind: 'done' }
- if (!dueStarAsk(state, now)) return state
- return state.kind === 'never' ? { kind: 'asked', at: now } : { kind: 'done' }
+ if (!dueStarAsk(state, prompts)) return state
+ return state.kind === 'never' ? { kind: 'asked' } : { kind: 'done' }
}
diff --git a/apps/desktop/src/renderer/lib/use-star-ask.ts b/apps/desktop/src/renderer/lib/use-star-ask.ts
index 84f6ce8c..89f3b530 100644
--- a/apps/desktop/src/renderer/lib/use-star-ask.ts
+++ b/apps/desktop/src/renderer/lib/use-star-ask.ts
@@ -4,18 +4,19 @@ import { analytics } from '../store/analytics'
export const STAR_REPO = 'https://github.com/leepokai/Codync'
-/** Setup and the later reminder share one persisted answer history. */
+/** Setup and the invitation at the fifth prompt share one persisted answer history. */
export function useStarAsk() {
const [state, setState] = usePref(prefs.starAsk)
+ const [prompts] = usePref(prefs.promptsSent)
const answer = (starred: boolean) => {
const current = prefs.starAsk.get()
- const now = Date.now()
- const due = dueStarAsk(current, now)
- setState(afterStarAsk(current, starred, now))
+ const sent = prefs.promptsSent.get()
+ const due = dueStarAsk(current, sent)
+ setState(afterStarAsk(current, starred, sent))
if (due) {
analytics.track({ event: 'star_prompt_answered', ask: due, starred })
}
if (starred) window.codync.app.openExternal(STAR_REPO)
}
- return { state, answer }
+ return { due: dueStarAsk(state, prompts), prompts, answer }
}
diff --git a/apps/desktop/src/renderer/store/bot-store.ts b/apps/desktop/src/renderer/store/bot-store.ts
index 395549bd..13261ffa 100644
--- a/apps/desktop/src/renderer/store/bot-store.ts
+++ b/apps/desktop/src/renderer/store/bot-store.ts
@@ -16,6 +16,7 @@ import {
import type { CallLine } from '@shared/calls'
import type { HostClient } from '../client/host-client'
import { readSharedFile } from '../../shared/files.ts'
+import { prefs } from '../lib/prefs'
import { FileDownloads } from './file-downloads'
import { BotSections } from './bot-sections'
import { BotSync, sleep } from './bot-sync'
@@ -95,6 +96,8 @@ export class BotStore extends BotSync {
this.outgoingFiles.delete(nonce)
this.upsert(e)
this.changed()
+ // Only once it arrived, so a resend counts once.
+ if (!call) prefs.promptsSent.set(prefs.promptsSent.get() + 1)
} catch (error) {
if (this.outgoingFiles.has(nonce)) this.lastError = `Couldn't send the files: ${error instanceof Error ? error.message : error}`
this.markLocal(nonce, botId, 'failed')
diff --git a/apps/desktop/src/renderer/views/StarPrompt.tsx b/apps/desktop/src/renderer/views/StarPrompt.tsx
index b248ec84..f0c5f426 100644
--- a/apps/desktop/src/renderer/views/StarPrompt.tsx
+++ b/apps/desktop/src/renderer/views/StarPrompt.tsx
@@ -7,7 +7,6 @@ import { HStack, VStack } from '../components/Stack'
import { Text } from '../components/Text'
import { useModel } from '../lib/observable'
import { prefs, usePref } from '../lib/prefs'
-import { dueStarAsk } from '../lib/star-ask'
import { useStarAsk } from '../lib/use-star-ask'
import { useApp } from '../store/context'
import { useTr } from '../lib/use-language'
@@ -20,13 +19,13 @@ const copy = {
},
second: {
title: 'Enjoying Codync?',
- message: "You've been using Codync for a while. If it saves you trips to your desk, a star on GitHub helps other people find it.",
+ message: 'If Codync saves you trips to your desk, a star on GitHub helps other people find it.',
},
}
/**
- * Reminds once a week after the setup invitation; also covers older installations
- * that have not seen the setup invitation.
+ * Invites again at the fifth prompt after the setup invitation; also covers older
+ * installations that have not seen the setup invitation.
* Starring ends it.
*/
export function StarPrompt() {
@@ -34,14 +33,14 @@ export function StarPrompt() {
const app = useApp()
const local = useModel(app.local)
const [onboarded] = usePref(prefs.onboardingDone)
- const { state, answer } = useStarAsk()
- const [closed, setClosed] = useState(false)
- const due = dueStarAsk(state, Date.now())
- const open = due !== null && onboarded && !closed && local?.connection.kind === 'online'
+ const { due, prompts, answer } = useStarAsk()
+ // The prompt count when this sheet last closed: the next ask waits for a later prompt, so two never follow each other.
+ const [closedAt, setClosedAt] = useState(-1)
+ const open = due !== null && onboarded && prompts > closedAt && local?.connection.kind === 'online'
const finish = (starred: boolean) => {
- if (closed || !due) return
- setClosed(true)
+ if (!open) return
+ setClosedAt(prompts)
answer(starred)
}
diff --git a/apps/ios/App/CodyncApp.swift b/apps/ios/App/CodyncApp.swift
index 6fb46390..8d597b71 100644
--- a/apps/ios/App/CodyncApp.swift
+++ b/apps/ios/App/CodyncApp.swift
@@ -73,7 +73,6 @@ struct CodyncApp: App {
}
.onOpenURL { url in app.open(url) }
.onChange(of: scenePhase, initial: true) { _, phase in
- ReviewInvitation.shared.setActive(phase == .active)
switch phase {
case .active: Analytics.shared.becameActive()
case .background: BackgroundTime.run("Analytics") { await Analytics.shared.enteredBackground() }
diff --git a/apps/ios/Kit/Sources/CodyncKit/Analytics/AnalyticsEvent.swift b/apps/ios/Kit/Sources/CodyncKit/Analytics/AnalyticsEvent.swift
index 0673261d..b04f794a 100644
--- a/apps/ios/Kit/Sources/CodyncKit/Analytics/AnalyticsEvent.swift
+++ b/apps/ios/Kit/Sources/CodyncKit/Analytics/AnalyticsEvent.swift
@@ -27,13 +27,9 @@ public enum AnalyticsEvent: Equatable, Sendable {
/// never), reconnects, the first phase stuck too long, why it failed.
case voiceCallQuality(VoiceEngine, readyMs: Int?, reconnects: Int, stuck: VoiceStuck, failure: VoiceFailure)
case screenViewed(Screen)
- case reviewOpportunity(completed: Int)
- case reviewCancelled(ReviewCancellation)
- case reviewRequested(completed: Int)
+ case reviewRequested(prompts: Int)
case reviewLinkOpened
- public enum ReviewCancellation: String, Sendable { case background, interaction, unavailable }
-
public enum Notifications: String, Sendable { case allowed, denied, notAsked = "not_asked" }
public enum OnboardingStep: String, Sendable { case welcome, choose, install, scan }
public enum OnboardingVia: String, Sendable { case paired, account, skipped }
@@ -121,8 +117,6 @@ public enum AnalyticsEvent: Equatable, Sendable {
case .voiceCallStarted: "voice_call_started"
case .voiceCallQuality: "voice_call_quality"
case .screenViewed: "screen_viewed"
- case .reviewOpportunity: "review_opportunity"
- case .reviewCancelled: "review_cancelled"
case .reviewRequested: "review_requested"
case .reviewLinkOpened: "review_link_opened"
}
@@ -155,9 +149,8 @@ public enum AnalyticsEvent: Equatable, Sendable {
"stuck": .string(stuck.rawValue), "failure": .string(failure.rawValue)]
p["ready_ms"] = readyMs.map(Analytics.Value.int)
return p
- case let .reviewOpportunity(completed), let .reviewRequested(completed):
- return ["completed_interactions": .int(completed), "policy": .string("v1"), "trigger": .string("return_to_bots")]
- case let .reviewCancelled(reason): return ["reason": .string(reason.rawValue), "policy": .string("v1")]
+ case let .reviewRequested(prompts):
+ return ["prompts": .int(prompts), "policy": .string("v2")]
case .reviewLinkOpened: return ["source": .string("settings")]
case let .screenViewed(screen): return ["screen": .string(screen.rawValue)]
}
diff --git a/apps/ios/Kit/Sources/CodyncKit/Resources/Languages/de.json b/apps/ios/Kit/Sources/CodyncKit/Resources/Languages/de.json
index 29e2d9e8..2f36a89a 100644
--- a/apps/ios/Kit/Sources/CodyncKit/Resources/Languages/de.json
+++ b/apps/ios/Kit/Sources/CodyncKit/Resources/Languages/de.json
@@ -49,6 +49,7 @@
"Connects on Wi-Fi, over Tailscale, or from anywhere through Cloudflare, on its own. End-to-end encrypted.": "Verbindet sich allein über WLAN, über Tailscale oder von überall über Cloudflare. Ende-zu-Ende verschlüsselt.",
"Connecting": "Verbindung wird hergestellt",
"Connecting…": "Verbindung wird hergestellt…",
+ "If Codync saves you trips to your desk, a star on GitHub helps other people find it.": "Wenn Codync dir Wege zum Schreibtisch spart, hilft ein Stern auf GitHub anderen, es zu finden.",
"Updating…": "Wird aktualisiert…",
"Connection": "Verbindung",
"Continue": "Weiter",
@@ -1744,7 +1745,6 @@
"Works once, until {time}": "Gilt einmal, bis {time}",
"Yellow": "Gelb",
"You wrote it": "Von dir geschrieben",
- "You've been using Codync for a while. If it saves you trips to your desk, a star on GitHub helps other people find it.": "Du nutzt Codync schon eine ganze Weile. Wenn es dir Wege zum Schreibtisch spart, hilft ein Stern auf GitHub anderen, es zu finden.",
"Your bots are idle. Message one from here, or open Codync.": "Deine Bots sind untätig. Schreib einem von hier aus oder öffne Codync.",
"Your computer is offline.": "Dein Computer ist offline.",
"a computer": "ein Computer",
diff --git a/apps/ios/Kit/Sources/CodyncKit/Resources/Languages/es.json b/apps/ios/Kit/Sources/CodyncKit/Resources/Languages/es.json
index 6503942c..cc18b65c 100644
--- a/apps/ios/Kit/Sources/CodyncKit/Resources/Languages/es.json
+++ b/apps/ios/Kit/Sources/CodyncKit/Resources/Languages/es.json
@@ -49,6 +49,7 @@
"Connects on Wi-Fi, over Tailscale, or from anywhere through Cloudflare, on its own. End-to-end encrypted.": "Se conecta por Wi-Fi, a través de Tailscale o desde cualquier lugar a través de Cloudflare, por sí solo. Cifrado de extremo a extremo.",
"Connecting": "Conectando",
"Connecting…": "Conectando…",
+ "If Codync saves you trips to your desk, a star on GitHub helps other people find it.": "Si Codync te ahorra viajes a tu escritorio, una estrella en GitHub ayuda a otras personas a encontrarlo.",
"Updating…": "Actualizando…",
"Connection": "Conexión",
"Continue": "Continuar",
@@ -1744,7 +1745,6 @@
"Works once, until {time}": "Funciona una vez, hasta {time}",
"Yellow": "Amarillo",
"You wrote it": "Lo escribiste tú",
- "You've been using Codync for a while. If it saves you trips to your desk, a star on GitHub helps other people find it.": "Llevas un tiempo usando Codync. Si te ahorra viajes a tu escritorio, una estrella en GitHub ayuda a otras personas a encontrarlo.",
"Your bots are idle. Message one from here, or open Codync.": "Tus bots están inactivos. Escribe a uno desde aquí o abre Codync.",
"Your computer is offline.": "Tu computadora está desconectada.",
"a computer": "una computadora",
diff --git a/apps/ios/Kit/Sources/CodyncKit/Resources/Languages/fr.json b/apps/ios/Kit/Sources/CodyncKit/Resources/Languages/fr.json
index 0cfb87ad..9ae3579b 100644
--- a/apps/ios/Kit/Sources/CodyncKit/Resources/Languages/fr.json
+++ b/apps/ios/Kit/Sources/CodyncKit/Resources/Languages/fr.json
@@ -49,6 +49,7 @@
"Connects on Wi-Fi, over Tailscale, or from anywhere through Cloudflare, on its own. End-to-end encrypted.": "Se connecte seul en Wi-Fi, via Tailscale ou depuis n'importe où via Cloudflare. Chiffré de bout en bout.",
"Connecting": "Connexion",
"Connecting…": "Connexion…",
+ "If Codync saves you trips to your desk, a star on GitHub helps other people find it.": "Si Codync vous évite des allers-retours à votre bureau, une étoile sur GitHub aide d'autres personnes à le trouver.",
"Updating…": "Mise à jour…",
"Connection": "Connexion",
"Continue": "Continuer",
@@ -1744,7 +1745,6 @@
"Works once, until {time}": "Fonctionne une fois, jusqu'à {time}",
"Yellow": "Jaune",
"You wrote it": "Écrit par vous",
- "You've been using Codync for a while. If it saves you trips to your desk, a star on GitHub helps other people find it.": "Vous utilisez Codync depuis un moment. S'il vous évite des allers-retours à votre bureau, une étoile sur GitHub aide d'autres personnes à le trouver.",
"Your bots are idle. Message one from here, or open Codync.": "Vos bots sont inactifs. Écrivez-en un d'ici ou ouvrez Codync.",
"Your computer is offline.": "Votre ordinateur est hors ligne.",
"a computer": "un ordinateur",
diff --git a/apps/ios/Kit/Sources/CodyncKit/Resources/Languages/it.json b/apps/ios/Kit/Sources/CodyncKit/Resources/Languages/it.json
index dcaaa0b0..3f37e6c8 100644
--- a/apps/ios/Kit/Sources/CodyncKit/Resources/Languages/it.json
+++ b/apps/ios/Kit/Sources/CodyncKit/Resources/Languages/it.json
@@ -511,6 +511,7 @@
"How to add the Codync widget": "Come aggiungere il widget Codync",
"I saved it": "L'ho salvato",
"IBM Bob is your AI-Powered Development Partner": "IBM Bob è il tuo partner di sviluppo basato su AI",
+ "If Codync saves you trips to your desk, a star on GitHub helps other people find it.": "Se Codync ti risparmia qualche viaggio alla scrivania, una stella su GitHub aiuta altre persone a trovarlo.",
"If the computer asks, check it shows {code}.": "Se il computer lo chiede, controlla che mostri {code}.",
"If {agent} runs out of usage or can't answer, the bot carries on with the next one. Chat, memory and workspace carry over.": "Se {agent} esaurisce l'utilizzo o non può rispondere, il bot continua con il successivo. Chat, memoria e spazio di lavoro vengono mantenuti.",
"Image URL": "URL dell'immagine",
@@ -1744,7 +1745,6 @@
"Works once, until {time}": "Funziona una volta, fino alle {time}",
"Yellow": "Giallo",
"You wrote it": "L'hai scritto tu",
- "You've been using Codync for a while. If it saves you trips to your desk, a star on GitHub helps other people find it.": "Usi Codync da un po'. Se ti risparmia qualche viaggio alla scrivania, una stella su GitHub aiuta altre persone a trovarlo.",
"Your bots are idle. Message one from here, or open Codync.": "I tuoi bot sono inattivi. Scrivi a uno di loro da qui o apri Codync.",
"Your computer is offline.": "Il tuo computer è offline.",
"a computer": "un computer",
diff --git a/apps/ios/Kit/Sources/CodyncKit/Resources/Languages/ja.json b/apps/ios/Kit/Sources/CodyncKit/Resources/Languages/ja.json
index c8ff17b9..638fcb26 100644
--- a/apps/ios/Kit/Sources/CodyncKit/Resources/Languages/ja.json
+++ b/apps/ios/Kit/Sources/CodyncKit/Resources/Languages/ja.json
@@ -49,6 +49,7 @@
"Connects on Wi-Fi, over Tailscale, or from anywhere through Cloudflare, on its own. End-to-end encrypted.": "Wi-Fi、Tailscale経由、またはCloudflare経由でどこからでも単独で接続します。エンドツーエンドで暗号化されます。",
"Connecting": "接続中",
"Connecting…": "接続中…",
+ "If Codync saves you trips to your desk, a star on GitHub helps other people find it.": "Codync で机に戻る手間を省けているなら、GitHub でスターを付けていただくと、他の人にも見つけてもらいやすくなります。",
"Updating…": "アップデート中…",
"Connection": "接続",
"Continue": "続ける",
@@ -1744,7 +1745,6 @@
"Works once, until {time}": "1 回限り有効、{time} まで",
"Yellow": "黄色",
"You wrote it": "ご自身が書いた内容",
- "You've been using Codync for a while. If it saves you trips to your desk, a star on GitHub helps other people find it.": "Codync をしばらくお使いいただきありがとうございます。机に戻る手間を省けているなら、GitHub でスターを付けていただくと、他の人にも見つけてもらいやすくなります。",
"Your bots are idle. Message one from here, or open Codync.": "ボットは待機中です。ここから 1 つのボットにメッセージを送るか、Codync を開いてください。",
"Your computer is offline.": "コンピューターがオフラインです。",
"a computer": "コンピューター",
diff --git a/apps/ios/Kit/Sources/CodyncKit/Resources/Languages/ko.json b/apps/ios/Kit/Sources/CodyncKit/Resources/Languages/ko.json
index 3553984c..815dc798 100644
--- a/apps/ios/Kit/Sources/CodyncKit/Resources/Languages/ko.json
+++ b/apps/ios/Kit/Sources/CodyncKit/Resources/Languages/ko.json
@@ -49,6 +49,7 @@
"Connects on Wi-Fi, over Tailscale, or from anywhere through Cloudflare, on its own. End-to-end encrypted.": "Wi-Fi, Tailscale 또는 Cloudflare를 통해 어디서나 자체적으로 연결됩니다. 엔드투엔드 암호화.",
"Connecting": "연결 중",
"Connecting…": "연결 중…",
+ "If Codync saves you trips to your desk, a star on GitHub helps other people find it.": "Codync가 자리에 가는 수고를 덜어주고 있다면, GitHub에 스타를 눌러 다른 사람들이 찾을 수 있도록 도와주세요.",
"Updating…": "업데이트 중…",
"Connection": "연결",
"Continue": "계속",
@@ -1744,7 +1745,6 @@
"Works once, until {time}": "한 번만 사용 가능, {time}까지",
"Yellow": "노란색",
"You wrote it": "직접 작성함",
- "You've been using Codync for a while. If it saves you trips to your desk, a star on GitHub helps other people find it.": "Codync를 한동안 사용해 주셨네요. 자리에 가는 수고를 덜어주고 있다면, GitHub에 스타를 눌러 다른 사람들이 찾을 수 있도록 도와주세요.",
"Your bots are idle. Message one from here, or open Codync.": "봇들이 대기 중입니다. 여기서 한 봇에게 메시지를 보내거나 Codync를 여세요.",
"Your computer is offline.": "컴퓨터가 오프라인입니다.",
"a computer": "컴퓨터",
diff --git a/apps/ios/Kit/Sources/CodyncKit/Resources/Languages/pt-BR.json b/apps/ios/Kit/Sources/CodyncKit/Resources/Languages/pt-BR.json
index be89a0b1..c08d64b4 100644
--- a/apps/ios/Kit/Sources/CodyncKit/Resources/Languages/pt-BR.json
+++ b/apps/ios/Kit/Sources/CodyncKit/Resources/Languages/pt-BR.json
@@ -49,6 +49,7 @@
"Connects on Wi-Fi, over Tailscale, or from anywhere through Cloudflare, on its own. End-to-end encrypted.": "Conecta automaticamente por Wi-Fi, pelo Tailscale ou de qualquer lugar pelo Cloudflare. Com criptografia de ponta a ponta.",
"Connecting": "Conectando",
"Connecting…": "Conectando…",
+ "If Codync saves you trips to your desk, a star on GitHub helps other people find it.": "Se o Codync economiza idas até a mesa de trabalho, uma estrela no GitHub ajuda outras pessoas a encontrá-lo.",
"Updating…": "Atualizando…",
"Connection": "Conexão",
"Continue": "Continuar",
@@ -1744,7 +1745,6 @@
"Works once, until {time}": "Funciona uma vez, até {time}",
"Yellow": "Amarelo",
"You wrote it": "Você escreveu",
- "You've been using Codync for a while. If it saves you trips to your desk, a star on GitHub helps other people find it.": "Você usa o Codync há algum tempo. Se ele economiza idas até a mesa de trabalho, uma estrela no GitHub ajuda outras pessoas a encontrá-lo.",
"Your bots are idle. Message one from here, or open Codync.": "Seus bots estão ociosos. Envie uma mensagem para um deles daqui ou abra o Codync.",
"Your computer is offline.": "Seu computador está offline.",
"a computer": "um computador",
diff --git a/apps/ios/Kit/Sources/CodyncKit/Resources/Languages/ru.json b/apps/ios/Kit/Sources/CodyncKit/Resources/Languages/ru.json
index 40ec2865..f05cc0f7 100644
--- a/apps/ios/Kit/Sources/CodyncKit/Resources/Languages/ru.json
+++ b/apps/ios/Kit/Sources/CodyncKit/Resources/Languages/ru.json
@@ -49,6 +49,7 @@
"Connects on Wi-Fi, over Tailscale, or from anywhere through Cloudflare, on its own. End-to-end encrypted.": "Подключается сам: по Wi-Fi, через Tailscale или откуда угодно через Cloudflare. Сквозное шифрование.",
"Connecting": "Подключение",
"Connecting…": "Подключение…",
+ "If Codync saves you trips to your desk, a star on GitHub helps other people find it.": "Если Codync экономит вам время, звезда на GitHub поможет другим его найти.",
"Updating…": "Обновление…",
"Connection": "Подключение",
"Continue": "Продолжить",
@@ -1744,7 +1745,6 @@
"Works once, until {time}": "Работает один раз, до {time}",
"Yellow": "Жёлтый",
"You wrote it": "Написано вами",
- "You've been using Codync for a while. If it saves you trips to your desk, a star on GitHub helps other people find it.": "Вы уже давно пользуетесь Codync. Если он экономит вам время, звезда на GitHub поможет другим его найти.",
"Your bots are idle. Message one from here, or open Codync.": "Ваши боты свободны. Напишите одному из них отсюда или откройте Codync.",
"Your computer is offline.": "Ваш компьютер не в сети.",
"a computer": "компьютер",
diff --git a/apps/ios/Kit/Sources/CodyncKit/Resources/Languages/zh-Hans.json b/apps/ios/Kit/Sources/CodyncKit/Resources/Languages/zh-Hans.json
index 11417d3d..2f90c937 100644
--- a/apps/ios/Kit/Sources/CodyncKit/Resources/Languages/zh-Hans.json
+++ b/apps/ios/Kit/Sources/CodyncKit/Resources/Languages/zh-Hans.json
@@ -49,6 +49,7 @@
"Connects on Wi-Fi, over Tailscale, or from anywhere through Cloudflare, on its own. End-to-end encrypted.": "会自己走 Wi-Fi、Tailscale,或经 Cloudflare 从任何地方连接。端到端加密。",
"Connecting": "正在连接",
"Connecting…": "正在连接…",
+ "If Codync saves you trips to your desk, a star on GitHub helps other people find it.": "如果 Codync 帮你省下了来回走动的时间,在 GitHub 上点个星标,能帮助更多人找到它。",
"Updating…": "正在更新…",
"Connection": "连接",
"Continue": "继续",
@@ -1744,7 +1745,6 @@
"Works once, until {time}": "仅可使用一次,{time} 前有效",
"Yellow": "黄色",
"You wrote it": "由你写下",
- "You've been using Codync for a while. If it saves you trips to your desk, a star on GitHub helps other people find it.": "你已经使用 Codync 一段时间了。如果它帮你省下了来回走动的时间,在 GitHub 上点个星标,能帮助更多人找到它。",
"Your bots are idle. Message one from here, or open Codync.": "你的 Bot 目前空闲。可以在这里给其中一个发消息,或打开 Codync。",
"Your computer is offline.": "你的电脑离线了。",
"a computer": "一台电脑",
diff --git a/apps/ios/Kit/Sources/CodyncKit/Resources/Languages/zh-Hant.json b/apps/ios/Kit/Sources/CodyncKit/Resources/Languages/zh-Hant.json
index 406723bb..85090ea7 100644
--- a/apps/ios/Kit/Sources/CodyncKit/Resources/Languages/zh-Hant.json
+++ b/apps/ios/Kit/Sources/CodyncKit/Resources/Languages/zh-Hant.json
@@ -49,6 +49,7 @@
"Connects on Wi-Fi, over Tailscale, or from anywhere through Cloudflare, on its own. End-to-end encrypted.": "會自己走 Wi-Fi、Tailscale,或經 Cloudflare 從任何地方連線。端到端加密。",
"Connecting": "正在連線",
"Connecting…": "正在連線…",
+ "If Codync saves you trips to your desk, a star on GitHub helps other people find it.": "如果 Codync 幫你省下了來回走動的時間,在 GitHub 上點個星標,能幫助更多人找到它。",
"Updating…": "正在更新…",
"Connection": "連線",
"Continue": "繼續",
@@ -1744,7 +1745,6 @@
"Works once, until {time}": "僅可使用一次,{time} 前有效",
"Yellow": "黃色",
"You wrote it": "由你寫下",
- "You've been using Codync for a while. If it saves you trips to your desk, a star on GitHub helps other people find it.": "你已經使用 Codync 一段時間了。如果它幫你省下了來回走動的時間,在 GitHub 上點個星標,能幫助更多人找到它。",
"Your bots are idle. Message one from here, or open Codync.": "你的 Bot 目前閒置。可以在這裡傳訊息給其中一個,或開啟 Codync。",
"Your computer is offline.": "你的電腦離線了。",
"a computer": "一臺電腦",
diff --git a/apps/ios/Kit/Sources/CodyncKit/Review/ReviewCompletion.swift b/apps/ios/Kit/Sources/CodyncKit/Review/ReviewCompletion.swift
deleted file mode 100644
index a408a174..00000000
--- a/apps/ios/Kit/Sources/CodyncKit/Review/ReviewCompletion.swift
+++ /dev/null
@@ -1,20 +0,0 @@
-import Foundation
-
-/// Uses host-owned turn IDs/final flags; never infers satisfaction from message content.
-enum ReviewCompletion {
- static func match(entries: [Entry], sent: [String: Date], now: Date) -> [String]? {
- let chat = entries.filter { $0.isChat && $0.data.call == nil }
- guard let final = chat.last, final.kind == "agent", final.data.final == true, final.turn > 0 else { return nil }
- let turn = entries.filter { $0.turn == final.turn }
- // Non-successful completions and stops produce notices; be conservative about all notices.
- guard !turn.contains(where: { $0.kind == "notice" || $0.data.status == "failed" || $0.data.status == "cancelled" }) else { return nil }
- let nonces = turn.compactMap { entry -> String? in
- guard entry.kind == "user", entry.data.status == "sent", entry.data.call == nil,
- entry.data.routineId == nil, entry.data.from == nil,
- let nonce = entry.data.clientNonce, let date = sent[nonce],
- now.timeIntervalSince(date) < 30 * ReviewHistory.day else { return nil }
- return nonce
- }
- return nonces.isEmpty ? nil : nonces
- }
-}
diff --git a/apps/ios/Kit/Sources/CodyncKit/Review/ReviewHistory.swift b/apps/ios/Kit/Sources/CodyncKit/Review/ReviewHistory.swift
index 8a539da4..78476260 100644
--- a/apps/ios/Kit/Sources/CodyncKit/Review/ReviewHistory.swift
+++ b/apps/ios/Kit/Sources/CodyncKit/Review/ReviewHistory.swift
@@ -5,36 +5,46 @@ struct ReviewHistory: Codable {
struct Request: Codable {
let date: Date
let version: String
- let completed: Int
+ let prompts: Int
}
static let day: TimeInterval = 86_400
- var firstUse: Date
- var activeDays: Set<String> = []
- var completed = 0
+ /// The prompt that brings the first request, and how many more each later one needs.
+ static let promptsPerRequest = 5
+ var prompts = 0
var requests: [Request] = []
var requestedVersions: Set<String> = []
- var sent: [String: Date] = [:]
-
- mutating func recordActivity(at now: Date) {
- let parts = Calendar.current.dateComponents([.year, .month, .day], from: now)
- activeDays.insert("\(parts.year ?? 0)-\(parts.month ?? 0)-\(parts.day ?? 0)")
- // Only the three-day milestone matters; retain a bounded set after reaching it.
- if activeDays.count > 3 { activeDays = Set(activeDays.sorted().suffix(3)) }
- }
func eligible(at now: Date, version: String) -> Bool {
- guard now.timeIntervalSince(firstUse) >= 7 * Self.day,
- activeDays.count >= 3, completed >= 5,
+ guard prompts >= Self.promptsPerRequest,
!requestedVersions.contains(version),
requests.filter({ now.timeIntervalSince($0.date) < 365 * Self.day }).count < 2 else { return false }
guard let last = requests.last else { return true }
- return now.timeIntervalSince(last.date) >= 120 * Self.day && completed - last.completed >= 5
+ return now.timeIntervalSince(last.date) >= 120 * Self.day && prompts - last.prompts >= Self.promptsPerRequest
}
mutating func recordRequest(at now: Date, version: String) {
requestedVersions.insert(version)
requests.removeAll { now.timeIntervalSince($0.date) >= 365 * Self.day }
- requests.append(Request(date: now, version: version, completed: completed))
+ requests.append(Request(date: now, version: version, prompts: prompts))
+ }
+}
+
+/// A history saved before 2.39.1 counted results, not prompts: its requests still hold, and prompts start at zero.
+extension ReviewHistory {
+ init(from decoder: any Decoder) throws {
+ let values = try decoder.container(keyedBy: CodingKeys.self)
+ prompts = try values.decodeIfPresent(Int.self, forKey: .prompts) ?? 0
+ requests = try values.decode([Request].self, forKey: .requests)
+ requestedVersions = try values.decode(Set<String>.self, forKey: .requestedVersions)
+ }
+}
+
+extension ReviewHistory.Request {
+ init(from decoder: any Decoder) throws {
+ let values = try decoder.container(keyedBy: CodingKeys.self)
+ date = try values.decode(Date.self, forKey: .date)
+ version = try values.decode(String.self, forKey: .version)
+ prompts = try values.decodeIfPresent(Int.self, forKey: .prompts) ?? 0
}
}
diff --git a/apps/ios/Kit/Sources/CodyncKit/Review/ReviewInvitation.swift b/apps/ios/Kit/Sources/CodyncKit/Review/ReviewInvitation.swift
index 24ca8312..f1b0af60 100644
--- a/apps/ios/Kit/Sources/CodyncKit/Review/ReviewInvitation.swift
+++ b/apps/ios/Kit/Sources/CodyncKit/Review/ReviewInvitation.swift
@@ -7,17 +7,15 @@ import os
public final class ReviewInvitation {
public static let shared = ReviewInvitation()
static let storageKey = "reviewInvitation.v1"
+ /// E2E flows launch with this argument on: the system's window would cover what they tap.
+ static let offKey = "reviewInvitationOff"
private static let log = Logger(subsystem: "com.pokai.Codync", category: "ReviewInvitation")
private let defaults: UserDefaults
private let capture: @MainActor (AnalyticsEvent) -> Void
private var history: ReviewHistory
- private var activeSince: Date?
- private var viewedChat: String?
public private(set) var opportunity: UUID?
- private var interruptions: Set<UUID> = []
- public var isInterrupted: Bool { !interruptions.isEmpty }
- init(defaults: UserDefaults = .standard, now: Date = .now,
+ init(defaults: UserDefaults = .standard,
capture: @escaping @MainActor (AnalyticsEvent) -> Void = { Analytics.shared.capture($0) }) {
self.defaults = defaults
self.capture = capture
@@ -25,84 +23,28 @@ public final class ReviewInvitation {
do { history = try JSONDecoder().decode(ReviewHistory.self, from: data) }
catch {
Self.log.error("Cannot read review history: \(error.localizedDescription)")
- history = ReviewHistory(firstUse: now)
+ history = ReviewHistory()
}
- } else { history = ReviewHistory(firstUse: now) }
- prune(at: now)
- save()
- }
-
- public func setInterrupted(_ token: UUID, active: Bool) {
- if active {
- interruptions.insert(token)
- cancel(.unavailable)
- } else { interruptions.remove(token) }
- }
-
- public func setActive(_ active: Bool, now: Date = .now) {
- if active {
- prune(at: now)
- save()
- if activeSince == nil { activeSince = now }
- } else {
- activeSince = nil
- viewedChat = nil
- cancel(.background)
- }
- }
-
- public func sent(_ nonce: String, now: Date = .now) {
- prune(at: now)
- if history.sent.count >= 100, let oldest = history.sent.min(by: { $0.value < $1.value })?.key {
- history.sent[oldest] = nil
- }
- history.sent[nonce] = now
- history.recordActivity(at: now)
- viewedChat = nil
- cancel(.interaction)
- save()
+ } else { history = ReviewHistory() }
}
- /// Called only after an unobscured final answer at the bottom of the chat stayed visible.
- public func viewed(chat: String, entries: [Entry], now: Date = .now) {
- guard activeSince != nil, !isInterrupted,
- let result = ReviewCompletion.match(entries: entries, sent: history.sent, now: now) else { return }
- for nonce in result { history.sent[nonce] = nil }
- history.completed += 1
- history.recordActivity(at: now)
- viewedChat = chat
+ /// A prompt reached the computer or its mailbox. One the app couldn't ask on (backgrounded) leaves the next prompt to ask.
+ public func sent(version: String = AppVersion.current, now: Date = .now) {
+ history.prompts += 1
save()
- }
-
- public func returned(from chat: String, version: String = AppVersion.current, now: Date = .now) {
- defer { viewedChat = nil }
- guard !isInterrupted, viewedChat == chat, let activeSince, now.timeIntervalSince(activeSince) >= 60,
- history.eligible(at: now, version: version) else { return }
- opportunity = UUID()
- capture(.reviewOpportunity(completed: history.completed))
- }
-
- public func cancel(_ reason: AnalyticsEvent.ReviewCancellation) {
- guard opportunity != nil else { return }
- opportunity = nil
- capture(.reviewCancelled(reason))
+ if !defaults.bool(forKey: Self.offKey), history.eligible(at: now, version: version) { opportunity = UUID() }
}
/// Persist before StoreKit: an undisplayed request still consumes our own cooldown.
public func request(_ token: UUID, version: String = AppVersion.current, now: Date = .now) -> Bool {
- guard !isInterrupted, opportunity == token, let activeSince, now.timeIntervalSince(activeSince) >= 60,
- history.eligible(at: now, version: version) else { return false }
+ guard opportunity == token else { return false }
opportunity = nil
history.recordRequest(at: now, version: version)
save()
- capture(.reviewRequested(completed: history.completed))
+ capture(.reviewRequested(prompts: history.prompts))
return true
}
- private func prune(at now: Date) {
- history.sent = history.sent.filter { now.timeIntervalSince($0.value) < 30 * ReviewHistory.day }
- }
-
private func save() {
do { defaults.set(try JSONEncoder().encode(history), forKey: Self.storageKey) }
catch { Self.log.error("Cannot save review history: \(error.localizedDescription)") }
diff --git a/apps/ios/Kit/Sources/CodyncUI/Chrome.swift b/apps/ios/Kit/Sources/CodyncUI/Chrome.swift
index 0014b1a6..d30b2fca 100644
--- a/apps/ios/Kit/Sources/CodyncUI/Chrome.swift
+++ b/apps/ios/Kit/Sources/CodyncUI/Chrome.swift
@@ -166,19 +166,16 @@ public extension View {
/// Content titles itself with `ModalHeader` and closes with `\.dismissModal`.
func codyncSheet<Sheet: View>(isPresented: Binding<Bool>, @ViewBuilder content: @escaping () -> Sheet) -> some View {
modifier(CodyncSheet(isPresented: isPresented, sheet: content))
- .reviewInterruption(active: isPresented.wrappedValue)
}
func codyncSheet<Item: Identifiable, Sheet: View>(item: Binding<Item?>, @ViewBuilder content: @escaping (Item) -> Sheet) -> some View {
modifier(CodyncItemSheet(item: item, sheet: content))
- .reviewInterruption(active: item.wrappedValue != nil)
}
/// Presents a full-window layer the content draws itself (dialogs, the remote screen), fading in and out.
/// `close` animates it away.
func codyncOverlay<Layer: View>(isPresented: Binding<Bool>, @ViewBuilder content: @escaping (_ close: @escaping () -> Void) -> Layer) -> some View {
modifier(CodyncOverlay(isPresented: isPresented, layer: content))
- .reviewInterruption(active: isPresented.wrappedValue)
}
}
diff --git a/apps/ios/Kit/Sources/CodyncUI/Dialog.swift b/apps/ios/Kit/Sources/CodyncUI/Dialog.swift
index 67349dd8..dfcc9b47 100644
--- a/apps/ios/Kit/Sources/CodyncUI/Dialog.swift
+++ b/apps/ios/Kit/Sources/CodyncUI/Dialog.swift
@@ -39,7 +39,6 @@ public extension View {
actions: @escaping () -> [DialogAction]) -> some View {
modifier(CodyncDialog(title: title, message: message, field: field, cancel: cancel, inPlace: inPlace,
isPresented: isPresented, actions: actions))
- .reviewInterruption(active: isPresented.wrappedValue)
}
}
diff --git a/apps/ios/Kit/Sources/CodyncUI/ReviewInterruption.swift b/apps/ios/Kit/Sources/CodyncUI/ReviewInterruption.swift
deleted file mode 100644
index 20f3a837..00000000
--- a/apps/ios/Kit/Sources/CodyncUI/ReviewInterruption.swift
+++ /dev/null
@@ -1,21 +0,0 @@
-import CodyncKit
-import SwiftUI
-
-extension View {
- /// Shared presentations and editing suspend the continuous result-reading timer.
- func reviewInterruption(active: Bool) -> some View {
- modifier(ReviewInterruption(active: active))
- }
-}
-
-private struct ReviewInterruption: ViewModifier {
- let active: Bool
- @State private var token = UUID()
-
- func body(content: Content) -> some View {
- content
- .onAppear { ReviewInvitation.shared.setInterrupted(token, active: active) }
- .onChange(of: active) { _, active in ReviewInvitation.shared.setInterrupted(token, active: active) }
- .onDisappear { ReviewInvitation.shared.setInterrupted(token, active: false) }
- }
-}
diff --git a/apps/ios/Kit/Sources/CodyncUI/Store/BotStore+Sending.swift b/apps/ios/Kit/Sources/CodyncUI/Store/BotStore+Sending.swift
index f22a6734..efc81c4d 100644
--- a/apps/ios/Kit/Sources/CodyncUI/Store/BotStore+Sending.swift
+++ b/apps/ios/Kit/Sources/CodyncUI/Store/BotStore+Sending.swift
@@ -73,7 +73,6 @@ extension BotStore {
let trimmed = text.trimmingCharacters(in: .whitespacesAndNewlines)
guard !trimmed.isEmpty || !files.isEmpty, !retired else { return nil }
lastSentNonce = nonce
- if call == nil { ReviewInvitation.shared.sent(nonce) }
var data = EntryData(text: trimmed, status: "sending", clientNonce: nonce)
data.call = call
// Shown at once; the computer's own quote replaces it.
@@ -119,6 +118,8 @@ extension BotStore {
}
outgoingFiles[nonce] = nil
upsert(e)
+ // Only once it arrived, so a resend counts once.
+ if call == nil { onPromptSent() }
if let bot = bots[botId] { onSent?(bot, .delivered) }
return .delivered
} catch {
@@ -138,6 +139,7 @@ extension BotStore {
do {
try Task.checkCancellation()
try await remote.enqueue(botId: botId, text: text, clientNonce: nonce, replyTo: replyTo)
+ onPromptSent()
if let bot = bots[botId] { onSent?(bot, .queued) }
return .queued
} catch MailboxError.hostOnline {
diff --git a/apps/ios/Kit/Sources/CodyncUI/Store/BotStore.swift b/apps/ios/Kit/Sources/CodyncUI/Store/BotStore.swift
index 1e1da537..d999cf61 100644
--- a/apps/ios/Kit/Sources/CodyncUI/Store/BotStore.swift
+++ b/apps/ios/Kit/Sources/CodyncUI/Store/BotStore.swift
@@ -97,6 +97,8 @@ public final class BotStore {
public var onUsageChanged: (@MainActor (ComputerID, Usage) -> Void)?
/// A message to the bot from this phone moved along (the Live Activity follows it).
public var onSent: (@MainActor (Bot, SendProgress) -> Void)?
+ /// A prompt reached the computer or its mailbox.
+ var onPromptSent: @MainActor () -> Void = { ReviewInvitation.shared.sent() }
/// A bot appeared, changed or went away.
var onRosterChanged: (@MainActor () -> Void)?
/// The computer's addresses or keys changed (merged from its `hello`); persist it.
diff --git a/apps/ios/Kit/Sources/CodyncUI/Thread/Composer.swift b/apps/ios/Kit/Sources/CodyncUI/Thread/Composer.swift
index 0a8de10d..a599cabc 100644
--- a/apps/ios/Kit/Sources/CodyncUI/Thread/Composer.swift
+++ b/apps/ios/Kit/Sources/CodyncUI/Thread/Composer.swift
@@ -153,8 +153,6 @@ struct Composer: View {
append(picked.map(\.file))
return true
}
- .reviewInterruption(active: focused || pickingFiles || pickingPhotos || !files.isEmpty
- || dictation.listening || dictation.transcribing)
.fileImporter(isPresented: $pickingFiles, allowedContentTypes: [.item], allowsMultipleSelection: true) { result in
if case .success(let urls) = result { add(urls) }
}
diff --git a/apps/ios/Kit/Sources/CodyncUI/Thread/ReviewReading.swift b/apps/ios/Kit/Sources/CodyncUI/Thread/ReviewReading.swift
deleted file mode 100644
index 0db681ee..00000000
--- a/apps/ios/Kit/Sources/CodyncUI/Thread/ReviewReading.swift
+++ /dev/null
@@ -1,32 +0,0 @@
-import CodyncKit
-import SwiftUI
-
-extension View {
- func reviewReading(botId: String, unobscured: Bool) -> some View {
- modifier(ReviewReading(botId: botId, unobscured: unobscured))
- }
-}
-
-private struct ReviewReading: ViewModifier {
- let botId: String
- let unobscured: Bool
- @Environment(BotStore.self) private var model
- @Environment(\.scenePhase) private var phase
-
- private struct Reading: Equatable {
- let entries: [Entry]
- let ready: Bool
- }
-
- func body(content: Content) -> some View {
- let reading = Reading(entries: model.chat(botId), ready: unobscured && !ReviewInvitation.shared.isInterrupted && phase == .active
- && model.connection == .online && model.mismatch == nil && model.lastError == nil
- && model.screenRequest == nil && model.bots[botId]?.status == "idle")
- content.task(id: reading) {
- guard reading.ready else { return }
- do { try await Task.sleep(for: .seconds(3)) } catch { return }
- guard !Task.isCancelled else { return }
- ReviewInvitation.shared.viewed(chat: "\(model.storage.id)/\(model.computer.id)/\(botId)", entries: reading.entries)
- }
- }
-}
diff --git a/apps/ios/Kit/Sources/CodyncUI/Thread/ThreadView.swift b/apps/ios/Kit/Sources/CodyncUI/Thread/ThreadView.swift
index 52bb497f..11f9e085 100644
--- a/apps/ios/Kit/Sources/CodyncUI/Thread/ThreadView.swift
+++ b/apps/ios/Kit/Sources/CodyncUI/Thread/ThreadView.swift
@@ -66,9 +66,6 @@ public struct ThreadView: View {
var conversation: some View {
chrome(chat)
.readingConversation(botId)
- .reviewReading(botId: botId, unobscured: following && !calling && !showTrace && botChat == nil
- && openArtifact == nil && openCall == nil && details == nil && !editingGroup
- && model.composerDraft(for: botId).isEmpty && model.fileDownloads.export == nil)
.onChange(of: model.voiceCallRequest, initial: true) { _, _ in
if model.takeVoiceCallRequest(for: botId) { startShortcutCall() }
}
diff --git a/apps/ios/Kit/Tests/CodyncKitTests/ReviewInvitationTests.swift b/apps/ios/Kit/Tests/CodyncKitTests/ReviewInvitationTests.swift
index c632d00b..dbcda66e 100644
--- a/apps/ios/Kit/Tests/CodyncKitTests/ReviewInvitationTests.swift
+++ b/apps/ios/Kit/Tests/CodyncKitTests/ReviewInvitationTests.swift
@@ -4,126 +4,76 @@ import Testing
private let reviewNow = Date(timeIntervalSince1970: 1_800_000_000)
-private func eligibleHistory() -> ReviewHistory {
- ReviewHistory(firstUse: reviewNow.addingTimeInterval(-8 * ReviewHistory.day),
- activeDays: ["2026-1-1", "2026-1-2", "2026-1-3"], completed: 5)
+@MainActor
+private func tracker(_ suite: String) -> ReviewInvitation {
+ ReviewInvitation(defaults: UserDefaults(suiteName: suite)!, capture: { _ in })
}
-@Test func reviewRequiresAgeActiveDaysAndCompletedInteractions() {
- let now = reviewNow
- var history = eligibleHistory()
- #expect(history.eligible(at: now, version: "2.29.0"))
- history.firstUse = now.addingTimeInterval(-7 * ReviewHistory.day + 1)
- #expect(!history.eligible(at: now, version: "2.29.0"))
- history.firstUse = now.addingTimeInterval(-7 * ReviewHistory.day)
- #expect(history.eligible(at: now, version: "2.29.0"))
- history.activeDays.remove("2026-1-3")
- #expect(!history.eligible(at: now, version: "2.29.0"))
- history = eligibleHistory()
- history.completed = 4
- #expect(!history.eligible(at: now, version: "2.29.0"))
+@Test func reviewBecomesEligibleAtTheFifthPrompt() {
+ var history = ReviewHistory(prompts: 4)
+ #expect(!history.eligible(at: reviewNow, version: "2.29.0"))
+ history.prompts = 5
+ #expect(history.eligible(at: reviewNow, version: "2.29.0"))
}
@Test func reviewCooldownSurvivesVersionsAndRequiresNewUse() {
- var history = eligibleHistory()
+ var history = ReviewHistory(prompts: 5)
history.recordRequest(at: reviewNow, version: "2.29.0")
- history.completed += 5
+ history.prompts += 5
#expect(!history.eligible(at: reviewNow.addingTimeInterval(120 * ReviewHistory.day - 1), version: "2.30.0"))
let later = reviewNow.addingTimeInterval(120 * ReviewHistory.day)
#expect(!history.eligible(at: later, version: "2.29.0"))
#expect(history.eligible(at: later, version: "2.30.0"))
- history.completed -= 1
+ history.prompts -= 1
#expect(!history.eligible(at: later, version: "2.30.0"))
}
@Test func reviewAllowsAtMostTwoRequestsInRollingYear() {
- var history = eligibleHistory()
+ var history = ReviewHistory(prompts: 5)
history.recordRequest(at: reviewNow, version: "2.29.0")
- history.completed += 5
+ history.prompts += 5
history.recordRequest(at: reviewNow.addingTimeInterval(120 * ReviewHistory.day), version: "2.30.0")
- history.completed += 5
+ history.prompts += 5
#expect(!history.eligible(at: reviewNow.addingTimeInterval(364 * ReviewHistory.day), version: "2.31.0"))
#expect(history.eligible(at: reviewNow.addingTimeInterval(365 * ReviewHistory.day), version: "2.31.0"))
}
-private func reviewEntries(nonce: String = "local-send", turn: Int64 = 1) -> [Entry] {
- var final = EntryData(text: "Done")
- final.final = true
- return [
- Entry(id: "u", seq: 1, botId: "b", rev: 1, kind: "user", turn: turn,
- data: EntryData(text: "Hello", status: "sent", clientNonce: nonce), createdAt: 1, updatedAt: 1),
- Entry(id: "a", seq: 2, botId: "b", rev: 2, kind: "agent", turn: turn, data: final, createdAt: 2, updatedAt: 2),
- ]
-}
-
-@Test func reviewIgnoresHistoricalOtherDeviceAndExpiredSends() {
- let entries = reviewEntries()
- #expect(ReviewCompletion.match(entries: entries, sent: [:], now: reviewNow) == nil)
- #expect(ReviewCompletion.match(entries: entries, sent: ["another-device": reviewNow], now: reviewNow) == nil)
- #expect(ReviewCompletion.match(entries: entries, sent: ["local-send": reviewNow.addingTimeInterval(-30 * ReviewHistory.day)], now: reviewNow) == nil)
- #expect(ReviewCompletion.match(entries: entries, sent: ["local-send": reviewNow], now: reviewNow) == ["local-send"])
-}
-
-@Test func reviewIgnoresPartialFailedCancelledAndRoutineTurns() {
- let sent = ["local-send": reviewNow]
- var entries = reviewEntries()
- entries[1].data.final = false
- #expect(ReviewCompletion.match(entries: entries, sent: sent, now: reviewNow) == nil)
- for status in ["failed", "cancelled", "queued"] {
- entries = reviewEntries()
- entries[0].data.status = status
- #expect(ReviewCompletion.match(entries: entries, sent: sent, now: reviewNow) == nil)
- }
- entries = reviewEntries()
- entries[0].data.routineId = "routine"
- #expect(ReviewCompletion.match(entries: entries, sent: sent, now: reviewNow) == nil)
- entries = reviewEntries()
- var notice = entries[1]
- notice.id = "stop"; notice.kind = "notice"; notice.data = EntryData(text: "Stopped.")
- entries.append(notice)
- #expect(ReviewCompletion.match(entries: entries, sent: sent, now: reviewNow) == nil)
+@Test func reviewRemembersVersionsAfterOldAttemptsExpire() {
+ var history = ReviewHistory(prompts: 5)
+ history.recordRequest(at: reviewNow, version: "2.29.0")
+ history.prompts += 5
+ let nextYear = reviewNow.addingTimeInterval(366 * ReviewHistory.day)
+ history.recordRequest(at: nextYear, version: "2.30.0")
+ history.prompts += 5
+ #expect(!history.eligible(at: nextYear.addingTimeInterval(120 * ReviewHistory.day), version: "2.29.0"))
}
@MainActor
-@Test func reviewCountsTurnOnceAcrossReplaysAndRelaunch() throws {
+@Test func reviewOpensAtTheFifthPromptAcrossRelaunches() {
let suite = UUID().uuidString
- let defaults = UserDefaults(suiteName: suite)!
- defer { defaults.removePersistentDomain(forName: suite) }
- let tracker = ReviewInvitation(defaults: defaults, now: reviewNow, capture: { _ in })
- tracker.setActive(true, now: reviewNow)
- tracker.sent("local-send", now: reviewNow)
- tracker.viewed(chat: "c/b", entries: reviewEntries(), now: reviewNow)
- tracker.viewed(chat: "c/b", entries: reviewEntries(), now: reviewNow)
- let relaunched = ReviewInvitation(defaults: defaults, now: reviewNow, capture: { _ in })
- relaunched.setActive(true, now: reviewNow)
- relaunched.viewed(chat: "c/b", entries: reviewEntries(), now: reviewNow)
- let history = try JSONDecoder().decode(ReviewHistory.self, from: #require(defaults.data(forKey: ReviewInvitation.storageKey)))
- #expect(history.completed == 1)
+ defer { UserDefaults(suiteName: suite)!.removePersistentDomain(forName: suite) }
+ let first = tracker(suite)
+ for _ in 1...4 { first.sent(version: "2.29.0", now: reviewNow) }
+ #expect(first.opportunity == nil)
+ let relaunched = tracker(suite)
+ #expect(relaunched.opportunity == nil)
+ relaunched.sent(version: "2.29.0", now: reviewNow)
+ #expect(relaunched.opportunity != nil)
}
@MainActor
-@Test func reviewOnlyRequestsAfterReturnAndCancelsOnBackground() throws {
+@Test func reviewMissedRequestLeavesTheNextPromptToAsk() throws {
let suite = UUID().uuidString
- let defaults = UserDefaults(suiteName: suite)!
- defer { defaults.removePersistentDomain(forName: suite) }
- try defaults.set(JSONEncoder().encode(eligibleHistory()), forKey: ReviewInvitation.storageKey)
- var events: [AnalyticsEvent] = []
- let tracker = ReviewInvitation(defaults: defaults, now: reviewNow, capture: { events.append($0) })
- tracker.setActive(true, now: reviewNow)
- tracker.sent("local-send", now: reviewNow)
- tracker.viewed(chat: "c/b", entries: reviewEntries(), now: reviewNow)
- #expect(tracker.opportunity == nil)
- tracker.returned(from: "c/b", version: "2.29.0", now: reviewNow.addingTimeInterval(59))
- #expect(tracker.opportunity == nil)
- tracker.sent("next", now: reviewNow)
- tracker.viewed(chat: "c/b", entries: reviewEntries(nonce: "next", turn: 2), now: reviewNow)
- tracker.returned(from: "c/b", version: "2.29.0", now: reviewNow.addingTimeInterval(60))
- let token = try #require(tracker.opportunity)
- tracker.setActive(false)
- #expect(!tracker.request(token, version: "2.29.0", now: reviewNow.addingTimeInterval(62)))
- #expect(events.last == .reviewCancelled(.background))
- tracker.setActive(true, now: reviewNow.addingTimeInterval(100))
- #expect(tracker.opportunity == nil)
+ defer { UserDefaults(suiteName: suite)!.removePersistentDomain(forName: suite) }
+ let invitation = tracker(suite)
+ for _ in 1...5 { invitation.sent(version: "2.29.0", now: reviewNow) }
+ let missed = try #require(invitation.opportunity)
+ invitation.sent(version: "2.29.0", now: reviewNow)
+ let next = try #require(invitation.opportunity)
+ #expect(next != missed)
+ #expect(!invitation.request(missed, version: "2.29.0", now: reviewNow))
+ #expect(invitation.request(next, version: "2.29.0", now: reviewNow))
+ #expect(invitation.opportunity == nil)
}
@MainActor
@@ -133,82 +83,51 @@ private func reviewEntries(nonce: String = "local-send", turn: Int64 = 1) -> [En
defer { defaults.removePersistentDomain(forName: suite) }
defaults.set(false, forKey: Analytics.enabledKey)
let analytics = Analytics(defaults: defaults, upload: { _ in true })
- try defaults.set(JSONEncoder().encode(eligibleHistory()), forKey: ReviewInvitation.storageKey)
- let tracker = ReviewInvitation(defaults: defaults, now: reviewNow, capture: { analytics.capture($0) })
- tracker.setActive(true, now: reviewNow)
- tracker.sent("local-send", now: reviewNow)
- tracker.viewed(chat: "c/b", entries: reviewEntries(), now: reviewNow)
- tracker.returned(from: "c/b", version: "2.29.0", now: reviewNow.addingTimeInterval(60))
- let token = try #require(tracker.opportunity)
- #expect(tracker.request(token, version: "2.29.0", now: reviewNow.addingTimeInterval(62)))
- #expect(!tracker.request(token, version: "2.29.0", now: reviewNow.addingTimeInterval(63)))
+ let invitation = ReviewInvitation(defaults: defaults, capture: { analytics.capture($0) })
+ for _ in 1...5 { invitation.sent(version: "2.29.0", now: reviewNow) }
+ let token = try #require(invitation.opportunity)
+ #expect(invitation.request(token, version: "2.29.0", now: reviewNow))
+ #expect(!invitation.request(token, version: "2.29.0", now: reviewNow))
let history = try JSONDecoder().decode(ReviewHistory.self, from: #require(defaults.data(forKey: ReviewInvitation.storageKey)))
#expect(history.requests.count == 1)
- #expect(!history.eligible(at: reviewNow.addingTimeInterval(63), version: "2.30.0"))
+ #expect(!history.eligible(at: reviewNow, version: "2.30.0"))
#expect(analytics.pending.isEmpty)
-}
-
-@Test func reviewAnalyticsContainsOnlyCountsAndFixedNames() {
- #expect(AnalyticsEvent.reviewRequested(completed: 8).name == "review_requested")
- #expect(AnalyticsEvent.reviewRequested(completed: 8).properties == [
- "completed_interactions": .int(8), "policy": .string("v1"), "trigger": .string("return_to_bots"),
- ])
- #expect(AnalyticsEvent.reviewCancelled(.interaction).properties["reason"] == .string("interaction"))
- #expect(AnalyticsEvent.reviewLinkOpened.properties == ["source": .string("settings")])
+ invitation.sent(version: "2.29.0", now: reviewNow)
+ #expect(invitation.opportunity == nil)
}
@MainActor
-@Test func reviewDoesNotCountResultsBehindNestedPresentations() throws {
+@Test func reviewKeepsTheCooldownOfAHistoryFromBeforePromptsCounted() {
let suite = UUID().uuidString
let defaults = UserDefaults(suiteName: suite)!
defer { defaults.removePersistentDomain(forName: suite) }
- let tracker = ReviewInvitation(defaults: defaults, now: reviewNow, capture: { _ in })
- tracker.setActive(true, now: reviewNow)
- tracker.sent("local-send", now: reviewNow)
- let sheet = UUID(), picker = UUID()
- tracker.setInterrupted(sheet, active: true)
- tracker.setInterrupted(picker, active: true)
- tracker.setInterrupted(sheet, active: false)
- tracker.viewed(chat: "c/b", entries: reviewEntries(), now: reviewNow)
- var history = try JSONDecoder().decode(ReviewHistory.self, from: #require(defaults.data(forKey: ReviewInvitation.storageKey)))
- #expect(history.completed == 0)
- #expect(history.sent["local-send"] != nil)
- tracker.setInterrupted(picker, active: false)
- tracker.viewed(chat: "c/b", entries: reviewEntries(), now: reviewNow)
- history = try JSONDecoder().decode(ReviewHistory.self, from: #require(defaults.data(forKey: ReviewInvitation.storageKey)))
- #expect(history.completed == 1)
+ let asked = reviewNow.timeIntervalSinceReferenceDate
+ let older = #"{"firstUse":\#(asked),"activeDays":["2026-10-1"],"completed":9,"sent":{},"#
+ + #""requests":[{"date":\#(asked),"version":"2.38.0","completed":5}],"requestedVersions":["2.38.0"]}"#
+ defaults.set(Data(older.utf8), forKey: ReviewInvitation.storageKey)
+ let invitation = tracker(suite)
+ let due = reviewNow.addingTimeInterval(120 * ReviewHistory.day)
+ for _ in 1...5 { invitation.sent(version: "2.40.0", now: due.addingTimeInterval(-1)) }
+ #expect(invitation.opportunity == nil)
+ invitation.sent(version: "2.38.0", now: due)
+ #expect(invitation.opportunity == nil)
+ invitation.sent(version: "2.40.0", now: due)
+ #expect(invitation.opportunity != nil)
}
@MainActor
-@Test func reviewRemovesExpiredNoncesOnNextLaunch() throws {
+@Test func reviewStaysOutOfTheWayOfE2EFlows() {
let suite = UUID().uuidString
let defaults = UserDefaults(suiteName: suite)!
defer { defaults.removePersistentDomain(forName: suite) }
- var history = eligibleHistory()
- history.sent = ["old": reviewNow.addingTimeInterval(-30 * ReviewHistory.day), "recent": reviewNow]
- try defaults.set(JSONEncoder().encode(history), forKey: ReviewInvitation.storageKey)
- _ = ReviewInvitation(defaults: defaults, now: reviewNow, capture: { _ in })
- let saved = try JSONDecoder().decode(ReviewHistory.self, from: #require(defaults.data(forKey: ReviewInvitation.storageKey)))
- #expect(saved.sent == ["recent": reviewNow])
-}
-
-@Test func reviewCountsSeveralMessagesInOneTurnTogetherAndExcludesCalls() {
- var entries = reviewEntries()
- var second = entries[0]
- second.id = "u2"; second.seq = 2; second.data.clientNonce = "second"
- entries.insert(second, at: 1)
- #expect(ReviewCompletion.match(entries: entries, sent: ["local-send": reviewNow, "second": reviewNow], now: reviewNow) == ["local-send", "second"])
- entries = reviewEntries()
- entries[0].data.call = "voice"
- #expect(ReviewCompletion.match(entries: entries, sent: ["local-send": reviewNow], now: reviewNow) == nil)
+ defaults.set(true, forKey: ReviewInvitation.offKey)
+ let invitation = tracker(suite)
+ for _ in 1...5 { invitation.sent(version: "2.29.0", now: reviewNow) }
+ #expect(invitation.opportunity == nil)
}
-@Test func reviewRemembersVersionsAfterOldAttemptsExpire() {
- var history = eligibleHistory()
- history.recordRequest(at: reviewNow, version: "2.29.0")
- history.completed += 5
- let nextYear = reviewNow.addingTimeInterval(366 * ReviewHistory.day)
- history.recordRequest(at: nextYear, version: "2.30.0")
- history.completed += 5
- #expect(!history.eligible(at: nextYear.addingTimeInterval(120 * ReviewHistory.day), version: "2.29.0"))
+@Test func reviewAnalyticsContainsOnlyCountsAndFixedNames() {
+ #expect(AnalyticsEvent.reviewRequested(prompts: 5).name == "review_requested")
+ #expect(AnalyticsEvent.reviewRequested(prompts: 5).properties == ["prompts": .int(5), "policy": .string("v2")])
+ #expect(AnalyticsEvent.reviewLinkOpened.properties == ["source": .string("settings")])
}
diff --git a/apps/ios/Kit/Tests/CodyncUITests/PromptCountTests.swift b/apps/ios/Kit/Tests/CodyncUITests/PromptCountTests.swift
new file mode 100644
index 00000000..34636254
--- /dev/null
+++ b/apps/ios/Kit/Tests/CodyncUITests/PromptCountTests.swift
@@ -0,0 +1,53 @@
+import Foundation
+import Testing
+@testable import CodyncKit
+@testable import CodyncUI
+
+@MainActor @Test func aPromptCountsOnceItArrivedAndAVoiceLineNever() async throws {
+ let (storage, suite) = context()
+ defer { UserDefaults(suiteName: suite)?.removePersistentDomain(forName: suite) }
+ let fake = FakeRemote(.ready(.direct))
+ let store = BotStore(computer: randomComputer("Mac"), storage: storage) { _ in fake }
+ defer { store.retire() }
+ var prompts = 0
+ store.onPromptSent = { prompts += 1 }
+ store.setActive(true)
+ #expect(await until { await fake.subscribed })
+ await fake.emit(#"{"type":"bot","bot":{"id":"b1","name":"Bot","rev":1,"lastAt":1}}"#)
+ #expect(await until { store.connection == .online })
+
+ store.send("said aloud", to: "b1", call: "c1")
+ #expect(await until { store.chat("b1").contains { $0.id == "e1" } })
+ #expect(prompts == 0)
+
+ store.send("typed", to: "b1")
+ #expect(await until { store.chat("b1").contains { $0.id == "e2" } })
+ #expect(prompts == 1)
+
+ await fake.fail("send", times: 1_000)
+ let failing = try #require(store.send("never arrives", to: "b1", replyTo: nil, nonce: UUID().uuidString))
+ #expect(await until { await fake.calls.filter { $0 == "send" }.count > 2 })
+ failing.cancel()
+ #expect(await failing.value == .failed)
+ #expect(prompts == 1)
+}
+
+@MainActor @Test func aPromptCountsOnceTheMailboxHoldsIt() async throws {
+ let (storage, suite) = context()
+ defer { UserDefaults(suiteName: suite)?.removePersistentDomain(forName: suite) }
+ let fake = FakeRemote(.hostOffline(lastSeen: nil))
+ let store = BotStore(computer: randomComputer("Mac"), storage: storage) { _ in fake }
+ defer { store.retire() }
+ var prompts = 0
+ store.onPromptSent = { prompts += 1 }
+ store.setActive(true)
+ #expect(await until { store.canQueue })
+
+ store.send("waits", to: "b1")
+ #expect(await until { prompts == 1 })
+
+ await fake.failEnqueue(HostError.unreachable)
+ store.send("refused", to: "b2")
+ #expect(await until { store.chat("b2").first?.data.status == "failed" })
+ #expect(prompts == 1)
+}
diff --git a/apps/ios/Views/BotListView.swift b/apps/ios/Views/BotListView.swift
index f070ee60..4ca9bd1f 100644
--- a/apps/ios/Views/BotListView.swift
+++ b/apps/ios/Views/BotListView.swift
@@ -173,8 +173,6 @@ struct BotListView: View {
.listRowSeparator(.hidden)
.listRowBackground(Color.clear)
}
- .reviewInvitation(blocked: creating != nil || editing != nil || editingGroup != nil
- || confirmDelete != nil || lifted != nil)
.listStyle(.plain)
.scrollContentBackground(.hidden)
.environment(\.defaultMinListRowHeight, 0)
diff --git a/apps/ios/Views/ReviewInvitationModifier.swift b/apps/ios/Views/ReviewInvitationModifier.swift
index 0b479041..68d672d1 100644
--- a/apps/ios/Views/ReviewInvitationModifier.swift
+++ b/apps/ios/Views/ReviewInvitationModifier.swift
@@ -1,56 +1,24 @@
import CodyncKit
-import CodyncUI
import StoreKit
import SwiftUI
extension View {
- func reviewInvitation(blocked: Bool) -> some View {
- modifier(ReviewInvitationModifier(blocked: blocked))
+ func reviewInvitation() -> some View {
+ modifier(ReviewInvitationModifier())
}
}
-/// Only the returned-to roster can present StoreKit; navigation/overlays cancel its one-shot delay.
+/// Asks StoreKit once the prompt that made the invitation due has landed in its chat.
private struct ReviewInvitationModifier: ViewModifier {
- let blocked: Bool
- @Environment(AppStore.self) private var app
- @Environment(AccountStore.self) private var accounts
- @Environment(\.scenePhase) private var phase
@Environment(\.requestReview) private var requestReview
private let invitation = ReviewInvitation.shared
- private var unavailable: Bool {
- blocked || invitation.isInterrupted || phase != .active || app.tab != .bots || accounts.selection != nil
- || app.showComputers || app.showUsage || app.marketplace != nil || app.account.showSwitcher
- || accounts.lastError != nil || accounts.computers.isEmpty
- || accounts.computers.contains { computer in
- guard let store = accounts.store(for: computer.id) else { return true }
- return store.connection != .online || store.mismatch != nil || store.lastError != nil
- || store.screenRequest != nil || store.bots.values.contains { $0.isWorking || $0.status == "error" }
- }
- }
-
func body(content: Content) -> some View {
- content
- .task(id: invitation.opportunity) {
- guard let token = invitation.opportunity else { return }
- guard !unavailable else { invitation.cancel(.unavailable); return }
- do { try await Task.sleep(for: .seconds(2)) } catch { return }
- guard !Task.isCancelled, !unavailable, presentationIsClear else {
- invitation.cancel(.unavailable)
- return
- }
- if invitation.request(token) { requestReview() }
- }
- .onChange(of: unavailable) { _, blocked in if blocked { invitation.cancel(.unavailable) } }
- .onDisappear { invitation.cancel(.interaction) }
- .simultaneousGesture(DragGesture(minimumDistance: 0).onChanged { _ in invitation.cancel(.interaction) })
- }
-
- private var presentationIsClear: Bool {
- guard let scene = UIApplication.shared.connectedScenes.compactMap({ $0 as? UIWindowScene })
- .first(where: { $0.activationState == .foregroundActive }),
- let window = scene.windows.first(where: \.isKeyWindow),
- let root = window.rootViewController else { return false }
- return root.presentedViewController == nil
+ content.task(id: invitation.opportunity) {
+ guard let token = invitation.opportunity else { return }
+ do { try await Task.sleep(for: .seconds(1)) } catch { return }
+ // The live state: an environment scenePhase here would still be the one this task began with.
+ if UIApplication.shared.applicationState == .active, invitation.request(token) { requestReview() }
+ }
}
}
diff --git a/apps/ios/Views/RootView.swift b/apps/ios/Views/RootView.swift
index 53090f69..8ebcb665 100644
--- a/apps/ios/Views/RootView.swift
+++ b/apps/ios/Views/RootView.swift
@@ -34,6 +34,7 @@ struct RootView: View {
}
}
.background(Palette.background)
+ .reviewInvitation()
.onChange(of: accounts.computers.isEmpty, initial: true) { _, empty in
// Reaching a computer (paired, or approved through the account) or explicitly skipping completes
// setup. Keep this device-level milestone across account changes and unpairing.
@@ -117,13 +118,8 @@ struct RootView: View {
.tint(Palette.text)
.tracked(.screenViewed(screen))
// Opening a bot (notification, widget, link) always lands on the Bots tab.
- .onChange(of: accounts.selection) { old, ref in
- if ref != nil {
- app.tab = .bots
- ReviewInvitation.shared.cancel(.interaction)
- } else if let old {
- ReviewInvitation.shared.returned(from: "\(accounts.storage.id)/\(old.computerId)/\(old.botId)")
- }
+ .onChange(of: accounts.selection) { _, ref in
+ if ref != nil { app.tab = .bots }
}
}
diff --git a/apps/maestro/queue.yaml b/apps/maestro/queue.yaml
index f76cd6f8..3538da42 100644
--- a/apps/maestro/queue.yaml
+++ b/apps/maestro/queue.yaml
@@ -21,6 +21,8 @@ onFlowComplete:
commands:
- launchApp:
appId: com.pokai.Codync.ios.dev
+ arguments:
+ "-reviewInvitationOff": true
- runFlow:
when:
platform: Android
diff --git a/apps/maestro/review-invitation.yaml b/apps/maestro/review-invitation.yaml
new file mode 100644
index 00000000..0f8ce1b2
--- /dev/null
+++ b/apps/maestro/review-invitation.yaml
@@ -0,0 +1,46 @@
+# The iPhone's rating request: no window after the fourth prompt, StoreKit's about a second after the fifth. Android has
+# no invitation until it is on Google Play (docs/features/ios-review-invitation.md), so nothing runs there. The launch
+# argument seeds the review history with three prompts and no requests (`-<key>` reaches UserDefaults, as hex JSON), so
+# every run starts from the same place. The phone must already be signed in and paired, as for `queue.yaml`, whose bot
+# it borrows:
+# maestro --device "<simulator udid>" test --include-tags review-invitation \
+# -e HOST_PORT=<sandbox port> -e HOST_TOKEN="$(cat ~/.codync-dev-<sandbox name>/token)" \
+# -e STEER_AGENT="$PWD/host/tests/fixtures/steer_agent.py" apps/maestro
+appId: com.pokai.Codync.ios.dev
+tags:
+ - review-invitation
+onFlowComplete:
+ - runScript:
+ file: queue.js
+ env:
+ CLEANUP: "true"
+---
+- runFlow:
+ when:
+ platform: iOS
+ commands:
+ - runScript: queue.js
+ - launchApp:
+ appId: com.pokai.Codync.ios.dev
+ arguments:
+ "-reviewInvitation.v1": "<7b2270726f6d707473223a332c227265717565737473223a5b5d2c2272657175657374656456657273696f6e73223a5b5d7d>"
+ - tapOn: ${output.bot.name}
+ - tapOn: "Queue a message for.*"
+ - inputText: "fourth"
+ - tapOn: "Send"
+ - assertVisible: "fourth"
+ # Past the invitation's one second: the window would have come by now.
+ - extendedWaitUntil:
+ visible: "Enjoying .*"
+ timeout: 4000
+ optional: true
+ - assertNotVisible: "Enjoying .*"
+ - tapOn: "Queue a message for.*"
+ - inputText: "fifth"
+ - tapOn: "Send"
+ - extendedWaitUntil:
+ visible: "Enjoying .*"
+ timeout: 10000
+ - takeScreenshot: review-invitation
+ - tapOn: "Not Now"
+ - assertNotVisible: "Enjoying .*"
diff --git a/docs/architecture/desktop-app.md b/docs/architecture/desktop-app.md
index 14efcfc6..887ed23b 100644
--- a/docs/architecture/desktop-app.md
+++ b/docs/architecture/desktop-app.md
@@ -62,7 +62,7 @@ The TUI connects to one host at a time, so it keeps its single roster.
## Platform notes
-- **First-run computer access** uses a capsule with one permission per panel, the app icon above it, and directional transitions (disabled with Reduce Motion). GitHub Star is the optional final panel and shares its answer history with the later reminder. macOS has three permission panels; Linux combines capture and input; Windows only shows control availability. Settings and the menu-bar setup keep their permission overview. iOS, Android and the terminal UI continue to show remote permission status and direct people to this desktop setup; they cannot request these desktop OS grants.
+- **First-run computer access** uses a capsule with one permission per panel, the app icon above it, and directional transitions (disabled with Reduce Motion). GitHub Star is the optional final panel and shares its answer history with the invitation at the fifth prompt. macOS has three permission panels; Linux combines capture and input; Windows only shows control availability. Settings and the menu-bar setup keep their permission overview. iOS, Android and the terminal UI continue to show remote permission status and direct people to this desktop setup; they cannot request these desktop OS grants.
- **Local host recovery** uses the Codync character: looking around and bobbing while starting,
resting for setup, and a still disappointed expression with lowered eyelids and a downturned mouth if the host is missing or
diff --git a/docs/features/ios-review-invitation.md b/docs/features/ios-review-invitation.md
index 16340965..3271013d 100644
--- a/docs/features/ios-review-invitation.md
+++ b/docs/features/ios-review-invitation.md
@@ -1,65 +1,47 @@
# iPhone rating invitations
-The iPhone asks StoreKit for a review at a natural pause: after a locally sent bot interaction
-finishes, its final result stays visible at the bottom of the conversation for three seconds,
-and the person returns to Bots. It waits two more seconds with no interaction. It never
-requests on launch, pairing, sign-in, or foregrounding. These are conservative initial
-thresholds, not measured conversion optima.
+The iPhone asks StoreKit for a review about a second after the fifth prompt it sent reaches the
+computer (or the relay mailbox, while the computer is offline), over whichever screen is open.
+It never requests on launch, pairing, sign-in, or foregrounding.
-## Eligibility and cancellation
+## Eligibility
-- At least seven elapsed days since this feature first ran, activity on three different local
- calendar dates, and five completed, viewed interactions.
-- At least 60 seconds continuously active before returning to Bots.
+- Five prompts from this iPhone that reached the computer or the relay mailbox. Voice calls don't count.
+ A resend of a prompt that never got there counts once. The mailbox counts on arrival: one that then fails
+ or expires counts again when resent, and taking one back doesn't subtract, so the ask can come a prompt early.
- At least 120 days between attempts, two attempts per rolling 365 days, one per version,
- and five additional completed/viewed interactions since the previous attempt.
-- Navigation, touching the list, backgrounding, sheets, errors, incompatible versions,
- disconnected computers, running agents, or pending approvals cancel the opportunity.
- Cancellation does not consume the cooldown; it needs a new completed/viewed interaction.
-- StoreKit may suppress the prompt. Persist an attempt before calling it regardless; there
- is no event claiming it appeared or that someone rated the app.
+ and five more prompts since the previous attempt.
+- A prompt sent while the app is in the background (a shortcut) doesn't ask; the next prompt does.
+- StoreKit may suppress the prompt, and never shows it in TestFlight. Persist an attempt before
+ calling it regardless; there is no event claiming it appeared or that someone rated the app.
-The device retains first-use time, three activity-day markers, counts, request history, and
-up to 100 locally generated message nonces, valid for 30 days. Expired nonces are removed
-on the next launch, foreground transition, or send. This is device-only StoreKit
-presentation policy, using the host's existing turn IDs, statuses, and final-message flags.
-No host API or compatibility minimum changes. Pending sends survive a relaunch; presentation
-opportunities do not. Successful turns with notices are conservatively excluded, as are
-voice calls, routine results, historical messages without a locally recorded send, failures,
-and cancellations. Multiple messages in one turn count once. Reading means the result was
-visible, not that the user approved it; no sentiment analysis or rating pre-screen is used.
+The device retains the prompt count and request history; a history from before 2.39.1 keeps its requests and
+starts counting prompts at zero. This is device-only StoreKit presentation
+policy: no host API or compatibility minimum changes, and no sentiment analysis or rating pre-screen
+is used.
Settings offers **Rate on the App Store** to everyone, opening Apple's write-review page,
and an independent **Report an issue** link to GitHub. Neither is gated on satisfaction.
-Only StoreKit's own prompt appears automatically. All seven existing translations include
-the settings label.
+Only StoreKit's own prompt appears automatically.
## Analytics
Use the existing iPhone PostHog client and opt-out switch. See the event contract in
-[analytics events](../reference/analytics-events.md). Compare `review_opportunity` to
-`review_requested`, grouped by `app_version`, and inspect cancellation reasons. For any
-rating-count trend use aggregate App Store Connect reports; individual review conversion
-is unavailable. Never treat a StoreKit attempt or a manual link tap as a submitted rating.
+[analytics events](../reference/analytics-events.md). For any rating-count trend use aggregate
+App Store Connect reports; individual review conversion is unavailable. Never treat a StoreKit
+attempt or a manual link tap as a submitted rating.
+
+## Testing
+
+E2E flows that send through the composer launch with the `-reviewInvitationOff` argument
+(`apps/maestro/queue.yaml`; the dash is what makes UserDefaults read it): the system's window would cover what they
+tap. `apps/maestro/review-invitation.yaml` checks the request itself: no window at the fourth prompt, StoreKit's after
+the fifth.
## Platform scope
The iPhone uses StoreKit. The Android app has no invitation until it is on Google Play (the owner's call,
2026-11-01): its Settings has **Rate on Google Play** and **Report an issue**, and the invitation comes with the
-Play release, through Play's in-app review API and this same policy. Desktop Settings and help menu and terminal
-settings have no store review capability and keep their behavior.
-
-## Validation (2026-10-26)
-
-- iOS package: 286 tests passed, including 13 invitation regression tests; iOS Dev simulator
- build passed. The three-reviewer pass confirmed and fixed obscured reading, expired nonce
- cleanup, and the missing independent issue-report link.
-- Device Hub on a dedicated iOS 26.5 simulator: fresh launch had no rating prompt; version
- 2.29.0 Settings exposed Rate on the App Store and Report an issue. UI testing was narrowed
- to this smoke check at the owner's request. An eligible StoreKit display and live PostHog
- ingestion were not verified; request semantics and analytics opt-out have unit coverage.
-- Desktop: typecheck and 258 tests passed. User documentation: 18 pages and 88 links passed.
-- Version-only host checks: formatting and Clippy passed; the broad suite progressed through
- many suites but timed out at `stop_ends_a_turn_whose_agent_ignores_the_cancel` after the
- hook's 300-second limit. Host source is unchanged. Android checks were not run; the owner
- explicitly excluded Android review invitations because the app is not published yet.
+Play release, through Play's in-app review API and this same policy. The desktop app invites a GitHub star at the
+same fifth prompt instead (`apps/desktop/src/renderer/lib/star-ask.ts`); terminal settings have no store review
+capability and keep their behavior.
diff --git a/docs/reference/analytics-events.md b/docs/reference/analytics-events.md
index 8d0178bc..55655fa2 100644
--- a/docs/reference/analytics-events.md
+++ b/docs/reference/analytics-events.md
@@ -57,7 +57,7 @@ host answers and sends it once the host is up.
| `phone_connected` | host | A paired phone connects, at most once per phone per UTC day | `platform` |
| `notifications_answered` | iOS, Android | The system notification prompt was answered | `granted`, `source` (`settings`/`widgets`/`automatic`) |
| `notification_opened` | iOS, Android | A Codync notification was tapped | `kind` (`done`/`needs_input`/`failed`) |
-| `star_prompt_answered` | host `track` (desktop) | The GitHub star setup invitation or reminder was answered or closed | `ask` (`first`/`second`), `starred` |
+| `star_prompt_answered` | host `track` (desktop) | The GitHub star setup invitation or the fifth-prompt invitation was answered or closed | `ask` (`first`/`second`), `starred` |
| `link_opened` | host `track` (desktop), iOS, Android | An outbound link was opened (`install_command`: an install command copied; `install_link`: the phone's website link copied) | `link` (`github`/`docs`/`issues`/`discord`/`app_store`/`demo`/`tailscale`/`privacy`/`support`/`install_command`/`install_link`/`product_hunt`) |
## Using Codync
@@ -168,9 +168,7 @@ opt-out. Android sends only `review_link_opened` until it has the invitation. No
| Event | When | Properties |
| --- | --- | --- |
-| `review_opportunity` | An eligible, viewed result is followed by returning to Bots | `completed_interactions` (count), `policy: v1`, `trigger: return_to_bots` |
-| `review_cancelled` | An opportunity is abandoned before StoreKit | `reason: background / interaction / unavailable`, `policy: v1` |
-| `review_requested` | The persisted cooldown is consumed and StoreKit is about to be called | `completed_interactions` (count), `policy: v1`, `trigger: return_to_bots` |
+| `review_requested` | The persisted cooldown is consumed and StoreKit is about to be called | `prompts` (count), `policy: v2` |
| `review_link_opened` | The person taps Rate on the App Store (Android: Rate on Google Play) in Settings | `source: settings` |
`review_requested` does not mean the system displayed a prompt or the person submitted a
diff --git a/web/content/docs/getting-started.mdx b/web/content/docs/getting-started.mdx
index 03fffc78..c2500605 100644
--- a/web/content/docs/getting-started.mdx
+++ b/web/content/docs/getting-started.mdx
@@ -43,7 +43,7 @@ You can also install the host with Homebrew (`brew install leepokai/codync/codyn
The app first asks you to sign in with Apple, Google or GitHub. The computer joins your account, so your phone can find it there. It then offers **Computer access**, which bots need only to use the screen; choose **Set up later** to skip it. See [Computer use](/docs/computer-use).
-Setup also offers an optional GitHub star. If you skip it, the desktop app can remind you once after seven days. That reminder has two actions: **Star on GitHub** opens the repository, and **Not now** dismisses it. You can also dismiss it by clicking outside the card or pressing Escape. Opening the repository or dismissing this reminder ends further reminders on that computer.
+Setup also offers an optional GitHub star. If you skip it, the desktop app invites you once more when you've sent your fifth message from that computer. That invitation has two actions: **Star on GitHub** opens the repository, and **Not now** dismisses it. You can also dismiss it by clicking outside the card or pressing Escape. Opening the repository or dismissing this invitation ends the invitations on that computer.
The computer menu shows a device icon beside each name, helping you distinguish a laptop, Mac mini, or Linux computer. Connection status appears alongside the name (on a separate secondary line on desktop and Android). Tick or untick computers to choose whose bots the list shows; the menu stays open while you pick, so you can change several at once, and **All computers** shows every one again.
diff --git a/web/content/docs/privacy.mdx b/web/content/docs/privacy.mdx
index d3b919bf..4af34d58 100644
--- a/web/content/docs/privacy.mdx
+++ b/web/content/docs/privacy.mdx
@@ -89,13 +89,13 @@ Delete a bot to remove its conversation. To remove everything from a computer, s
## iPhone rating invitations
-Codync may invite you to rate it after you have used it on several days, viewed a bot's
-completed result, and returned to the bot list. It does not ask when you open the app.
+Codync may invite you to rate it when you've sent your fifth message from your iPhone. It
+does not ask when you open the app, and voice calls don't count.
Invitations are at least 120 days apart, with at most two requests in a year. Apple decides
whether to show its rating window. You can also choose **Rate on the App Store** on the
**Settings** tab at any time. **Report an issue** opens a separate feedback link,
regardless of whether you choose to rate the app.
The timing history stays on your iPhone. If **Share usage analytics** is on, Codync records
-invitation opportunities, cancellation reasons, requests, and taps on the rating link, with
-interaction counts. It does not send conversation content or know whether you rated it.
+requests and taps on the rating link, with the number of messages sent. It does not send
+conversation content or know whether you rated it.