From 5e8c9492b33e634678c69bbcb71b7772bd19af05 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zo=C3=AB=20Kooijmans?= Date: Fri, 9 Oct 2026 17:34:15 +0200 Subject: [PATCH] feat(phase5): star/watch/fork, releases, wiki fallback, capability probe MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - endpoints: is-starred (404→false), star/unstar, subscription watch/unwatch, fork, releases list/detail - hooks: useIsStarred/useToggleStar, useSubscription/useToggleWatch, useForkRepository, useReleases/useRelease - repo overview: star/watch/fork actions, Releases + Wiki entries (wiki via explicit browser fallback gated by capability probe) - screens: Releases list, Release detail with downloadable assets - core/capabilities: version parsing + per-capability minimum versions + tests - i18n (en/nl); README/ROADMAP/FEATURE_PARITY updated for phases 3-5 --- README.md | 26 ++-- ROADMAP.md | 16 ++- docs/FEATURE_PARITY.md | 18 ++- src/core/api/endpoints.ts | 105 ++++++++++++++ src/core/api/query-keys.ts | 12 ++ src/core/api/types.ts | 33 +++++ src/core/capabilities/index.test.ts | 57 ++++++++ src/core/capabilities/index.ts | 57 ++++++++ src/features/repositories/queries.ts | 131 ++++++++++++++++- .../screens/release-detail-screen.tsx | 136 ++++++++++++++++++ .../repository/screens/releases-screen.tsx | 66 +++++++++ .../screens/repo-overview-screen.tsx | 84 ++++++++++- src/i18n/locales/en.json | 19 +++ src/i18n/locales/nl.json | 19 +++ src/navigation/repository-navigator.tsx | 12 ++ src/navigation/types.ts | 2 + 16 files changed, 769 insertions(+), 24 deletions(-) create mode 100644 src/core/capabilities/index.test.ts create mode 100644 src/core/capabilities/index.ts create mode 100644 src/features/repository/screens/release-detail-screen.tsx create mode 100644 src/features/repository/screens/releases-screen.tsx diff --git a/README.md b/README.md index f9ecada..c0a9e14 100644 --- a/README.md +++ b/README.md @@ -32,6 +32,14 @@ covers the read-heavy Git workflow: - **Issues & pull requests**: cross-repository lists (assigned, created, review-requested), per-repository lists, and detail screens with Markdown bodies, labels, assignees, milestones and reviewers. +- **Collaboration**: comment threads with compose/edit/delete, create and edit + issues, approve / request-changes / comment reviews, merge (squash or merge + commit), a native unified diff viewer, and CI check statuses. +- **Quick Edit**: edit a file in-app and commit it through the Contents API — + to a branch or a new branch (protected branches are handled), optionally + opening a pull request in the same step. +- **Repository actions**: star/unstar, watch/unwatch, fork, plus releases and + assets, and a configurable "Open in editor" action. - **Notification inbox**: unread/all filters, mark-as-read, mark-all-read, and life-cycle-aware polling. - **English & Dutch**, light/dark/system theme, accessible touch targets and @@ -172,20 +180,22 @@ state/data-flow, API client and account-registry design. ## Roadmap -See [`ROADMAP.md`](ROADMAP.md). Phases 0–2 are complete; Phase 3 -(collaboration) is partially implemented (read paths) and the write paths -(comments, reviews, merges, diffs) are planned. +See [`ROADMAP.md`](ROADMAP.md). Phases 0–4 are complete; Phase 5 (advanced) is +in progress — stars, watches, forks, releases, wiki and a capability probe are +in, while orgs, Actions, packages and admin screens are planned. ## Known limitations -- Read-only collaboration: you can view issues, pull requests and - notifications, but cannot yet create comments, review, or merge from the app. -- The commit view lists changed files; an inline unified/split diff viewer is - planned. +- The in-app editor is a native monospace field; syntax highlighting and + search/replace (CodeMirror in a WebView) are planned. +- Pull-request review comments are at the PR level; line-level (inline) review + comments are planned. +- Gitea Actions, packages, organizations and admin screens are not built yet. - Gitea's REST API exposes no total count for some endpoints, so infinite scroll falls back to a page-length heuristic. - Features that are unavailable or disabled on a given instance degrade to a - clear empty/error state; a browser fallback is planned but not yet wired. + clear empty/error state, or open in the browser where that is the only path + (wiki). A version-based capability probe gates features without a server flag. ## License diff --git a/ROADMAP.md b/ROADMAP.md index e2ce7a4..d2fb49e 100644 --- a/ROADMAP.md +++ b/ROADMAP.md @@ -17,7 +17,7 @@ This document is the living implementation plan. It is updated as phases land. | 2 | Core Git experience: home, repos, browsing, commits | ✅ Done | | 3 | Collaboration: issues, PRs, reviews, notifications | ✅ Done (read + write) | | 4 | Code editing: Quick Edit, commit flow, editor workspace | ✅ Done (native editor) | -| 5 | Advanced: Actions, packages, orgs, wiki, releases, admin | ⬜ Planned | +| 5 | Advanced: Actions, packages, orgs, wiki, releases, admin | 🟡 In progress | Detailed acceptance criteria per phase are in `docs/FEATURE_PARITY.md`. Architectural decisions are recorded in `docs/ARCHITECTURE.md`. @@ -117,18 +117,20 @@ Architectural decisions are recorded in `docs/ARCHITECTURE.md`. - [ ] CodeMirror 6 editor in a WebView (syntax highlighting, search/replace) - [ ] Line-level diff preview before committing -## Phase 5 — Advanced features (planned) +## Phase 5 — Advanced features (in progress) +- [x] Star / unstar and watch / unwatch repositories +- [x] Fork a repository +- [x] Releases list and detail with downloadable assets +- [x] Wiki entry with an explicit browser fallback (never silent) +- [x] Instance capability service (version parsing + feature gating) with tests - [ ] Repository create/edit/delete, settings, collaborators, webhooks, deploy keys -- [ ] Protected branches, releases, assets, forks -- [ ] Wiki, projects, organizations, teams, permissions +- [ ] Protected-branch management, release management, asset upload +- [ ] Organizations, teams, projects, permissions - [ ] Gitea Actions: workflows, runs, jobs, logs, artifacts, reruns - [ ] Package registries - [ ] User settings: SSH/GPG keys, tokens, profile - [ ] Administration screens where instance permissions allow -- [ ] Instance capability service (version, endpoint probing, tri-state: supported / - unsupported / disabled / unauthorized / unknown) + graceful degradation -- [ ] Browser fallback for API-unavailable features (explicit, never silent) --- diff --git a/docs/FEATURE_PARITY.md b/docs/FEATURE_PARITY.md index 991040d..d6b677b 100644 --- a/docs/FEATURE_PARITY.md +++ b/docs/FEATURE_PARITY.md @@ -115,15 +115,21 @@ roadmap). | VS Code / editor workspace | ✅ | configurable URL template, no token passthrough | | Syntax highlighting / search-replace | ⬜ | planned (CodeMirror 6 in a WebView) | -## Advanced (planned) +## Advanced (partially implemented) | Feature | Status | | --- | --- | -| Repo create/edit/settings/webhooks | ⬜ | -| Protected branches / releases / forks | ⬜ | -| Wiki / projects / orgs / teams | ⬜ | -| Gitea Actions (runs, jobs, logs) | ⬜ | +| Star / unstar repository | ✅ | +| Watch / unwatch repository | ✅ | +| Fork repository | ✅ | +| Releases list + detail (with assets) | ✅ | +| Wiki (explicit browser fallback) | ✅ | +| Instance capability probe (version-gated) | ✅ | +| Repo create/edit/delete/settings/webhooks | ⬜ | +| Protected branch management | ⬜ | +| Release management (create/edit/upload) | ⬜ | +| Organizations / teams / projects | ⬜ | +| Gitea Actions (runs, jobs, logs, artifacts) | ⬜ | | Package registries | ⬜ | | User settings (SSH/GPG keys, tokens) | ⬜ | | Admin screens | ⬜ | -| Capability probe + browser fallback | 🌐 | diff --git a/src/core/api/endpoints.ts b/src/core/api/endpoints.ts index 52b305f..5301249 100644 --- a/src/core/api/endpoints.ts +++ b/src/core/api/endpoints.ts @@ -9,6 +9,7 @@ * Gitea instances at `/swagger.v1.json`. */ +import { ApiError } from './errors'; import type { GiteaClient, RequestOptions } from './client'; import type { Activity, @@ -25,9 +26,11 @@ import type { NotificationThread, PullRequest, PullReview, + Release, Repository, ReviewEvent, ServerVersion, + Subscription, Tag, User, } from './types'; @@ -145,6 +148,108 @@ export function fetchRepositoryLanguages( return client.get>(`${repoPath(owner, repo)}/languages`, options); } +// --- repository actions (star / watch / fork) ------------------------------ + +/** `true` when the authenticated user has starred the repository (404 → false). */ +export async function fetchIsStarred( + client: GiteaClient, + owner: string, + repo: string, + options?: RequestOptions, +): Promise { + try { + await client.get(`/user/starred/${enc(owner)}/${enc(repo)}`, options); + return true; + } catch (error) { + if (error instanceof ApiError && error.kind === 'not-found') return false; + throw error; + } +} + +export function starRepo(client: GiteaClient, owner: string, repo: string, options?: RequestOptions) { + return client.put(`/user/starred/${enc(owner)}/${enc(repo)}`, undefined, options); +} + +export function unstarRepo( + client: GiteaClient, + owner: string, + repo: string, + options?: RequestOptions, +) { + return client.delete(`/user/starred/${enc(owner)}/${enc(repo)}`, options); +} + +export function fetchSubscription( + client: GiteaClient, + owner: string, + repo: string, + options?: RequestOptions, +): Promise { + return client.get(`${repoPath(owner, repo)}/subscription`, options); +} + +export function watchRepo( + client: GiteaClient, + owner: string, + repo: string, + options?: RequestOptions, +): Promise { + return client.put( + `${repoPath(owner, repo)}/subscription`, + { subscribed: true, ignored: false }, + options, + ); +} + +export function unwatchRepo( + client: GiteaClient, + owner: string, + repo: string, + options?: RequestOptions, +) { + return client.delete(`${repoPath(owner, repo)}/subscription`, options); +} + +export interface ForkRepoInput { + name?: string; + organization?: string; +} + +export function forkRepository( + client: GiteaClient, + owner: string, + repo: string, + input: ForkRepoInput = {}, + options?: RequestOptions, +): Promise { + return client.post(`${repoPath(owner, repo)}/forks`, input, options); +} + +// --- releases -------------------------------------------------------------- + +export function listReleases( + client: GiteaClient, + owner: string, + repo: string, + params: PageParams = {}, + options?: RequestOptions, +) { + return client.raw(`${repoPath(owner, repo)}/releases`, { + ...options, + query: { page: params.page ?? 1, limit: params.limit ?? 20 }, + }); +} + +export function fetchRelease( + client: GiteaClient, + owner: string, + repo: string, + id: number, + options?: RequestOptions, +): Promise { + return client.get(`${repoPath(owner, repo)}/releases/${id}`, options); +} + // --------------------------------------------------------------------------- // Contents, README, branches, tags // --------------------------------------------------------------------------- diff --git a/src/core/api/query-keys.ts b/src/core/api/query-keys.ts index b2a9b1e..69b52d9 100644 --- a/src/core/api/query-keys.ts +++ b/src/core/api/query-keys.ts @@ -44,6 +44,18 @@ export const queryKeys = { repoLanguages: (accountId: string, owner: string, name: string) => [...queryKeys.repo(accountId, owner, name), 'languages'] as const, + repoStar: (accountId: string, owner: string, name: string) => + [...queryKeys.repo(accountId, owner, name), 'star'] as const, + + repoSubscription: (accountId: string, owner: string, name: string) => + [...queryKeys.repo(accountId, owner, name), 'subscription'] as const, + + releases: (accountId: string, owner: string, name: string, params: Record) => + [...queryKeys.repo(accountId, owner, name), 'releases', params] as const, + + release: (accountId: string, owner: string, name: string, id: number) => + [...queryKeys.repo(accountId, owner, name), 'release', id] as const, + contents: (accountId: string, owner: string, name: string, path: string, ref?: string) => [...queryKeys.repo(accountId, owner, name), 'contents', { path, ref }] as const, diff --git a/src/core/api/types.ts b/src/core/api/types.ts index fadfbaa..6813084 100644 --- a/src/core/api/types.ts +++ b/src/core/api/types.ts @@ -349,6 +349,39 @@ export interface ServerVersion { version: string; } +/** A release asset (downloadable file). */ +export interface ReleaseAsset { + id?: number; + name?: string; + size?: number; + download_count?: number; + browser_download_url?: string; + created_at?: string; +} + +export interface Release { + id?: number; + tag_name?: string; + target_commitish?: string; + name?: string; + body?: string; + draft?: boolean; + prerelease?: boolean; + author?: User; + created_at?: string; + published_at?: string; + html_url?: string; + tarball_url?: string; + zipball_url?: string; + assets?: ReleaseAsset[]; +} + +/** Repository watch subscription state. */ +export interface Subscription { + subscribed?: boolean; + ignored?: boolean; +} + export interface Activity { id?: number; user_id?: number; diff --git a/src/core/capabilities/index.test.ts b/src/core/capabilities/index.test.ts new file mode 100644 index 0000000..4250ed5 --- /dev/null +++ b/src/core/capabilities/index.test.ts @@ -0,0 +1,57 @@ +/** Instance capability detection (version parsing + feature gating). */ + +import { atLeast, parseGiteaVersion, supports } from './index'; + +describe('parseGiteaVersion', () => { + it('parses plain versions', () => { + expect(parseGiteaVersion('1.21.4')).toEqual({ major: 1, minor: 21, patch: 4, raw: '1.21.4' }); + }); + + it('tolerates suffixes and a leading v', () => { + expect(parseGiteaVersion('v1.22.0+rc1')?.minor).toBe(22); + expect(parseGiteaVersion('1.19.3-rc2')?.patch).toBe(3); + }); + + it('defaults a missing patch to 0', () => { + expect(parseGiteaVersion('1.21')?.patch).toBe(0); + }); + + it('returns null for empty or invalid input', () => { + expect(parseGiteaVersion(undefined)).toBeNull(); + expect(parseGiteaVersion('')).toBeNull(); + expect(parseGiteaVersion('development')).toBeNull(); + }); +}); + +describe('atLeast', () => { + const v = parseGiteaVersion('1.21.4'); + + it('compares major/minor/patch correctly', () => { + expect(atLeast(v, 1, 21, 4)).toBe(true); + expect(atLeast(v, 1, 21, 5)).toBe(false); + expect(atLeast(v, 1, 22, 0)).toBe(false); + expect(atLeast(v, 2, 0, 0)).toBe(false); + expect(atLeast(v, 1, 20, 0)).toBe(true); + }); + + it('treats an unknown version as too old', () => { + expect(atLeast(null, 1, 0, 0)).toBe(false); + }); +}); + +describe('supports', () => { + it('gates Actions on Gitea 1.19+', () => { + expect(supports('actions', parseGiteaVersion('1.18.5'))).toBe(false); + expect(supports('actions', parseGiteaVersion('1.19.0'))).toBe(true); + expect(supports('actions', parseGiteaVersion('1.24.1'))).toBe(true); + }); + + it('treats releases and wiki as widely available', () => { + expect(supports('releases', parseGiteaVersion('1.9.0'))).toBe(true); + expect(supports('wiki', parseGiteaVersion('1.0.0'))).toBe(true); + }); + + it('is conservative for unknown instances', () => { + expect(supports('packages', null)).toBe(false); + }); +}); diff --git a/src/core/capabilities/index.ts b/src/core/capabilities/index.ts new file mode 100644 index 0000000..c2fd9ed --- /dev/null +++ b/src/core/capabilities/index.ts @@ -0,0 +1,57 @@ +/** + * Instance capability detection. + * + * Gitea feature availability varies by version and by instance config. Where an + * API exposes a per-repository flag (e.g. `has_actions`) we prefer that; this + * module fills the gaps for capabilities that have no flag by comparing the + * server version reported at `/version`. + */ + +export interface GiteaVersion { + major: number; + minor: number; + patch: number; + raw: string; +} + +/** Parses `1.21.0`, `1.22.0+rc1`, `1.19.3-rc1` … Returns null when unparseable. */ +export function parseGiteaVersion(raw: string | null | undefined): GiteaVersion | null { + if (!raw) return null; + const match = raw.match(/(\d+)\.(\d+)(?:\.(\d+))?/); + if (!match) return null; + return { + major: Number(match[1]), + minor: Number(match[2]), + patch: Number(match[3] ?? 0), + raw, + }; +} + +/** True when `version >= major.minor.patch`. Unknown versions are treated as unsupported. */ +export function atLeast( + version: GiteaVersion | null, + major: number, + minor = 0, + patch = 0, +): boolean { + if (!version) return false; + if (version.major !== major) return version.major > major; + if (version.minor !== minor) return version.minor > minor; + return version.patch >= patch; +} + +export type Capability = 'releases' | 'wiki' | 'projects' | 'packages' | 'actions'; + +/** First Gitea release that shipped each capability. */ +export const CAPABILITY_SINCE: Record = { + wiki: [1, 0, 0], + releases: [1, 9, 0], + projects: [1, 12, 0], + packages: [1, 14, 0], + actions: [1, 19, 0], +}; + +export function supports(capability: Capability, version: GiteaVersion | null): boolean { + const [major, minor, patch] = CAPABILITY_SINCE[capability]; + return atLeast(version, major, minor, patch); +} diff --git a/src/features/repositories/queries.ts b/src/features/repositories/queries.ts index 8fef883..3a75c8e 100644 --- a/src/features/repositories/queries.ts +++ b/src/features/repositories/queries.ts @@ -7,23 +7,35 @@ import { keepPreviousData, useInfiniteQuery, + useMutation, useQuery, + useQueryClient, type InfiniteData, } from '@tanstack/react-query'; import { useSession } from '@/features/accounts/use-session'; import { + fetchIsStarred, + fetchRelease, fetchRepository, fetchRepositoryLanguages, + fetchSubscription, + forkRepository, listMyRepos, + listReleases, listStarredRepos, searchRepositories, + starRepo, + unstarRepo, + unwatchRepo, + watchRepo, + type ForkRepoInput, type ListMyReposParams, type SearchReposParams, } from '@/core/api/endpoints'; import type { RawResponse } from '@/core/api/client'; import { queryKeys } from '@/core/api/query-keys'; -import type { Repository } from '@/core/api/types'; +import type { Release, Repository, Subscription } from '@/core/api/types'; type RepoPage = RawResponse; @@ -107,3 +119,120 @@ export function useRepositoryLanguages(owner: string, name: string) { queryFn: ({ signal }) => fetchRepositoryLanguages(client!, owner, name, { signal }), }); } + +// --------------------------------------------------------------------------- +// Star / watch / fork +// --------------------------------------------------------------------------- + +export function useIsStarred(owner: string, name: string) { + const { client, account } = useSession(); + const accountId = account?.id ?? ''; + + return useQuery({ + queryKey: queryKeys.repoStar(accountId, owner, name), + enabled: Boolean(client) && Boolean(accountId) && owner.length > 0, + queryFn: ({ signal }) => fetchIsStarred(client!, owner, name, { signal }), + staleTime: 60_000, + }); +} + +export function useToggleStar(owner: string, name: string) { + const { client, account } = useSession(); + const queryClient = useQueryClient(); + const accountId = account?.id ?? ''; + const key = queryKeys.repoStar(accountId, owner, name); + + return useMutation({ + mutationFn: (starred: boolean) => + starred ? unstarRepo(client!, owner, name) : starRepo(client!, owner, name), + onSuccess: () => { + void queryClient.invalidateQueries({ queryKey: key }); + void queryClient.invalidateQueries({ queryKey: queryKeys.repos.starred(accountId, { limit: 20 }) }); + void queryClient.invalidateQueries({ queryKey: queryKeys.repoDetail(accountId, owner, name) }); + }, + }); +} + +export function useSubscription(owner: string, name: string) { + const { client, account } = useSession(); + const accountId = account?.id ?? ''; + + return useQuery({ + queryKey: queryKeys.repoSubscription(accountId, owner, name), + enabled: Boolean(client) && Boolean(accountId) && owner.length > 0, + queryFn: ({ signal }) => fetchSubscription(client!, owner, name, { signal }), + staleTime: 60_000, + retry: false, + }); +} + +export function useToggleWatch(owner: string, name: string) { + const { client, account } = useSession(); + const queryClient = useQueryClient(); + const accountId = account?.id ?? ''; + const key = queryKeys.repoSubscription(accountId, owner, name); + + return useMutation({ + mutationFn: async (watching: boolean): Promise => { + if (watching) { + await unwatchRepo(client!, owner, name); + } else { + await watchRepo(client!, owner, name); + } + }, + onSuccess: () => { + void queryClient.invalidateQueries({ queryKey: key }); + }, + }); +} + +export function useForkRepository(owner: string, name: string) { + const { client, account } = useSession(); + const queryClient = useQueryClient(); + const accountId = account?.id ?? ''; + + return useMutation({ + mutationFn: (input: ForkRepoInput) => forkRepository(client!, owner, name, input), + onSuccess: () => { + // A fork can appear in many repo lists; refresh the account's repo data. + void queryClient.invalidateQueries({ queryKey: queryKeys.account(accountId) }); + }, + }); +} + +// --------------------------------------------------------------------------- +// Releases +// --------------------------------------------------------------------------- + +export function useReleases(owner: string, name: string, limit = 20) { + const { client, account } = useSession(); + const accountId = account?.id ?? ''; + const params = { limit }; + + return useInfiniteQuery< + RawResponse, + Error, + InfiniteData>, + readonly unknown[], + number + >({ + queryKey: queryKeys.releases(accountId, owner, name, params), + enabled: Boolean(client) && Boolean(accountId), + initialPageParam: 1, + queryFn: ({ pageParam, signal }) => + listReleases(client!, owner, name, { ...params, page: pageParam }, { signal }), + getNextPageParam: (last, all) => (last.hasMore ? all.length + 1 : undefined), + placeholderData: keepPreviousData, + }); +} + +export function useRelease(owner: string, name: string, id: number) { + const { client, account } = useSession(); + const accountId = account?.id ?? ''; + + return useQuery({ + queryKey: queryKeys.release(accountId, owner, name, id), + enabled: Boolean(client) && Boolean(accountId) && id > 0, + queryFn: ({ signal }) => fetchRelease(client!, owner, name, id, { signal }), + }); +} diff --git a/src/features/repository/screens/release-detail-screen.tsx b/src/features/repository/screens/release-detail-screen.tsx new file mode 100644 index 0000000..d002268 --- /dev/null +++ b/src/features/repository/screens/release-detail-screen.tsx @@ -0,0 +1,136 @@ +import { Linking, Pressable, StyleSheet, View } from 'react-native'; +import { useTranslation } from 'react-i18next'; + +import { Markdown } from '@/components/git/markdown'; +import { Screen } from '@/components/layout/screen'; +import { AppText } from '@/components/ui/app-text'; +import { Avatar } from '@/components/ui/avatar'; +import { Badge } from '@/components/ui/badge'; +import { Button } from '@/components/ui/button'; +import { Card } from '@/components/ui/card'; +import { Icon } from '@/components/ui/icon'; +import { ErrorState, LoadingView } from '@/components/ui/state-views'; +import { apiErrorMessage } from '@/core/api/error-text'; +import { useSession } from '@/features/accounts/use-session'; +import { useRelease } from '@/features/repositories/queries'; +import { formatBytes, formatDateTime } from '@/core/utils/format'; +import { useTheme } from '@/theme/theme-provider'; +import { spacing } from '@/theme/tokens'; +import type { RepositoryStackParamList } from '@/navigation/types'; +import type { ScreenProps } from '@/navigation/typing'; + +type Props = ScreenProps; + +/** One release: metadata, notes and downloadable assets. */ +export function ReleaseDetailScreen({ route }: Props) { + const { t } = useTranslation(); + const { colors } = useTheme(); + const { instance } = useSession(); + const { owner, name, id } = route.params; + + const query = useRelease(owner, name, id); + const release = query.data; + + if (query.isPending) return ; + if (query.isError) { + return ( + void query.refetch()} + /> + ); + } + if (!release) return null; + + const assets = release.assets ?? []; + + return ( + + + {release.name || release.tag_name} + + {release.tag_name ? {release.tag_name} : null} + {release.prerelease ? {t('releases.prerelease')} : null} + {release.draft ? {t('releases.draft')} : null} + + + + + + + {release.author?.login ?? t('common.unknown')} + + + {formatDateTime(release.published_at ?? release.created_at)} + + + + {release.body && release.body.trim().length > 0 ? ( + + + + ) : null} + + {assets.length > 0 ? ( + <> + {t('releases.assets')} + + {assets.map((asset, index) => ( + + asset.browser_download_url + ? void Linking.openURL(asset.browser_download_url).catch(() => undefined) + : undefined + } + accessibilityRole="button" + accessibilityLabel={asset.name} + style={[styles.assetRow, index < assets.length - 1 && styles.divider]} + > + + + + {asset.name} + + + {t('releases.downloads', { + size: formatBytes(asset.size ?? 0), + count: asset.download_count ?? 0, + })} + + + + ))} + + + ) : null} + + {release.html_url ? ( +