Skip to content

armgit / kaneo

Public Imported from GitHub
0

⚡ Project management that doesn't become the project. Boards, Gantt charts, and GitHub integration. Self-host it or use Kaneo Cloud.

fix(mobile): address Android tester feedback

Tinfa40e8716199
diff --git a/apps/mobile/src/app/(app)/board/[projectId].tsx b/apps/mobile/src/app/(app)/board/[projectId].tsx
index 86d6924ca..bd19a7697 100644
--- a/apps/mobile/src/app/(app)/board/[projectId].tsx
+++ b/apps/mobile/src/app/(app)/board/[projectId].tsx
@@ -71,7 +71,7 @@ export default function BoardScreen() {
const [view, setView] = useState<"board" | "list">("board");
const [filters, setFilters] = useState<BoardFilters>(emptyFilters);
- const [showBacklog, setShowBacklog] = useState(true);
+ const [showPlanned, setShowPlanned] = useState(true);
const [showArchived, setShowArchived] = useState(false);
const [filterSheet, setFilterSheet] = useState(false);
const [menu, setMenu] = useState(false);
@@ -79,7 +79,7 @@ export default function BoardScreen() {
const [quick, setQuick] = useState<{ task: BoardTask; lane: Lane } | null>(
null,
);
- const [page, setPage] = useState(showBacklog ? 1 : 0);
+ const [page, setPage] = useState(showPlanned ? 1 : 0);
const pager = useRef<FlatList<Lane>>(null);
const tabs = useRef<ScrollView>(null);
const reloadTimer = useRef<ReturnType<typeof setTimeout> | null>(null);
@@ -110,9 +110,9 @@ export default function BoardScreen() {
const lanes = useMemo(
() =>
board.data
- ? buildLanes(board.data, filters, showBacklog, showArchived)
+ ? buildLanes(board.data, filters, showPlanned, showArchived)
: [],
- [board.data, filters, showBacklog, showArchived],
+ [board.data, filters, showPlanned, showArchived],
);
const laneWidth = width - inset * 2 - 36;
const current = lanes[Math.min(page, Math.max(0, lanes.length - 1))];
@@ -636,9 +636,9 @@ export default function BoardScreen() {
members={members.data ?? []}
labels={labels.data ?? []}
currentUserId={session.userId}
- showBacklog={showBacklog}
- setShowBacklog={(v) => {
- setShowBacklog(v);
+ showPlanned={showPlanned}
+ setShowPlanned={(v) => {
+ setShowPlanned(v);
setPage(0);
pager.current?.scrollToOffset({ offset: 0, animated: false });
}}
@@ -683,8 +683,8 @@ export default function BoardScreen() {
options={[
{ value: "settings", label: "Project settings" },
{
- value: "backlog",
- label: showBacklog ? "Hide backlog" : "Show backlog",
+ value: "planned",
+ label: showPlanned ? "Hide planned" : "Show planned",
},
{
value: "archived",
@@ -698,8 +698,8 @@ export default function BoardScreen() {
pathname: "/project/[projectId]/settings",
params: { projectId, workspaceId },
});
- if (v === "backlog") {
- setShowBacklog(!showBacklog);
+ if (v === "planned") {
+ setShowPlanned(!showPlanned);
setPage(0);
pager.current?.scrollToOffset({ offset: 0, animated: false });
}
diff --git a/apps/mobile/src/app/(app)/task/[taskId].tsx b/apps/mobile/src/app/(app)/task/[taskId].tsx
index fc539dd09..96f057177 100644
--- a/apps/mobile/src/app/(app)/task/[taskId].tsx
+++ b/apps/mobile/src/app/(app)/task/[taskId].tsx
@@ -101,7 +101,7 @@ export default function TaskScreen() {
: null;
const ex = extras.data;
const statusNames: Record<string, string> = {
- planned: "Backlog",
+ planned: "Planned",
archived: "Archived",
};
d.columns.forEach((col) => (statusNames[col.slug] = col.name));
diff --git a/apps/mobile/src/app/(app)/task/new.tsx b/apps/mobile/src/app/(app)/task/new.tsx
index 5c2586e2d..218b51e4a 100644
--- a/apps/mobile/src/app/(app)/task/new.tsx
+++ b/apps/mobile/src/app/(app)/task/new.tsx
@@ -105,7 +105,7 @@ export default function NewTaskScreen() {
const effectiveStatus = status ?? sortedColumns[0]?.slug ?? STATUS_PLANNED;
const statusLabel =
effectiveStatus === STATUS_PLANNED
- ? "Backlog"
+ ? "Planned"
: (sortedColumns.find((col) => col.slug === effectiveStatus)?.name ??
effectiveStatus);
const statusIdx = sortedColumns.findIndex(
@@ -510,7 +510,7 @@ export default function NewTaskScreen() {
options={[
{
value: STATUS_PLANNED,
- label: "Backlog",
+ label: "Planned",
leading: <StatusIcon status={STATUS_PLANNED} />,
},
...sortedColumns.map((col) => ({
@@ -668,6 +668,7 @@ export default function NewTaskScreen() {
onClose={() => setFieldEditing(null)}
title={fieldEditing?.name ?? ""}
initial={fieldEditing ? (fieldValues[fieldEditing.id] ?? "") : ""}
+ multiline={fieldEditing?.type === "text"}
keyboardType={
fieldEditing?.type === "number" ? "decimal-pad" : "default"
}
diff --git a/apps/mobile/src/app/sign-in.tsx b/apps/mobile/src/app/sign-in.tsx
index 3e9f540e1..d55d6c51a 100644
--- a/apps/mobile/src/app/sign-in.tsx
+++ b/apps/mobile/src/app/sign-in.tsx
@@ -1,4 +1,5 @@
import * as Clipboard from "expo-clipboard";
+import * as Linking from "expo-linking";
import * as WebBrowser from "expo-web-browser";
import {
ArrowUpRight,
@@ -36,6 +37,8 @@ import { font, useColors } from "@/theme";
type Step = "start" | "otp" | "device" | "apiKey" | "signUp";
const CODE_SLOTS = [0, 1, 2, 3, 4, 5];
+// The scheme from app.json; the web approval page links back here after approving.
+const APP_RETURN_URL = "kaneo://";
function friendly(e: unknown): string {
const text = userMessage(e);
@@ -676,6 +679,7 @@ function DeviceStep({
result = { kind: "pending" };
}
if (result.kind === "approved") {
+ if (Platform.OS === "ios") WebBrowser.dismissAuthSession();
await auth.completeWithToken(serverUrl, result.token);
return;
}
@@ -699,6 +703,20 @@ function DeviceStep({
const link = device?.verification_uri_complete ?? device?.verification_uri;
+ const openBrowser = async (link: string) => {
+ // Tells the approval page to send the user back here when they're done.
+ const url = `${link}${link.includes("?") ? "&" : "?"}from=app`;
+ try {
+ // Unlike a plain browser tab, an auth session closes when the page returns to the app.
+ await WebBrowser.openAuthSessionAsync(url, APP_RETURN_URL);
+ } catch {
+ // No browser that supports in-app tabs: hand the link to the default browser instead.
+ await Linking.openURL(url).catch(() =>
+ toast.show("Couldn’t open a browser. Copy the link instead.", "error"),
+ );
+ }
+ };
+
return (
<View style={{ gap: 28, paddingTop: 20 }}>
<StepTitle
@@ -769,7 +787,7 @@ function DeviceStep({
strokeWidth={2}
/>
}
- onPress={() => link && WebBrowser.openBrowserAsync(link)}
+ onPress={() => link && void openBrowser(link)}
style={{ flexDirection: "row-reverse" }}
/>
{error ? (
diff --git a/apps/mobile/src/components/avatar.tsx b/apps/mobile/src/components/avatar.tsx
index 4b2e27334..a19dd098b 100644
--- a/apps/mobile/src/components/avatar.tsx
+++ b/apps/mobile/src/components/avatar.tsx
@@ -1,4 +1,5 @@
import { Image } from "expo-image";
+import { useState } from "react";
import { View } from "react-native";
import { resolveUrl } from "@/lib/api/client";
@@ -21,10 +22,12 @@ export function Avatar({
const session = useSession();
const tint = avatarTint(name ?? "?", isDark);
const uri = session ? resolveUrl(session.serverUrl, image) : null;
- if (uri) {
+ const [failedUri, setFailedUri] = useState<string | null>(null);
+ if (uri && uri !== failedUri) {
return (
<Image
source={{ uri }}
+ onError={() => setFailedUri(uri)}
style={{ width: size, height: size, borderRadius: size / 2 }}
contentFit="cover"
/>
diff --git a/apps/mobile/src/components/pickers.tsx b/apps/mobile/src/components/pickers.tsx
index 78d02f9e0..332221d55 100644
--- a/apps/mobile/src/components/pickers.tsx
+++ b/apps/mobile/src/components/pickers.tsx
@@ -302,6 +302,7 @@ function TextInputForm({
multiline={multiline}
keyboardType={keyboardType}
autoFocus
+ style={multiline ? { maxHeight: 160 } : undefined}
/>
<Button
label={confirmLabel}
diff --git a/apps/mobile/src/components/sheet.tsx b/apps/mobile/src/components/sheet.tsx
index fc81d683a..75b2be310 100644
--- a/apps/mobile/src/components/sheet.tsx
+++ b/apps/mobile/src/components/sheet.tsx
@@ -5,7 +5,6 @@ import {
Dimensions,
KeyboardAvoidingView,
Modal,
- Platform,
Pressable,
ScrollView,
TextInput,
@@ -84,8 +83,10 @@ export function Sheet({
accessibilityLabel="Close"
/>
</Animated.View>
+ {/* "height" can't lift an absolutely positioned sheet, and Android doesn't resize the
+ modal window under edge-to-edge, so pad on both platforms. */}
<KeyboardAvoidingView
- behavior={Platform.OS === "ios" ? "padding" : "height"}
+ behavior="padding"
style={{ position: "absolute", left: 0, right: 0, bottom: 0 }}
pointerEvents="box-none"
>
diff --git a/apps/mobile/src/features/board/model.test.ts b/apps/mobile/src/features/board/model.test.ts
index 18e2e7803..7a7378e5f 100644
--- a/apps/mobile/src/features/board/model.test.ts
+++ b/apps/mobile/src/features/board/model.test.ts
@@ -67,7 +67,7 @@ describe("lanes", () => {
archivedTasks: [],
};
- it("adds backlog and archive lanes only when asked", () => {
+ it("adds planned and archived lanes only when asked", () => {
expect(
lanes(data, emptyFilters, false, false).map((l) => l.status),
).toEqual(["to-do", "done"]);
diff --git a/apps/mobile/src/features/board/model.ts b/apps/mobile/src/features/board/model.ts
index 4a957d9df..1543ed9e7 100644
--- a/apps/mobile/src/features/board/model.ts
+++ b/apps/mobile/src/features/board/model.ts
@@ -56,7 +56,7 @@ export function matches(f: BoardFilters, task: BoardTask): boolean {
return true;
}
-/** One swipeable page of the board: a workflow column, or the virtual backlog/archive lists. */
+/** One swipeable page of the board: a workflow column, or the virtual planned/archived lists. */
export type Lane = {
status: string;
name: string;
@@ -69,15 +69,15 @@ export type Lane = {
export function lanes(
data: BoardData,
f: BoardFilters,
- backlog: boolean,
+ planned: boolean,
archived: boolean,
): Lane[] {
const cols = data.columns ?? [];
const out: Lane[] = [];
- if (backlog)
+ if (planned)
out.push({
status: STATUS_PLANNED,
- name: "Backlog",
+ name: "Planned",
isFinal: false,
tasks: data.plannedTasks.filter((t) => matches(f, t)),
total: data.plannedTasks.length,
diff --git a/apps/mobile/src/features/board/sheets.tsx b/apps/mobile/src/features/board/sheets.tsx
index faa40d008..6d89f1766 100644
--- a/apps/mobile/src/features/board/sheets.tsx
+++ b/apps/mobile/src/features/board/sheets.tsx
@@ -49,8 +49,8 @@ export function FilterSheet({
members,
labels,
currentUserId,
- showBacklog,
- setShowBacklog,
+ showPlanned,
+ setShowPlanned,
showArchived,
setShowArchived,
matching,
@@ -62,8 +62,8 @@ export function FilterSheet({
members: WorkspaceMember[];
labels: Label[];
currentUserId: string;
- showBacklog: boolean;
- setShowBacklog: (v: boolean) => void;
+ showPlanned: boolean;
+ setShowPlanned: (v: boolean) => void;
showArchived: boolean;
setShowArchived: (v: boolean) => void;
matching: number;
@@ -185,10 +185,10 @@ export function FilterSheet({
/>
<Divider />
<ToggleRow
- label="Show backlog"
- hint="Planned, not on the board yet"
- value={showBacklog}
- onChange={setShowBacklog}
+ label="Show planned"
+ hint="Tasks not on the board yet"
+ value={showPlanned}
+ onChange={setShowPlanned}
/>
<Divider />
<ToggleRow
diff --git a/apps/mobile/src/features/task/description-editor.tsx b/apps/mobile/src/features/task/description-editor.tsx
index fc113cc71..e74267a61 100644
--- a/apps/mobile/src/features/task/description-editor.tsx
+++ b/apps/mobile/src/features/task/description-editor.tsx
@@ -7,9 +7,10 @@ import {
Link2,
List,
} from "lucide-react-native";
-import { useRef, useState, type ReactNode } from "react";
+import { useEffect, useRef, useState, type ReactNode } from "react";
import {
ActivityIndicator,
+ Keyboard,
KeyboardAvoidingView,
Modal,
Platform,
@@ -17,6 +18,7 @@ import {
TextInput,
View,
} from "react-native";
+import { useSafeAreaInsets } from "react-native-safe-area-context";
import { MarkdownText } from "@/components/markdown";
import { BackButton, Screen } from "@/components/screen";
@@ -85,6 +87,26 @@ function EditorBody({
});
const [uploading, setUploading] = useState(false);
const input = useRef<TextInput>(null);
+ const insets = useSafeAreaInsets();
+ const [keyboardShown, setKeyboardShown] = useState(false);
+ // The keyboard covers the system navigation area, so only clear it while the keyboard is down.
+ const bottomInset = keyboardShown ? 0 : insets.bottom;
+
+ useEffect(() => {
+ const ios = Platform.OS === "ios";
+ const show = Keyboard.addListener(
+ ios ? "keyboardWillShow" : "keyboardDidShow",
+ () => setKeyboardShown(true),
+ );
+ const hide = Keyboard.addListener(
+ ios ? "keyboardWillHide" : "keyboardDidHide",
+ () => setKeyboardShown(false),
+ );
+ return () => {
+ show.remove();
+ hide.remove();
+ };
+ }, []);
const focus = () => input.current?.focus();
@@ -135,48 +157,55 @@ function EditorBody({
style={{
flexDirection: "row",
alignItems: "center",
- justifyContent: "space-between",
+ gap: 4,
height: 52,
paddingLeft: 6,
paddingRight: 16,
+ }}
+ >
+ <BackButton close onPress={onClose} />
+ <Txt
+ variant="body"
+ weight="semibold"
+ numberOfLines={1}
+ style={{ flex: 1, fontSize: 16 }}
+ >
+ Description
+ </Txt>
+ <Touch
+ onPress={() => {
+ onSave(text);
+ onClose();
+ }}
+ style={{
+ height: 32,
+ paddingHorizontal: 14,
+ borderRadius: 9,
+ backgroundColor: c.primary,
+ justifyContent: "center",
+ }}
+ >
+ <Txt variant="bodySm" weight="medium" color={c.onPrimary}>
+ Save
+ </Txt>
+ </Touch>
+ </View>
+ <View
+ style={{
+ paddingHorizontal: 16,
+ paddingBottom: 10,
borderBottomWidth: 1,
borderBottomColor: c.divider,
}}
>
- <View style={{ flexDirection: "row", alignItems: "center", gap: 4 }}>
- <BackButton close onPress={onClose} />
- <Txt variant="body" weight="semibold" style={{ fontSize: 16 }}>
- Description
- </Txt>
- </View>
- <View style={{ flexDirection: "row", alignItems: "center", gap: 8 }}>
- <Segmented
- style={{ padding: 2 }}
- value={mode}
- onChange={setMode}
- options={[
- { value: "write", label: "Write" },
- { value: "preview", label: "Preview" },
- ]}
- />
- <Touch
- onPress={() => {
- onSave(text);
- onClose();
- }}
- style={{
- height: 32,
- paddingHorizontal: 14,
- borderRadius: 9,
- backgroundColor: c.primary,
- justifyContent: "center",
- }}
- >
- <Txt variant="bodySm" weight="medium" color={c.onPrimary}>
- Save
- </Txt>
- </Touch>
- </View>
+ <Segmented
+ value={mode}
+ onChange={setMode}
+ options={[
+ { value: "write", label: "Write" },
+ { value: "preview", label: "Preview" },
+ ]}
+ />
</View>
{mode === "write" ? (
<TextInput
@@ -203,7 +232,10 @@ function EditorBody({
) : (
<ScrollView
style={{ flex: 1 }}
- contentContainerStyle={{ padding: 20 }}
+ contentContainerStyle={{
+ padding: 20,
+ paddingBottom: 20 + insets.bottom,
+ }}
>
{text.trim() ? (
<MarkdownText>{text}</MarkdownText>
@@ -218,8 +250,9 @@ function EditorBody({
flexDirection: "row",
alignItems: "center",
justifyContent: "space-between",
- height: 48,
+ height: 48 + bottomInset,
paddingHorizontal: 12,
+ paddingBottom: bottomInset,
borderTopWidth: 1,
borderTopColor: c.hairline,
backgroundColor: c.ground,
diff --git a/apps/mobile/src/features/task/properties.tsx b/apps/mobile/src/features/task/properties.tsx
index fe08f96fe..cb53da9f6 100644
--- a/apps/mobile/src/features/task/properties.tsx
+++ b/apps/mobile/src/features/task/properties.tsx
@@ -209,7 +209,7 @@ export function Properties({
options={[
{
value: STATUS_PLANNED,
- label: "Backlog",
+ label: "Planned",
leading: <StatusIcon status={STATUS_PLANNED} />,
},
...columns.map((col) => ({
diff --git a/apps/mobile/src/features/task/sections.tsx b/apps/mobile/src/features/task/sections.tsx
index 156cdf336..fe2b86fc3 100644
--- a/apps/mobile/src/features/task/sections.tsx
+++ b/apps/mobile/src/features/task/sections.tsx
@@ -118,6 +118,29 @@ function stringList(value: Json | undefined | null): string[] {
// --- Custom fields ---
+const MAX_FIELD_CHIPS = 4;
+
+function FieldChip({ label }: { label: string }) {
+ const c = useColors();
+ return (
+ <View
+ style={{
+ maxWidth: "100%",
+ paddingHorizontal: 8,
+ height: 24,
+ justifyContent: "center",
+ borderRadius: 6,
+ backgroundColor: c.fill,
+ alignSelf: "flex-start",
+ }}
+ >
+ <Txt variant="meta" weight="medium" numberOfLines={1}>
+ {label}
+ </Txt>
+ </View>
+ );
+}
+
export function CustomFields({
taskId,
extras,
@@ -125,7 +148,6 @@ export function CustomFields({
taskId: string;
extras: TaskExtras;
}) {
- const c = useColors();
const { run } = useAction();
const [editing, setEditing] = useState<CustomFieldDefinition | null>(null);
if (!extras.fields.length) return null;
@@ -149,45 +171,24 @@ export function CustomFields({
);
} else if (f.type === "multiselect") {
const items = stringList(value);
+ const extra = items.length - MAX_FIELD_CHIPS;
display = items.length ? (
<View style={{ flexDirection: "row", flexWrap: "wrap", gap: 4 }}>
- {items.map((i) => (
- <View
- key={i}
- style={{
- paddingHorizontal: 8,
- height: 24,
- justifyContent: "center",
- borderRadius: 6,
- backgroundColor: c.fill,
- }}
- >
- <Txt variant="meta" weight="medium">
- {i}
- </Txt>
- </View>
+ {items.slice(0, MAX_FIELD_CHIPS).map((i) => (
+ <FieldChip key={i} label={i} />
))}
+ {extra > 0 ? <FieldChip label={`+${extra}`} /> : null}
</View>
) : null;
} else if (value) {
display =
f.type === "dropdown" ? (
- <View
- style={{
- paddingHorizontal: 8,
- height: 24,
- justifyContent: "center",
- borderRadius: 6,
- backgroundColor: c.fill,
- alignSelf: "flex-start",
- }}
- >
- <Txt variant="meta" weight="medium">
- {value}
- </Txt>
- </View>
+ <FieldChip label={value} />
) : (
- <Txt variant={f.type === "number" ? "monoMd" : "bodySm"}>
+ <Txt
+ variant={f.type === "number" ? "monoMd" : "bodySm"}
+ numberOfLines={3}
+ >
{f.type === "date" ? formatDate(value) : value}
</Txt>
);
@@ -199,21 +200,22 @@ export function CustomFields({
onPress={() => setEditing(f)}
style={{
flexDirection: "row",
- alignItems: "center",
+ alignItems: "flex-start",
+ gap: 12,
minHeight: 40,
- paddingVertical: 6,
+ paddingVertical: 8,
}}
>
<Txt
variant="bodySm"
tone="muted"
- style={{ width: 132 }}
+ style={{ width: 112, paddingTop: 2 }}
numberOfLines={2}
>
{f.name}
{f.required ? " *" : ""}
</Txt>
- <View style={{ flex: 1 }}>
+ <View style={{ flex: 1, minHeight: 24, justifyContent: "center" }}>
{display ?? (
<Txt variant="bodySm" tone="placeholder">
Empty
@@ -257,6 +259,7 @@ export function CustomFields({
onClose={() => setEditing(null)}
title={editing?.name ?? ""}
initial={editing ? (valueOf(editing.id) ?? "") : ""}
+ multiline={editing?.type === "text"}
keyboardType={editing?.type === "number" ? "decimal-pad" : "default"}
validate={(v) => !editing?.required || v.trim().length > 0}
onSubmit={(v) => editing && set(editing.id, v)}
diff --git a/apps/mobile/src/features/task/use-task.ts b/apps/mobile/src/features/task/use-task.ts
index 70a6fcdbd..241fa081b 100644
--- a/apps/mobile/src/features/task/use-task.ts
+++ b/apps/mobile/src/features/task/use-task.ts
@@ -99,7 +99,7 @@ export function entrySeconds(entry: TimeEntry, now: number): number {
}
export function statusName(status: string, columns: Column[]): string {
- if (status === "planned") return "Backlog";
+ if (status === "planned") return "Planned";
if (status === "archived") return "Archived";
return columns.find((c) => c.slug === status)?.name ?? status;
}
diff --git a/apps/mobile/src/lib/background.ts b/apps/mobile/src/lib/background.ts
index 8085ef841..28a37fd37 100644
--- a/apps/mobile/src/lib/background.ts
+++ b/apps/mobile/src/lib/background.ts
@@ -87,6 +87,9 @@ export async function requestNotificationPermission(): Promise<boolean> {
export async function setBackgroundChecks(enabled: boolean) {
const registered = await TaskManager.isTaskRegisteredAsync(BACKGROUND_TASK);
if (enabled && !registered) {
+ // Start from now, so the first background run already reports what arrived since.
+ if (!(await AsyncStorage.getItem(SINCE_KEY)))
+ await AsyncStorage.setItem(SINCE_KEY, String(Date.now()));
await BackgroundTask.registerTaskAsync(BACKGROUND_TASK, {
minimumInterval: 15,
});