Skip to content

Commit 4f49e1c

Browse files
refactor(mobile): adopt shared task contracts
Generated-By: PostHog Code Task-Id: 40c57a59-b4e1-4760-8e56-ecd03e9c2f0f
1 parent c2659ec commit 4f49e1c

33 files changed

Lines changed: 136 additions & 266 deletions

apps/mobile/src/app/task/[id].tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { Text } from "@components/text";
2+
import type { Task } from "@posthog/shared";
23
import { useQueryClient } from "@tanstack/react-query";
34
import * as Haptics from "expo-haptics";
45
import { useLocalSearchParams, useRouter } from "expo-router";
@@ -51,7 +52,6 @@ import {
5152
} from "@/features/tasks/stores/pendingTaskPromptStore";
5253
import { useTaskSessionStore } from "@/features/tasks/stores/taskSessionStore";
5354
import { useTaskStore } from "@/features/tasks/stores/taskStore";
54-
import type { Task } from "@/features/tasks/types";
5555
import {
5656
confirmStopRun,
5757
isTaskRunning,

apps/mobile/src/features/navigation/components/SwipeableArchivedDrawerRow.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { Text } from "@components/text";
2+
import type { Task } from "@posthog/shared";
23
import * as Haptics from "expo-haptics";
34
import { ArrowCounterClockwise } from "phosphor-react-native";
45
import { useEffect, useRef } from "react";
@@ -11,7 +12,6 @@ import {
1112
View,
1213
} from "react-native";
1314
import { TaskStatusIcon } from "@/features/tasks/components/TaskStatusIcon";
14-
import type { Task } from "@/features/tasks/types";
1515
import { useThemeColors } from "@/lib/theme";
1616

1717
const SWIPE_THRESHOLD = 60;

apps/mobile/src/features/tasks/api.ts

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,12 @@
1-
import type { Adapter } from "@posthog/shared";
1+
import type {
2+
Adapter,
3+
CreateTaskAutomationOptions,
4+
StoredLogEntry,
5+
Task,
6+
TaskAutomation,
7+
TaskRun,
8+
UpdateTaskAutomationOptions,
9+
} from "@posthog/shared";
210
import type {
311
SandboxCustomImage,
412
SandboxEnvironment,
@@ -13,14 +21,8 @@ import {
1321
} from "@/lib/api";
1422
import { logger } from "@/lib/logger";
1523
import type {
16-
CreateTaskAutomationOptions,
1724
CreateTaskOptions,
1825
Integration,
19-
StoredLogEntry,
20-
Task,
21-
TaskAutomation,
22-
TaskRun,
23-
UpdateTaskAutomationOptions,
2426
UserGithubIntegration,
2527
} from "./types";
2628

apps/mobile/src/features/tasks/components/AutomationDetail.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { Text } from "@components/text";
2+
import type { TaskAutomation, TaskRun } from "@posthog/shared";
23
import { ActivityIndicator, Pressable, View } from "react-native";
3-
import type { TaskAutomation, TaskRun } from "../types";
44
import { formatAutomationScheduleSummary } from "../utils/automationSchedule";
55
import { getAutomationTemplatePresentation } from "../utils/automationTemplatePresentation";
66
import { AutomationStatusBadge } from "./AutomationStatusBadge";

apps/mobile/src/features/tasks/components/AutomationForm.tsx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { Text } from "@components/text";
2+
import type { CreateTaskAutomationOptions } from "@posthog/shared";
23
import { CaretDown, GithubLogo } from "phosphor-react-native";
34
import { type MutableRefObject, useEffect, useMemo, useState } from "react";
45
import {
@@ -12,10 +13,7 @@ import { MarkdownText } from "@/features/chat/components/MarkdownText";
1213
import { useThemeColors } from "@/lib/theme";
1314
import { RepositoryPickerInline } from "../composer/RepositoryPickerInline";
1415
import { useIntegrations } from "../hooks/useIntegrations";
15-
import type {
16-
CreateTaskAutomationOptions,
17-
RepositorySelection,
18-
} from "../types";
16+
import type { RepositorySelection } from "../types";
1917
import {
2018
type AutomationScheduleDraft,
2119
buildCronExpression,

apps/mobile/src/features/tasks/components/AutomationItem.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import { Text } from "@components/text";
2+
import type { TaskAutomation, TaskRun } from "@posthog/shared";
23
import { format, formatDistanceToNow } from "date-fns";
34
import { memo } from "react";
45
import { Pressable, View } from "react-native";
5-
import type { TaskAutomation, TaskRun } from "../types";
66
import { formatAutomationScheduleSummary } from "../utils/automationSchedule";
77
import { getAutomationTemplatePresentation } from "../utils/automationTemplatePresentation";
88
import { AutomationStatusBadge } from "./AutomationStatusBadge";

apps/mobile/src/features/tasks/components/AutomationList.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { Text } from "@components/text";
2+
import type { TaskAutomation } from "@posthog/shared";
23
import { Plus } from "phosphor-react-native";
34
import {
45
ActivityIndicator,
@@ -10,7 +11,6 @@ import {
1011
import { useThemeColors } from "@/lib/theme";
1112
import { useAutomations } from "../hooks/useAutomations";
1213
import { useTasks } from "../hooks/useTasks";
13-
import type { TaskAutomation } from "../types";
1414
import { AutomationItem } from "./AutomationItem";
1515

1616
interface AutomationListProps {

apps/mobile/src/features/tasks/components/AutomationStatusBadge.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { Text } from "@components/text";
2+
import type { TaskRun } from "@posthog/shared";
23
import { View } from "react-native";
3-
import type { TaskRun } from "../types";
44
import { getAutomationStatusPresentation } from "../utils/automationStatus";
55

66
interface AutomationStatusBadgeProps {

apps/mobile/src/features/tasks/components/CustomImageBadge.test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1+
import type { Task, TaskRun } from "@posthog/shared";
12
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
23
import { createElement } from "react";
34
import { act, create } from "react-test-renderer";
45
import { beforeEach, describe, expect, it, vi } from "vitest";
5-
import type { Task, TaskRun } from "../types";
66

77
const { mockUseAuthStore, mockGetImages, mockGetEnvironments } = vi.hoisted(
88
() => ({

apps/mobile/src/features/tasks/components/CustomImageBadge.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import { Text } from "@components/text";
2+
import type { Task } from "@posthog/shared";
23
import { Cube } from "phosphor-react-native";
34
import { View } from "react-native";
45
import { toRgba } from "@/lib/theme";
56
import { useCustomImageName } from "../hooks/useCustomImageName";
6-
import type { Task } from "../types";
77

88
// Theme tokens have no violet; a fixed Radix violet-9 mirrors the desktop
99
// custom-image badge and reads well in both light and dark.

0 commit comments

Comments
 (0)