Skip to content

Commit e625f1e

Browse files
feat(mobile): render the Android subscription widget with expo-widgets
expo-widgets 58 runs Android home-screen widgets from the same JS layout model as iOS, so the hand-written RemoteViews module is replaced by a Compose layout in SubscriptionUsage.android.tsx. One TSX implementation per platform now feeds one snapshot pipeline, and the widget follows the device's Material palette. What the RemoteViews module did that expo-widgets does not: - Expiry re-render while the app is closed. Kept as a small t3-widget-expiry module that arms one inexact alarm per deadline and sends ACTION_APPWIDGET_UPDATE to the generated provider, which re-runs the stored snapshot through the widget runtime. - Cold-start tap. expo-widgets delivers taps to the running app's interaction listener; there is no Android counterpart to widgetURL. A tap opens Usage while T3 is alive and otherwise only refreshes the widget. Co-Authored-By: Claude Fable 5 <[email protected]>
1 parent 919588c commit e625f1e

21 files changed

Lines changed: 360 additions & 286 deletions

‎apps/mobile/app.config.ts‎

Lines changed: 47 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -129,51 +129,66 @@ const widgetsPlugin: NonNullable<ExpoConfig["plugins"]>[number] = [
129129
// Agent activity can update many times an hour; without the
130130
// frequent-updates entitlement iOS throttles the update budget sooner.
131131
frequentUpdates: true,
132+
enableAndroid: true,
132133
widgets: [
133134
{
134135
name: "SubscriptionUsage",
135136
displayName: "Subscription usage",
136137
description: "Subscription quotas from your connected T3 Code environments.",
137-
configuration: {
138-
title: "Subscription usage",
139-
description:
140-
"Both shows Session and Weekly when available. The Lock Screen shows the tightest selected limit.",
141-
parameters: {
142-
codexPeriod: {
143-
title: "Codex limits",
144-
type: "enum",
145-
default: "auto",
146-
values: [
147-
{ name: "Both", value: "auto" },
148-
{ name: "Session", value: "session" },
149-
{ name: "Weekly", value: "weekly" },
150-
],
151-
},
152-
claudePeriod: {
153-
title: "Claude limits",
154-
type: "enum",
155-
default: "auto",
156-
values: [
157-
{ name: "Both", value: "auto" },
158-
{ name: "Session", value: "session" },
159-
{ name: "Weekly", value: "weekly" },
160-
],
138+
ios: {
139+
configuration: {
140+
title: "Subscription usage",
141+
description:
142+
"Both shows Session and Weekly when available. The Lock Screen shows the tightest selected limit.",
143+
parameters: {
144+
codexPeriod: {
145+
title: "Codex limits",
146+
type: "enum",
147+
default: "auto",
148+
values: [
149+
{ name: "Both", value: "auto" },
150+
{ name: "Session", value: "session" },
151+
{ name: "Weekly", value: "weekly" },
152+
],
153+
},
154+
claudePeriod: {
155+
title: "Claude limits",
156+
type: "enum",
157+
default: "auto",
158+
values: [
159+
{ name: "Both", value: "auto" },
160+
{ name: "Session", value: "session" },
161+
{ name: "Weekly", value: "weekly" },
162+
],
163+
},
161164
},
162165
},
166+
supportedFamilies: [
167+
"systemSmall",
168+
"systemMedium",
169+
"systemLarge",
170+
"systemExtraLarge",
171+
"accessoryRectangular",
172+
],
173+
},
174+
android: {
175+
minWidth: 250,
176+
minHeight: 180,
177+
targetCellWidth: 4,
178+
targetCellHeight: 3,
179+
resizeMode: "both",
180+
// Embeds the layout in the APK so the widget renders before the app
181+
// has run once; the app replaces it with stored props on publish.
182+
initialLayout: "./src/widgets/SubscriptionUsage.android.tsx",
163183
},
164-
supportedFamilies: [
165-
"systemSmall",
166-
"systemMedium",
167-
"systemLarge",
168-
"systemExtraLarge",
169-
"accessoryRectangular",
170-
],
171184
},
172185
{
173186
name: "AgentActivity",
174187
displayName: "Agent Activity",
175188
description: "Shows the current state of active T3 Code agents.",
176-
supportedFamilies: ["systemSmall", "systemMedium", "accessoryRectangular"],
189+
// Live Activity companion; there is no Android presentation for it.
190+
android: null,
191+
ios: { supportedFamilies: ["systemSmall", "systemMedium", "accessoryRectangular"] },
177192
},
178193
],
179194
},

‎apps/mobile/modules/t3-subscription-widget/android/src/main/AndroidManifest.xml‎

Lines changed: 0 additions & 8 deletions
This file was deleted.

‎apps/mobile/modules/t3-subscription-widget/android/src/main/java/expo/modules/t3subscriptionwidget/SubscriptionUsageWidget.kt‎

Lines changed: 0 additions & 163 deletions
This file was deleted.

‎apps/mobile/modules/t3-subscription-widget/android/src/main/java/expo/modules/t3subscriptionwidget/T3SubscriptionWidgetModule.kt‎

Lines changed: 0 additions & 18 deletions
This file was deleted.

‎apps/mobile/modules/t3-subscription-widget/android/src/main/res/drawable/t3_subscription_widget_background.xml‎

Lines changed: 0 additions & 4 deletions
This file was deleted.

‎apps/mobile/modules/t3-subscription-widget/android/src/main/res/layout/t3_subscription_widget.xml‎

Lines changed: 0 additions & 9 deletions
This file was deleted.

‎apps/mobile/modules/t3-subscription-widget/android/src/main/res/layout/t3_subscription_widget_row.xml‎

Lines changed: 0 additions & 10 deletions
This file was deleted.

‎apps/mobile/modules/t3-subscription-widget/android/src/main/res/values-night/colors.xml‎

Lines changed: 0 additions & 5 deletions
This file was deleted.

‎apps/mobile/modules/t3-subscription-widget/android/src/main/res/values/colors.xml‎

Lines changed: 0 additions & 5 deletions
This file was deleted.

‎apps/mobile/modules/t3-subscription-widget/android/src/main/res/values/strings.xml‎

Lines changed: 0 additions & 11 deletions
This file was deleted.

0 commit comments

Comments
 (0)