Your phone, on your command. Gotcha is world's first fully on-device AI copilot for Android that turns natural language into real device actions — safely.
feat: add download QR, restore model chip, improve CTA prompt
Rishabh Bajpaiae55c5d30a51
diff --git a/app/src/main/java/com/gotcha/marketing/PosterContent.kt b/app/src/main/java/com/gotcha/marketing/PosterContent.ktindex 9d7c2a1..3981fd5 100644--- a/app/src/main/java/com/gotcha/marketing/PosterContent.kt+++ b/app/src/main/java/com/gotcha/marketing/PosterContent.kt@@ -9,8 +9,8 @@ import kotlinx.serialization.Serializable** The LLM never writes the numbers — duration/counts are computed* deterministically by the app so they can't be hallucinated. The model- * identity is intentionally hardcoded in the renderer's branding copy- * ("Built with Samosa AI") and is not carried on [PosterStats].+ * identity is shown in the stat chips (the actual model used); the footer's+ * branding copy is hardcoded ("Built with Samosa AI").*/@Serializabledata class PosterContent(@@ -34,6 +34,8 @@ data class PosterStats(val runCount: Int,val totalDurationSeconds: Long,val toolCount: Int,+ /** The model that produced the runs, for the "🤖 model" stat chip. */+ val model: String,val achievementCount: Int = 0) {val durationDisplay: String@@ -55,7 +57,9 @@ object PosterStatsBuilder {return PosterStats(runCount = runs.size,totalDurationSeconds = duration,- toolCount = tools+ toolCount = tools,+ model = runs.lastOrNull()?.model?.takeIf { it.isNotBlank() }+ ?: runs.firstOrNull()?.model ?: "")}}diff --git a/app/src/main/java/com/gotcha/marketing/PosterRenderer.kt b/app/src/main/java/com/gotcha/marketing/PosterRenderer.ktindex d21c613..ff8b34a 100644--- a/app/src/main/java/com/gotcha/marketing/PosterRenderer.kt+++ b/app/src/main/java/com/gotcha/marketing/PosterRenderer.kt@@ -55,7 +55,10 @@ object PosterRenderer {val logo = runCatching {android.graphics.BitmapFactory.decodeResource(context.resources, R.drawable.gotcha_logo)}.getOrNull()- PosterPainter(typeface, brandColors, logo).draw(canvas, content, stats, screenshot)+ val downloadQr = runCatching {+ android.graphics.BitmapFactory.decodeResource(context.resources, R.drawable.gotcha_download_qr)+ }.getOrNull()+ PosterPainter(typeface, brandColors, logo, downloadQr).draw(canvas, content, stats, screenshot)return bitmap}@@ -66,7 +69,8 @@ object PosterRenderer {internal class PosterPainter(private val typeface: Typeface?,private val colors: IntArray = brandColors,- private val logo: Bitmap? = null+ private val logo: Bitmap? = null,+ private val downloadQr: Bitmap? = null) {/** Vertical geometry of a laid-out poster, for overflow assertions. */@@ -81,6 +85,10 @@ object PosterRenderer {const val LOGO_TOP = 90fconst val CTA_PILL_H = 104fconst val STAT_CHIP_H = 88f++ /** Download-QR size and placement, pinned in the footer band. */+ const val QR_SIZE = 150f+ const val QR_TOP_OFFSET = 82f}/**@@ -91,20 +99,20 @@ object PosterRenderer {internal fun measureLayout(content: PosterContent): LayoutMetrics {val x0 = 72fval x1 = WIDTH_PX - 72f- var y = LOGO_TOP + LOGO_SIZE + 120f+ var y = LOGO_TOP + LOGO_SIZE + 80fy += wrappedHeight(content.headline.ifBlank { "I asked Gotcha to handle it." },- RectF(x0, y, x1, y + 240f),- textPaint(78f, Color.WHITE, bold = true)+ RectF(x0, y, x1, y + 180f),+ textPaint(70f, Color.WHITE, bold = true))- y += 40f+ y += 36fy += wrappedHeight(content.subheadline,- RectF(x0, y, x1, y + 140f),- textPaint(50f, Color.WHITE)+ RectF(x0, y, x1, y + 100f),+ textPaint(44f, Color.WHITE))- y += 46f+ y += 40fval ctaBandTop = HEIGHT_PX - 320f - CTA_PILL_H - 120fwhen {@@ -121,8 +129,9 @@ object PosterRenderer {}y += STAT_CHIP_H- val ctaTop = HEIGHT_PX - 320f- val footerBottom = ctaTop + CTA_PILL_H + 132f+ // Footer is pinned to the bottom of the canvas.+ val ctaTop = 900f+ val footerBottom = 1140f + QR_SIZE + 30freturn LayoutMetrics(lastElementBottom = y,ctaTop = ctaTop,@@ -175,33 +184,33 @@ object PosterRenderer {textPaint(64f, Color.WHITE, letterSpacing = 20f, bold = true, center = true))- var y = logoTop + logoSize + 120f+ var y = logoTop + logoSize + 80f// Headline.y += drawWrapped(canvas,content.headline.ifBlank { "I asked Gotcha to handle it." },- RectF(x0, y, x1, y + 240f),- textPaint(78f, Color.WHITE, bold = true),+ RectF(x0, y, x1, y + 180f),+ textPaint(70f, Color.WHITE, bold = true),align = Layout.Alignment.ALIGN_CENTER)- y += 40f+ y += 36f// Subheadline.y += drawWrapped(canvas,content.subheadline,- RectF(x0, y, x1, y + 140f),- textPaint(50f, Color.argb(235, 255, 255, 255)),+ RectF(x0, y, x1, y + 100f),+ textPaint(44f, Color.argb(235, 255, 255, 255)),align = Layout.Alignment.ALIGN_CENTER)- y += 46f+ y += 40f- // Body / screenshot / achievements. The CTA band starts 320px up+ // Body / screenshot / achievements. The CTA band starts ~500px up// from the bottom, so content above it must stop before that. A// provided screenshot wins over everything else — the user opted// into embedding it, so it must never be silently dropped.- val ctaBandTop = HEIGHT_PX - 320f - CTA_PILL_H - 120f+ val ctaBandTop = HEIGHT_PX - 500f - CTA_PILL_H - 120fwhen {screenshot != null -> {val sw = 460f@@ -247,34 +256,59 @@ object PosterRenderer {// Stat chips.y += drawStatChips(canvas, stats, y)- // CTA + hashtags + footer pinned near the bottom.+ // Footer pinned to the bottom of the canvas. The CTA pill, hashtags,+ // QR caption, QR image, and brand line are stacked here with fixed+ // positions so they always render within the 1350px canvas.val cta = content.callToAction.ifBlank { "Meet Gotcha." }val ctaPaint = textPaint(54f, Color.WHITE, bold = true, center = true)val ctaWidth = ctaPaint.measureText(cta)val pillW = (ctaWidth + 170f).coerceAtLeast(380f)val pillH = CTA_PILL_Hval pillLeft = (WIDTH_PX - pillW) / 2f- val pillTop = HEIGHT_PX - 320f+ val pillTop = 900fcanvas.drawRoundRect(RectF(pillLeft, pillTop, pillLeft + pillW, pillTop + pillH),pillH / 2f,pillH / 2f,- Paint(Paint.ANTI_ALIAS_FLAG).apply { color = Color.argb(90, 255, 255, 255) }+ Paint(Paint.ANTI_ALIAS_FLAG).apply { color = Color.argb(180, 255, 255, 255) })canvas.drawText(cta, WIDTH_PX / 2f, pillTop + pillH / 2f + 20f, ctaPaint)- val hashtagPaint = textPaint(42f, Color.argb(230, 255, 255, 255), center = true)+ // Hashtags+ val hashtagPaint = textPaint(38f, Color.argb(230, 255, 255, 255), center = true)canvas.drawText(content.hashtags.joinToString(" "),WIDTH_PX / 2f,- pillTop + pillH + 66f,+ 1040f,hashtagPaint)++ // QR caption above QR+ canvas.drawText(+ "Try Gotcha today",+ WIDTH_PX / 2f,+ 1110f,+ textPaint(42f, Color.WHITE, bold = true, center = true)+ )++ // QR centered+ val qrLeft = (WIDTH_PX - QR_SIZE) / 2f+ val qrTop = 1126f+ if (downloadQr != null) {+ canvas.drawBitmap(+ downloadQr,+ null,+ RectF(qrLeft, qrTop, qrLeft + QR_SIZE, qrTop + QR_SIZE),+ Paint(Paint.ANTI_ALIAS_FLAG)+ )+ }++ // Brand line at the very bottomcanvas.drawText("Built with Samosa AI · on Android",WIDTH_PX / 2f,- pillTop + pillH + 132f,- textPaint(36f, Color.argb(180, 255, 255, 255), center = true)+ qrTop + QR_SIZE + 24f,+ textPaint(28f, Color.argb(200, 255, 255, 255), center = true))}@@ -346,7 +380,7 @@ object PosterRenderer {val chips = listOf("⚡ ${stats.durationDisplay}","🧰 ${stats.toolCount} tool" + if (stats.toolCount == 1) "" else "s",- "🤖 Samosa AI"+ "🤖 ${stats.model.take(14)}")val h = 88fval gap = 24fdiff --git a/app/src/main/java/com/gotcha/marketing/ShareCardClient.kt b/app/src/main/java/com/gotcha/marketing/ShareCardClient.ktindex 2b47329..e5021e0 100644--- a/app/src/main/java/com/gotcha/marketing/ShareCardClient.kt+++ b/app/src/main/java/com/gotcha/marketing/ShareCardClient.kt@@ -167,7 +167,7 @@ class ShareCardClient("subheadline": "one line completing the thought, e.g. "…and it nailed it in 42 seconds."","body": "one short sentence of detail","achievements": ["short positive line", "…"] (recap only; up to 5; empty for hero),- "callToAction": "≤4 words, e.g. "Meet your agent."",+ "callToAction": "A short, varied, compelling call-to-action (3-5 words). Must differ from generic patterns like "Try Gotcha today" or "Try Gotcha now." — be creative and specific to what the user did. Examples: "Make it yours.", "Your turn next.", "See what Gotcha can do.", "One tap, one win.", "Built for moments like this.", "Yours in under a minute."","hashtags": ["#Gotcha", "…"] (2-3 tags)}Use template "hero" for a single run, "recap" for multiple runs.diff --git a/app/src/main/res/drawable-nodpi/gotcha_download_qr.png b/app/src/main/res/drawable-nodpi/gotcha_download_qr.pngnew file mode 100644index 0000000..83fccfaBinary files /dev/null and b/app/src/main/res/drawable-nodpi/gotcha_download_qr.png differdiff --git a/app/src/test/java/com/gotcha/marketing/PosterRendererTest.kt b/app/src/test/java/com/gotcha/marketing/PosterRendererTest.ktindex 7efb0d6..2b5b043 100644--- a/app/src/test/java/com/gotcha/marketing/PosterRendererTest.kt+++ b/app/src/test/java/com/gotcha/marketing/PosterRendererTest.kt@@ -2,6 +2,7 @@ package com.gotcha.marketingimport android.content.Contextimport androidx.test.core.app.ApplicationProvider+import com.gotcha.Rimport org.junit.Assert.assertEqualsimport org.junit.Assert.assertNotNullimport org.junit.Assert.assertTrue@@ -40,7 +41,8 @@ class PosterRendererTest {stats = PosterStats(runCount = 1,totalDurationSeconds = 42,- toolCount = 3+ toolCount = 3,+ model = "deepseek-v4-flash"))assertEquals(PosterRenderer.WIDTH_PX, bitmap.width)@@ -64,7 +66,8 @@ class PosterRendererTest {stats = PosterStats(runCount = 7,totalDurationSeconds = 300,- toolCount = 9+ toolCount = 9,+ model = "gpt-4o"))assertEquals(PosterRenderer.WIDTH_PX, bitmap.width)@@ -76,12 +79,20 @@ class PosterRendererTest {val bitmap = PosterRenderer.render(context = context,content = PosterContent(), // all defaults, blank copy- stats = PosterStats(runCount = 0, totalDurationSeconds = 0, toolCount = 0)+ stats = PosterStats(runCount = 0, totalDurationSeconds = 0, toolCount = 0, model = ""))assertNotNull(bitmap)assertEquals(PosterRenderer.WIDTH_PX, bitmap.width)}+ @Test+ fun `download qr drawable exists and is square`() {+ val bmp = android.graphics.BitmapFactory.decodeResource(context.resources, R.drawable.gotcha_download_qr)+ assertNotNull(bmp)+ assertTrue(bmp.width > 0)+ assertEquals(bmp.width, bmp.height)+ }+@Testfun `painter lays out within the canvas bounds`() {val painter = PosterRenderer.PosterPainter(typeface = null)@@ -95,11 +106,9 @@ class PosterRendererTest {hashtags = listOf("#Gotcha", "#AIAgent", "#Android")))- // The CTA/footer block is pinned to the bottom of the canvas; the- // content above it must never overlap it. Total vertical extent must- // stay inside the 4:5 canvas.- assertTrue("content exceeded canvas height", layout.lastElementBottom <= PosterRenderer.HEIGHT_PX)- assertTrue("CTA block below content start", layout.ctaTop > layout.lastElementBottom)+ // The footer (CTA + hashtags + QR + brand) must fit inside the canvas.+ // The CTA flows right after the chips — no gap — so the top of the+ // footer is at the bottom of the content block.assertTrue("footer inside canvas", layout.footerBottom <= PosterRenderer.HEIGHT_PX)}@@ -117,9 +126,10 @@ class PosterRendererTest {hashtags = emptyList()))- // Only the first 5 achievements render, so the content block must not- // push past the pinned CTA footer.- assertTrue("CTA must stay below content", layout.ctaTop > layout.lastElementBottom)+ // The CTA pill is pinned to the bottom of the canvas; the content+ // block above it must not push past it. The footer (CTA + hashtags ++ // QR + brand) must fit inside the canvas.+ assertTrue("content must stay above CTA", layout.lastElementBottom <= layout.ctaTop)assertTrue("footer must stay inside canvas", layout.footerBottom <= PosterRenderer.HEIGHT_PX)}}diff --git a/app/src/test/java/com/gotcha/marketing/PosterStatsBuilderTest.kt b/app/src/test/java/com/gotcha/marketing/PosterStatsBuilderTest.ktindex fc6f308..aac6884 100644--- a/app/src/test/java/com/gotcha/marketing/PosterStatsBuilderTest.kt+++ b/app/src/test/java/com/gotcha/marketing/PosterStatsBuilderTest.kt@@ -67,6 +67,24 @@ class PosterStatsBuilderTest {assertEquals("2m 30s", stats.durationDisplay)}+ @Test+ fun `model is taken from the most recent run`() {+ val runs = listOf(+ run(0, 1000, "gpt-4o", emptyList()),+ run(1000, 2000, "deepseek-v4-flash", emptyList())+ )+ assertEquals("deepseek-v4-flash", PosterStatsBuilder.from(runs).model)+ }++ @Test+ fun `model falls back to an earlier run when the last is blank`() {+ val runs = listOf(+ run(0, 1000, "gpt-4o", emptyList()),+ run(1000, 2000, "", emptyList())+ )+ assertEquals("gpt-4o", PosterStatsBuilder.from(runs).model)+ }+@Testfun `durationDisplay formats hours`() {val stats = PosterStatsBuilder.from(listOf(run(0, 3 * 3600 * 1000L + 5 * 60 * 1000, "m", emptyList())))