Compare commits

...
438 Commits
Author SHA1 Message Date
Nextcloud bot 155ddbfd25 fix(l10n): Update translations from Transifex
Signed-off-by: Nextcloud bot <[email protected]>
2026-11-07 06:42:19 +00:00
Nextcloud bot d502bbf5ce fix(l10n): Update translations from Transifex
Signed-off-by: Nextcloud bot <[email protected]>
2026-11-06 06:59:58 +00:00
Nextcloud bot 9f30fd1c12 fix(l10n): Update translations from Transifex
Signed-off-by: Nextcloud bot <[email protected]>
2026-11-05 03:36:13 +00:00
Nextcloud bot 42aa0103e7 fix(l10n): Update translations from Transifex
Signed-off-by: Nextcloud bot <[email protected]>
2026-11-04 04:03:49 +00:00
Milen Pivchev d68cf195cc feat: user friendly error messages (#4397)
* WIP

Signed-off-by: Milen Pivchev <[email protected]>

* WIP

Signed-off-by: Milen Pivchev <[email protected]>

* WIP

Signed-off-by: Milen Pivchev <[email protected]>

* WIP

Signed-off-by: Milen Pivchev <[email protected]>

* WIP

Signed-off-by: Milen Pivchev <[email protected]>

* WIP

Signed-off-by: Milen Pivchev <[email protected]>

* WIP

Signed-off-by: Milen Pivchev <[email protected]>

* refactor: persist NKError kind and simplify user-friendly error messages

Signed-off-by: Milen Pivchev <[email protected]>

* refactor: detect virus-blocked uploads via NKError kind

Signed-off-by: Milen Pivchev <[email protected]>

* WIP

Signed-off-by: Milen Pivchev <[email protected]>

* WIP

Signed-off-by: Milen Pivchev <[email protected]>

---------

Signed-off-by: Milen Pivchev <[email protected]>
2026-11-03 17:00:55 +01:00
Nextcloud bot 184cf38893 fix(l10n): Update translations from Transifex
Signed-off-by: Nextcloud bot <[email protected]>
2026-11-02 04:07:48 +00:00
Nextcloud bot 1c3279e11b fix(l10n): Update translations from Transifex
Signed-off-by: Nextcloud bot <[email protected]>
2026-11-01 03:42:49 +00:00
Marino Faggiana f9ee48286a fix: measure sidebar insets against the stationary container (#4436)
Signed-off-by: Marino Faggiana <[email protected]>
2026-10-31 08:16:30 +01:00
Nextcloud bot b9fe0d16bb fix(l10n): Update translations from Transifex
Signed-off-by: Nextcloud bot <[email protected]>
2026-10-31 03:31:41 +00:00
Nextcloud bot bf7f47ed0e fix(l10n): Update translations from Transifex
Signed-off-by: Nextcloud bot <[email protected]>
2026-10-30 03:36:29 +00:00
Milen Pivchev 540777ece5 feat: return to All Files when re-tapping Browse tab (#4432)
Signed-off-by: Milen Pivchev <[email protected]>
2026-10-29 14:09:52 +01:00
Milen Pivchev bd9e1ff40e fix(l10n): reword transfer status strings to "Scheduled" and "Failed" (#4433)
Signed-off-by: Milen Pivchev <[email protected]>
2026-10-29 12:43:52 +01:00
Nextcloud bot bb593bb65e fix(l10n): Update translations from Transifex
Signed-off-by: Nextcloud bot <[email protected]>
2026-10-29 03:35:18 +00:00
Marino Faggiana 394a7dc02b chore: bump marketing version to 35.2.2
Signed-off-by: Marino Faggiana <[email protected]>
2026-10-28 11:55:41 +01:00
Marino Faggiana 0a4e82bb3c fix: animate sidebar with a leading-edge transition (#4429)
Signed-off-by: Marino Faggiana <[email protected]>
2026-10-28 11:52:21 +01:00
Nextcloud bot c5b43ef115 fix(l10n): Update translations from Transifex
Signed-off-by: Nextcloud bot <[email protected]>
2026-10-28 07:15:31 +00:00
Nextcloud bot 980f5ef781 fix(l10n): Update translations from Transifex
Signed-off-by: Nextcloud bot <[email protected]>
2026-10-28 07:10:38 +00:00
Marino Faggiana 48d27f2ca9 refactor: migrate app passcode flows to SwiftUI (#4419)
* feat: add shared SwiftUI passcode component

Support passcode authentication, creation, changes and removal with biometrics and shared lockout protection. Keep the existing passcode flow active until callers are migrated.

Signed-off-by: Marino Faggiana <[email protected]>

* feat: migrate settings to SwiftUI passcode flow

Update lock settings after passcode completion and handle reset results. Add toolbar dismissal and require the current passcode when changing it.

Signed-off-by: Marino Faggiana <[email protected]>

* fix: authenticate E2EE actions with the shared passcode view

Require authentication in Debug builds and verify the account before executing E2EE actions. Present cancellable passcode flows as sheets and handle completion during dismissal.

Signed-off-by: Marino Faggiana <[email protected]>

* refactor: migrate app passcode flows to NCPasscodeView

Use the shared passcode view for app unlock and enforced setup. Scope lifecycle handling to the presenting window scene and cancel optional operations when backgrounded.

Signed-off-by: Marino Faggiana <[email protected]>

* refactor: migrate passcode flows to shared SwiftUI components

Replace TOPasscode in the main app and Share Extension, remove the legacy implementation, and add passcode UI tests.

Signed-off-by: Marino Faggiana <[email protected]>

* Acknowledgements update

Signed-off-by: Marino Faggiana <[email protected]>

* fix

Signed-off-by: Marino Faggiana <[email protected]>

* fix: preserve passcode reset threshold across lockouts

Clear only the retry counter and lockout deadline when the delay expires. Add UI coverage verifying app reset after ten failures across lockouts.

Signed-off-by: Marino Faggiana <[email protected]>

* fix: keep app passcode lock above sheets and alerts

Present the mandatory lock in a dedicated window per scene and preserve underlying UI after unlocking.

Add UI regression coverage, improve authentication test handling, and enforce CI test timeouts with retained diagnostics.

Signed-off-by: Marino Faggiana <[email protected]>

* fix: wait for HTTP fallback in UI test login

Allow the initial HTTPS request to time out before expecting the localhost authentication page, and skip UI queries against authentication services that are not running.

Signed-off-by: Marino Faggiana <[email protected]>
Assisted-by: Codex:GPT-6

* CI

Signed-off-by: Marino Faggiana <[email protected]>

* CI

Signed-off-by: Marino Faggiana <[email protected]>

* CI

Signed-off-by: Marino Faggiana <[email protected]>

* CI

Signed-off-by: Marino Faggiana <[email protected]>

* size button

Signed-off-by: Marino Faggiana <[email protected]>

* fix: avoid redundant transfer and auto-upload state updates

Preserve the auto-upload suspension message until all reads finish, and discard cancelled or stale refreshes.

Signed-off-by: Marino Faggiana <[email protected]>

* added NCPasscodeView.embed

Signed-off-by: Marino Faggiana <[email protected]>

* fix: correct share extension passcode layout

Embed the passcode view in the content controller while hiding the enclosing navigation bar, and constrain its width to the available space.

Signed-off-by: Marino Faggiana <[email protected]>

* fix: enforce app lock after failed passcode attempts

Preserve mandatory authentication across scenes and relaunches after lockout. Require biometric authorization before enabling Touch ID or Face ID, add passcode error feedback, and update lockout UI tests.

Signed-off-by: Marino Faggiana <[email protected]>

* fix: stabilize passcode UI tests and run them for relevant changes

Shorten reset-test lockouts and let XCTest terminate the app after observing completed cleanup to avoid TSan exit issues. Run passcode UI tests when related files change and increase CI test timeouts.

Signed-off-by: Marino Faggiana <[email protected]>

---------

Signed-off-by: Marino Faggiana <[email protected]>
2026-10-28 07:57:01 +01:00
Nextcloud bot 7b62932aad fix(l10n): Update translations from Transifex
Signed-off-by: Nextcloud bot <[email protected]>
2026-10-26 03:39:54 +00:00
Nextcloud bot aa294ec9fe fix(l10n): Update translations from Transifex
Signed-off-by: Nextcloud bot <[email protected]>
2026-10-25 04:06:02 +00:00
dependabot[bot] 7568e344bd fix(deps): Bump github.com/apple/swift-nio-ssl (#4401)
Bumps the swift-packages group with 1 update in the / directory: [github.com/apple/swift-nio-ssl](https://github.com/apple/swift-nio-ssl).


Updates `github.com/apple/swift-nio-ssl` from 2.37.4 to 2.37.5
- [Release notes](https://github.com/apple/swift-nio-ssl/releases)
- [Commits](https://github.com/apple/swift-nio-ssl/compare/2.37.4...322f3c2a4a21df31c84ca416bf65ee5e9059e440)

---
updated-dependencies:
- dependency-name: github.com/apple/swift-nio-ssl
  dependency-version: 2.37.5
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: swift-packages
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-10-23 20:12:30 +02:00
Marino Faggiana 4c4e643b76 fix: allow sidebar buttons to move into navigation overflow (#4418)
Signed-off-by: Marino Faggiana <[email protected]>
2026-10-23 09:40:20 +02:00
Marino Faggiana f338e5512b fix: prevent out-of-bounds access in recommendations (#4415)
Reload recommendations when their count changes and clear cells requested for invalid indices.

Signed-off-by: Marino Faggiana <[email protected]>
2026-10-23 09:39:10 +02:00
Nextcloud bot 4353b63a91 fix(l10n): Update translations from Transifex
Signed-off-by: Nextcloud bot <[email protected]>
2026-10-23 03:42:46 +00:00
Marino Faggiana faf9617904 fix: unify navigation overflow and organize file action menus (#4412)
* refactor: use native navigation overflow menus

Move screen options into UIKit's shared overflow menu, guard asynchronous updates against navigation changes, and expose the media date picker as an overflow action.

Signed-off-by: Marino Faggiana <[email protected]>

* feat: add view in folder to media and recommendation menus

Signed-off-by: Marino Faggiana <[email protected]>

* refactor: group context menu actions into consistent sections

Signed-off-by: Marino Faggiana <[email protected]>

* chore: bump version to 35.2.1 and reset build number to 0

Signed-off-by: Marino Faggiana <[email protected]>

---------

Signed-off-by: Marino Faggiana <[email protected]>
2026-10-22 09:45:52 +02:00
Marino Faggiana 869ffa6a23 closed version
Signed-off-by: Marino Faggiana <[email protected]>
2026-10-21 09:00:56 +02:00
Nextcloud bot b1672c9c81 fix(l10n): Update translations from Transifex
Signed-off-by: Nextcloud bot <[email protected]>
2026-10-21 03:27:21 +00:00
Marino Faggiana 0b9c7598fa fix: use consistent 20-point spacing for the add button
Bump the build number to 2.

Signed-off-by: Marino Faggiana <[email protected]>
2026-10-20 15:52:14 +02:00
Marino Faggiana a2d8a5d4e5 fix: adapt layouts and image rendering to the available window (#4409)
* fix: adapt collection layouts to available view dimensions

Calculate maximum columns and rich workspace header height from collection view bounds, ensuring at least one column. Refresh the header height constraint when updating the layout.

Signed-off-by: Marino Faggiana <[email protected]>

* fix: size popups and context menu previews within safe areas

Use source view bounds for preview sizing and constrain popups to available safe areas. Update keyboard positioning as its frame and the popup layout change.

Signed-off-by: Marino Faggiana <[email protected]>

* refactor: use view-specific display scales for image rendering

Replace UIScreen.main dependencies with trait and environment display scales. Modernize link avatar rendering and size folder icons independently of screen bounds.

Signed-off-by: Marino Faggiana <[email protected]>

* fix: use static thumbnails for context menu media previews

Remove video, audio and Live Photo playback and related downloads. Prefer the supplied thumbnail and limit transfer updates to the previewed image.

Signed-off-by: Marino Faggiana <[email protected]>

* cleaning

Signed-off-by: Marino Faggiana <[email protected]>

---------

Signed-off-by: Marino Faggiana <[email protected]>
2026-10-20 15:23:27 +02:00
Marino Faggiana 216746ae6e fix: load older filtered media and keep navigation bars visible (#4407)
* fix: load older filtered media and keep navigation bars visible

Continue fetching images and videos together while a media filter is active, and skip deletion checks for partial history pages. Keep navigation controls visible while scrolling on iOS 27.

Assisted-by: Codex:GPT-6
Signed-off-by: Marino Faggiana <[email protected]>

* fix: keep activity navigation visible while scrolling

Assisted-by: Codex:GPT-6
Signed-off-by: Marino Faggiana <[email protected]>

* chore: bump project build number to 1

Signed-off-by: Marino Faggiana <[email protected]>

* fix: keep transfers navigation visible while scrolling

Assisted-by: Codex:GPT-6
Signed-off-by: Marino Faggiana <[email protected]>

---------

Signed-off-by: Marino Faggiana <[email protected]>
2026-10-20 10:10:36 +02:00
Nextcloud bot f3bcf3040d fix(l10n): Update translations from Transifex
Signed-off-by: Nextcloud bot <[email protected]>
2026-10-19 03:37:10 +00:00
Nextcloud bot 47e46f3afa fix(l10n): Update translations from Transifex
Signed-off-by: Nextcloud bot <[email protected]>
2026-10-17 03:41:07 +00:00
Marino Faggiana 841d44ea08 feat: enable adaptive media viewer and improve navigation consistency (#4403)
* feat: enable adaptive media layout and remove filename logo

Signed-off-by: Marino Faggiana <[email protected]>

* fix: unify navigation loading indicators and preserve Browse state

Show loading indicators in the navigation bar for files, albums and trash while keeping cached albums visible during refresh.

Preserve the sidebar destination, personal filter and folder stack when switching tabs.

Signed-off-by: Marino Faggiana <[email protected]>

* fix: keep sidebar notification badge within bounds before iOS 26

Signed-off-by: Marino Faggiana <[email protected]>

* fix: use opaque media date picker background before iOS 26

Signed-off-by: Marino Faggiana <[email protected]>

* fix: refresh search navigation layout on iOS versions before 26

Signed-off-by: Marino Faggiana <[email protected]>

* fix: use waveform icon for video audio track menus

Signed-off-by: Marino Faggiana <[email protected]>

* fix: allow media viewer filenames to span two lines

Signed-off-by: Marino Faggiana <[email protected]>

* build 3

Signed-off-by: Marino Faggiana <[email protected]>

* new version

Signed-off-by: Marino Faggiana <[email protected]>

---------

Signed-off-by: Marino Faggiana <[email protected]>
2026-10-16 16:10:25 +02:00
Nextcloud bot c00dd78508 fix(l10n): Update translations from Transifex
Signed-off-by: Nextcloud bot <[email protected]>
2026-10-16 03:40:00 +00:00
Marino Faggiana 09b30d4126 [fix] Improved files scroll (#4400)
* fix: defer cell context menu creation until opening

Validate the cell's current metadata before creating menu actions to handle cell reuse safely. Clear the menu when metadata is unavailable.

Signed-off-by: Marino Faggiana <[email protected]>

* fix: reuse favorite outline view in list cells

Keep a single outline view and its constraints across cell reuse, updating visibility instead of adding duplicate subviews.

Signed-off-by: Marino Faggiana <[email protected]>

---------

Signed-off-by: Marino Faggiana <[email protected]>
2026-10-15 15:50:10 +02:00
Marino Faggiana 43f57df908 fix: keep whole-library auto-upload discovery unfiltered (#4399)
* fix: keep whole-library auto-upload discovery unfiltered

Share date filtering between app and extension, ignoring upload progress in whole-library mode. Clear the previous date when selecting the whole library and add regression tests.

Signed-off-by: Marino Faggiana <[email protected]>

* test: stabilize media viewer layout assertions

Account for pixel rounding in image centering and constrain video controls within a fixed test container.

Signed-off-by: Marino Faggiana <[email protected]>

---------

Signed-off-by: Marino Faggiana <[email protected]>
2026-10-15 11:24:19 +02:00
Nextcloud bot 87c0cd23e1 fix(l10n): Update translations from Transifex
Signed-off-by: Nextcloud bot <[email protected]>
2026-10-15 04:05:03 +00:00
Nextcloud bot ee54ca3e47 fix(l10n): Update translations from Transifex
Signed-off-by: Nextcloud bot <[email protected]>
2026-10-14 14:33:46 +00:00
Marino Faggiana d5f40266cc fix: track photo library assets for manual uploads (#4396)
* fix test

Signed-off-by: Marino Faggiana <[email protected]>

* fix: track photo library assets for manual uploads

Signed-off-by: Marino Faggiana <[email protected]>

---------

Signed-off-by: Marino Faggiana <[email protected]>
2026-10-14 16:10:23 +02:00
Nextcloud bot 7583433c84 fix(l10n): Update translations from Transifex
Signed-off-by: Nextcloud bot <[email protected]>
2026-10-14 14:09:40 +00:00
Nextcloud bot cd6956d249 fix(l10n): Update translations from Transifex
Signed-off-by: Nextcloud bot <[email protected]>
2026-10-14 10:23:56 +00:00
Marino Faggiana b7853ed4b0 feat: add experimental adaptive media viewer
Add independent adaptive controls for images, audio, AVPlayer and VLC while
keeping the experiment disabled for normal-mode TestFlight regression checks.
Include shared playback progress styling, information fixes, viewer tests
and the required project resources.

Assisted-by: Codex:GPT-6
Signed-off-by: Marino Faggiana <[email protected]>
2026-10-14 12:05:11 +02:00
Nextcloud bot 21982966d8 fix(l10n): Update translations from Transifex
Signed-off-by: Nextcloud bot <[email protected]>
2026-10-14 03:39:58 +00:00
Marino Faggiana 7d82fefdc9 chore(deps): update resolved Swift package versions
Signed-off-by: Marino Faggiana <[email protected]>
2026-10-13 18:43:22 +02:00
Nextcloud bot 482768aa42 fix(l10n): Update translations from Transifex
Signed-off-by: Nextcloud bot <[email protected]>
2026-10-13 15:38:32 +00:00
Marino Faggiana c50342357a Adaptive sidebar navigation (#4381)
* chore: bump version to 35.2.0 and require iOS 18

Reset the build number to 0 and remove test target deployment overrides to inherit the project setting.

Signed-off-by: Marino Faggiana <[email protected]>

* feat: add SwiftUI sidebar overlay with Settings access

Keep the existing five-tab navigation and add a leading sidebar button in Files, Media, Favorites, More, and the Albums list. Present a glass sidebar overlay with Settings and animated opening and closing.

Assisted-by: Codex:GPT-6
Signed-off-by: Marino Faggiana <[email protected]>

* iOS 17

Signed-off-by: Marino Faggiana <[email protected]>

* refactor: move assistant, notifications and transfers to sidebar

Signed-off-by: Marino Faggiana <[email protected]>

* fix: keep media calendar visible and respect safe area

Use a persistent calendar button with separate loading state and navigation groups. Constrain the media grid horizontally to the safe area when the available width changes.

Assisted-by: Codex:GPT-6
Signed-off-by: Marino Faggiana <[email protected]>

* fix: recalculate collection cell widths on resize

Update the stored list item size and invalidate flow layout metrics when collection bounds change. Refresh the first header layout alongside the collection.

Assisted-by: Codex:GPT-6
Signed-off-by: Marino Faggiana <[email protected]>

* feat: integrate iPad sidebar with native split view

Host the existing tabs in the secondary split column on iPad while retaining the sidebar overlay on phones. Resolve the contained tab controller for account, login, transfer and video presentation flows. Refresh sidebar actions from cached capabilities on account changes and server updates.

Assisted-by: Codex:GPT-6
Signed-off-by: Marino Faggiana <[email protected]>

* fix: improve sidebar dismissal and header alignment

Toggle the sidebar closed from its navigation button and retain an accessible close action when needed. Align header controls with the navigation bar while respecting safe areas and iPad window corners.

Signed-off-by: Marino Faggiana <[email protected]>

* wip

Signed-off-by: Marino Faggiana <[email protected]>

* wip

Signed-off-by: Marino Faggiana <[email protected]>

* wip

Signed-off-by: Marino Faggiana <[email protected]>

* wip

Signed-off-by: Marino Faggiana <[email protected]>

* refactor: simplify sidebar helpers and document split setup

Assisted-by: Codex:GPT-6
Signed-off-by: Marino Faggiana <[email protected]>

* fix: refresh media permissions when etags are unchanged

Request permissions in media queries and update cached metadata when permissions change. Preserve known permissions when responses omit them.

Signed-off-by: Marino Faggiana <[email protected]>

* refactor: align albums with shared UIKit navigation

Assisted-by: Codex:GPT-6
Signed-off-by: Marino Faggiana <[email protected]>

* wip

Signed-off-by: Marino Faggiana <[email protected]>

* fix: open settings and transfers as sidebar destinations

Tie transfer observation to view visibility so updates resume on subsequent visits.

Signed-off-by: Marino Faggiana <[email protected]>

* wip

Signed-off-by: Marino Faggiana <[email protected]>

* wip

Signed-off-by: Marino Faggiana <[email protected]>

* feat: add app shortcuts and storage quota to sidebar

Signed-off-by: Marino Faggiana <[email protected]>

* wip

Signed-off-by: Marino Faggiana <[email protected]>

* wip

Signed-off-by: Marino Faggiana <[email protected]>

* refactor: replace More navigation with dedicated sidebar controllers

Remove the More view and model, preserve section-specific menus in dedicated navigation controllers, and route deep links through sidebar destinations.

Signed-off-by: Marino Faggiana <[email protected]>

* fix: improve sidebar layout and navigation

Respect the landscape safe area and widen the overlay sidebar. Present auto-upload settings in a dismissible sheet and configure the Activity tab in the storyboard.

Signed-off-by: Marino Faggiana <[email protected]>

* fix: keep recommendations carousel within list safe area

Signed-off-by: Marino Faggiana <[email protected]>

* fix: use overlay sidebar on iPad and preserve navigation controls

Remove the iPad split view container and share the overlay sidebar across devices. Keep sidebar and account controls accessible through navigation item groups and overflow menus.

Signed-off-by: Marino Faggiana <[email protected]>

* fix: refresh destination folders after cross-account uploads

Fetch each affected folder after drag-and-drop uploads so all windows discover the new files.

Signed-off-by: Marino Faggiana <[email protected]>

* feat: add swipe gestures to open and close the sidebar

Signed-off-by: Marino Faggiana <[email protected]>

* feat: add experimental folded video layout

Add separate normal and adaptive video controls for AVPlayer and VLC, with video above the fold and playback controls below. Keep the experiment disabled by default and preserve the original normal layout constraints without creating adaptive controls.

Group playback controls under Controls, add layout regression tests, and require Xcode 27.1 for the reserved-region APIs.

Validation: SwiftLint and static project checks passed. Builds and tests remain for manual verification under the project instructions.

Assisted-by: Codex:GPT-6
Signed-off-by: Marino Faggiana <[email protected]>

* fix: present sidebar as a full-screen modal overlay

Keep the sidebar outside the tab bar controller's child hierarchy and dismiss it through UIKit. Remove the sidebar header close button and its visibility checks.

Signed-off-by: Marino Faggiana <[email protected]>

* fix: extend sidebar background beneath landscape camera margin

Signed-off-by: Marino Faggiana <[email protected]>

* fix

Signed-off-by: Marino Faggiana <[email protected]>

* Update Master

Signed-off-by: Marino Faggiana <[email protected]>

* duo fix

Signed-off-by: Marino Faggiana <[email protected]>

* feat: enhance sidebar status indicators and navigation

Show transfer status, notification counts and an animated auto-upload icon. Improve sidebar scrolling and restore All files when tapping Browse.

Signed-off-by: Marino Faggiana <[email protected]>

* ci: use Xcode 27.1 for additional targets

Assisted-by: Codex:GPT-6
Signed-off-by: Marino Faggiana <[email protected]>

---------

Signed-off-by: Marino Faggiana <[email protected]>
2026-10-13 17:32:16 +02:00
dependabot[bot] 38478cc391 fix(deps): Bump the swift-packages group with 5 updates (#4394)
Bumps the swift-packages group with 5 updates:

| Package | From | To |
| --- | --- | --- |
| [github.com/firebase/firebase-ios-sdk](https://github.com/firebase/firebase-ios-sdk) | `12.19.2` | `13.0.1` |
| [github.com/krzyzanowskim/openssl](https://github.com/krzyzanowskim/OpenSSL) | `3.6.3000` | `3.6.5000` |
| [github.com/exyte/popupview](https://github.com/exyte/PopupView) | `5.0.6` | `5.0.8` |
| [github.com/apple/swift-collections](https://github.com/apple/swift-collections) | `1.7.1` | `1.7.2` |
| [github.com/apple/swift-nio](https://github.com/apple/swift-nio) | `2.103.0` | `2.104.0` |


Updates `github.com/firebase/firebase-ios-sdk` from 12.19.2 to 13.0.1
- [Release notes](https://github.com/firebase/firebase-ios-sdk/releases)
- [Commits](https://github.com/firebase/firebase-ios-sdk/compare/12.19.2...1c35b9453868cea1ecdf9f112b5b23b8b6343854)

Updates `github.com/krzyzanowskim/openssl` from 3.6.3000 to 3.6.5000
- [Release notes](https://github.com/krzyzanowskim/OpenSSL/releases)
- [Commits](https://github.com/krzyzanowskim/OpenSSL/compare/3.6.3000...0a6149bff4fb00921ce0ec1811f726b166638095)

Updates `github.com/exyte/popupview` from 5.0.6 to 5.0.8
- [Commits](https://github.com/exyte/PopupView/compare/5.0.6...99695337ce9e965b70e4aa14b49b1a9920017333)

Updates `github.com/apple/swift-collections` from 1.7.1 to 1.7.2
- [Release notes](https://github.com/apple/swift-collections/releases)
- [Commits](https://github.com/apple/swift-collections/compare/1.7.1...3b69cedbaa49957e97c092ae400bb57602ef941f)

Updates `github.com/apple/swift-nio` from 2.103.0 to 2.104.0
- [Release notes](https://github.com/apple/swift-nio/releases)
- [Commits](https://github.com/apple/swift-nio/compare/2.103.0...6db9d9abd92ad7399b8a564cafbb87d3507245fa)

---
updated-dependencies:
- dependency-name: github.com/firebase/firebase-ios-sdk
  dependency-version: 13.0.1
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: swift-packages
- dependency-name: github.com/krzyzanowskim/openssl
  dependency-version: 3.6.5000
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: swift-packages
- dependency-name: github.com/exyte/popupview
  dependency-version: 5.0.8
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: swift-packages
- dependency-name: github.com/apple/swift-collections
  dependency-version: 1.7.2
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: swift-packages
- dependency-name: github.com/apple/swift-nio
  dependency-version: 2.104.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: swift-packages
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-10-13 15:50:16 +02:00
Milen Pivchev 7771089208 feat(deps): dependabot groups (#4393)
* WIP

Signed-off-by: Milen Pivchev <[email protected]>

* ci: ignore temp Firebase and Realm deps in Dependabot

Signed-off-by: Milen Pivchev <[email protected]>

---------

Signed-off-by: Milen Pivchev <[email protected]>
2026-10-13 07:28:23 +02:00
Marino Faggiana 7ab5ebf959 feat: add GRDB state for background auto upload (#4392)
* feat: add GRDB state for background auto upload

Track photo and video progress per asset, destination and upload session,
preserving confirmed components and assigned pair names on repeated writes.
Add the SQLite table and unit tests, and normalize the PhotoLibraryAsset
source filename. Integration with background upload discovery follows later.

Assisted-by: Codex:GPT-6
Signed-off-by: Marino Faggiana <[email protected]>

* wip

Signed-off-by: Marino Faggiana <[email protected]>

* wip

Signed-off-by: Marino Faggiana <[email protected]>

* wip

Signed-off-by: Marino Faggiana <[email protected]>

* wip

Signed-off-by: Marino Faggiana <[email protected]>

* wip

Signed-off-by: Marino Faggiana <[email protected]>

* wip

Signed-off-by: Marino Faggiana <[email protected]>

* wip

Signed-off-by: Marino Faggiana <[email protected]>

* wip

Signed-off-by: Marino Faggiana <[email protected]>

* wip

Signed-off-by: Marino Faggiana <[email protected]>

* wip

Signed-off-by: Marino Faggiana <[email protected]>

* wip

Signed-off-by: Marino Faggiana <[email protected]>

* wip

Signed-off-by: Marino Faggiana <[email protected]>

* wip

Signed-off-by: Marino Faggiana <[email protected]>

* version

Signed-off-by: Marino Faggiana <[email protected]>

* Fix Test

Signed-off-by: Marino Faggiana <[email protected]>

---------

Signed-off-by: Marino Faggiana <[email protected]>
2026-10-13 07:26:29 +02:00
Nextcloud bot fb61bb6b17 fix(l10n): Update translations from Transifex
Signed-off-by: Nextcloud bot <[email protected]>
2026-10-12 03:44:40 +00:00
Nextcloud bot dc21188f3f fix(l10n): Update translations from Transifex
Signed-off-by: Nextcloud bot <[email protected]>
2026-10-11 03:45:14 +00:00
Nextcloud bot 93a12027ed fix(l10n): Update translations from Transifex
Signed-off-by: Nextcloud bot <[email protected]>
2026-10-10 03:49:43 +00:00
Nextcloud bot 0d8b15c584 fix(l10n): Update translations from Transifex
Signed-off-by: Nextcloud bot <[email protected]>
2026-10-08 04:03:31 +00:00
Marino Faggiana dc214c4c92 fix: prevent auto-upload summary truncation in More view (#4379)
* fix: prevent auto-upload summary truncation in More view

Signed-off-by: Marino Faggiana <[email protected]>

* version closed

Signed-off-by: Marino Faggiana <[email protected]>

* version closed

Signed-off-by: Marino Faggiana <[email protected]>

---------

Signed-off-by: Marino Faggiana <[email protected]>
2026-10-07 16:15:51 +02:00
Wang Hailong 5f992a8f1e fix: clean up local copies of existing auto uploads (#4378)
Release the camera roll transfer directory after its metadata has been removed, preserving files when database operations fail.

Assisted-by: Codex:GPT-6

Signed-off-by: Hailong Wang <[email protected]>
2026-10-07 11:14:33 +02:00
Flamenco 2bdd62a456 fix: release the Text file lock when leaving the editor with the back button (#4342)
Leaving a Markdown file with the back button popped NCViewerDirectEditing
without running Text's close(), so the editing session was never closed and
the file stayed "Locked by Text" on the server. Text's own close button saves,
closes the session (releasing the lock) and then posts "close".

For the Text editor, route the back button through that close button and let
the existing "close" message pop the view, with a 5 s fallback so navigation
can never get stuck.

Fixes nextcloud/text#8858

Assisted-by: Claude Code:claude-opus-5-5

Signed-off-by: Steven Spungin <[email protected]>
2026-10-07 09:08:29 +02:00
Nextcloud bot 1b90414067 fix(l10n): Update translations from Transifex
Signed-off-by: Nextcloud bot <[email protected]>
2026-10-07 03:59:05 +00:00
Marino Faggiana 3ebda4f3b4 fix: preserve whole-library auto upload selection across restarts (#4376)
* fix: preserve whole-library auto upload selection across restarts

Store the selected scope separately from incremental progress. Preserve the restart date when switching options and reset it only when starting a whole-library upload. Migrate existing accounts and preserve compatibility with older account backups.

Signed-off-by: Marino Faggiana <[email protected]>

* build 13

Signed-off-by: Marino Faggiana <[email protected]>

---------

Signed-off-by: Marino Faggiana <[email protected]>
2026-10-06 18:17:38 +02:00
Marino Faggiana 4ac2f0d797 fix: add fullscreen video menus and improve playback transitions (#4375)
* fix: share video viewer menus and activate audio asynchronously

Expose the cover menu during AVPlayer and VLC playback, update renamed titles, and present delete confirmations from the active viewer. Restore immediate engine switching with safe dismissal and presentation state cleanup.

Share asynchronous video audio session activation, gate playback and replay on readiness, and cancel pending starts when the viewer closes.

Assisted-by: Codex:GPT-6
Signed-off-by: Marino Faggiana <[email protected]>

* fix: reposition video controls after navigation bar transitions

Refresh top action positions when showing or hiding the navigation bar and after its transition completes. Keep the action row within the safe area during automatic video advance.

Assisted-by: Codex:GPT-6
Signed-off-by: Marino Faggiana <[email protected]>

* new build

Signed-off-by: Marino Faggiana <[email protected]>

---------

Signed-off-by: Marino Faggiana <[email protected]>
2026-10-06 16:26:06 +02:00
Marino Faggiana b600a93d5e update lib (#4374)
Signed-off-by: Marino Faggiana <[email protected]>
2026-10-06 10:27:12 +02:00
Nextcloud bot 50adca3c5b fix(l10n): Update translations from Transifex
Signed-off-by: Nextcloud bot <[email protected]>
2026-10-06 03:57:54 +00:00
Marino Faggiana 961ff24106 style: compact media viewer function signatures (#4373)
* style: compact media viewer function signatures

Use single-line signatures where practical and activate audio sessions without blocking the main thread.

* prj

Signed-off-by: Marino Faggiana <[email protected]>

---------

Signed-off-by: Marino Faggiana <[email protected]>
2026-10-05 18:19:49 +02:00
Marino Faggiana 8bca689e83 fix: adapt audio viewer layout to available space (#4372) 2026-10-05 18:03:03 +02:00
Milen Pivchev 4da4984f3d feat: Add "suggested_server" to Login screen (#4329)
* WIP

Signed-off-by: Milen Pivchev <[email protected]>

* WIP

Signed-off-by: Milen Pivchev <[email protected]>

* WIP

Signed-off-by: Milen Pivchev <[email protected]>

---------

Signed-off-by: Milen Pivchev <[email protected]>
2026-10-05 16:54:10 +02:00
dependabot[bot] 5a968289d3 fix(deps): Bump github.com/google/app-check from 11.3.2 to 12.0.0 (#4357)
Bumps [github.com/google/app-check](https://github.com/google/app-check) from 11.3.2 to 12.0.0.
- [Release notes](https://github.com/google/app-check/releases)
- [Changelog](https://github.com/google/app-check/blob/main/CHANGELOG.md)
- [Commits](https://github.com/google/app-check/compare/11.3.2...c7eb17e5545f36e43dc50e70da09c2e999714e16)

---
updated-dependencies:
- dependency-name: github.com/google/app-check
  dependency-version: 12.0.0
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-10-05 16:53:24 +02:00
dependabot[bot] d9c4441238 fix(deps): Bump github.com/google/abseil-cpp-binary (#4358)
Bumps [github.com/google/abseil-cpp-binary](https://github.com/google/abseil-cpp-binary) from 1.2024072200.0 to 1.2025051202.0.
- [Release notes](https://github.com/google/abseil-cpp-binary/releases)
- [Commits](https://github.com/google/abseil-cpp-binary/compare/1.2024072200.0...26509120768c4add61cc1a63059f15f4fb49edb4)

---
updated-dependencies:
- dependency-name: github.com/google/abseil-cpp-binary
  dependency-version: 1.2025051202.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-10-05 16:53:05 +02:00
dependabot[bot] ac9c9ce929 fix(deps): Bump github.com/google/grpc-binary from 1.69.1 to 1.83.1 (#4359)
Bumps [github.com/google/grpc-binary](https://github.com/google/grpc-binary) from 1.69.1 to 1.83.1.
- [Release notes](https://github.com/google/grpc-binary/releases)
- [Changelog](https://github.com/google/grpc-binary/blob/main/CHANGELOG.md)
- [Commits](https://github.com/google/grpc-binary/compare/1.69.1...9d5e9f05670c9eab8d8c22731ddd5d4d9cf867a8)

---
updated-dependencies:
- dependency-name: github.com/google/grpc-binary
  dependency-version: 1.83.1
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-10-05 16:52:46 +02:00
dependabot[bot] 6007ae4d8f fix(deps): Bump github.com/google/googleappmeasurement (#4360)
Bumps [github.com/google/googleappmeasurement](https://github.com/google/GoogleAppMeasurement) from 12.19.2 to 13.0.0.
- [Release notes](https://github.com/google/GoogleAppMeasurement/releases)
- [Commits](https://github.com/google/GoogleAppMeasurement/compare/12.19.2...33f4d83faebca7dc908ecee956eb195cfc4a87d0)

---
updated-dependencies:
- dependency-name: github.com/google/googleappmeasurement
  dependency-version: 13.0.0
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-10-05 16:52:27 +02:00
Milen Pivchev af2290e976 fix: video player visibility and localization (#4353)
* Localization

Signed-off-by: Milen Pivchev <[email protected]>

* indicator

Signed-off-by: Milen Pivchev <[email protected]>

* Fix visibility

Signed-off-by: Milen Pivchev <[email protected]>

* Remove custom glass look

Signed-off-by: Milen Pivchev <[email protected]>

* WIP

Signed-off-by: Milen Pivchev <[email protected]>

---------

Signed-off-by: Milen Pivchev <[email protected]>
2026-10-05 16:48:31 +02:00
Nextcloud bot f42ff9e948 fix(l10n): Update translations from Transifex
Signed-off-by: Nextcloud bot <[email protected]>
2026-10-05 06:28:22 +00:00
Nextcloud bot 9214ee60a7 fix(l10n): Update translations from Transifex
Signed-off-by: Nextcloud bot <[email protected]>
2026-10-05 06:21:40 +00:00
Marino Faggiana 8d6b1c27bd Merge branch 'master' of https://github.com/nextcloud/ios 2026-10-05 08:18:00 +02:00
Marino Faggiana d37940ccd6 update localizable
Signed-off-by: Marino Faggiana <[email protected]>
2026-10-05 08:17:50 +02:00
Nextcloud bot 8e29fc8742 fix(l10n): Update translations from Transifex
Signed-off-by: Nextcloud bot <[email protected]>
2026-10-05 06:17:35 +00:00
Marino Faggiana f7b129a37b fix: unify disabled auto upload settings and remove unused English strings (#4364)
Remove 79 unused localization keys and one unused plural while preserving keys used by NextcloudKit. Apply a shared disabled appearance to auto-upload settings and update the build number to 10.


Signed-off-by: Marino Faggiana <[email protected]>
2026-10-05 08:11:41 +02:00
Nextcloud bot b49c8c86ec fix(l10n): Update translations from Transifex
Signed-off-by: Nextcloud bot <[email protected]>
2026-10-05 04:28:45 +00:00
Nextcloud bot d638f548c3 fix(l10n): Update translations from Transifex
Signed-off-by: Nextcloud bot <[email protected]>
2026-10-04 03:47:54 +00:00
Nextcloud bot 5867b5ac79 fix(l10n): Update translations from Transifex
Signed-off-by: Nextcloud bot <[email protected]>
2026-10-03 08:42:03 +00:00
Marino Faggiana 3173216543 Gui fix (#4363)
* fix: preserve Live Photo playback request after download

Assisted-by: Codex:gpt-6
Signed-off-by: Marino Faggiana <[email protected]>

* fix: improve auto-upload album icon and date spacing

Assisted-by: Codex:gpt-6
Signed-off-by: Marino Faggiana <[email protected]>

* feat: allow auto upload to ignore previous upload records

Persist the reupload option per account and track completed uploads by session to avoid repeatedly requeuing them. Apply the option to legacy and PhotoKit uploads and clarify that the displayed count represents queued files. Bump Realm schema to 422.

Assisted-by: Codex:GPT-6
Signed-off-by: Marino Faggiana <[email protected]>

* fix: prevent overlapping auto upload background syncs

Guard the shared refresh, processing, and location entry point with a protected running flag. Release the flag on every exit without holding the lock across awaits.

Assisted-by: Codex:GPT-6
Signed-off-by: Marino Faggiana <[email protected]>

---------

Signed-off-by: Marino Faggiana <[email protected]>
2026-10-03 10:36:48 +02:00
Nextcloud bot 0fa1215209 fix(l10n): Update translations from Transifex
Signed-off-by: Nextcloud bot <[email protected]>
2026-10-03 03:50:09 +00:00
Nextcloud bot cc26ea5a5b fix(l10n): Update translations from Transifex
Signed-off-by: Nextcloud bot <[email protected]>
2026-10-02 09:45:05 +00:00
Marino Faggiana 1d8269785e fix: preserve legacy auto upload progress for Live Photos (#4362)
Track paired videos in auto upload history, recover incomplete Live Photos, and record resources already present on the server before removing their transfers.

Signed-off-by: Marino Faggiana <[email protected]>
2026-10-02 11:41:15 +02:00
Nextcloud bot 7968c4c842 fix(l10n): Update translations from Transifex
Signed-off-by: Nextcloud bot <[email protected]>
2026-10-02 09:19:55 +00:00
Marino Faggiana bd58e2f17e fix: clarify auto upload progress and PhotoKit settings (#4361)
Display the incremental backup date while uploading and show range controls only while stopped. Hide focused upload and background location controls when PhotoKit is enabled and supported.

Assisted-by: Codex:GPT-6

Signed-off-by: Marino Faggiana <[email protected]>
2026-10-02 11:16:07 +02:00
Nextcloud bot d7e48d66e5 fix(l10n): Update translations from Transifex
Signed-off-by: Nextcloud bot <[email protected]>
2026-10-02 09:03:58 +00:00
Marino Faggiana a157232cf3 fix: clean up PhotoKit auto uploads on stop and prevent log viewer freezes (#4356)
* fix: clean up PhotoKit upload jobs when auto upload stops

Cancel queued jobs from the host app and preserve successful upload records before acknowledgement. Stop extension discovery and scheduling when auto upload is disabled.

Assisted-by: Codex:GPT-6
Signed-off-by: Marino Faggiana <[email protected]>

* fix: explicitly capture database in PhotoKit change closure

Assisted-by: Codex:GPT-6
Signed-off-by: Marino Faggiana <[email protected]>

* fix: isolate PhotoKit auto upload sessions across restarts

Invalidate stale discovery and retry passes across start/stop transitions. Reconcile outstanding PhotoKit jobs before restarting, preserve discovery date advancement, and save the new-photos cutoff before enabling Start. Bump the Realm schema to 418.

Assisted-by: Codex:GPT-6
Signed-off-by: Marino Faggiana <[email protected]>

* fix: preview log snapshots without blocking the interface

Move logger flushes and log file operations off the main actor. Present an immutable temporary copy in Quick Look and prevent overlapping preview preparation.

Assisted-by: Codex:GPT-6
Signed-off-by: Marino Faggiana <[email protected]>

* build 9

Signed-off-by: Marino Faggiana <[email protected]>

* fix: preserve PhotoKit upload cancellation during job updates

Prevent stale job updates from recreating deleted transfers or clearing cancellation. Require the active auto-upload session before requeueing acknowledged failures.

Assisted-by: Codex:GPT-6
Signed-off-by: Marino Faggiana <[email protected]>

* fix: use view dimensions for media previews

Remove global screen dependencies from preview and avatar sizing, make media callback captures consistently weak, and raise the SwiftLint function body warning to 500 lines.

Assisted-by: Codex:GPT-6
Signed-off-by: Marino Faggiana <[email protected]>

* lint

Signed-off-by: Marino Faggiana <[email protected]>

* fix: separate auto upload cutoff from discovery progress

Replace the new-photos switch with whole-library and explicit-date choices, remove the intermediate reset confirmation, and preserve the selected cutoff across restarts.

Persist discovery progress independently, retain unfinished upload restart points, and guard legacy queue insertion and extraction against stopped sessions. Add date policy and account backup compatibility tests and migrate Realm to schema 420.

Assisted-by: Codex:GPT-6
Signed-off-by: Marino Faggiana <[email protected]>

* fix: refine auto upload date settings and defaults

Initialize new accounts with a saved current-date cutoff and preserve existing account settings on re-registration. Simplify range selection styling, group date controls, and dim them while auto upload is active.

Assisted-by: Codex:GPT-6
Signed-off-by: Marino Faggiana <[email protected]>

* revert

Signed-off-by: Marino Faggiana <[email protected]>

---------

Signed-off-by: Marino Faggiana <[email protected]>
2026-10-02 10:58:35 +02:00
Nextcloud bot 6ddcd59efd fix(l10n): Update translations from Transifex
Signed-off-by: Nextcloud bot <[email protected]>
2026-10-02 04:18:49 +00:00
Marino Faggiana b2f5ad8233 added LOG (#4355)
Signed-off-by: Marino Faggiana <[email protected]>
2026-10-01 11:41:41 +02:00
Marino Faggiana 00fe5b2800 Fix: Live Photo restoration and Office routing, improve logs and notifications (#4354)
* fix crash notification

Signed-off-by: Marino Faggiana <[email protected]>

* improved Log view

Signed-off-by: Marino Faggiana <[email protected]>

* https://github.com/nextcloud/ios/issues/2164

Signed-off-by: Marino Faggiana <[email protected]>

* fix: improve Office editor routing and prevent download fallback

Improve document MIME type matching, including generic server types, Apple type identifiers and optional editor formats. Restrict the HTML compatibility exception to Nextcloud Text.

Extend “Open in Office” to available Collabora, OnlyOffice and EuroOffice editors, with a submenu when multiple editors are available. Keep the local PDF viewer as the default when tapping a PDF.

Propagate editor errors instead of falling back to native preview or download. Preserve local preview for downloaded documents while offline.

Add MIME type and editor compatibility regression tests.

Validation: SwiftLint and project file checks passed. Builds, tests and Collabora/secure-view verification have not been run locally.

Refs #4347.

Signed-off-by: Marino Faggiana <[email protected]>

* Build 8

Signed-off-by: Marino Faggiana <[email protected]>

---------

Signed-off-by: Marino Faggiana <[email protected]>
2026-10-01 08:57:31 +02:00
Nextcloud bot e7af075dfd fix(l10n): Update translations from Transifex
Signed-off-by: Nextcloud bot <[email protected]>
2026-10-01 04:02:09 +00:00
Marino Faggiana d9d464c6af feat: Track uploaded PhotoKit assets independently from Realm (#4352)
* feat: add persistent photo library asset tracking

Signed-off-by: Marino Faggiana <[email protected]>

* extension connection

Signed-off-by: Marino Faggiana <[email protected]>

* wip

Signed-off-by: Marino Faggiana <[email protected]>

* wip

Signed-off-by: Marino Faggiana <[email protected]>

* WIP

Signed-off-by: Marino Faggiana <[email protected]>

* fix: serialize background upload job processing

Signed-off-by: Marino Faggiana <[email protected]>

---------

Signed-off-by: Marino Faggiana <[email protected]>
2026-09-30 16:04:20 +02:00
Marino Faggiana 5a8712fa41 feat: add GRDB-backed local database (#4351)
Add the initial photo library asset schema and a debug settings action for exporting the database.

Signed-off-by: Marino Faggiana <[email protected]>
2026-09-30 10:28:13 +02:00
Nextcloud bot b76944837b fix(l10n): Update translations from Transifex
Signed-off-by: Nextcloud bot <[email protected]>
2026-09-30 04:17:38 +00:00
Marino Faggiana 273eefd0bb docs: document background upload extension flow (#4350)
Signed-off-by: Marino Faggiana <[email protected]>
2026-09-29 16:38:56 +02:00
Marino Faggiana 91dda27c89 fix: defer large auto uploads to chunked pipeline (#4349)
Keep oversized Live Photo resources together and reserve paired filenames while the host app handles chunked uploads.

Update resolved Google binary package versions.

Signed-off-by: Marino Faggiana <[email protected]>
2026-09-29 16:28:16 +02:00
Marino Faggiana 0b3b16b62c fix: recover interrupted PhotoKit background uploads (#4348)
* fix: recover interrupted background upload jobs

Reconnect PhotoKit jobs to pending metadata and treat valid server file IDs as successful uploads to prevent duplicate retries.

Signed-off-by: Marino Faggiana <[email protected]>

* refactor: centralize background upload metadata state transitions

Apply complete upload lifecycle states through a single persistence helper to keep related metadata fields consistent.

Signed-off-by: Marino Faggiana <[email protected]>

---------

Signed-off-by: Marino Faggiana <[email protected]>
2026-09-29 15:47:56 +02:00
dependabot[bot] 32411824bb fix(deps): Bump github.com/google/grpc-binary from 1.69.1 to 1.83.1 (#4338)
Bumps [github.com/google/grpc-binary](https://github.com/google/grpc-binary) from 1.69.1 to 1.83.1.
- [Release notes](https://github.com/google/grpc-binary/releases)
- [Changelog](https://github.com/google/grpc-binary/blob/main/CHANGELOG.md)
- [Commits](https://github.com/google/grpc-binary/compare/1.69.1...9d5e9f05670c9eab8d8c22731ddd5d4d9cf867a8)

---
updated-dependencies:
- dependency-name: github.com/google/grpc-binary
  dependency-version: 1.83.1
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-09-29 12:32:07 +02:00
dependabot[bot] 6854da3512 fix(deps): Bump github.com/google/abseil-cpp-binary (#4337)
Bumps [github.com/google/abseil-cpp-binary](https://github.com/google/abseil-cpp-binary) from 1.2024072200.0 to 1.2025051202.0.
- [Release notes](https://github.com/google/abseil-cpp-binary/releases)
- [Commits](https://github.com/google/abseil-cpp-binary/compare/1.2024072200.0...26509120768c4add61cc1a63059f15f4fb49edb4)

---
updated-dependencies:
- dependency-name: github.com/google/abseil-cpp-binary
  dependency-version: 1.2025051202.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-09-29 12:31:52 +02:00
Marino Faggiana 26f21f2bdd feat: link Live Photos in background uploads (#4346)
Process completed Live Photo pairs in bounded batches, retain transient failures for retry, and suspend uploads on authentication errors.

Signed-off-by: Marino Faggiana <[email protected]>
2026-09-29 09:23:53 +02:00
Nextcloud bot cf76d5857f fix(l10n): Update translations from Transifex
Signed-off-by: Nextcloud bot <[email protected]>
2026-09-29 06:44:42 +00:00
Marino Faggiana 72fd5b2f8a feat: harden experimental PhotoKit background uploads (#4343)
* fix: stop background uploads on database schema mismatch

Validate the Realm schema version before opening the database and fail background upload jobs when the database is unavailable.

Signed-off-by: Marino Faggiana <[email protected]>

* fix: require manual retry for background upload auth failures

Avoid falling back to the Camera Roll when selected albums are unavailable and document the background upload extension workflow.

Signed-off-by: Marino Faggiana <[email protected]>

* fix: suspend background uploads after repeated failures

Limit each upload to three attempts and pause an account after consecutive asset failures. Resume suspended queues through explicit user actions and surface the blocking error in Auto Upload status.

Signed-off-by: Marino Faggiana <[email protected]>

* perf: bound auto-upload asset discovery memory

Lazily merge sorted PhotoKit results and scope duplicate checks to active or relevant uploads.

Signed-off-by: Marino Faggiana <[email protected]>

* feat: add experimental background upload opt-in

Limit the PhotoKit extension to Debug and TestFlight builds on Nextcloud 35 or later.

Signed-off-by: Marino Faggiana <[email protected]>

* fix: clarify PhotoKit HEIC upload behavior

Signed-off-by: Marino Faggiana <[email protected]>

* fix: improve background upload diagnostics

Log processing stages and detailed errors, and promote extension diagnostics to notice level.

Signed-off-by: Marino Faggiana <[email protected]>

* fix: mark background PhotoKit uploads

Add the X-NC-PhotoKit-Upload header to background upload requests.

Signed-off-by: Marino Faggiana <[email protected]>

* Clean up background upload metadata when PhotoKit assets are missing

Signed-off-by: Marino Faggiana <[email protected]>

* Log

Signed-off-by: Marino Faggiana <[email protected]>

* Log

Signed-off-by: Marino Faggiana <[email protected]>

* feat: add log file browser to advanced settings

List, preview, and share active and rotated log files.
Limit upload diagnostics to failures and redact sensitive response headers.
Update NextcloudKit and Realm dependencies.

Signed-off-by: Marino Faggiana <[email protected]>

* feat: document Apache setup for PhotoKit uploads

Mark the background upload extension as experimental and show the required Apache rewrite rules.

Update NextcloudKit and bump the project build number.

Signed-off-by: Marino Faggiana <[email protected]>

---------

Signed-off-by: Marino Faggiana <[email protected]>
2026-09-29 08:18:02 +02:00
Nextcloud bot fc2030645c fix(l10n): Update translations from Transifex
Signed-off-by: Nextcloud bot <[email protected]>
2026-09-28 03:51:40 +00:00
Nextcloud bot c7659ccf41 fix(l10n): Update translations from Transifex
Signed-off-by: Nextcloud bot <[email protected]>
2026-09-27 03:54:52 +00:00
Marino Faggiana 7f9a72463d fix: hide top scroll edge effects on iOS 27 (#4339)
* fix: hide top scroll edge effects on iOS 27

Apply the behavior consistently across UIKit and SwiftUI scrollable views, and adjust the activity layout to extend beneath the navigation area.

Bump the project build number to 3.

Signed-off-by: Marino Faggiana <[email protected]>

* fix: forward direct editing paste to first responder

Signed-off-by: Marino Faggiana <[email protected]>

---------

Signed-off-by: Marino Faggiana <[email protected]>
2026-09-25 17:20:13 +02:00
Marino Faggiana e0a3570121 refactor: remove redundant networking task registry (#4336)
* fix: manage favorite listing task locally

Signed-off-by: Marino Faggiana <[email protected]>

* fix: manage recent listing task directly

Signed-off-by: Marino Faggiana <[email protected]>

* fix: track notification requests locally

Cancel the active notification data source task when leaving the view and prevent duplicate in-flight requests.

Signed-off-by: Marino Faggiana <[email protected]>

* fix: manage group folder request cancellation locally

Signed-off-by: Marino Faggiana <[email protected]>

* fix: manage data source tasks on the main actor

Track and cancel trash loading directly through its URL session task.

Signed-off-by: Marino Faggiana <[email protected]>

* fix: cancel shares request when leaving the view

Signed-off-by: Marino Faggiana <[email protected]>

* fix: cancel NCSelect data source task on dismissal

Track the folder request directly and prevent duplicate reads while it is running or suspended.

Signed-off-by: Marino Faggiana <[email protected]>

* fix: track activity requests per view controller

Signed-off-by: Marino Faggiana <[email protected]>

* fix: cancel file data source requests directly

Signed-off-by: Marino Faggiana <[email protected]>

* fix: cancel active metadata sync network task

Track the current metadata sync request directly and cancel it when metadata synchronization stops.

Signed-off-by: Marino Faggiana <[email protected]>

* refactor: remove redundant network task tracking

Signed-off-by: Marino Faggiana <[email protected]>

* refactor: remove unused networking task tracker

Signed-off-by: Marino Faggiana <[email protected]>

---------

Signed-off-by: Marino Faggiana <[email protected]>
2026-09-25 16:24:14 +02:00
Marino Faggiana 1a6d1cc7b2 Merge branch 'master' of https://github.com/nextcloud/ios 2026-09-25 16:23:10 +02:00
Marino Faggiana 768a5e85ec fix: correct BackgroundUploadExtension build paths - Archive build
Include inherited and additional Realm header search paths and remove duplicate slashes from plist and entitlement paths.

Signed-off-by: Marino Faggiana <[email protected]>
2026-09-25 16:22:57 +02:00
Nextcloud bot e2f957e154 fix(l10n): Update translations from Transifex
Signed-off-by: Nextcloud bot <[email protected]>
2026-09-25 03:55:30 +00:00
Marino Faggiana baa093448a Fix: improve album photo previews and titles (#4334)
* fix: improve album photo previews and titles

Load cached and locally generated thumbnails before falling back to server previews, and display the resolved album screen title in the photo grid.

Signed-off-by: Marino Faggiana <[email protected]>

* fix: improve album cover thumbnail loading

Signed-off-by: Marino Faggiana <[email protected]>

* fix: isolate photo thumbnail loading to main actor

Reset loading state consistently and ignore cancelled preview downloads.

Signed-off-by: Marino Faggiana <[email protected]>

* refactor: reuse album grid item for list thumbnails

Signed-off-by: Marino Faggiana <[email protected]>

* cleaning

Signed-off-by: Marino Faggiana <[email protected]>

* fix: prevent duplicate photo selection handling

Reset selection handling for each newly created album and process sheet completion only once.

Signed-off-by: Marino Faggiana <[email protected]>

* refactor: centralize album preview loading

Reuse a shared preview loader for photo and album grids, including cancellation handling, network task tracking, and preview caching.

Signed-off-by: Marino Faggiana <[email protected]>

---------

Signed-off-by: Marino Faggiana <[email protected]>
2026-09-24 15:20:29 +02:00
Nextcloud bot 8127cd09c7 fix(l10n): Update translations from Transifex
Signed-off-by: Nextcloud bot <[email protected]>
2026-09-24 04:03:53 +00:00
Nextcloud bot 6529c80910 fix(l10n): Update translations from Transifex
Signed-off-by: Nextcloud bot <[email protected]>
2026-09-23 13:43:39 +00:00
Marino Faggiana 72a55aa649 fix: refresh album cover in details view (#4333)
Load the cover from the current cover photo instead of passing a cached image through navigation, preventing removed photos from remaining visible.

Signed-off-by: Marino Faggiana <[email protected]>
2026-09-23 15:40:13 +02:00
Nextcloud bot 3ce6ec15fa fix(l10n): Update translations from Transifex
Signed-off-by: Nextcloud bot <[email protected]>
2026-09-23 13:09:58 +00:00
Marino Faggiana abc071d9ae feat: persist albums and photo references in Realm (#4331)
* feat: persist albums and photo references in Realm

Cache albums and photos for offline access, preserve references across renames, and invalidate stale refresh requests after changes. Bump the database schema and add persistence tests.

Signed-off-by: Marino Faggiana <[email protected]>

* fix: refresh albums when view reappears

Defer initial album loading to viewWillAppear and sync the currently displayed account on subsequent appearances.

Signed-off-by: Marino Faggiana <[email protected]>

* feat: enhance album covers and metadata

Add a featured album cover with photo count, improve localized media counts and date ranges, and refine album subtitle layout.

Signed-off-by: Marino Faggiana <[email protected]>

* fix: improve album grid layout responsiveness

Use square album thumbnails, adapt column count to available width, and preserve consistent spacing for subtitles and photo sections.

Signed-off-by: Marino Faggiana <[email protected]>

* feat: improve album grid layout and cover transitions

Signed-off-by: Marino Faggiana <[email protected]>

* fix: refine album actions and name validation

Signed-off-by: Marino Faggiana <[email protected]>

* refactor: standardize album sheet toolbar actions

Use standard cancel and confirmation icons with shared accessibility labels, and remove an unused album localization.

Signed-off-by: Marino Faggiana <[email protected]>

* fix: show album errors using descriptions

Signed-off-by: Marino Faggiana <[email protected]>

---------

Signed-off-by: Marino Faggiana <[email protected]>
2026-09-23 15:03:10 +02:00
Nextcloud bot 2cab822119 fix(l10n): Update translations from Transifex
Signed-off-by: Nextcloud bot <[email protected]>
2026-09-23 03:56:12 +00:00
Marino Faggiana d8eee77999 fix: verify unauthorized credentials before deleting accounts (#4330)
* fix: verify unauthorized credentials before deleting accounts

Recheck stored 401 errors with the server and clear stale unauthorized flags. Deduplicate account checks, guard against cancellation and credential changes, and avoid switching unrelated controllers.

Signed-off-by: Marino Faggiana <[email protected]>

* fix: synchronize file context before account switch requests

Signed-off-by: Marino Faggiana <[email protected]>

---------

Signed-off-by: Marino Faggiana <[email protected]>
2026-09-22 18:27:28 +02:00
Marino Faggiana 9f6af63061 fix: refresh collection layout after size changes (#4328)
Signed-off-by: Marino Faggiana <[email protected]>
2026-09-22 10:50:37 +02:00
Marino Faggiana 2014d05ddb Build 2
Signed-off-by: Marino Faggiana <[email protected]>
2026-09-22 10:41:43 +02:00
Marino Faggiana 9667516785 iPhone duo - fix (#4327)
* fix: prevent stale UI updates after account switch

Signed-off-by: Marino Faggiana <[email protected]>

* fix: refresh capabilities before building plus menu

Prevent stale asynchronous menu creation from updating a changed account and avoid retaining the tab bar controller.

Signed-off-by: Marino Faggiana <[email protected]>

* fix: use consistent selection tab bar height

Signed-off-by: Marino Faggiana <[email protected]>

---------

Signed-off-by: Marino Faggiana <[email protected]>
2026-09-22 10:17:56 +02:00
Marino Faggiana 0dda1e7deb fix: isolate album state and navigation per account (#4326)
Pass the active tab controller through album views and media selection, and scope album publishers and navigation to each account.

Signed-off-by: Marino Faggiana <[email protected]>
2026-09-22 09:02:41 +02:00
Guillaume Flambard 68fbd5ad46 fix: size the account settings avatar to the window, not the device screen (#4285)
NCAccountSettingsView is presented as a page sheet, so the width available to it
is the sheet's, not the display's. Framing the avatar at
UIScreen.main.bounds.width asks for a child wider than its container whenever the
presentation is narrower than the screen: a page sheet on iPad, Split View, Slide
Over or Stage Manager.

Constrain the height and let the width fill what the parent offers, which keeps
the avatar 65pt tall and centred at every window size.

UIScreen.main is also deprecated in iOS 27, where layout is expected to follow
the scene rather than the device.


Assisted-by: claude-code:claude-opus-5

Signed-off-by: Guillaume Flambard <[email protected]>
2026-09-22 08:27:50 +02:00
Marino Faggiana 6751b40335 fix: scope metadata lookups to account (#4325)
Reuse existing metadata from search result file IDs and paths before creating new entries.

Signed-off-by: Marino Faggiana <[email protected]>
2026-09-22 08:27:22 +02:00
Nextcloud bot 967ec6abf3 fix(l10n): Update translations from Transifex
Signed-off-by: Nextcloud bot <[email protected]>
2026-09-22 05:58:52 +00:00
Marino Faggiana 254bc9a161 fix: avoid repeated camera roll deletion prompts (#4323)
Signed-off-by: Marino Faggiana <[email protected]>
2026-09-22 07:46:35 +02:00
Nextcloud bot e0310eefd4 fix(l10n): Update translations from Transifex
Signed-off-by: Nextcloud bot <[email protected]>
2026-09-22 04:21:07 +00:00
Marino Faggiana bb430c09f3 Auto Upload - Account single (#4322)
* fix: prevent replacing the active auto-upload account

Signed-off-by: Marino Faggiana <[email protected]>

* fix: disable auto upload settings used by another account

Show the active account inline and refresh its status when the view appears or the app becomes active.

Document that local builds and tests must not be run.

Signed-off-by: Marino Faggiana <[email protected]>

---------

Signed-off-by: Marino Faggiana <[email protected]>
2026-09-21 16:50:19 +02:00
Claudio Cambra 611deecd1b fix(duo): Extend header view in share view beyond safe area (#4313)
Signed-off-by: Claudio Cambra <[email protected]>
2026-09-21 16:36:28 +02:00
Marino Faggiana 505fd86d0a fix: validate share extension account on foreground (#4281)
Fall back to the active account when the selected account is unavailable and keep account UI state in sync.

Signed-off-by: Marino Faggiana <[email protected]>
2026-09-21 16:15:17 +02:00
Claudio Cambra e3d7309775 fix(share): Fix alignment for advanced permission footer buttons (#4314)
Signed-off-by: Claudio Cambra <[email protected]>
2026-09-21 16:14:17 +02:00
Marino Faggiana c4754aba1a update gitignore
Signed-off-by: Marino Faggiana <[email protected]>
2026-09-21 11:27:50 +02:00
Milen Pivchev 669b597d9d chore: add REUSE compliance (#4268)
* chore: add REUSE compliance

Signed-off-by: Milen Pivchev <[email protected]>

* WIP

Signed-off-by: Milen Pivchev <[email protected]>

* WIP

Signed-off-by: Milen Pivchev <[email protected]>

* Fix icon

Signed-off-by: Milen Pivchev <[email protected]>

* Remove unused fonts

Signed-off-by: Milen Pivchev <[email protected]>

* Apply suggestion from @mpivchev

Signed-off-by: Milen Pivchev <[email protected]>

---------

Signed-off-by: Milen Pivchev <[email protected]>
2026-09-21 11:19:52 +02:00
Marino Faggiana d28f26a31c Fix/album api validation (#4320)
* fix: validate album photo metadata and wait for all copies

Skip photos with missing metadata and show an error. Keep the album details loading indicator visible until all copies finish.

Switch NextcloudKit to main and update App Check and SwiftNIO.

Signed-off-by: Marino Faggiana <[email protected]>

* package

Signed-off-by: Marino Faggiana <[email protected]>

---------

Signed-off-by: Marino Faggiana <[email protected]>
2026-09-21 09:39:47 +02:00
Nextcloud bot a0f21d1758 fix(l10n): Update translations from Transifex
Signed-off-by: Nextcloud bot <[email protected]>
2026-09-21 03:59:29 +00:00
Nextcloud bot 6a1788ffb0 fix(l10n): Update translations from Transifex
Signed-off-by: Nextcloud bot <[email protected]>
2026-09-20 04:02:56 +00:00
dependabot[bot] d9dac6830e fix(deps): Bump github.com/1024jp/gzipswift from 6.0.0 to 7.0.0 (#4263)
Bumps [github.com/1024jp/gzipswift](https://github.com/1024jp/GzipSwift) from 6.0.0 to 7.0.0.
- [Release notes](https://github.com/1024jp/GzipSwift/releases)
- [Changelog](https://github.com/1024jp/GzipSwift/blob/main/CHANGELOG.md)
- [Commits](https://github.com/1024jp/GzipSwift/compare/6.0.0...41d37421fe2cbbfae4a5593dc29d12999fb73cd7)

---
updated-dependencies:
- dependency-name: github.com/1024jp/gzipswift
  dependency-version: 7.0.0
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-09-19 17:31:49 +02:00
dependabot[bot] 651a0ff71a fix(deps): Bump github.com/google/app-check from 11.3.1 to 11.3.2 (#4303)
Bumps [github.com/google/app-check](https://github.com/google/app-check) from 11.3.1 to 11.3.2.
- [Release notes](https://github.com/google/app-check/releases)
- [Changelog](https://github.com/google/app-check/blob/main/CHANGELOG.md)
- [Commits](https://github.com/google/app-check/compare/11.3.1...97f7d74dd0e8f3d0fe5fc75cc8957aa73bdc948a)

---
updated-dependencies:
- dependency-name: github.com/google/app-check
  dependency-version: 11.3.2
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-09-19 17:27:21 +02:00
Claudio Cambra c3f6f86b7c fix(duo): Fix overflow menu duplication with automatic system overflow mechanism (#4319)
Signed-off-by: Claudio Cambra <[email protected]>
2026-09-19 17:26:35 +02:00
Claudio Cambra fa0044b06d fix: Only hide carousel for compact devices when in landscape (#4318)
Signed-off-by: Claudio Cambra <[email protected]>
2026-09-19 17:24:53 +02:00
Claudio Cambra 93917f8bbf feat: Allow recommended files carousel to render in safe area (#4316)
* feat: Allow view recommendations carousel to extend beyond and under safe area

Signed-off-by: Claudio Cambra <[email protected]>

* feat: Add inset to recommended items to ensure items fall within safe area when scrolled

Signed-off-by: Claudio Cambra <[email protected]>

---------

Signed-off-by: Claudio Cambra <[email protected]>
2026-09-19 17:23:39 +02:00
Claudio Cambra e069c25d32 chore: Add CODEOWNERS (#4317)
Signed-off-by: Claudio Cambra <[email protected]>
2026-09-19 16:54:17 +02:00
1893cbfd2a ci: Update runners to Xcode 27 and iPhone 17 simulator (#4315)
* ci: Update runners to Xcode 27 and iPhone 17 simulator

Signed-off-by: Milen Pivchev <[email protected]>

* docs: sync AGENTS test command

Assisted-by: GitHub Copilot Coding Agent:gpt-5
Signed-off-by: GitHub <[email protected]>

Co-authored-by: mpivchev <[email protected]>

* Add a skill

Signed-off-by: Milen Pivchev <[email protected]>

---------

Signed-off-by: Milen Pivchev <[email protected]>
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: mpivchev <[email protected]>
2026-09-19 15:51:25 +02:00
Marino Faggiana de054206b4 UI fix ios27 (#4310)
* wip

Signed-off-by: Marino Faggiana <[email protected]>

* fix menu media

Signed-off-by: Marino Faggiana <[email protected]>

* fix upload

Signed-off-by: Marino Faggiana <[email protected]>

* wip

Signed-off-by: Marino Faggiana <[email protected]>

* lint

Signed-off-by: Marino Faggiana <[email protected]>

* deletePhotoFromAlbum

Signed-off-by: Marino Faggiana <[email protected]>

* build 1

Signed-off-by: Marino Faggiana <[email protected]>

* Albums wip

Signed-off-by: Marino Faggiana <[email protected]>

* fix: process Live Photos before removing uploaded camera roll assets

Allow Live Photo processing while transfers remain queued, without blocking it on failed or declined deletion attempts.

Signed-off-by: Marino Faggiana <[email protected]>

---------

Signed-off-by: Marino Faggiana <[email protected]>
2026-09-19 11:12:23 +02:00
Nextcloud bot 123788d359 fix(l10n): Update translations from Transifex
Signed-off-by: Nextcloud bot <[email protected]>
2026-09-19 04:05:52 +00:00
Marino Faggiana 8684364a18 Albums - metadata (internal) - NextcloudKit (#4302)
* wip

Signed-off-by: Marino Faggiana <[email protected]>

* wip

Signed-off-by: Marino Faggiana <[email protected]>

* wip

Signed-off-by: Marino Faggiana <[email protected]>

---------

Signed-off-by: Marino Faggiana <[email protected]>
2026-09-18 10:12:14 +02:00
Nextcloud bot d525436057 fix(l10n): Update translations from Transifex
Signed-off-by: Nextcloud bot <[email protected]>
2026-09-18 04:01:06 +00:00
Marino Faggiana 1ba9017c3c Merge branch 'master' of https://github.com/nextcloud/ios into 3838-autoupload-investigate-ios27-background-uploader---photokit 2026-09-17 16:36:51 +02:00
Marino Faggiana 032606d86f wip
Signed-off-by: Marino Faggiana <[email protected]>
2026-09-17 16:36:32 +02:00
Marino Faggiana 7f6440faca fix: preserve chunked uploads after background interruption
Retain interrupted uploads for retry and guard against stale task callbacks. Clear old encrypted chunks before retrying with fresh encryption keys.

Signed-off-by: Marino Faggiana <[email protected]>
2026-09-17 16:32:42 +02:00
Marino Faggiana e6cd4cab42 fix: safely clean up uploaded camera roll assets
Allow cleanup while unrelated transfers remain queued, requiring all asset transfers and Live Photo components to be complete. Throttle deletion prompts, require the app to be active, and clear asset identifiers only after successful deletion.

Add unit tests for cleanup eligibility.

Signed-off-by: Marino Faggiana <[email protected]>
2026-09-17 06:52:49 +02:00
Nextcloud bot cc8cc2fb6b fix(l10n): Update translations from Transifex
Signed-off-by: Nextcloud bot <[email protected]>
2026-09-17 04:23:33 +00:00
Nextcloud bot 6ad9ed4c66 fix(l10n): Update translations from Transifex
Signed-off-by: Nextcloud bot <[email protected]>
2026-09-16 03:59:24 +00:00
Marino Faggiana 01d96f773f fix
Signed-off-by: Marino Faggiana <[email protected]>
2026-09-15 11:32:09 +02:00
Marino Faggiana 3567d1e191 WIP
Signed-off-by: Marino Faggiana <[email protected]>
2026-09-15 11:03:07 +02:00
Marino Faggiana 75ba75ef28 Merge remote-tracking branch 'origin/master' into 3838-autoupload-investigate-ios27-background-uploader---photokit 2026-09-15 11:00:49 +02:00
Nextcloud bot 4d76004c34 fix(l10n): Update translations from Transifex
Signed-off-by: Nextcloud bot <[email protected]>
2026-09-15 04:02:19 +00:00
Marino Faggiana c340d1f82f fix: prevent stale recommendations across account switches
Scope recommended file metadata lookups to the account and discard outdated content and image requests. Clear reused cell state and stale context menus.

Signed-off-by: Marino Faggiana <[email protected]>
2026-09-14 07:30:34 +02:00
Marino Faggiana f8b6b59bc7 cleaning
Signed-off-by: Marino Faggiana <[email protected]>
2026-09-13 11:05:12 +02:00
Marino Faggiana b4a90c02b9 fix: improve album cover loading and photo viewer resolution (#4296)
Cache album covers and try alternative photos when the preferred preview is unavailable. Fetch missing photo metadata and include all album photos for lazy viewer loading.

Signed-off-by: Marino Faggiana <[email protected]>
2026-09-13 11:01:06 +02:00
Marino Faggiana 235f099bee fix: use account-specific colors in album controls (#4295)
Add icons to album rename and delete actions, clean up album views, and bump the build number to 8.

Signed-off-by: Marino Faggiana <[email protected]>
2026-09-13 09:56:18 +02:00
naelfe 272673eedd fix(auto-upload): reduce JPEG compression quality to 0.85 (#4288)
Quality 1.0 forces an inefficient encode and re-encodes the source HEIC's compression artifacts, roughly tripling the resulting file size with no visible gain.

Fixes #4287

Signed-off-by: naelfe <[email protected]>
2026-09-13 09:55:42 +02:00
Nextcloud bot 915250cbd5 fix(l10n): Update translations from Transifex
Signed-off-by: Nextcloud bot <[email protected]>
2026-09-13 03:51:15 +00:00
Marino Faggiana 6703774102 feat: add photo removal from album grid (#4293)
* feat: add photo removal from album grid

Add a context menu action with confirmation to remove album entries, including photos without local metadata, while preserving original files.

Signed-off-by: Marino Faggiana <[email protected]>

* Build 6

Signed-off-by: Marino Faggiana <[email protected]>

* fix: allow media search while selecting album photos

Make album photo selection ready after loading local media, then search for new media in the background. Support media reloads in the selection sheet and bump the build number to 7.

Signed-off-by: Marino Faggiana <[email protected]>

---------

Signed-off-by: Marino Faggiana <[email protected]>
2026-09-12 08:55:14 +02:00
Nextcloud bot 19ee2b7b10 fix(l10n): Update translations from Transifex
Signed-off-by: Nextcloud bot <[email protected]>
2026-09-12 04:02:30 +00:00
Marino Faggiana 6fea58356f Build 6
Signed-off-by: Marino Faggiana <[email protected]>
2026-09-11 09:07:08 +02:00
Nextcloud bot a52f0c144c fix(l10n): Update translations from Transifex
Signed-off-by: Nextcloud bot <[email protected]>
2026-09-11 04:01:34 +00:00
Nextcloud bot 2234a80b95 fix(l10n): Update translations from Transifex
Signed-off-by: Nextcloud bot <[email protected]>
2026-09-10 15:52:54 +00:00
Nextcloud bot b30092d225 fix(l10n): Update translations from Transifex
Signed-off-by: Nextcloud bot <[email protected]>
2026-09-10 15:49:45 +00:00
Marino Faggiana d05b8a0e4c feat: add unified sharing interface (#4291)
Use the NextcloudKit unified-sharing branch and present its share list and creation flow on supported servers, while retaining legacy sharing behavior otherwise.

Signed-off-by: Marino Faggiana <[email protected]>
2026-09-10 17:44:58 +02:00
Marino Faggianaandharshada-15-tsys 718ef0a3aa feat: Albums integration (#4286)
* Init

Signed-off-by: Marino Faggiana <[email protected]>

* fix: update album media viewing and thumbnail handling

Use the media viewer presenter with valid account metadata instead of creating stubs. Create thumbnails using the account session, remove obsolete album navigation handling, and recheck cancellation after media search.

Signed-off-by: Marino Faggiana <[email protected]>

* feat: add Albums entry to the More menu

Signed-off-by: Marino Faggiana <[email protected]>

* align version code

Signed-off-by: Marino Faggiana <[email protected]>

* fix: reload media in album photo selection sheet

Force data source loading before and after media search, then refresh the collection view before enabling selection.

Signed-off-by: Marino Faggiana <[email protected]>

* iOS Albums feature  (#4290)

* feat: Add albums images and localisations. Add "add to album" and "create new album" menu from media tab to add photos to album. Remove the unused code.

Signed-off-by: harshada-15-tsys <[email protected]>

* fix: reload media in album photo selection sheet
Force data source loading before and after media search, then refresh the collection view before enabling selection.
fix: Handling select all functionality in media menu

Signed-off-by: harshada-15-tsys <[email protected]>

---------

Signed-off-by: harshada-15-tsys <[email protected]>

* fix: scope album navigation and feedback to the originating window

Open album details through the More tab after creating albums or adding photos. Scope loaders, banners, and refresh notifications to the originating controller, and wait for sheet dismissal before presenting the next view.

Signed-off-by: Marino Faggiana <[email protected]>

* Album image

Signed-off-by: Marino Faggiana <[email protected]>

* lint

Signed-off-by: Marino Faggiana <[email protected]>

* license - lint

Signed-off-by: Marino Faggiana <[email protected]>

* V 35.0.0 - Build 4

Signed-off-by: Marino Faggiana <[email protected]>

* fix: swap Activity and Album navigation

Signed-off-by: Marino Faggiana <[email protected]>

* wip

Signed-off-by: Marino Faggiana <[email protected]>

* wip

Signed-off-by: Marino Faggiana <[email protected]>

* UI

Signed-off-by: Marino Faggiana <[email protected]>

---------

Signed-off-by: Marino Faggiana <[email protected]>
Signed-off-by: harshada-15-tsys <[email protected]>
Co-authored-by: harshada-15-tsys <[email protected]>
2026-09-10 17:00:50 +02:00
Nextcloud bot aeb789c098 fix(l10n): Update translations from Transifex
Signed-off-by: Nextcloud bot <[email protected]>
2026-09-08 04:21:12 +00:00
Nextcloud bot bc288cdbf6 fix(l10n): Update translations from Transifex
Signed-off-by: Nextcloud bot <[email protected]>
2026-09-06 03:47:25 +00:00
Nextcloud bot cb6383bb20 fix(l10n): Update translations from Transifex
Signed-off-by: Nextcloud bot <[email protected]>
2026-09-05 03:55:47 +00:00
Nextcloud bot 3eeb8d0b9f fix(l10n): Update translations from Transifex
Signed-off-by: Nextcloud bot <[email protected]>
2026-09-04 04:06:01 +00:00
Marino Faggiana 101eb27d4a feat: make background upload extension configurable
Signed-off-by: Marino Faggiana <[email protected]>
2026-09-03 10:31:55 +02:00
Nextcloud bot 9de4faa4d6 fix(l10n): Update translations from Transifex
Signed-off-by: Nextcloud bot <[email protected]>
2026-09-03 03:46:28 +00:00
Marino Faggiana a366842996 feat: support Live Photo background uploads
Queue and upload paired Live Photo image and video resources, then link them when supported by the server.

Signed-off-by: Marino Faggiana <[email protected]>
2026-09-02 14:31:42 +02:00
Marino Faggiana 2f2e98329b fix: process Live Photos for all accounts
Signed-off-by: Marino Faggiana <[email protected]>
2026-09-02 12:04:35 +02:00
Marino Faggiana 27f51026ee fix: reset pending background upload retry state
Signed-off-by: Marino Faggiana <[email protected]>
2026-09-02 11:50:35 +02:00
Marino Faggiana b32e8e7dac feat: allow retrying failed background uploads
Mark retryable jobs as pending, add retry controls and auto-upload indicators, and improve account-specific error logging.

Signed-off-by: Marino Faggiana <[email protected]>
2026-09-02 11:46:22 +02:00
Nextcloud bot cea7d7f2d6 fix(l10n): Update translations from Transifex
Signed-off-by: Nextcloud bot <[email protected]>
2026-09-02 03:47:29 +00:00
Marino Faggiana 182c63dcfc refactor: improve background upload extension logging
Use OSLog levels for extension diagnostics while persisting errors and key lifecycle events. Update the Nextcloud scheme to prompt for the app when debugging extensions.

Signed-off-by: Marino Faggiana <[email protected]>
2026-09-01 12:12:56 +02:00
Marino Faggiana c0736d8bcc fix: handle background upload cancellation
Delete pending uploads immediately and mark active background uploads for cancellation.

Signed-off-by: Marino Faggiana <[email protected]>
2026-09-01 11:23:47 +02:00
Marino Faggiana 9f84fd42b5 fix: handle background upload authentication failures
Acknowledge orphaned jobs, stop retrying authentication failures, and keep processing active while upload jobs remain.

Signed-off-by: Marino Faggiana <[email protected]>
2026-09-01 11:15:37 +02:00
Marino Faggiana cf67ba022e fix: disable background upload extension when idle
Defer disabling until active auto-upload jobs finish and cap concurrent extension jobs at 20.

Signed-off-by: Marino Faggiana <[email protected]>
2026-09-01 09:10:59 +02:00
Nextcloud bot 80630cb8fa fix(l10n): Update translations from Transifex
Signed-off-by: Nextcloud bot <[email protected]>
2026-09-01 03:43:13 +00:00
Marino Faggiana 6ad82521be fix: enable background uploads after date changes
Signed-off-by: Marino Faggiana <[email protected]>
2026-08-31 15:26:49 +02:00
Marino Faggiana 9168fc498d lint
Signed-off-by: Marino Faggiana <[email protected]>
2026-08-31 11:51:17 +02:00
Marino Faggiana 3add9520ad capabilities fix
Signed-off-by: Marino Faggiana <[email protected]>
2026-08-31 10:49:33 +02:00
Marino Faggiana d94bf597b1 fix: retry failed background upload jobs
Reset retry state after successful uploads and preserve session data when handling failures.

Signed-off-by: Marino Faggiana <[email protected]>
2026-08-31 10:02:17 +02:00
Marino Faggiana 694286a41e fix: coordinate auto-upload account switching and job cancellation
Restrict auto-upload processing to the active account and delegate supported flows to the Photos extension.

Cancel or acknowledge background jobs when auto-upload is disabled or moved to another account.

Signed-off-by: Marino Faggiana <[email protected]>
2026-08-31 09:43:10 +02:00
Marino Faggiana e1b905018c fix: limit auto upload to one account
Signed-off-by: Marino Faggiana <[email protected]>
2026-08-31 08:50:30 +02:00
Marino Faggiana ae9b60e750 fix: respect background upload job capacity
Limit pending metadata creation to available upload slots and prevent duplicate asset queuing by local identifier.

Signed-off-by: Marino Faggiana <[email protected]>
2026-08-31 07:44:51 +02:00
Marino Faggiana b6f4c0e9fd fix: register metadata tags in background upload database
Signed-off-by: Marino Faggiana <[email protected]>
2026-08-30 10:23:02 +02:00
Nextcloud bot 28c5d85ea0 fix(l10n): Update translations from Transifex
Signed-off-by: Nextcloud bot <[email protected]>
2026-08-30 03:44:55 +00:00
Marino Faggiana 2c1ac993db feat: persist background upload retry state
Bump the Realm database schema version to 416.

Signed-off-by: Marino Faggiana <[email protected]>
2026-08-29 10:05:44 +02:00
Marino Faggiana d3127ecf97 fix: harden background upload job processing
Scope pending uploads to active accounts, acknowledge orphan retry jobs, preserve asset dimensions and size, and accept standard ETag headers.

Signed-off-by: Marino Faggiana <[email protected]>
2026-08-29 09:36:11 +02:00
Marino Faggiana 723a79e426 fix: respect account settings for background auto uploads
Use account-specific subfolder granularity when creating upload paths and only skip assets by their generated filename.

Signed-off-by: Marino Faggiana <[email protected]>
2026-08-29 09:22:50 +02:00
Marino Faggiana fa8d9446c1 fix: honor network settings for background uploads
Require server version 33 or later and update the upload extension options when already enabled.

Signed-off-by: Marino Faggiana <[email protected]>
2026-08-29 08:59:18 +02:00
Nextcloud bot a2d3014e71 fix(l10n): Update translations from Transifex
Signed-off-by: Nextcloud bot <[email protected]>
2026-08-29 03:42:36 +00:00
Marino Faggiana fc53dcd052 lint
Signed-off-by: Marino Faggiana <[email protected]>
2026-08-28 11:59:28 +02:00
Marino Faggiana c33b076f42 refactor: extract background upload discovery
Signed-off-by: Marino Faggiana <[email protected]>
2026-08-28 11:54:06 +02:00
Marino Faggiana 903eb1ea78 fix: handle orphaned background upload jobs
Acknowledge jobs without metadata and mark successful uploads with a missing file ID as errors.

Signed-off-by: Marino Faggiana <[email protected]>
2026-08-28 11:40:29 +02:00
Marino Faggiana 7124eabe17 feat: queue assets for background auto upload
Track completed auto-upload transfers and clear job identifiers only after successful acknowledgement.

Signed-off-by: Marino Faggiana <[email protected]>
2026-08-28 11:33:40 +02:00
Marino Faggiana 4b83071390 refactor: clean up background upload extension code
Signed-off-by: Marino Faggiana <[email protected]>
2026-08-28 11:15:42 +02:00
Marino Faggiana 09206cd8b6 cleaning
Signed-off-by: Marino Faggiana <[email protected]>
2026-08-28 11:03:15 +02:00
Marino Faggiana ea4be8d4a7 refactor: split background upload extension workflows
Move destination, job, and result handling into focused extension files and add retry processing for background upload jobs.

Signed-off-by: Marino Faggiana <[email protected]>
2026-08-28 11:02:39 +02:00
Marino Faggiana b873487b66 feat: set up accounts for background uploads
Initialize the extension database, logger, and NextcloudKit sessions, and split account-related metadata handling into dedicated extension files.

Signed-off-by: Marino Faggiana <[email protected]>
2026-08-28 10:49:57 +02:00
Marino Faggiana 2b63aedddf feat: delegate auto uploads to Photos extension
Enable the upload job extension for eligible accounts and fall back to the existing auto-upload flow when unavailable.

Signed-off-by: Marino Faggiana <[email protected]>
2026-08-28 10:28:13 +02:00
Marino Faggiana 0c46437294 feat: complete background upload job lifecycle
Create, retry, and acknowledge Photos background upload jobs while syncing their results to metadata.

Exclude extension-managed uploads from the legacy networking process.

Signed-off-by: Marino Faggiana <[email protected]>
2026-08-28 09:54:32 +02:00
Marino Faggiana 61cd561cb1 refactor: move background upload configuration to Brand
Update the extension project settings to use the relocated entitlements and property list files.

Signed-off-by: Marino Faggiana <[email protected]>
2026-08-28 08:44:18 +02:00
Marino Faggiana c512b0507c feat: enable database access in background upload extension
Add Realm-backed metadata support and build upload destination requests in the background upload target.

Signed-off-by: Marino Faggiana <[email protected]>
2026-08-28 08:33:53 +02:00
Nextcloud bot 3c0ef18505 fix(l10n): Update translations from Transifex
Signed-off-by: Nextcloud bot <[email protected]>
2026-08-28 03:51:45 +00:00
Marino Faggiana 5cbc4fab9b lib
Signed-off-by: Marino Faggiana <[email protected]>
2026-08-27 17:29:49 +02:00
Marino Faggiana 0c49ab7239 test
Signed-off-by: Marino Faggiana <[email protected]>
2026-08-27 17:28:23 +02:00
Marino Faggiana 945f1f7556 feat: acknowledge background photo upload jobs
Store background upload job identifiers in metadata and bump the database schema version.

Signed-off-by: Marino Faggiana <[email protected]>
2026-08-27 16:07:23 +02:00
Marino Faggiana 813bab13ba fix: disable auto upload on iOS 27
Signed-off-by: Marino Faggiana <[email protected]>
2026-08-27 14:59:02 +02:00
Marino Faggiana f2af31ec7e test
Signed-off-by: Marino Faggiana <[email protected]>
2026-08-27 11:35:36 +02:00
Marino Faggiana 5bfe6ce671 feat: embed background upload extension
Add a shared extension scheme and diagnostic lifecycle logging.

Signed-off-by: Marino Faggiana <[email protected]>
2026-08-27 11:11:28 +02:00
Marino Faggiana 8fec657ed8 feat: enable background photo upload extension
Request full photo library access at launch and enable the upload job extension on iOS 27.

Use OSLog for background upload lifecycle events.

Signed-off-by: Marino Faggiana <[email protected]>
2026-08-27 10:20:09 +02:00
Marino Faggiana c83905f48b feat: add Photos background upload extension
Signed-off-by: Marino Faggiana <[email protected]>
2026-08-27 09:50:27 +02:00
Nextcloud bot 8104883d62 fix(l10n): Update translations from Transifex
Signed-off-by: Nextcloud bot <[email protected]>
2026-08-27 04:10:48 +00:00
Marino Faggiana 68e28f4d32 feat: preserve E2EE key sets during setup (#4270)
* feat: preserve E2EE key sets during setup

Archive active E2EE credentials in the Keychain before setup resets or certificate renewal, while deduplicating snapshots and preserving explicit full cleanup.

Add unit coverage for complete, duplicate, and partial key-set archives, and update resolved package versions.

Signed-off-by: Marino Faggiana <[email protected]>

* feat: support read-only access with archived E2EE keys

Signed-off-by: Marino Faggiana <[email protected]>

* fix: reuse root metadata key for E2EE v2 child folders

Signed-off-by: Marino Faggiana <[email protected]>

* fix: enforce E2EE write access before metadata changes

Signed-off-by: Marino Faggiana <[email protected]>

* fix: handle empty users in E2EE v2 metadata

Reuse the encrypted root key only for child metadata and verify empty-user signatures with the current certificate.

Update Firebase dependencies to 12.18.0.

Signed-off-by: Marino Faggiana <[email protected]>

* fix: enforce E2EE key set write access

Block metadata recovery and destructive operations when only archived or unavailable keys can decrypt the folder.

Allow explicit initial metadata creation for newly encrypted folders.

Signed-off-by: Marino Faggiana <[email protected]>

* test: verify E2EE archiving preserves active credentials

Pin Firebase and GoogleAppMeasurement to 12.17.0.

Signed-off-by: Marino Faggiana <[email protected]>

* fix: handle changed E2EE server keys safely

Detect and replace stale server key sets while preserving archived keys for read-only access. Validate write operations and route encrypted media folder deletion through the E2EE flow.

Signed-off-by: Marino Faggiana <[email protected]>

* fix: validate E2EE server keys once per active cycle

Signed-off-by: Marino Faggiana <[email protected]>

* refactor: clarify metadata key decryption checks

Signed-off-by: Marino Faggiana <[email protected]>

* fix: require password for E2EE key deletion

Prompt for the account password before deleting E2EE keys or renewing certificates.

Update NextcloudKit to the password-parameter branch.

Signed-off-by: Marino Faggiana <[email protected]>

* fix: allow passwordless E2EE key management

Update NextcloudKit and Firebase package revisions.

Signed-off-by: Marino Faggiana <[email protected]>

* cleaning

Signed-off-by: Marino Faggiana <[email protected]>

* rename

Signed-off-by: Marino Faggiana <[email protected]>

* fix: validate E2EE keys against user certificates

Use the server public key only to authenticate certificates, and compare embedded user keys when detecting key changes.

Verify decrypted private keys match the user certificate before storing or uploading them.

Signed-off-by: Marino Faggiana <[email protected]>

* fix: refresh plus menu when E2EE preference changes

Signed-off-by: Marino Faggiana <[email protected]>

* chore: prepare 34.2.0 release

Pin NextcloudKit to 7.5.0 and reset the build number.

Signed-off-by: Marino Faggiana <[email protected]>

* fix: prevent sensitive E2EE data from being logged

Replace raw key and metadata output with non-sensitive E2EE diagnostics.

Signed-off-by: Marino Faggiana <[email protected]>

---------

Signed-off-by: Marino Faggiana <[email protected]>
2026-08-26 09:46:27 +02:00
Nextcloud bot 1a60516706 fix(l10n): Update translations from Transifex
Signed-off-by: Nextcloud bot <[email protected]>
2026-08-26 04:19:48 +00:00
Milen Pivchev 11f5ee22cf fix: Arbitrary loads
Signed-off-by: Milen Pivchev <[email protected]>
2026-08-25 13:25:22 +02:00
Nextcloud bot e270ba89db fix(l10n): Update translations from Transifex
Signed-off-by: Nextcloud bot <[email protected]>
2026-08-25 04:07:20 +00:00
Marino Faggiana 95b54c4a93 fix: bound media search and backfill requests (#4273)
* fix: limit media verification request size

Signed-off-by: Marino Faggiana <[email protected]>

* fix: resume media metadata backfill in bounded batches

Signed-off-by: Marino Faggiana <[email protected]>

* fix: increase media verification result limit

Use a fixed 1,000-item cap because Nextcloud cannot range-filter display names for same-date results.

Signed-off-by: Marino Faggiana <[email protected]>

* chore: bump project build number to 1

Signed-off-by: Marino Faggiana <[email protected]>

---------

Signed-off-by: Marino Faggiana <[email protected]>
2026-08-24 08:04:39 +02:00
Nextcloud bot 2c118c7b7a fix(l10n): Update translations from Transifex
Signed-off-by: Nextcloud bot <[email protected]>
2026-08-24 03:27:33 +00:00
Marino Faggiana 204f9e23b1 refactor: reorganize plus menu document actions (#4271)
* refactor: reorganize plus menu document actions

Signed-off-by: Marino Faggiana <[email protected]>

* fix: use automatic sizing for context menu elements

Signed-off-by: Marino Faggiana <[email protected]>

---------

Signed-off-by: Marino Faggiana <[email protected]>
2026-08-23 08:37:15 +02:00
Nextcloud bot be77b87304 fix(l10n): Update translations from Transifex
Signed-off-by: Nextcloud bot <[email protected]>
2026-08-21 03:35:03 +00:00
Marino Faggiana 535993571b fix: zoom state live (#4269)
* fix: zoom state live

Signed-off-by: Marino Faggiana <[email protected]>

* fix: reset zoom state after Live Photo playback

Signed-off-by: Marino Faggiana <[email protected]>

---------

Signed-off-by: Marino Faggiana <[email protected]>
2026-08-20 08:46:39 +02:00
Nextcloud bot 07841f297a fix(l10n): Update translations from Transifex
Signed-off-by: Nextcloud bot <[email protected]>
2026-08-20 03:33:03 +00:00
dependabot[bot] 65143c3e51 fix(deps): Bump github.com/siteline/swiftui-introspect (#4262)
Bumps [github.com/siteline/swiftui-introspect](https://github.com/siteline/swiftui-introspect) from 1.3.0 to 26.0.1.
- [Release notes](https://github.com/siteline/swiftui-introspect/releases)
- [Commits](https://github.com/siteline/swiftui-introspect/compare/1.3.0...26986a57e31c813f98262ddb62d4b07d40008535)

---
updated-dependencies:
- dependency-name: github.com/siteline/swiftui-introspect
  dependency-version: 26.0.1
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-08-19 13:54:30 +02:00
dependabot[bot] 1995d9e425 fix(deps): Bump github.com/google/googleappmeasurement (#4265)
Bumps [github.com/google/googleappmeasurement](https://github.com/google/GoogleAppMeasurement) from 12.15.0 to 12.18.0.
- [Release notes](https://github.com/google/GoogleAppMeasurement/releases)
- [Commits](https://github.com/google/GoogleAppMeasurement/compare/12.15.0...f04760d460296cc0fa430935a7be212e5bd67fc5)

---
updated-dependencies:
- dependency-name: github.com/google/googleappmeasurement
  dependency-version: 12.18.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-08-19 13:54:27 +02:00
dependabot[bot] d98ed21691 fix(deps): Bump github.com/exyte/popupview from 2.10.6 to 5.0.5 (#4266)
Bumps [github.com/exyte/popupview](https://github.com/exyte/PopupView) from 2.10.6 to 5.0.5.
- [Commits](https://github.com/exyte/PopupView/compare/2.10.6...62e1698164c352e4cae074bb30eff011ef1b9af6)

---
updated-dependencies:
- dependency-name: github.com/exyte/popupview
  dependency-version: 5.0.5
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-08-19 13:53:50 +02:00
dependabot[bot] bbff6d2b6a fix(deps): Bump github.com/firebase/firebase-ios-sdk (#4264)
Bumps [github.com/firebase/firebase-ios-sdk](https://github.com/firebase/firebase-ios-sdk) from 12.15.0 to 12.17.0.
- [Release notes](https://github.com/firebase/firebase-ios-sdk/releases)
- [Commits](https://github.com/firebase/firebase-ios-sdk/compare/12.15.0...33a468adfdb75b53f05a37e7c886ca7c962b5c17)

---
updated-dependencies:
- dependency-name: github.com/firebase/firebase-ios-sdk
  dependency-version: 12.17.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-08-19 13:53:24 +02:00
dependabot[bot] eeb5692d4f ci: Bump actions/upload-artifact from 4 to 7 (#4261)
Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 4 to 7.
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](https://github.com/actions/upload-artifact/compare/v4...v7)

---
updated-dependencies:
- dependency-name: actions/upload-artifact
  dependency-version: '7'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-08-19 13:51:39 +02:00
dependabot[bot] 542ce2e641 ci: Bump actions/download-artifact from 4 to 8 (#4260)
Bumps [actions/download-artifact](https://github.com/actions/download-artifact) from 4 to 8.
- [Release notes](https://github.com/actions/download-artifact/releases)
- [Commits](https://github.com/actions/download-artifact/compare/v4...v8)

---
updated-dependencies:
- dependency-name: actions/download-artifact
  dependency-version: '8'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-08-19 13:51:22 +02:00
dependabot[bot] 0f24168711 ci: Bump maxim-lobanov/setup-xcode from 1.6.0 to 1.7.0 (#4259)
Bumps [maxim-lobanov/setup-xcode](https://github.com/maxim-lobanov/setup-xcode) from 1.6.0 to 1.7.0.
- [Release notes](https://github.com/maxim-lobanov/setup-xcode/releases)
- [Commits](https://github.com/maxim-lobanov/setup-xcode/compare/60606e260d2fc5762a71e64e74b2174e8ea3c8bd...ed7a3b1fda3918c0306d1b724322adc0b8cc0a90)

---
updated-dependencies:
- dependency-name: maxim-lobanov/setup-xcode
  dependency-version: 1.7.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-08-19 13:51:08 +02:00
dependabot[bot] 42a4bc290a ci: Bump actions/checkout from 4 to 7 (#4258)
Bumps [actions/checkout](https://github.com/actions/checkout) from 4 to 7.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v4...v7)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-version: '7'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-08-19 13:50:38 +02:00
Milen Pivchev 43bbc46bd7 feat: Add Dependabot (#4257)
* WIP

Signed-off-by: Milen Pivchev <[email protected]>

* WIP

Signed-off-by: Milen Pivchev <[email protected]>

* WIP

Signed-off-by: Milen Pivchev <[email protected]>

* WIP

Signed-off-by: Milen Pivchev <[email protected]>

---------

Signed-off-by: Milen Pivchev <[email protected]>
2026-08-18 11:45:53 +02:00
Milen Pivchev 4c05872f2f Update AGENTS.md (#4244)
Signed-off-by: Milen Pivchev <[email protected]>
2026-08-18 11:25:37 +02:00
Nextcloud bot f48455af66 fix(l10n): Update translations from Transifex
Signed-off-by: Nextcloud bot <[email protected]>
2026-08-18 03:28:51 +00:00
Marino Faggiana 38fdc7a99e feat: load media viewer originals on demand (#4256)
* feat: load media viewer originals on demand

Defer original image and Live Photo resource downloads until required, while preserving automatic loading for GIFs, SVGs, and missing previews.

Signed-off-by: Marino Faggiana <[email protected]>

* fix: only show media detail loading for image downloads

Signed-off-by: Marino Faggiana <[email protected]>

* fix: show media detail loading only when download starts

Signed-off-by: Marino Faggiana <[email protected]>

---------

Signed-off-by: Marino Faggiana <[email protected]>
2026-08-17 10:14:13 +02:00
Marino Faggiana abaf4975f8 fix: preserve zoom during Live Photo playback (#4254)
* fix: preserve zoom during Live Photo playback

Signed-off-by: Marino Faggiana <[email protected]>

* chore: bump version to 34.1.4

Reset the project build number to 0.

Signed-off-by: Marino Faggiana <[email protected]>

---------

Signed-off-by: Marino Faggiana <[email protected]>
2026-08-17 07:52:19 +02:00
Nextcloud bot 2f2fc1015a fix(l10n): Update translations from Transifex
Signed-off-by: Nextcloud bot <[email protected]>
2026-08-17 03:26:52 +00:00
Nextcloud bot f2437c35e5 fix(l10n): Update translations from Transifex
Signed-off-by: Nextcloud bot <[email protected]>
2026-08-16 03:25:26 +00:00
Nextcloud bot c830f06212 fix(l10n): Update translations from Transifex
Signed-off-by: Nextcloud bot <[email protected]>
2026-08-15 03:34:47 +00:00
Marino Faggiana e377d52077 feat: support API in direct editing (#4249)
* feat: support API in direct editing

Signed-off-by: Marino Faggiana <[email protected]>

* fix: use direct editing creator for text documents

Signed-off-by: Marino Faggiana <[email protected]>

* refactor: migrate cached editor capabilities to Direct Editing

Signed-off-by: Marino Faggiana <[email protected]>

* fix: refresh direct editing capabilities

Fetch direct editing capabilities through the dedicated API and clear cached data when the request fails.

Signed-off-by: Marino Faggiana <[email protected]>

* fix: distinguish direct editing from legacy rich documents

Use direct-editing capabilities for editor lookup and tighten legacy rich-document MIME type matching.

Signed-off-by: Marino Faggiana <[email protected]>

* fix: check editor availability for OpenDocument files

Signed-off-by: Marino Faggiana <[email protected]>

* fix: report direct editing capabilities accurately

Use direct editing editor identifiers to detect supported editors and distinguish Collabora direct editing from legacy rich documents.

Signed-off-by: Marino Faggiana <[email protected]>

* refactor: migrate rich workspace to direct editing API

Rename rich workspace operations and use direct editing creators for file creation and opening.

Handle missing editor URLs as invalid data instead of force-unwrapping them.

Signed-off-by: Marino Faggiana <[email protected]>

* refactor: rename rich workspace coordinator

Signed-off-by: Marino Faggiana <[email protected]>

* refactor: rename rich document viewer to Collabora

Update the richdocuments asset URL API and track the NextcloudKit editors branch.

Signed-off-by: Marino Faggiana <[email protected]>

* fix: exclude Collabora viewer from main navigation handling

Signed-off-by: Marino Faggiana <[email protected]>

* refactor: unify document editor routing

Route supported editors through the Direct Editing API while preserving legacy Richdocuments fallback for Collabora.

Signed-off-by: Marino Faggiana <[email protected]>

* refactor: split direct editing and richdocuments creation

Prefer Direct Editing creators for Collabora and fall back to the legacy Richdocuments API when needed.

Signed-off-by: Marino Faggiana <[email protected]>

* fix: group document creation actions by office editor

Use advertised editor names, refresh cached menus when editors change, and match Collabora creators by template identifier.

Signed-off-by: Marino Faggiana <[email protected]>

* refactor: scope automatic editor ordering to coordinator

Use the shared EuroOffice identifier when building the context menu.

Signed-off-by: Marino Faggiana <[email protected]>

* feat: expand Collabora mobile editing support

Add diagram creation and handle RichDocuments commands for image insertion, downloads, printing, renaming, and hyperlinks.

Signed-off-by: Marino Faggiana <[email protected]>

* fix: improve Collabora creation and viewer lifecycle

Validate editor URLs and legacy templates before opening created files.
Handle Collabora focus, close events, loading failures, and menu sizing.

Signed-off-by: Marino Faggiana <[email protected]>

* fix: use automatic size for crowded editor menus

Signed-off-by: Marino Faggiana <[email protected]>

* fix: correct ordering of large office menus

Signed-off-by: Marino Faggiana <[email protected]>

* fix: avoid legacy Collabora fallback with direct editing

Signed-off-by: Marino Faggiana <[email protected]>

* refactor: centralize document editor support

Signed-off-by: Marino Faggiana <[email protected]>

* chore: pin NextcloudKit 7.4.3 and bump build version

Signed-off-by: Marino Faggiana <[email protected]>

---------

Signed-off-by: Marino Faggiana <[email protected]>
2026-08-14 18:22:52 +02:00
Marino Faggiana 8121c9e6e6 fix: preserve image zoom (#4252)
* fix: preserve image zoom when changing media

Signed-off-by: Marino Faggiana <[email protected]>

* fix: preserve media viewer zoom state

Persist each page’s image zoom scale and focal point across rotations and view recreation.

Add coverage for orientation round trips and double-tap zoom restoration.

Signed-off-by: Marino Faggiana <[email protected]>

---------

Signed-off-by: Marino Faggiana <[email protected]>
2026-08-14 08:10:00 +02:00
Nextcloud bot e22b4a41d0 fix(l10n): Update translations from Transifex
Signed-off-by: Nextcloud bot <[email protected]>
2026-08-14 03:37:25 +00:00
Marino Faggiana 3b5e2b90e0 fix: preserve media viewer floating title color (#4250)
Keep the title button enabled while making the containing view ignore touches, preserving the system foreground color and normal tint state.

Add unit coverage for title styling and interaction behavior.

Signed-off-by: Marino Faggiana <[email protected]>
2026-08-13 11:48:39 +02:00
Marino Faggiana c1f26f28d2 fix: support whiteboard direct editing (#4247)
* fix: support whiteboard direct editing

Centralize editor identifiers and configure each direct editor with its adapter-provided user agent.

Signed-off-by: Marino Faggiana <[email protected]>

* refactor: inject direct editing viewer dependencies

Signed-off-by: Marino Faggiana <[email protected]>

---------

Signed-off-by: Marino Faggiana <[email protected]>
2026-08-13 10:02:31 +02:00
Marino Faggiana 9d07282403 refactor: remove obsolete upload no-delete handling (#4246)
Signed-off-by: Marino Faggiana <[email protected]>
2026-08-13 07:49:42 +02:00
Nextcloud bot 704cc79cc3 fix(l10n): Update translations from Transifex
Signed-off-by: Nextcloud bot <[email protected]>
2026-08-13 03:32:46 +00:00
Marino Faggiana b7f8234832 fix: preserve offline files during storage cleanup (#4245)
* fix: preserve offline files during storage cleanup

Signed-off-by: Marino Faggiana <[email protected]>

* Build 3

Signed-off-by: Marino Faggiana <[email protected]>

---------

Signed-off-by: Marino Faggiana <[email protected]>
2026-08-12 10:51:08 +02:00
Marino Faggiana 5d423fcdab feat: add media repeat and auto-advance controls (#4243)
* feat: add media repeat and auto-advance controls

Support shared playback completion options across audio, AVPlayer, and VLC viewers.

Automatically advance to the next compatible media item and cover option precedence with unit tests.

Signed-off-by: Marino Faggiana <[email protected]>

* fix: restore audio autoplay when paging tracks

Reload the audio player after viewer-wide teardown and skip fullscreen video dismissal for audio transitions.

Use the repeat-one icon for the audio repeat control.

Signed-off-by: Marino Faggiana <[email protected]>

* feat: persist media viewer playback options

Signed-off-by: Marino Faggiana <[email protected]>

* feat: update audio viewer playback controls

Signed-off-by: Marino Faggiana <[email protected]>

* chore: bump project build version to 2

Signed-off-by: Marino Faggiana <[email protected]>

* fix: improve VLC playback progress and seeking

Track playback using elapsed media time, keep progress updates active during UI interactions, and seek by timestamp after scrubbing.

Signed-off-by: Marino Faggiana <[email protected]>

* fix: preserve hidden video controls during autoplay

Signed-off-by: Marino Faggiana <[email protected]>

* fix: stabilize video controls during playback transitions

Share presentation state across AVPlayer and VLC to suppress controls during automatic playback, repeat restarts, and seeking.

Signed-off-by: Marino Faggiana <[email protected]>

* fix: stabilize audio viewer top action padding

Signed-off-by: Marino Faggiana <[email protected]>

* fix: handle duplicate media and failed auto-advance

Deduplicate media viewer identifiers and skip repeated source items during next-media lookup.
Restore stopped playback controls when no matching item can be advanced to.

Signed-off-by: Marino Faggiana <[email protected]>

* fix: stabilize playback during media page transitions

Deactivate media while paging and resume playback only after the target page settles.

Signed-off-by: Marino Faggiana <[email protected]>

* fix: skip animation for non-adjacent media transitions

Signed-off-by: Marino Faggiana <[email protected]>

* fix: prevent cover flash during local video auto-advance

Signed-off-by: Marino Faggiana <[email protected]>

* chore: bump project build number to 2

Signed-off-by: Marino Faggiana <[email protected]>

---------

Signed-off-by: Marino Faggiana <[email protected]>
2026-08-12 08:50:23 +02:00
Nextcloud bot ce29f3d227 fix(l10n): Update translations from Transifex
Signed-off-by: Nextcloud bot <[email protected]>
2026-08-12 03:31:21 +00:00
Marino Faggiana 9a3f72871f fix: remove placeholder file provider action (#4242)
* fix: remove placeholder file provider action

Signed-off-by: Marino Faggiana <[email protected]>

* chore: bump project build version to 1

Signed-off-by: Marino Faggiana <[email protected]>

---------

Signed-off-by: Marino Faggiana <[email protected]>
2026-08-11 07:50:04 +02:00
Marino Faggiana 6f0315759e fix: remove bottom inset from direct editing viewer (#4241)
* fix: remove bottom inset from direct editing viewer

Signed-off-by: Marino Faggiana <[email protected]>

* chore: bump app version to 34.1.3

Reset the project build number to 0.

Signed-off-by: Marino Faggiana <[email protected]>

---------

Signed-off-by: Marino Faggiana <[email protected]>
2026-08-11 07:36:17 +02:00
Nextcloud bot 1fc7bf16da fix(l10n): Update translations from Transifex
Signed-off-by: Nextcloud bot <[email protected]>
2026-08-11 03:40:29 +00:00
Milen Pivchev 831f1b4842 fix: Show wrong passcode prompt immediately without delay
Signed-off-by: Milen Pivchev <[email protected]>
2026-08-10 12:53:53 +02:00
Nextcloud bot 9131291bdb fix(l10n): Update translations from Transifex
Signed-off-by: Nextcloud bot <[email protected]>
2026-08-10 03:31:11 +00:00
Marino Faggiana 703f6238c8 refactor: remove Assistant text handling from share extension (#4240)
* refactor: remove Assistant text handling from share extension

Signed-off-by: Marino Faggiana <[email protected]>

* chore: bump project build number to 6

Signed-off-by: Marino Faggiana <[email protected]>

---------

Signed-off-by: Marino Faggiana <[email protected]>
2026-08-09 17:19:50 +02:00
Marino Faggiana 0d5f7fe6ad fix: preserve video menus during playback updates (#4239)
* fix: preserve video menus during playback updates

Signed-off-by: Marino Faggiana <[email protected]>

* feat: select external subtitles from Nextcloud

Signed-off-by: Marino Faggiana <[email protected]>

* chore: bump project build number to 5

Signed-off-by: Marino Faggiana <[email protected]>

---------

Signed-off-by: Marino Faggiana <[email protected]>
2026-08-09 11:05:42 +02:00
Nextcloud bot 278319c39d fix(l10n): Update translations from Transifex
Signed-off-by: Nextcloud bot <[email protected]>
2026-08-09 03:25:27 +00:00
Marino Faggiana 5028977cc8 fix: show loading state while media data source builds (#4238)
* fix: show loading state while media data source builds

Route media collection updates through the safe reload helper.

Signed-off-by: Marino Faggiana <[email protected]>

* chore: bump project build number to 4

Signed-off-by: Marino Faggiana <[email protected]>

---------

Signed-off-by: Marino Faggiana <[email protected]>
2026-08-08 10:20:33 +02:00
Marino Faggiana b2974669b0 feat: add document editor coordinator (#4237)
* feat: add document editor coordinator

Select the highest-priority available editor and open Collabora documents using generated rich-document URLs.

Signed-off-by: Marino Faggiana <[email protected]>

* feat: support text and EuroOffice document editors

Signed-off-by: Marino Faggiana <[email protected]>

* refactor: centralize document editor selection

Signed-off-by: Marino Faggiana <[email protected]>

* refactor: migrate to renamed editor capabilities API

Signed-off-by: Marino Faggiana <[email protected]>

* fix: support OnlyOffice in document editor flows

Organize document creation actions by editor and use shared editor identifiers for capability detection.

Signed-off-by: Marino Faggiana <[email protected]>

* chore: bump build number and pin NextcloudKit 7.4.2

Signed-off-by: Marino Faggiana <[email protected]>

* chore: bump project build number to 3

Signed-off-by: Marino Faggiana <[email protected]>

---------

Signed-off-by: Marino Faggiana <[email protected]>
2026-08-08 09:16:35 +02:00
Nextcloud bot 3a997b480e fix(l10n): Update translations from Transifex
Signed-off-by: Nextcloud bot <[email protected]>
2026-08-08 03:28:57 +00:00
Marino Faggiana 5cc53050ea fix: initialize media data source before searching (#4234)
* fix: initialize media data source before searching

Signed-off-by: Marino Faggiana <[email protected]>

* fix: avoid redundant media collection reloads

Signed-off-by: Marino Faggiana <[email protected]>

* fix: force media reload after directory changes

Signed-off-by: Marino Faggiana <[email protected]>

---------

Signed-off-by: Marino Faggiana <[email protected]>
2026-08-07 07:58:54 +02:00
Nextcloud bot 16bbdca67e fix(l10n): Update translations from Transifex
Signed-off-by: Nextcloud bot <[email protected]>
2026-08-07 03:35:10 +00:00
Nextcloud bot 045429fd38 fix(l10n): Update translations from Transifex
Signed-off-by: Nextcloud bot <[email protected]>
2026-08-06 03:52:45 +00:00
Marino Faggiana d48b8418fc fix: prevent camera roll upload extraction races (#4227)
Use unique temporary paths and validate extracted assets before promoting them for upload.
Preserve auto-upload metadata when cancelled and construct upload paths safely.

Signed-off-by: Marino Faggiana <[email protected]>
2026-08-05 09:47:21 +02:00
Nextcloud bot 7aa5ac583f fix(l10n): Update translations from Transifex
Signed-off-by: Nextcloud bot <[email protected]>
2026-08-05 06:26:25 +00:00
Marino Faggiana b4332c7cc7 fix: store preferences in shared app group (#4226)
* fix: store preferences in shared app group

Migrate legacy preference values on first app launch while preserving existing shared values.

Signed-off-by: Marino Faggiana <[email protected]>

* feat: add account unavailable localization

Signed-off-by: Marino Faggiana <[email protected]>

---------

Signed-off-by: Marino Faggiana <[email protected]>
2026-08-05 08:22:46 +02:00
Nextcloud bot c85e7a63dc fix(l10n): Update translations from Transifex
Signed-off-by: Nextcloud bot <[email protected]>
2026-08-05 03:35:04 +00:00
Marino Faggiana 82634b52d6 fix: only convert camera roll compatibility formats to JPEG (#4223)
* fix: only convert camera roll compatibility formats to JPEG

Preserve animated and lossless image formats during auto upload and keep upload metadata filenames in sync.

Add coverage for native and compatibility filename handling.

Signed-off-by: Marino Faggiana <[email protected]>

* fix: preserve camera roll asset quality and format

Export current high-quality photo and video representations.
Preserve video containers and prefer rendered Live Photo resources.

Signed-off-by: Marino Faggiana <[email protected]>

* chore: bump app version to 34.1.2

Reset the project build number to 0.

Signed-off-by: Marino Faggiana <[email protected]>

---------

Signed-off-by: Marino Faggiana <[email protected]>
2026-08-04 10:35:16 +02:00
Marino Faggiana f0a250beeb feat: track server certificate trust status (#4222)
* feat: track server certificate trust status

Signed-off-by: Marino Faggiana <[email protected]>

* fix: download videos before playback with trusted certificates

Signed-off-by: Marino Faggiana <[email protected]>

* chore: bump project build number to 2

Signed-off-by: Marino Faggiana <[email protected]>

---------

Signed-off-by: Marino Faggiana <[email protected]>
2026-08-03 10:27:37 +02:00
Marino Faggiana d307ab5b2a fix: handle video playback startup failures
Add startup timeouts for AVPlayer and VLC playback, and report VLC failures when playback stops before starting.

Signed-off-by: Marino Faggiana <[email protected]>
2026-08-02 08:45:17 +02:00
Marino Faggiana ec55b04c5a Improve video playback loading and error recovery (#4218)
* fix: show loading state on video playback cover

Signed-off-by: Marino Faggiana <[email protected]>

* fix: handle video playback failures with retry

Signed-off-by: Marino Faggiana <[email protected]>

---------

Signed-off-by: Marino Faggiana <[email protected]>
2026-08-02 08:33:00 +02:00
Nextcloud bot be88ad96e1 fix(l10n): Update translations from Transifex
Signed-off-by: Nextcloud bot <[email protected]>
2026-08-02 03:18:02 +00:00
Marino Faggiana 4c4be4f57e Improve remote video playback reliability and VLC lifecycle handling (#4217)
* fix: wait for VLC shutdown before changing videos

Signed-off-by: Marino Faggiana <[email protected]>

* fix: prevent video playback probe from hanging

Use an async AVFoundation playability check with cancellation and an eight-second VLC fallback timeout.

Pass the user agent to video playback and bump the app version to 34.1.1.

Signed-off-by: Marino Faggiana <[email protected]>

* fix: recover from rejected VLC presentations

Reset playback launch state when presentation is rejected and add VLC presentation and playback diagnostics.

Signed-off-by: Marino Faggiana <[email protected]>

---------

Signed-off-by: Marino Faggiana <[email protected]>
2026-08-01 10:08:32 +02:00
Nextcloud bot 2f8f20297f fix(l10n): Update translations from Transifex
Signed-off-by: Nextcloud bot <[email protected]>
2026-08-01 03:25:52 +00:00
Marino Faggiana 0ddc684537 4211 media viewer title overflows right side upper buttons (#4216)
* fix: embed media viewer titles in navigation items

Signed-off-by: Marino Faggiana <[email protected]>

* chore: bump project build number to 6

Signed-off-by: Marino Faggiana <[email protected]>

---------

Signed-off-by: Marino Faggiana <[email protected]>
2026-07-31 07:23:27 +02:00
Nextcloud bot dc9db57529 fix(l10n): Update translations from Transifex
Signed-off-by: Nextcloud bot <[email protected]>
2026-07-31 03:24:11 +00:00
Marino Faggiana a7fa2a3097 perf: prefetch collection view images and avatars (#4215)
* perf: prefetch collection view images and avatars

Cache previews and avatars in memory to avoid repeated disk access and asynchronous image loading during cell configuration.

Signed-off-by: Marino Faggiana <[email protected]>

* fix: improve collection preview and avatar loading

Signed-off-by: Marino Faggiana <[email protected]>

* perf: reuse image preview availability check

Signed-off-by: Marino Faggiana <[email protected]>

* fix: load photo previews on cache miss

Signed-off-by: Marino Faggiana <[email protected]>

---------

Signed-off-by: Marino Faggiana <[email protected]>
2026-07-30 11:05:24 +02:00
Nextcloud bot 5da3a1c527 fix(l10n): Update translations from Transifex
Signed-off-by: Nextcloud bot <[email protected]>
2026-07-30 03:35:46 +00:00
Nextcloud bot c7bdc4d4aa fix(l10n): Update translations from Transifex
Signed-off-by: Nextcloud bot <[email protected]>
2026-07-29 15:36:49 +00:00
Marino Faggiana caff81156d chore: remove Play with VLC localization
Signed-off-by: Marino Faggiana <[email protected]>
2026-07-29 17:32:53 +02:00
Marino Faggiana 12c76849b8 refactor: remove navigation actions from video players (#4214)
Signed-off-by: Marino Faggiana <[email protected]>
2026-07-29 17:30:37 +02:00
Nextcloud bot eb2711a569 fix(l10n): Update translations from Transifex
Signed-off-by: Nextcloud bot <[email protected]>
2026-07-29 15:13:27 +00:00
Marino Faggiana d34c02a5f4 feat: add VLC playback options for videos (#4213)
* feat: add VLC playback options for videos

Allow switching individual videos to VLC and persisting that preference. Improve VLC replay and cleanup behavior.

Signed-off-by: Marino Faggiana <[email protected]>

* fix: handle VLC playback preference toggling

Retry playback with AVFoundation when disabling the per-video VLC preference and stop the controls timer when VLC shuts down.

Signed-off-by: Marino Faggiana <[email protected]>

* chore: bump project build number to 5

Signed-off-by: Marino Faggiana <[email protected]>

---------

Signed-off-by: Marino Faggiana <[email protected]>
2026-07-29 17:09:40 +02:00
Marino Faggiana 2e47a09845 perf(files): load file previews asynchronously (#4210)
* fix: disable interaction for media section headers

Signed-off-by: Marino Faggiana <[email protected]>

* fix: prevent stale previews in reused collection cells

Signed-off-by: Marino Faggiana <[email protected]>

* chore: bump project build number to 4

Signed-off-by: Marino Faggiana <[email protected]>

---------

Signed-off-by: Marino Faggiana <[email protected]>
2026-07-28 16:13:17 +02:00
Marino Faggiana 933b7ec44c cleaning 2026-07-27 16:55:13 +02:00
Marino Faggiana f92fd7e521 chore: bump project build number to 3 (#4208)
Signed-off-by: Marino Faggiana <[email protected]>
2026-07-27 12:20:03 +02:00
Marino Faggiana fe710979d9 refactor(media): move image cache window management into NCImageCache (#4207)
* fix: rerun media metadata backfill weekly

Resume interrupted cycles from the stored offset and skip completed cycles only until the weekly interval expires.

Signed-off-by: Marino Faggiana <[email protected]>

* refactor: simplify image cache usage

Load avatars directly from disk while continuing background refreshes, and remove redundant preview cache preloading and cleanup.

Signed-off-by: Marino Faggiana <[email protected]>

* refactor: split media delegates into extensions

Signed-off-by: Marino Faggiana <[email protected]>

* refactor: centralize media image cache window management

Move cache window state, loading, and invalidation into NCImageCache and precompute cache items in the media data source.

Signed-off-by: Marino Faggiana <[email protected]>

* refactor: isolate media window cache in an actor

Move media cache window state and loading into a dedicated actor to improve concurrency safety and remove main-actor restrictions.

Signed-off-by: Marino Faggiana <[email protected]>

---------

Signed-off-by: Marino Faggiana <[email protected]>
2026-07-27 11:36:03 +02:00
Nextcloud bot 12e0e52d7b fix(l10n): Update translations from Transifex
Signed-off-by: Nextcloud bot <[email protected]>
2026-07-27 03:20:21 +00:00
Nextcloud bot a05730a547 fix(l10n): Update translations from Transifex
Signed-off-by: Nextcloud bot <[email protected]>
2026-07-26 03:22:27 +00:00
Marino Faggiana bd6f12cfad Improve Media pinch-to-zoom navigation and preserve scroll position (#4206)
* Update NCMediaPinchGesture.swift

* Update project.pbxproj
2026-07-25 16:50:40 +02:00
Marino Faggiana 63172442b5 Fix UI media (#4204)
* fix: update media title after layout

Avoid clearing the media date while items are temporarily unavailable and bump the project build version.

Signed-off-by: Marino Faggiana <[email protected]>

* perf: avoid redundant media date title updates

Cache the visible media range and skip recalculating the navigation title when it has not changed.

Signed-off-by: Marino Faggiana <[email protected]>

* fix: prevent duplicate media image loading

Load media thumbnails with cancellable utility tasks and remove collection view prefetching. Reduce the in-memory image cache limit.

Signed-off-by: Marino Faggiana <[email protected]>

---------

Signed-off-by: Marino Faggiana <[email protected]>
2026-07-25 09:57:19 +02:00
Nextcloud bot f384e2961a fix(l10n): Update translations from Transifex
Signed-off-by: Nextcloud bot <[email protected]>
2026-07-25 03:49:57 +00:00
Nextcloud bot 2b7e64a861 fix(l10n): Update translations from Transifex
Signed-off-by: Nextcloud bot <[email protected]>
2026-07-24 10:49:34 +00:00
Nextcloud bot e8e2b43af0 fix(l10n): Update translations from Transifex
Signed-off-by: Nextcloud bot <[email protected]>
2026-07-24 10:41:34 +00:00
rakekniven 5342b2f871 chore(i18n): Removed "success" (#4202)
Follow our guidelines.

Signed-off-by: rakekniven <[email protected]>
2026-07-24 12:38:21 +02:00
Marino Faggiana 4d544a59a3 chore: bump app version to 34.1.0 (#4203)
Pin NextcloudKit to version 7.4.1.

Signed-off-by: Marino Faggiana <[email protected]>
2026-07-24 12:37:18 +02:00
Marino Faggiana fa7ca6b719 feat: prepare media date navigation by month (#4199)
* feat: prepare media date navigation by month

Replace the media date label with a button and index the first media item for each year and month.

Signed-off-by: Marino Faggiana <[email protected]>

* fix: improve media date button styling and gradient transition

Signed-off-by: Marino Faggiana <[email protected]>

* feat: add date picker navigation to media timeline

Signed-off-by: Marino Faggiana <[email protected]>

* fix: show visible date range in media header

Signed-off-by: Marino Faggiana <[email protected]>

* refactor: migrate media date picker to SwiftUI

Use a compact custom sheet and apply date selections as the picker changes.

Signed-off-by: Marino Faggiana <[email protected]>

* feat: add title to media date picker

Signed-off-by: Marino Faggiana <[email protected]>

* refactor: move media date range to navigation bar

Remove the media header gradient and activity indicator, and format the visible date range as a navigation bar item.

Signed-off-by: Marino Faggiana <[email protected]>

* fix: correct media collection layout calculations

Use safe column counts and collection view bounds, calculate content height across all columns, and rebuild accurate union and footer geometry.

Signed-off-by: Marino Faggiana <[email protected]>

* fix: improve media grid updates and viewer selection

Refresh the media layout when pinch gestures change column counts, use hydrated metadata for previews, and guard asynchronous viewer selection against reused cells.

Signed-off-by: Marino Faggiana <[email protected]>

* feat: group media into monthly sections

Add month and year section headers, update section-aware navigation and selection, and show media totals only in the final section footer.

Signed-off-by: Marino Faggiana <[email protected]>

* feat: add dedicated media section headers

Display month and year in a reusable media section header while preserving the existing empty-state header.

Signed-off-by: Marino Faggiana <[email protected]>

* fix: align media navigation with section headers

Increase section header spacing and add leading padding for clearer media grouping.

Signed-off-by: Marino Faggiana <[email protected]>

* fix: debounce and cancel stale media reloads

Guard media data loading against cancellation and inactive views, and build media sections more efficiently.

Signed-off-by: Marino Faggiana <[email protected]>

* perf: build media data source off the main actor

Revalidate the active media view before updating the collection view.

Signed-off-by: Marino Faggiana <[email protected]>

* perf: optimize media data source updates

Build compact metadata and sections in a single pass, and update affected sections directly when removing items.

Signed-off-by: Marino Faggiana <[email protected]>

* TEST

Signed-off-by: Marino Faggiana <[email protected]>

* fix: show media search activity in navigation bar

Signed-off-by: Marino Faggiana <[email protected]>

* fix: cancel stale media loading tasks

Prevent outdated search and data source tasks from updating the media view after cancellation or account changes.

Signed-off-by: Marino Faggiana <[email protected]>

* fix: cancel media tasks when view disappears

Avoid retaining the media controller in asynchronous tasks and load the data source directly after delegate registration.

Signed-off-by: Marino Faggiana <[email protected]>

* refactor: build media data source from compact metadata

Fetch and normalize compact media metadata directly from Realm, filtering Live Photo videos before constructing media sections.

Signed-off-by: Marino Faggiana <[email protected]>

* fix: reduce maximum grid columns

Increase the minimum item width for collection and media grids and simplify media placeholder sizing.

Signed-off-by: Marino Faggiana <[email protected]>

* fix: reload image cache when entering foreground

Use compact media metadata to rebuild the preview cache efficiently.

Signed-off-by: Marino Faggiana <[email protected]>

* fix: prevent image cache observer retain cycle

Ensure the cache loading flag is reset on every exit path.

Signed-off-by: Marino Faggiana <[email protected]>

* refactor: simplify image cache loading

Cache previews of all supported sizes and load media thumbnails asynchronously on demand.

Signed-off-by: Marino Faggiana <[email protected]>

* refactor: simplify image cache key handling

Centralize cache key creation, clarify the cache size setting, and safely capture the cache in lifecycle observers.

Signed-off-by: Marino Faggiana <[email protected]>

* refactor: remove redundant returns from image cache

Signed-off-by: Marino Faggiana <[email protected]>

* perf: preload media images around the visible range

Reset and rebuild the cache window when the layout, account, or media data changes.

Signed-off-by: Marino Faggiana <[email protected]>

* perf: skip repeated missing media cache reads

Track missing image keys within each cache session and clear them alongside the image cache. Add cache-window diagnostics for hits, disk reads, missing images, and cancellations.

Signed-off-by: Marino Faggiana <[email protected]>

* feat: overlay media section headers on content

Improve header readability with white text and a shadow, and clear reused header titles.

Signed-off-by: Marino Faggiana <[email protected]>

---------

Signed-off-by: Marino Faggiana <[email protected]>
2026-07-24 12:15:00 +02:00
Nextcloud bot 653c5b97e5 fix(l10n): Update translations from Transifex
Signed-off-by: Nextcloud bot <[email protected]>
2026-07-24 03:33:24 +00:00
Milen Pivchev d17d2d2a3e Bump to 34.0.0 (#4201)
Signed-off-by: Milen Pivchev <[email protected]>
2026-07-23 13:26:28 +02:00
Milen Pivchev 5e0f19171b feat: NC governance (#4152)
* WIP

Signed-off-by: Milen Pivchev <[email protected]>

* Use segmented tabs via swiftui

Signed-off-by: Milen Pivchev <[email protected]>

* Remove Parchment

Signed-off-by: Milen Pivchev <[email protected]>

* Remove Parchment

Signed-off-by: Milen Pivchev <[email protected]>

* Governance UI

Signed-off-by: Milen Pivchev <[email protected]>

* WIP

Signed-off-by: Milen Pivchev <[email protected]>

* WIP

Signed-off-by: Milen Pivchev <[email protected]>

* WIP

Signed-off-by: Milen Pivchev <[email protected]>

* WIP

Signed-off-by: Milen Pivchev <[email protected]>

* WIP

Signed-off-by: Milen Pivchev <[email protected]>

* WIP

Signed-off-by: Milen Pivchev <[email protected]>

* WIP

Signed-off-by: Milen Pivchev <[email protected]>

* WIP

Signed-off-by: Milen Pivchev <[email protected]>

* WIP

Signed-off-by: Milen Pivchev <[email protected]>

* WIP

Signed-off-by: Milen Pivchev <[email protected]>

* WIP

Signed-off-by: Milen Pivchev <[email protected]>

* WIP

Signed-off-by: Milen Pivchev <[email protected]>

* WIP

Signed-off-by: Milen Pivchev <[email protected]>

* refactor

Signed-off-by: Milen Pivchev <[email protected]>

* WIP

Signed-off-by: Milen Pivchev <[email protected]>

* WIP

Signed-off-by: Milen Pivchev <[email protected]>

* PR feedback

Signed-off-by: Milen Pivchev <[email protected]>

---------

Signed-off-by: Milen Pivchev <[email protected]>
2026-07-23 10:51:10 +00:00
Nextcloud bot ecf0fd92ad fix(l10n): Update translations from Transifex
Signed-off-by: Nextcloud bot <[email protected]>
2026-07-22 03:13:50 +00:00
Milen PivchevandMarino Faggiana 8c665a4fbd fix: plus button fixes (#4195)
* WIP

Signed-off-by: Milen Pivchev <[email protected]>

* fix: preserve plus button tint on account changes

Signed-off-by: Marino Faggiana <[email protected]>

* WIP

Signed-off-by: Milen Pivchev <[email protected]>

* WIP

Signed-off-by: Milen Pivchev <[email protected]>

* WIP

Signed-off-by: Milen Pivchev <[email protected]>

* Comment

Signed-off-by: Milen Pivchev <[email protected]>

* Refactor

Signed-off-by: Milen Pivchev <[email protected]>

---------

Signed-off-by: Milen Pivchev <[email protected]>
Signed-off-by: Marino Faggiana <[email protected]>
Co-authored-by: Marino Faggiana <[email protected]>
2026-07-21 16:27:22 +02:00
Marino Faggiana 0a82d58279 refactor: consolidate media metadata backfill processing (#4198)
* refactor: consolidate media metadata backfill processing

Signed-off-by: Marino Faggiana <[email protected]>

* docs: clarify media processing documentation

Signed-off-by: Marino Faggiana <[email protected]>

---------

Signed-off-by: Marino Faggiana <[email protected]>
2026-07-21 16:15:19 +02:00
Marino Faggiana 309f2c511d feat: persist media preview backfill failures (#4197)
* feat: persist media preview backfill failures

Add Realm-backed APIs to track and clear media preview backfill failures, and bump the database schema to version 413.

Signed-off-by: Marino Faggiana <[email protected]>

* refactor: split media background processing

Extract metadata backfill, placeholder hydration, and preview backfill into dedicated processors and organize processing and refresh sources.

Signed-off-by: Marino Faggiana <[email protected]>

* refactor: streamline media preview backfill processing

Select a limited batch of missing previews inside the processor and skip previously failed items. Simplify failure tracking and clear it when no previews remain or an account is removed.

Signed-off-by: Marino Faggiana <[email protected]>

* feat: run media preview backfill during app processing

Add dedicated logging for media preview backfill progress and completion.

Signed-off-by: Marino Faggiana <[email protected]>

* lint

Signed-off-by: Marino Faggiana <[email protected]>

* Update NCMediaPreviewBackfillProcessor.swift

* Update NCManageDatabase.swift

---------

Signed-off-by: Marino Faggiana <[email protected]>
2026-07-21 14:13:47 +02:00
Marino Faggiana 641b82cbc2 fix: constrain and truncate media viewer titles (#4196)
Update the app version to 33.1.3 and reset the project build number.

Signed-off-by: Marino Faggiana <[email protected]>
2026-07-21 08:00:48 +02:00
Milen PivchevandMarino Faggiana 0798a10d66 Liquid glass + button (#4191)
* WIP

Signed-off-by: Milen Pivchev <[email protected]>

* fix: preserve plus button tint on account changes

Signed-off-by: Marino Faggiana <[email protected]>

* WIP

Signed-off-by: Milen Pivchev <[email protected]>

---------

Signed-off-by: Milen Pivchev <[email protected]>
Signed-off-by: Marino Faggiana <[email protected]>
Co-authored-by: Marino Faggiana <[email protected]>
2026-07-21 07:51:18 +02:00
Nextcloud bot 159dd3b074 fix(l10n): Update translations from Transifex
Signed-off-by: Nextcloud bot <[email protected]>
2026-07-21 03:18:11 +00:00
Marino Faggiana 5013aa0587 Viewer title (#4194)
* fix: refine media viewer floating title sizing

Cap navigation item height and constrain Dynamic Type scaling for consistent title layout.

Signed-off-by: Marino Faggiana <[email protected]>

* UIGlassEffect

Signed-off-by: Marino Faggiana <[email protected]>

* fix: align media viewer title with navigation bar top

Signed-off-by: Marino Faggiana <[email protected]>

* chore: bump project build number to 3

Signed-off-by: Marino Faggiana <[email protected]>

* wip

Signed-off-by: Marino Faggiana <[email protected]>

---------

Signed-off-by: Marino Faggiana <[email protected]>
2026-07-20 09:48:36 +02:00
Nextcloud bot 1e74f7a8b1 fix(l10n): Update translations from Transifex
Signed-off-by: Nextcloud bot <[email protected]>
2026-07-19 03:16:07 +00:00
Marino Faggiana be8621ca27 Ios27 fix (#4192)
* fix: handle search dismissal and media callbacks

Signed-off-by: Marino Faggiana <[email protected]>

* chore: bump project build number to 2

Signed-off-by: Marino Faggiana <[email protected]>

* fix: keep plus button hidden during editing and search

Signed-off-by: Marino Faggiana <[email protected]>

---------

Signed-off-by: Marino Faggiana <[email protected]>
2026-07-18 07:50:39 +02:00
Nextcloud bot 271999ec08 fix(l10n): Update translations from Transifex
Signed-off-by: Nextcloud bot <[email protected]>
2026-07-18 03:14:04 +00:00
Nextcloud bot 7e53fffff2 fix(l10n): Update translations from Transifex
Signed-off-by: Nextcloud bot <[email protected]>
2026-07-17 05:30:18 +00:00
Marino Faggiana a44c07004e E2ee renew certificate (#4189)
* wip

Signed-off-by: Marino Faggiana <[email protected]>

* wip

Signed-off-by: Marino Faggiana <[email protected]>

* test

Signed-off-by: Marino Faggiana <[email protected]>

* wip

Signed-off-by: Marino Faggiana <[email protected]>

* wip

Signed-off-by: Marino Faggiana <[email protected]>

* X509_set_issuer_name(x509, name)

Signed-off-by: Marino Faggiana <[email protected]>

* X509_set_issuer_name(x509, name)

Signed-off-by: Marino Faggiana <[email protected]>

* wip

Signed-off-by: Marino Faggiana <[email protected]>

* wip

Signed-off-by: Marino Faggiana <[email protected]>

---------

Signed-off-by: Marino Faggiana <[email protected]>
2026-07-17 07:06:57 +02:00
Nextcloud bot c009702ced fix(l10n): Update translations from Transifex
Signed-off-by: Nextcloud bot <[email protected]>
2026-07-17 03:11:48 +00:00
Marino Faggiana abeaa0bea2 Title Appearance (#4187)
* fix

Signed-off-by: Marino Faggiana <[email protected]>

* fix

Signed-off-by: Marino Faggiana <[email protected]>

* wip

Signed-off-by: Marino Faggiana <[email protected]>

---------

Signed-off-by: Marino Faggiana <[email protected]>
2026-07-16 08:35:57 +02:00
Marino Faggiana aaae403c46 4181 swiping down any amount closes image preview even when zoomed in (#4184)
* added onZoomChanged

Signed-off-by: Marino Faggiana <[email protected]>

* improvements

Signed-off-by: Marino Faggiana <[email protected]>

* fix Live in thumbnail

Signed-off-by: Marino Faggiana <[email protected]>

---------

Signed-off-by: Marino Faggiana <[email protected]>
2026-07-16 07:12:17 +02:00
Nextcloud bot 07e68c0cb4 fix(l10n): Update translations from Transifex
Signed-off-by: Nextcloud bot <[email protected]>
2026-07-16 03:09:11 +00:00
Milen Pivchev 9246e70820 Rerequest push notifications (#4174)
* WIP

Signed-off-by: Milen Pivchev <[email protected]>

* WIP

Signed-off-by: Milen Pivchev <[email protected]>

* Refactor

Signed-off-by: Milen Pivchev <[email protected]>

---------

Signed-off-by: Milen Pivchev <[email protected]>
2026-07-15 16:58:08 +02:00
Nextcloud bot 9ca02722ef fix(l10n): Update translations from Transifex
Signed-off-by: Nextcloud bot <[email protected]>
2026-07-15 07:31:45 +00:00
Nextcloud bot be626864b1 fix(l10n): Update translations from Transifex
Signed-off-by: Nextcloud bot <[email protected]>
2026-07-15 07:23:27 +00:00
Marino Faggiana 1a42c12abc E2EE: key checksum failed (#4182)
* checksum missing

Signed-off-by: Marino Faggiana <[email protected]>

* wip

Signed-off-by: Marino Faggiana <[email protected]>

* wip

* refactor

Signed-off-by: Marino Faggiana <[email protected]>

* new version

Signed-off-by: Marino Faggiana <[email protected]>

---------

Signed-off-by: Marino Faggiana <[email protected]>
2026-07-15 09:18:39 +02:00
Nextcloud bot 26d517e0cb fix(l10n): Update translations from Transifex
Signed-off-by: Nextcloud bot <[email protected]>
2026-07-15 03:24:03 +00:00
Marino Faggiana 96676a00cb App Processing - V 33.1.1 (#4179)
* wip

Signed-off-by: Marino Faggiana <[email protected]>

* cleanUpAsync

Signed-off-by: Marino Faggiana <[email protected]>

* wip

Signed-off-by: Marino Faggiana <[email protected]>

* build 1 test

Signed-off-by: Marino Faggiana <[email protected]>

* wip

Signed-off-by: Marino Faggiana <[email protected]>

* Clear stale server-unavailable (503) state from the previous app session

Signed-off-by: Marino Faggiana <[email protected]>

* fix

Signed-off-by: Marino Faggiana <[email protected]>

* wip

Signed-off-by: Marino Faggiana <[email protected]>

* wip

Signed-off-by: Marino Faggiana <[email protected]>

* Build 2

Signed-off-by: Marino Faggiana <[email protected]>

* wip

Signed-off-by: Marino Faggiana <[email protected]>

* LOG

Signed-off-by: Marino Faggiana <[email protected]>

* fix hydrate

Signed-off-by: Marino Faggiana <[email protected]>

---------

Signed-off-by: Marino Faggiana <[email protected]>
2026-07-14 09:31:37 +02:00
Marino Faggiana ab96482dca fix (#4177)
* fix

Signed-off-by: Marino Faggiana <[email protected]>

* b 9

Signed-off-by: Marino Faggiana <[email protected]>

---------

Signed-off-by: Marino Faggiana <[email protected]>
2026-07-10 07:42:47 +02:00
Nextcloud bot b159dd9aff fix(l10n): Update translations from Transifex
Signed-off-by: Nextcloud bot <[email protected]>
2026-07-10 03:12:54 +00:00
Marino Faggiana 8bf4f70481 fix crash
Signed-off-by: Marino Faggiana <[email protected]>
2026-07-09 10:52:24 +02:00
Marino Faggiana e7aac49d4b Improvements varie (#4175)
* wip

Signed-off-by: Marino Faggiana <[email protected]>

* improved synchronizationDownload

Signed-off-by: Marino Faggiana <[email protected]>

* rename

Signed-off-by: Marino Faggiana <[email protected]>

* rename

Signed-off-by: Marino Faggiana <[email protected]>

* added NCMetadataDownloadTranfersSuccess

Signed-off-by: Marino Faggiana <[email protected]>

* improvements

Signed-off-by: Marino Faggiana <[email protected]>

---------

Signed-off-by: Marino Faggiana <[email protected]>
2026-07-09 10:39:06 +02:00
Marino Faggiana 963ba65aaa WIP (#4171)
Signed-off-by: Marino Faggiana <[email protected]>
2026-07-09 07:11:42 +02:00
Marino Faggiana 7bcd4d2e8c UI window scene (#4172)
* resolvedWindow

Signed-off-by: Marino Faggiana <[email protected]>

* wip

Signed-off-by: Marino Faggiana <[email protected]>

* fix

Signed-off-by: Marino Faggiana <[email protected]>

---------

Signed-off-by: Marino Faggiana <[email protected]>
2026-07-09 07:11:01 +02:00
Nextcloud bot d53569bea3 fix(l10n): Update translations from Transifex
Signed-off-by: Nextcloud bot <[email protected]>
2026-07-09 03:12:51 +00:00
Marino Faggiana 0933747068 Processing task Media (#4169)
* tableMediaMetadataBackfill

Signed-off-by: Marino Faggiana <[email protected]>

* wip

Signed-off-by: Marino Faggiana <[email protected]>

* wip

Signed-off-by: Marino Faggiana <[email protected]>

* wip

Signed-off-by: Marino Faggiana <[email protected]>

* wip

Signed-off-by: Marino Faggiana <[email protected]>

* wip

Signed-off-by: Marino Faggiana <[email protected]>

* wip

Signed-off-by: Marino Faggiana <[email protected]>

* wip

Signed-off-by: Marino Faggiana <[email protected]>

* wip

* Stops the backfill when the media archive has already been fully processed

Signed-off-by: Marino Faggiana <[email protected]>

* Retrieves and stores complete metadata when the media record is a placeholder.

Signed-off-by: Marino Faggiana <[email protected]>

* runMediaMetadataPlaceholderHydration

Signed-off-by: Marino Faggiana <[email protected]>

* wip

Signed-off-by: Marino Faggiana <[email protected]>

* wip

Signed-off-by: Marino Faggiana <[email protected]>

* wip

* Update AppDelegate+AppProcessing.swift

* Update AppDelegate+AppProcessing.swift

* Update NCSettingsView.swift

* wip

* Update AppDelegate+AppProcessing.swift

* limit

Signed-off-by: Marino Faggiana <[email protected]>

* code

Signed-off-by: Marino Faggiana <[email protected]>

* wip

Signed-off-by: Marino Faggiana <[email protected]>

* wip

Signed-off-by: Marino Faggiana <[email protected]>

* wip

Signed-off-by: Marino Faggiana <[email protected]>

* cleaning

Signed-off-by: Marino Faggiana <[email protected]>

* cleaning

Signed-off-by: Marino Faggiana <[email protected]>

* fix log

Signed-off-by: Marino Faggiana <[email protected]>

---------

Signed-off-by: Marino Faggiana <[email protected]>
2026-07-08 11:23:51 +02:00
Nextcloud bot 9304f1b1f4 fix(l10n): Update translations from Transifex
Signed-off-by: Nextcloud bot <[email protected]>
2026-07-08 03:09:48 +00:00
Marino Faggiana e770287f8a fix thumbnail (#4168)
* fix

Signed-off-by: Marino Faggiana <[email protected]>

* fix

Signed-off-by: Marino Faggiana <[email protected]>

* fix

Signed-off-by: Marino Faggiana <[email protected]>

* wip

Signed-off-by: Marino Faggiana <[email protected]>

* Media -> added metadata-files-live-photo

Signed-off-by: Marino Faggiana <[email protected]>

---------

Signed-off-by: Marino Faggiana <[email protected]>
2026-07-06 08:01:31 +02:00
Nextcloud bot 892fe1de6d fix(l10n): Update translations from Transifex
Signed-off-by: Nextcloud bot <[email protected]>
2026-07-06 03:08:16 +00:00
Marino Faggiana ca4cc0a308 Audio fix (#4167)
* fix

Signed-off-by: Marino Faggiana <[email protected]>

* wip

Signed-off-by: Marino Faggiana <[email protected]>

* wip

Signed-off-by: Marino Faggiana <[email protected]>

* wip

Signed-off-by: Marino Faggiana <[email protected]>

* wip

Signed-off-by: Marino Faggiana <[email protected]>

* wip

Signed-off-by: Marino Faggiana <[email protected]>

* verifyZombie

Signed-off-by: Marino Faggiana <[email protected]>

* added ProcessInfo.processInfo.thermalState

Signed-off-by: Marino Faggiana <[email protected]>

* clean

Signed-off-by: Marino Faggiana <[email protected]>

* build 7

Signed-off-by: Marino Faggiana <[email protected]>

* clean

Signed-off-by: Marino Faggiana <[email protected]>

* fix

Signed-off-by: Marino Faggiana <[email protected]>

* fix

Signed-off-by: Marino Faggiana <[email protected]>

* fix

Signed-off-by: Marino Faggiana <[email protected]>

* fix

Signed-off-by: Marino Faggiana <[email protected]>

* fix

Signed-off-by: Marino Faggiana <[email protected]>

* fix

Signed-off-by: Marino Faggiana <[email protected]>

* imagePlaceholderView

Signed-off-by: Marino Faggiana <[email protected]>

* fix

Signed-off-by: Marino Faggiana <[email protected]>

---------

Signed-off-by: Marino Faggiana <[email protected]>
2026-07-05 11:13:20 +02:00
Nextcloud bot 4b35496fcf fix(l10n): Update translations from Transifex
Signed-off-by: Nextcloud bot <[email protected]>
2026-07-05 03:06:49 +00:00
Marino Faggiana 7955f412e1 Recommendations improved (#4166)
* wip

Signed-off-by: Marino Faggiana <[email protected]>

* wip

Signed-off-by: Marino Faggiana <[email protected]>

* cleaning

Signed-off-by: Marino Faggiana <[email protected]>

* added recommendationsIdentity

Signed-off-by: Marino Faggiana <[email protected]>

---------

Signed-off-by: Marino Faggiana <[email protected]>
2026-07-04 07:10:50 +02:00
Nextcloud bot 303a431118 fix(l10n): Update translations from Transifex
Signed-off-by: Nextcloud bot <[email protected]>
2026-07-04 03:09:14 +00:00
Marino Faggiana 7fe29ea822 Fix UI (#4165)
* wip

Signed-off-by: Marino Faggiana <[email protected]>

* fix

Signed-off-by: Marino Faggiana <[email protected]>

* EU capabilities

Signed-off-by: Marino Faggiana <[email protected]>

---------

Signed-off-by: Marino Faggiana <[email protected]>
2026-07-03 08:41:55 +02:00
Nextcloud bot 3e54ebbcb0 fix(l10n): Update translations from Transifex
Signed-off-by: Nextcloud bot <[email protected]>
2026-07-03 03:09:17 +00:00
Marino Faggiana 821f1b6c5a Move Close Save Cancel button to image (#4164)
* fix doc

Signed-off-by: Marino Faggiana <[email protected]>

* replace with X

Signed-off-by: Marino Faggiana <[email protected]>

* replace X

Signed-off-by: Marino Faggiana <[email protected]>

* Button X

Signed-off-by: Marino Faggiana <[email protected]>

* change button type

Signed-off-by: Marino Faggiana <[email protected]>

* build 6

Signed-off-by: Marino Faggiana <[email protected]>

---------

Signed-off-by: Marino Faggiana <[email protected]>
2026-07-02 15:53:23 +02:00
Marino Faggiana b93034677e New build (#4163)
* code

Signed-off-by: Marino Faggiana <[email protected]>

* build 5

Signed-off-by: Marino Faggiana <[email protected]>

---------

Signed-off-by: Marino Faggiana <[email protected]>
2026-07-02 11:44:40 +02:00
Marino Faggiana b58cc428cf wip (#4162)
Signed-off-by: Marino Faggiana <[email protected]>
2026-07-02 10:11:13 +02:00
Marino Faggiana 28b35ed556 download Avatar improvements (#4161)
* wip

Signed-off-by: Marino Faggiana <[email protected]>

* wip

Signed-off-by: Marino Faggiana <[email protected]>

* wip

Signed-off-by: Marino Faggiana <[email protected]>

* WIP

Signed-off-by: Marino Faggiana <[email protected]>

* WIP

Signed-off-by: Marino Faggiana <[email protected]>

* wip

Signed-off-by: Marino Faggiana <[email protected]>

* WIP

Signed-off-by: Marino Faggiana <[email protected]>

---------

Signed-off-by: Marino Faggiana <[email protected]>
2026-07-02 09:35:37 +02:00
Nextcloud bot 1a958730df fix(l10n): Update translations from Transifex
Signed-off-by: Nextcloud bot <[email protected]>
2026-07-02 03:11:15 +00:00
Marino Faggiana 53682a6d81 menu-fix (#4160)
* wip

Signed-off-by: Marino Faggiana <[email protected]>

* clean

Signed-off-by: Marino Faggiana <[email protected]>

---------

Signed-off-by: Marino Faggiana <[email protected]>
2026-07-01 16:07:22 +02:00
Marino Faggiana ec5bf46318 Direct editing (#4159)
* fix

Signed-off-by: Marino Faggiana <[email protected]>

* wip

Signed-off-by: Marino Faggiana <[email protected]>

* hide goback + fix

Signed-off-by: Marino Faggiana <[email protected]>

* test

Signed-off-by: Marino Faggiana <[email protected]>

---------

Signed-off-by: Marino Faggiana <[email protected]>
2026-07-01 11:50:39 +02:00
Nextcloud bot f2c3986498 fix(l10n): Update translations from Transifex
Signed-off-by: Nextcloud bot <[email protected]>
2026-07-01 03:07:47 +00:00
Nextcloud bot 00c3dc0ab7 fix(l10n): Update translations from Transifex
Signed-off-by: Nextcloud bot <[email protected]>
2026-06-30 13:45:19 +00:00
Nextcloud bot 6f36ce7737 fix(l10n): Update translations from Transifex
Signed-off-by: Nextcloud bot <[email protected]>
2026-06-30 13:38:29 +00:00
Marino Faggiana 4a040f9e03 Open in office / Menu (#4153)
* plus menu displayInline

Signed-off-by: Marino Faggiana <[email protected]>

* plus menu

Signed-off-by: Marino Faggiana <[email protected]>

* new plus menu

Signed-off-by: Marino Faggiana <[email protected]>

* wip

Signed-off-by: Marino Faggiana <[email protected]>

* menu

Signed-off-by: Marino Faggiana <[email protected]>

* create wip

Signed-off-by: Marino Faggiana <[email protected]>

* getViewerController

Signed-off-by: Marino Faggiana <[email protected]>

* wip

Signed-off-by: Marino Faggiana <[email protected]>

---------

Signed-off-by: Marino Faggiana <[email protected]>
2026-06-30 15:34:20 +02:00
Nextcloud bot fdd93ca520 fix(l10n): Update translations from Transifex
Signed-off-by: Nextcloud bot <[email protected]>
2026-06-30 03:13:12 +00:00
Nextcloud bot e99bb65703 fix(l10n): Update translations from Transifex
Signed-off-by: Nextcloud bot <[email protected]>
2026-06-29 10:07:22 +00:00
Nextcloud bot 774be28b22 fix(l10n): Update translations from Transifex
Signed-off-by: Nextcloud bot <[email protected]>
2026-06-29 09:50:55 +00:00
Marino Faggiana f1a1481351 ImageCache (#4151)
* wip

Signed-off-by: Marino Faggiana <[email protected]>

* build 4

Signed-off-by: Marino Faggiana <[email protected]>

* restore focused auto upload

Signed-off-by: Marino Faggiana <[email protected]>

* remove old code

Signed-off-by: Marino Faggiana <[email protected]>

---------

Signed-off-by: Marino Faggiana <[email protected]>
2026-06-29 11:38:08 +02:00
Nextcloud bot 53e0adea34 fix(l10n): Update translations from Transifex
Signed-off-by: Nextcloud bot <[email protected]>
2026-06-29 03:10:41 +00:00
Nextcloud bot 4dafa55cb6 fix(l10n): Update translations from Transifex
Signed-off-by: Nextcloud bot <[email protected]>
2026-06-28 03:11:22 +00:00
Nextcloud bot 4d55f77f5e fix(l10n): Update translations from Transifex
Signed-off-by: Nextcloud bot <[email protected]>
2026-06-27 03:08:02 +00:00
Marino Faggiana 2af165bed1 Transfers view (#4148)
* wip

Signed-off-by: Marino Faggiana <[email protected]>

* wip

Signed-off-by: Marino Faggiana <[email protected]>

* new label

Signed-off-by: Marino Faggiana <[email protected]>

* wip

Signed-off-by: Marino Faggiana <[email protected]>

* build 3

Signed-off-by: Marino Faggiana <[email protected]>

---------

Signed-off-by: Marino Faggiana <[email protected]>
2026-06-26 14:34:23 +02:00
Rasmussw 198a2f0b32 Add in-app camera with direct upload to Nextcloud (#4058)
* feat(camera): add in-app camera with direct upload to Nextcloud

Introduces a custom AVFoundation camera that captures photos and videos
and uploads them directly to Nextcloud without saving to the device
camera roll by default.

- Custom camera UI: shutter, flash, flip, mode selector (photo/video)
- Pinch-to-zoom from 0.5x (ultra-wide) to 10x with live zoom label
- Virtual multi-camera support (triple/dual-wide) for sub-1x zoom
- Recording timer with red dot, screen stays on during video recording
- App backgrounding gracefully stops recording in progress
- Review screen after capture: retake or use, inline video playback
- "Save to camera roll" opt-in toggle per session (off by default)
- Global default for toggle in Settings -> Advanced
- Filenames follow Nextcloud conventions via createFileName(),
  including "Maintain original filename" mode (IMG_XXXX.JPG)
- Videos saved as .mov (QuickTime) matching Apple native camera format
- Restored live photo upload logic: livePhotoFile and nativeFormat
  were inadvertently removed in a previous refactor
- Fix: PHAuthorizationStatus.limited now correctly treated as authorized
- Fix: NCViewerQuickLookView crash when asset is nil after model change

Signed-off-by: Rasmus Wøldike <[email protected]>

Signed-off-by: Rasmus Wøldike <[email protected]>

* fix: remove reference to non-existent e2eeCompatibleVersions

Signed-off-by: Rasmus Wøldike <[email protected]>

Signed-off-by: Rasmus Wøldike <[email protected]>

* refactor(camera): simplify to UIImagePickerController delegate approach

Replace custom AVFoundation camera with UIImagePickerController by
intercepting TLPhotoPicker's camera presentation and injecting
customPhotoPickerViewController as delegate. Media is captured to a
temp file and passed directly to the upload flow without saving to
camera roll. Fixes iPad camera support.

Signed-off-by: Rasmus Wøldike <[email protected]>
Signed-off-by: Rasmus Wøldike <[email protected]>

Signed-off-by: Rasmus Wøldike <[email protected]>

* feat: apply brand icon colors and adjust navigation bar for iOS 26

Signed-off-by: Rasmus Wøldike <[email protected]>

Signed-off-by: Rasmus Wøldike <[email protected]>

* fix: use TLPhotoPicker didCaptureMediaURL and clean up strings

- Use didCaptureMediaURL from TLPhotoPicker 2.1.21 with correct
  filename convention via createFileName
- Remove unused strings (_retake_, _use_photo_, _use_video_)
- Fix autoMkcol version check to use isServerVersion
- Remove duplicate function declarations from merge

Signed-off-by: Rasmus Wøldike <[email protected]>

* fix: restore Localizable.strings to upstream baseline with camera strings

Only add _save_to_camera_roll_ and _save_to_camera_roll_desc_ strings.
All other strings from upstream master are preserved.

Signed-off-by: Rasmus Wøldike <[email protected]>

---------

Signed-off-by: Rasmus Wøldike <[email protected]>
2026-06-26 07:58:00 +02:00
Nextcloud bot 0800900271 fix(l10n): Update translations from Transifex
Signed-off-by: Nextcloud bot <[email protected]>
2026-06-26 03:08:23 +00:00
Marino Faggiana e7477225c1 E2ee new func (#4146)
* wip

Signed-off-by: Marino Faggiana <[email protected]>

* nckit main

Signed-off-by: Marino Faggiana <[email protected]>

---------

Signed-off-by: Marino Faggiana <[email protected]>
2026-06-25 16:29:15 +02:00
Marino Faggiana 96337feb27 fix (#4144)
Signed-off-by: Marino Faggiana <[email protected]>
2026-06-25 07:26:04 +02:00
Nextcloud bot fc2642a432 fix(l10n): Update translations from Transifex
Signed-off-by: Nextcloud bot <[email protected]>
2026-06-25 03:10:10 +00:00
Marino Faggiana f4aec3c690 New build (#4143)
* build 1

Signed-off-by: Marino Faggiana <[email protected]>

* NCMediaViewerDownloadTaskRegistry

Signed-off-by: Marino Faggiana <[email protected]>

* build 2

Signed-off-by: Marino Faggiana <[email protected]>

* fix version setup e2ee

Signed-off-by: Marino Faggiana <[email protected]>

---------

Signed-off-by: Marino Faggiana <[email protected]>
2026-06-24 18:54:01 +02:00
Nextcloud bot c71874eb30 fix(l10n): Update translations from Transifex
Signed-off-by: Nextcloud bot <[email protected]>
2026-06-24 03:35:09 +00:00
Marino Faggiana 73cb67a763 new-version (#4142)
* new v

Signed-off-by: Marino Faggiana <[email protected]>

* Activity

Signed-off-by: Marino Faggiana <[email protected]>

* NCTransferCoordinator

Signed-off-by: Marino Faggiana <[email protected]>

* cleaning

Signed-off-by: Marino Faggiana <[email protected]>

* cleaning

Signed-off-by: Marino Faggiana <[email protected]>

* cleaning

Signed-off-by: Marino Faggiana <[email protected]>

---------

Signed-off-by: Marino Faggiana <[email protected]>
2026-06-23 10:36:49 +02:00
Marino Faggiana e9103a1b3b media-viewer (#4118)
* Refactor media viewer comments

Signed-off-by: Marino Faggiana <[email protected]>
2026-06-23 07:04:54 +02:00
Nextcloud bot c31f400a49 fix(l10n): Update translations from Transifex
Signed-off-by: Nextcloud bot <[email protected]>
2026-06-22 03:11:57 +00:00
Marino Faggiana 6bc597dbbf errata branch !
Signed-off-by: Marino Faggiana <[email protected]>
2026-06-21 15:11:31 +02:00
Marino Faggiana ba55ce8e4e cleaning
Signed-off-by: Marino Faggiana <[email protected]>
2026-06-21 15:05:06 +02:00
Marino Faggiana 0cce33aedd ReloadDataKeepingPosition
Signed-off-by: Marino Faggiana <[email protected]>
2026-06-21 14:56:06 +02:00
Marino Faggiana 857a75d4af version (#4141)
Signed-off-by: Marino Faggiana <[email protected]>
2026-06-20 12:03:54 +02:00
Nextcloud bot d1df066ff3 fix(l10n): Update translations from Transifex
Signed-off-by: Nextcloud bot <[email protected]>
2026-06-19 06:04:27 +00:00
Nextcloud bot 641ef49407 fix(l10n): Update translations from Transifex
Signed-off-by: Nextcloud bot <[email protected]>
2026-06-18 03:14:12 +00:00
Marino Faggiana 3fe3a8d143 Improved (#4139)
* wip

Signed-off-by: Marino Faggiana <[email protected]>

* wip

Signed-off-by: Marino Faggiana <[email protected]>

* Update NCViewerQuickLook.swift

* wip

Signed-off-by: Marino Faggiana <[email protected]>

* wip

Signed-off-by: Marino Faggiana <[email protected]>

---------

Signed-off-by: Marino Faggiana <[email protected]>
2026-06-17 08:42:45 +02:00
Nextcloud bot fb01b1e74b fix(l10n): Update translations from Transifex
Signed-off-by: Nextcloud bot <[email protected]>
2026-06-17 03:07:02 +00:00
Milen Pivchev dba02f5db9 Rename target
Signed-off-by: Milen Pivchev <[email protected]>
2026-06-16 18:48:32 +02:00
Marino Faggiana 0f98682f46 Fix duplicate AutoUpload WiFi (#4137)
* cod

Signed-off-by: Marino Faggiana <[email protected]>

* cod

Signed-off-by: Marino Faggiana <[email protected]>

* build 1

Signed-off-by: Marino Faggiana <[email protected]>

---------

Signed-off-by: Marino Faggiana <[email protected]>
2026-06-15 11:17:22 +02:00
Milen Pivchevandcopilot-swe-agent[bot] 19c1c03c2c Fix unwanted gesture back action (#4135)
* Fix

Signed-off-by: Milen Pivchev <[email protected]>

* Fix 2

Signed-off-by: Milen Pivchev <[email protected]>

* WIP

Signed-off-by: Milen Pivchev <[email protected]>

* WIP

Signed-off-by: Milen Pivchev <[email protected]>

* Fix CI: remove APCu memcache config causing occ command failures

---------

Signed-off-by: Milen Pivchev <[email protected]>
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
2026-06-15 10:55:42 +02:00
Nextcloud bot 91dd8753af fix(l10n): Update translations from Transifex
Signed-off-by: Nextcloud bot <[email protected]>
2026-06-13 03:10:40 +00:00
Milen Pivchev 78cb027065 Settings fixes
commit e3aa423883244540e0de678384559b3e9020ccc4
Author: Milen Pivchev <[email protected]>
Date:   Fri Jun 12 12:43:35 2026 +0200

    WIP

    Signed-off-by: Milen Pivchev <[email protected]>

commit 4b52220fe115053b55d280329ee76996aace426b
Author: Milen Pivchev <[email protected]>
Date:   Fri Jun 12 11:48:47 2026 +0200

    WIP

    Signed-off-by: Milen Pivchev <[email protected]>

commit bd9a13d02f4c1f8c07fc8943112701e49b62a883
Author: Milen Pivchev <[email protected]>
Date:   Fri Jun 12 11:23:30 2026 +0200

    WIP

    Signed-off-by: Milen Pivchev <[email protected]>

Signed-off-by: Milen Pivchev <[email protected]>
2026-06-12 12:44:44 +02:00
Nextcloud bot 2b30f0bbd6 fix(l10n): Update translations from Transifex
Signed-off-by: Nextcloud bot <[email protected]>
2026-06-12 03:32:30 +00:00
Nextcloud bot bde1361e0d fix(l10n): Update translations from Transifex
Signed-off-by: Nextcloud bot <[email protected]>
2026-06-11 03:09:12 +00:00
Nextcloud bot fea04392ef fix(l10n): Update translations from Transifex
Signed-off-by: Nextcloud bot <[email protected]>
2026-06-10 03:05:23 +00:00
Nextcloud bot 416dda67b0 fix(l10n): Update translations from Transifex
Signed-off-by: Nextcloud bot <[email protected]>
2026-06-09 03:06:24 +00:00
Milen Pivchev 2dc375c71c Small refactor
Signed-off-by: Milen Pivchev <[email protected]>
2026-06-08 10:48:02 +02:00
Marino Faggiana 5c715fe263 fix (#4134)
Signed-off-by: Marino Faggiana <[email protected]>
2026-06-08 10:41:03 +02:00
Milen Pivchev c03755b672 Focused auto upload (#4096)
* WIP

Signed-off-by: Milen Pivchev <[email protected]>

* Animation

Signed-off-by: Milen Pivchev <[email protected]>

* WIP

Signed-off-by: Milen Pivchev <[email protected]>

* WIP

Signed-off-by: Milen Pivchev <[email protected]>

* WIP

Signed-off-by: Milen Pivchev <[email protected]>

* PR WIP

Signed-off-by: Milen Pivchev <[email protected]>

* WIP

Signed-off-by: Milen Pivchev <[email protected]>

* WIP

Signed-off-by: Milen Pivchev <[email protected]>

* WIP

Signed-off-by: Milen Pivchev <[email protected]>

* WIP

Signed-off-by: Milen Pivchev <[email protected]>

* WIP

Signed-off-by: Milen Pivchev <[email protected]>

* WIP

Signed-off-by: Milen Pivchev <[email protected]>

* Move to More

Signed-off-by: Milen Pivchev <[email protected]>

* Refactor

Signed-off-by: Milen Pivchev <[email protected]>

* WIP

Signed-off-by: Milen Pivchev <[email protected]>

* Use Form in NCMore

Signed-off-by: Milen Pivchev <[email protected]>

* Gradient

Signed-off-by: Milen Pivchev <[email protected]>

* WIP

Signed-off-by: Milen Pivchev <[email protected]>

* WIP

Signed-off-by: Milen Pivchev <[email protected]>

---------

Signed-off-by: Milen Pivchev <[email protected]>
2026-06-08 10:40:34 +02:00
Nextcloud bot 47d168dc9a fix(l10n): Update translations from Transifex
Signed-off-by: Nextcloud bot <[email protected]>
2026-06-08 03:09:23 +00:00
Marino Faggiana 5079c17d56 fix (#4129)
Signed-off-by: Marino Faggiana <[email protected]>
2026-06-06 08:48:30 +02:00
Marino Faggiana 94638b6e4a hidden-fix (#4131)
* error fix

Signed-off-by: Marino Faggiana <[email protected]>

* fix

Signed-off-by: Marino Faggiana <[email protected]>

---------

Signed-off-by: Marino Faggiana <[email protected]>
2026-06-05 09:13:09 +02:00
Milen PivchevandMarino Faggiana 6ad9fb0655 Read owner and permissions from PUT response on new file creation (#4105)
* WIP

Signed-off-by: Milen Pivchev <[email protected]>

* WIP

Signed-off-by: Milen Pivchev <[email protected]>

* WIP

Signed-off-by: Milen Pivchev <[email protected]>

* WIP

Signed-off-by: Milen Pivchev <[email protected]>

* Refactor

Signed-off-by: Milen Pivchev <[email protected]>

* Refactor

Signed-off-by: Milen Pivchev <[email protected]>

* Fix compile

Signed-off-by: Milen Pivchev <[email protected]>

* down

Signed-off-by: Marino Faggiana <[email protected]>

* prj

Signed-off-by: Marino Faggiana <[email protected]>

* up

Signed-off-by: Marino Faggiana <[email protected]>

* main

Signed-off-by: Marino Faggiana <[email protected]>

* varie

Signed-off-by: Marino Faggiana <[email protected]>

* dele

Signed-off-by: Marino Faggiana <[email protected]>

* delegate

Signed-off-by: Marino Faggiana <[email protected]>

* header2

Signed-off-by: Marino Faggiana <[email protected]>

* delegate

Signed-off-by: Marino Faggiana <[email protected]>

* nk main

Signed-off-by: Marino Faggiana <[email protected]>

* code cleaning

Signed-off-by: Marino Faggiana <[email protected]>

* ownerDisplayName

Signed-off-by: Marino Faggiana <[email protected]>

* ownerDisplayName

Signed-off-by: Marino Faggiana <[email protected]>

* lint

Signed-off-by: Marino Faggiana <[email protected]>

* fix query

Signed-off-by: Marino Faggiana <[email protected]>

* Refactor

Signed-off-by: Milen Pivchev <[email protected]>

---------

Signed-off-by: Milen Pivchev <[email protected]>
Signed-off-by: Marino Faggiana <[email protected]>
Co-authored-by: Marino Faggiana <[email protected]>
2026-06-03 14:29:47 +02:00
Nextcloud bot ac069c0002 fix(l10n): Update translations from Transifex
Signed-off-by: Nextcloud bot <[email protected]>
2026-06-03 03:58:16 +00:00
Nextcloud bot 22dea5430a fix(l10n): Update translations from Transifex
Signed-off-by: Nextcloud bot <[email protected]>
2026-06-01 03:08:10 +00:00
Nextcloud bot e9358fba93 fix(l10n): Update translations from Transifex
Signed-off-by: Nextcloud bot <[email protected]>
2026-05-31 03:05:50 +00:00
Nextcloud bot 913084ac91 fix(l10n): Update translations from Transifex
Signed-off-by: Nextcloud bot <[email protected]>
2026-05-30 03:06:04 +00:00
Marino Faggiana 3b3fb17f18 improvements (#4125)
* Harden Realm migration property access

Signed-off-by: Marino Faggiana <[email protected]>

* Banner for assistant not installed

Signed-off-by: Marino Faggiana <[email protected]>

---------

Signed-off-by: Marino Faggiana <[email protected]>
2026-05-29 14:22:55 +02:00
Blind Dev 9c64a7e976 Fix VoiceOver labels in share folder picker (#4111) 2026-05-28 13:23:30 +02:00
Marino Faggiana da5da2713c build 1 (#4119)
Signed-off-by: Marino Faggiana <[email protected]>
2026-05-27 06:54:15 +02:00
Laura Kramolis 8c0689bfa9 fix(AppIcon): Use app icon consistent with Talk (#4116)
Made by @yotamguttman

Signed-off-by: kramo <[email protected]>
2026-05-26 12:06:04 +02:00
Nextcloud bot a751848f7e fix(l10n): Update translations from Transifex
Signed-off-by: Nextcloud bot <[email protected]>
2026-05-26 04:13:04 +00:00
Nextcloud bot 1b043dca33 fix(l10n): Update translations from Transifex
Signed-off-by: Nextcloud bot <[email protected]>
2026-05-25 04:12:41 +00:00
Nextcloud bot eeac608cfc fix(l10n): Update translations from Transifex
Signed-off-by: Nextcloud bot <[email protected]>
2026-05-24 10:51:55 +00:00
Nextcloud bot 105667b1b2 fix(l10n): Update translations from Transifex
Signed-off-by: Nextcloud bot <[email protected]>
2026-05-23 11:15:56 +00:00
Marino Faggiana 86157201af Version 33.0.9
Signed-off-by: Marino Faggiana <[email protected]>
2026-05-22 16:38:53 +02:00
Marino Faggiana 1f1ba2efc5 Merge branch 'master' of https://github.com/nextcloud/ios
Signed-off-by: Marino Faggiana <[email protected]>
2026-05-22 16:35:39 +02:00
Marino Faggiana 647525919b new version
Signed-off-by: Marino Faggiana <[email protected]>
2026-05-22 16:33:30 +02:00
Marino Faggiana 48c8db13dc new build 3 (#4117)
* build 3

Signed-off-by: Marino Faggiana <[email protected]>

* text only

Signed-off-by: Marino Faggiana <[email protected]>

---------

Signed-off-by: Marino Faggiana <[email protected]>
2026-05-22 16:23:56 +02:00
Nextcloud bot fa73f5d521 fix(l10n): Update translations from Transifex
Signed-off-by: Nextcloud bot <[email protected]>
2026-05-22 03:45:59 +00:00
Marino Faggiana dbeda64e38 Transfer counter (#4115)
* counter badge

Signed-off-by: Marino Faggiana <[email protected]>

* counter

Signed-off-by: Marino Faggiana <[email protected]>

---------

Signed-off-by: Marino Faggiana <[email protected]>
2026-05-21 15:57:28 +02:00
Marino Faggiana 390d898806 icon() size (#4113)
* icon size to 21

Signed-off-by: Marino Faggiana <[email protected]>

* icon size fix

Signed-off-by: Marino Faggiana <[email protected]>

---------

Signed-off-by: Marino Faggiana <[email protected]>
2026-05-21 11:15:36 +02:00
Nextcloud bot fef419abac fix(l10n): Update translations from Transifex
Signed-off-by: Nextcloud bot <[email protected]>
2026-05-18 03:06:13 +00:00
Nextcloud bot 03caa6211f fix(l10n): Update translations from Transifex
Signed-off-by: Nextcloud bot <[email protected]>
2026-05-17 03:07:44 +00:00
Milen Pivchev cb7e4b95dc Add OAEP notification encryption (#4103)
* Add OAEP notification decryption

Signed-off-by: Milen Pivchev <[email protected]>

* Flip paddings

Signed-off-by: Milen Pivchev <[email protected]>

---------

Signed-off-by: Milen Pivchev <[email protected]>
2026-05-15 17:15:01 +02:00
Marino Faggiana bcac98a989 ability to directly share selected text to assistant (#4107)
* cod

Signed-off-by: Marino Faggiana <[email protected]>

* cod

Signed-off-by: Marino Faggiana <[email protected]>

* code

Signed-off-by: Marino Faggiana <[email protected]>

* fix

Signed-off-by: Marino Faggiana <[email protected]>

* cleaning

Signed-off-by: Marino Faggiana <[email protected]>

* assistant

Signed-off-by: Marino Faggiana <[email protected]>

* assistantEnabled

Signed-off-by: Marino Faggiana <[email protected]>

* clean code

Signed-off-by: Marino Faggiana <[email protected]>

* code

Signed-off-by: Marino Faggiana <[email protected]>

* Directediting (#4109)

* code

Signed-off-by: Marino Faggiana <[email protected]>

* code

Signed-off-by: Marino Faggiana <[email protected]>

* whiteboard

Signed-off-by: Marino Faggiana <[email protected]>

* nextcloudkit

Signed-off-by: Marino Faggiana <[email protected]>

* pencil.and.scribble

Signed-off-by: Marino Faggiana <[email protected]>

---------

Signed-off-by: Marino Faggiana <[email protected]>

* added inputText

Signed-off-by: Marino Faggiana <[email protected]>

* inputText

Signed-off-by: Marino Faggiana <[email protected]>

* ChatInputField

Signed-off-by: Marino Faggiana <[email protected]>

* NCAssistantInputModel

Signed-off-by: Marino Faggiana <[email protected]>

* cleaning

Signed-off-by: Marino Faggiana <[email protected]>

* action

Signed-off-by: Marino Faggiana <[email protected]>

* code

Signed-off-by: Marino Faggiana <[email protected]>

* code

Signed-off-by: Marino Faggiana <[email protected]>

* cod

Signed-off-by: Marino Faggiana <[email protected]>

* closed

Signed-off-by: Marino Faggiana <[email protected]>

* build 2

Signed-off-by: Marino Faggiana <[email protected]>

* appIcon

Signed-off-by: Marino Faggiana <[email protected]>

---------

Signed-off-by: Marino Faggiana <[email protected]>
2026-05-15 08:35:02 +02:00
Marino Faggiana 1407ecec9e Directediting (#4109)
* code

Signed-off-by: Marino Faggiana <[email protected]>

* code

Signed-off-by: Marino Faggiana <[email protected]>

* whiteboard

Signed-off-by: Marino Faggiana <[email protected]>

* nextcloudkit

Signed-off-by: Marino Faggiana <[email protected]>

* pencil.and.scribble

Signed-off-by: Marino Faggiana <[email protected]>

---------

Signed-off-by: Marino Faggiana <[email protected]>
2026-05-13 13:30:47 +02:00
Marino Faggiana 7b7f1d6650 Gui fix varie (#4097)
* fix “more” item

Signed-off-by: Marino Faggiana <[email protected]>

* fixup!

Signed-off-by: Marino Faggiana <[email protected]>

---------

Signed-off-by: Marino Faggiana <[email protected]>
2026-05-06 08:44:32 +02:00
Marino Faggiana 397f4f73da Revert "chore(l10n): Added nbsp before ellipsis (#4092)"
This reverts commit 9e1a450e20.
2026-05-04 16:39:29 +02:00
rakekniven 9e1a450e20 chore(l10n): Added nbsp before ellipsis (#4092)
Signed-off-by: rakekniven <[email protected]>
2026-05-04 07:15:20 +02:00
Nextcloud bot d1c8ab07ea fix(l10n): Update translations from Transifex
Signed-off-by: Nextcloud bot <[email protected]>
2026-05-01 02:55:18 +00:00
Marino Faggiana 0a5c5a234c AES_IVEC_LENGTH (#4090)
Signed-off-by: Marino Faggiana <[email protected]>
2026-04-30 08:21:23 +02:00
Marino Faggiana abf4353d0c fix build code
Signed-off-by: Marino Faggiana <[email protected]>
2026-04-30 07:50:52 +02:00
Marino Faggiana 274954334e More refactoring (#4089)
* wip

Signed-off-by: Marino Faggiana <[email protected]>

* wip

Signed-off-by: Marino Faggiana <[email protected]>

* wip

Signed-off-by: Marino Faggiana <[email protected]>

* wip

Signed-off-by: Marino Faggiana <[email protected]>

* remove old code

Signed-off-by: Marino Faggiana <[email protected]>

* wip

Signed-off-by: Marino Faggiana <[email protected]>

* wip

Signed-off-by: Marino Faggiana <[email protected]>

* code

Signed-off-by: Marino Faggiana <[email protected]>

* code

Signed-off-by: Marino Faggiana <[email protected]>

* wip

Signed-off-by: Marino Faggiana <[email protected]>

* review

Signed-off-by: Marino Faggiana <[email protected]>

* clean

Signed-off-by: Marino Faggiana <[email protected]>

---------

Signed-off-by: Marino Faggiana <[email protected]>
2026-04-29 18:04:50 +02:00
Nextcloud bot 5f298c5c13 fix(l10n): Update translations from Transifex
Signed-off-by: Nextcloud bot <[email protected]>
2026-04-29 02:57:11 +00:00
Marino Faggiana ccbbe2257e remove old code (#4087)
Signed-off-by: Marino Faggiana <[email protected]>
2026-04-28 09:45:28 +02:00
Nextcloud bot 03e5f5f516 fix(l10n): Update translations from Transifex
Signed-off-by: Nextcloud bot <[email protected]>
2026-04-28 02:54:19 +00:00
Marino Faggiana 5213ea092e ErrorBannerGate (refactoring) (#4086)
Signed-off-by: Marino Faggiana <[email protected]>
2026-04-26 10:12:56 +02:00
Nextcloud bot e3147733dd fix(l10n): Update translations from Transifex
Signed-off-by: Nextcloud bot <[email protected]>
2026-04-26 02:52:13 +00:00
Nextcloud bot 18e8fac47f fix(l10n): Update translations from Transifex
Signed-off-by: Nextcloud bot <[email protected]>
2026-04-25 02:53:20 +00:00
754 changed files with 58841 additions and 22646 deletions

No files matched your search

+5
View File
@@ -0,0 +1,5 @@
# SPDX-FileCopyrightText: 2026 Nextcloud GmbH and Nextcloud contributors
# SPDX-License-Identifier: GPL-3.0-or-later
# Default owner for all files in the repository.
* @marinofaggiana @mpivchev
+42
View File
@@ -0,0 +1,42 @@
# SPDX-FileCopyrightText: Nextcloud GmbH
# SPDX-FileCopyrightText: 2026 Milen Pivchev
# SPDX-License-Identifier: GPL-3.0-or-later
version: 2
updates:
# SPM packages declared in Nextcloud.xcodeproj (NextcloudKit, Realm, Firebase, …)
- package-ecosystem: "swift"
directory: "/"
schedule:
interval: "weekly"
groups:
swift-packages:
patterns:
- "*"
# These deps are ignored, since they are internal Firebase and Realm libs.
# They have their own version limits that may not be the latest version, which forces XCode to reverse a version change.
# Since these are ignored, the only way they update is through an Xcode package build, which will happen naturally.
ignore:
- dependency-name: "github.com/google/*"
- dependency-name: "github.com/googleads/*"
- dependency-name: "github.com/firebase/nanopb"
- dependency-name: "github.com/firebase/leveldb"
- dependency-name: "github.com/realm/realm-core"
labels:
- "dependencies"
commit-message:
prefix: "fix(deps)"
# Keep the GitHub Actions used by our workflows up to date
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
groups:
github-actions:
patterns:
- "*"
labels:
- "dependencies"
commit-message:
prefix: "ci"
@@ -0,0 +1,49 @@
---
# SPDX-FileCopyrightText: Nextcloud GmbH
# SPDX-FileCopyrightText: 2026 Milen Pivchev
# SPDX-License-Identifier: GPL-3.0-or-later
name: github-actions-failure-debugging
description: Debug and fix failing GitHub Actions workflows (CI) in this repo — failing PR checks, xcodebuild/simulator/runner-image errors, SwiftLint failures. Use when asked to review, debug, or fix CI or a failing workflow run.
---
# Debugging failing GitHub Actions workflows
Workflows live in `.github/workflows/`:
- `xcode.yml` — builds the `Nextcloud` scheme for testing, then runs tests on a simulator against a locally installed Nextcloud server. Version pins are env vars at the top: `XCODE_VERSION`, `DESTINATION`, plus the `runs-on` labels and the `simctl boot` device name further down.
- `additional-targets.yml` — builds the extension schemes (Share, File Provider, Notification Service, Widget, WidgetDashboardIntentHandler). Keep its image/Xcode/destination consistent with `xcode.yml`.
- `lint.yml` — SwiftLint on ubuntu.
## 1. Get the failure
Use the `gh` CLI (if a GitHub MCP server is connected, its equivalents like `list_workflow_runs` / `get_job_logs` work too):
- `gh pr checks <pr>` or `gh run list --branch <branch> --limit 10` — find failing runs
- `gh run view <run-id>` — see which jobs and steps failed
- `gh run view <run-id> --log-failed | grep -iE "error:|failed" | head -60` — never dump full logs into context; grep/tail them, or have a subagent read them and report only the failing step and error lines.
## 2. Classify before fixing
- `cannot find type '…' in scope` for Apple APIs → SDK mismatch: the code uses APIs newer than the SDK of the Xcode selected on the runner. Confirm the API's introduction version by grepping the local SDK, e.g.
`grep -rn -B4 "TypeName" /Applications/Xcode-*.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/<Framework>.framework/Modules/*.swiftmodule/*.swiftinterface`
and look for `@available(iOS X.0, …)`.
- "Unable to find a destination" or simulator boot errors → the pinned `DESTINATION` OS/device or the `simctl boot` device name doesn't exist on the runner image.
- Job queued forever or tooling missing → invalid or stale `runs-on` label.
- Test-job failures around PHP/occ → the Nextcloud server setup steps; these shell steps can be reproduced locally.
- SwiftLint failures → run `swiftlint` locally.
## 3. Check runner-image compatibility
Before changing any pin, check https://github.com/actions/runner-images:
- The README's Available Images table has the valid `runs-on` labels, including preview images (e.g. `xcode-27`) and deprecation notices.
- Each macOS image readme (`images/macos/<image>-arm64-Readme.md`) lists installed Xcode versions, iOS simulator runtimes, and device types.
The chosen combination must exist together on one image: `runs-on` label ↔ `XCODE_VERSION` ↔ `DESTINATION` OS + device ↔ `simctl boot` device name. New Xcode majors appear first on a dedicated preview image before reaching the GA `macos-NN` image.
## 4. Reproduce and fix
- Do **not** run `xcodebuild` locally to reproduce — builds take too long (repo rule). Reproduce only cheap failures (SwiftLint, YAML, shell steps); for compile/SDK failures, reason from the logs plus the SDK check above.
- Apply the fix to every workflow sharing the stale value.
- Validate edited YAML: `ruby -ryaml -e 'YAML.load_file(".github/workflows/xcode.yml")'`
- If you reproduced a failure locally, verify the fix locally before committing. Otherwise say plainly that verification needs a CI run; after pushing, watch it with `gh pr checks --watch` or `gh run watch`.
+11 -5
View File
@@ -1,3 +1,6 @@
# SPDX-FileCopyrightText: 2021 Nextcloud GmbH and Nextcloud contributors
# SPDX-License-Identifier: GPL-3.0-or-later
name: Build additional targets
on:
@@ -18,17 +21,20 @@ concurrency:
jobs:
build-and-test:
name: Build and Test
runs-on: macos-14
runs-on: xcode-27
if: github.event.pull_request.draft == false
env:
PROJECT: Nextcloud.xcodeproj
DESTINATION: platform=iOS Simulator,name=iPhone 15
DESTINATION: platform=iOS Simulator,name=iPhone 17,OS=27.0
XCODE_VERSION: '27.1'
steps:
- name: Set env var
run: echo "DEVELOPER_DIR=$(xcode-select --print-path)" >> $GITHUB_ENV
- uses: actions/checkout@v4
- uses: actions/checkout@v7
- name: Download GoogleService-Info.plist
run: wget "https://raw.githubusercontent.com/firebase/quickstart-ios/master/mock-GoogleService-Info.plist" -O GoogleService-Info.plist
- name: Setup Xcode
uses: maxim-lobanov/setup-xcode@ed7a3b1fda3918c0306d1b724322adc0b8cc0a90 # v1.7.0
with:
xcode-version: ${{ env.XCODE_VERSION }}
- name: Build iOS Share
run: |
xcodebuild build -project $PROJECT -scheme "$SCHEME" -destination "$DESTINATION" | xcbeautify --quieter
+4 -1
View File
@@ -1,3 +1,6 @@
# SPDX-FileCopyrightText: 2021 Nextcloud GmbH and Nextcloud contributors
# SPDX-License-Identifier: GPL-3.0-or-later
# Lints the project using SwiftLint
@@ -24,7 +27,7 @@ jobs:
if: github.event.pull_request.draft == false
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v7
- name: GitHub Action for SwiftLint
uses: norio-nomura/[email protected]
+27
View File
@@ -0,0 +1,27 @@
# This workflow is provided via the organization template repository
#
# https://github.com/nextcloud/.github
# https://docs.github.com/en/actions/learn-github-actions/sharing-workflows-with-your-organization
# SPDX-FileCopyrightText: 2022 Free Software Foundation Europe e.V. <https://fsfe.org>
#
# SPDX-License-Identifier: CC0-1.0
name: REUSE Compliance Check
on: [pull_request]
permissions:
contents: read
jobs:
reuse-compliance-check:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: REUSE Compliance Check
uses: fsfe/reuse-action@676e2d560c9a403aa252096d99fcab3e1132b0f5 # v6.0.0
+76 -20
View File
@@ -1,3 +1,6 @@
# SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors
# SPDX-License-Identifier: GPL-3.0-or-later
name: Build and test main target
on:
@@ -17,26 +20,26 @@ on:
env:
PROJECT: Nextcloud.xcodeproj
DESTINATION: platform=iOS Simulator,name=iPhone 16,OS=18.5
DESTINATION: platform=iOS Simulator,name=iPhone 17,OS=27.0
SCHEME: Nextcloud
XCODE_VERSION: '26.0.1'
XCODE_VERSION: '27.1'
SERVER_BRANCH: stable30
PHP_VERSION: 8.3
jobs:
build:
name: Build
runs-on: macos-15
runs-on: xcode-27
if: github.event.pull_request.draft == false
steps:
- uses: actions/checkout@v5
- uses: actions/checkout@v7
- name: Download GoogleService-Info.plist
run: wget "https://raw.githubusercontent.com/firebase/quickstart-ios/master/mock-GoogleService-Info.plist" -O GoogleService-Info.plist
- name: Setup Xcode
uses: maxim-lobanov/setup-xcode@60606e260d2fc5762a71e64e74b2174e8ea3c8bd # v1.6.0
uses: maxim-lobanov/setup-xcode@ed7a3b1fda3918c0306d1b724322adc0b8cc0a90 # v1.7.0
with:
xcode-version: ${{ env.XCODE_VERSION }}
@@ -50,7 +53,7 @@ jobs:
| xcbeautify --quieter
- name: Upload Build Products
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v7
with:
name: Nextcloud for iOS
path: DerivedData/Build/Products
@@ -58,16 +61,53 @@ jobs:
test:
name: Run Tests
runs-on: macos-15
runs-on: xcode-27
timeout-minutes: 40
needs: [build]
if: github.event.pull_request.draft == false
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v7
with:
fetch-depth: 0
- name: Detect passcode changes
id: passcode_changes
shell: bash
env:
PR_BASE_SHA: ${{ github.event.pull_request.base.sha }}
PR_HEAD_SHA: ${{ github.event.pull_request.head.sha }}
PUSH_BEFORE_SHA: ${{ github.event.before }}
run: |
run_passcode_tests=false
if [ "$GITHUB_EVENT_NAME" = "pull_request" ]; then
compare_base=$(git merge-base "$PR_BASE_SHA" "$PR_HEAD_SHA")
compare_head="$PR_HEAD_SHA"
else
compare_base="$PUSH_BEFORE_SHA"
compare_head="$GITHUB_SHA"
fi
if [ -z "$compare_base" ] || [ "$compare_base" = "0000000000000000000000000000000000000000" ]; then
run_passcode_tests=true
else
git diff --name-only -z "$compare_base" "$compare_head" > "$RUNNER_TEMP/passcode-changed-files"
while IFS= read -r -d '' changed_file; do
case "$changed_file" in
iOSClient/Utility/Passcode/* | \
Tests/NextcloudUITests/PasscodeUITests.swift)
run_passcode_tests=true
break
;;
esac
done < "$RUNNER_TEMP/passcode-changed-files"
fi
echo "run=$run_passcode_tests" >> "$GITHUB_OUTPUT"
echo "Run passcode UI tests: $run_passcode_tests"
- name: Setup Xcode
uses: maxim-lobanov/setup-xcode@60606e260d2fc5762a71e64e74b2174e8ea3c8bd # v1.6.0
uses: maxim-lobanov/setup-xcode@ed7a3b1fda3918c0306d1b724322adc0b8cc0a90 # v1.7.0
with:
xcode-version: ${{ env.XCODE_VERSION }}
@@ -82,7 +122,7 @@ jobs:
ini-values: apc.enable_cli=on, disable_functions=
- name: Checkout Nextcloud Server
uses: actions/checkout@v4
uses: actions/checkout@v7
with:
submodules: true
repository: nextcloud/server
@@ -90,7 +130,7 @@ jobs:
ref: ${{ env.SERVER_BRANCH }}
- name: Checkout Download Limits App
uses: actions/checkout@v4
uses: actions/checkout@v7
with:
repository: nextcloud/files_downloadlimit
path: server/apps/files_downloadlimit
@@ -100,27 +140,31 @@ jobs:
run: |
mkdir server/data
./server/occ maintenance:install --verbose --database=sqlite --database-name=nextcloud --database-host=127.0.0.1 --database-user=root --database-pass=rootpassword --admin-user admin --admin-pass admin
./server/occ config:system:set force_language --value=en
./server/occ config:system:set hashing_default_password --value=true --type=boolean
./server/occ config:system:set auth.bruteforce.protection.enabled --value false --type bool
./server/occ config:system:set ratelimit.protection.enabled --value false --type bool
./server/occ config:system:set memcache.local --value="\\OC\\Memcache\\APCu"
./server/occ config:system:set memcache.distributed --value="\\OC\\Memcache\\APCu"
./server/occ app:enable files_downloadlimit
./server/occ background:cron
PHP_CLI_SERVER_WORKERS=5 php -S localhost:8080 -t server/ &
- name: Download Build
uses: actions/download-artifact@v4
uses: actions/download-artifact@v8
with:
name: Nextcloud for iOS
- name: Assert Nextcloud Server Status
run: curl -s --retry 5 --retry-delay 60 --retry-all-errors http://localhost:8080/status.php || true
run: curl --fail --show-error --silent --max-time 5 --retry 5 --retry-delay 2 --retry-max-time 30 --retry-all-errors http://localhost:8080/status.php
- name: Boot iOS Simulator
run: |
xcrun simctl boot "iPhone 16"
xcrun simctl bootstatus "iPhone 16" || echo "Simulator booted"
xcrun simctl boot "iPhone 17"
xcrun simctl bootstatus "iPhone 17" -b
xcrun simctl spawn "iPhone 17" defaults write NSGlobalDomain AppleLanguages -array en
xcrun simctl spawn "iPhone 17" defaults write NSGlobalDomain AppleLocale -string en_US
xcrun simctl shutdown "iPhone 17"
xcrun simctl boot "iPhone 17"
xcrun simctl bootstatus "iPhone 17" -b
- name: Check if Safari is installed
run: |
@@ -132,19 +176,31 @@ jobs:
fi
- name: Run Xcode Test
timeout-minutes: 25
shell: bash
env:
RUN_PASSCODE_TESTS: ${{ steps.passcode_changes.outputs.run }}
run: |
set -o pipefail && \
set -o pipefail
test_selection=()
if [ "$RUN_PASSCODE_TESTS" != "true" ]; then
test_selection+=(-skip-testing:NextcloudUITests/PasscodeUITests)
fi
xcodebuild test-without-building \
-xctestrun $(find . -type f -name "*.xctestrun") \
-destination "${{ env.DESTINATION }}" \
-derivedDataPath "DerivedData" \
"${test_selection[@]}" \
-test-iterations 3 \
-retry-tests-on-failure \
-test-timeouts-enabled YES \
-default-test-execution-time-allowance 600 \
-maximum-test-execution-time-allowance 600 \
-resultBundlePath "TestResult.xcresult"
- name: Upload Xcode Test Results
uses: actions/upload-artifact@v4
if: ${{ !cancelled() }}
uses: actions/upload-artifact@v7
if: ${{ always() }}
with:
name: TestResult.xcresult
path: "TestResult.xcresult"
+3 -6
View File
@@ -35,12 +35,9 @@ DerivedData
*.hmap
*.xccheckout
## Package
Carthage/
### SwiftPackageManager ###
.swiftpm
Package.resolved
# Don't ignore Package.resolved: Dependabot needs it committed to update Xcode packages.
*.generated.swift
/.env-vars
## Claude Code
.claude/
+5 -2
View File
@@ -1,3 +1,6 @@
# SPDX-FileCopyrightText: 2021 Nextcloud GmbH and Nextcloud contributors
# SPDX-License-Identifier: GPL-3.0-or-later
opt_in_rules: # some rules are turned off by default, so you need to opt-in
- empty_collection_literal
- empty_string
@@ -10,7 +13,7 @@ line_length:
error: 5000
function_body_length:
warning: 400
warning: 500
type_body_length:
warning: 2000
@@ -45,7 +48,7 @@ excluded:
- Tests
- Brand/NCBrand.swift
- iOSClient/NCGlobal.swift
- iOSClient/Utility/NCLivePhoto.swift
- DerivedData
- .claude
reporter: "xcode"
+38 -18
View File
@@ -1,14 +1,13 @@
<!--
- SPDX-FileCopyrightText: 2026 Nextcloud GmbH and Nextcloud contributors
- SPDX-License-Identifier: GPL-2.0-or-later
- SPDX-License-Identifier: GPL-3.0-or-later
-->
# AGENTS.md
You are an experienced engineer specialized in Swift and familiar with the platform-specific details of iOS.
## Your Role
- You are an experienced engineer specialized in Swift and familiar with the platform-specific details of iOS.
- You implement features and fix bugs.
- Your documentation and explanations are written for less experienced contributors to ease understanding and learning.
- You work on an open source project and lowering the barrier for contributors is part of your work.
@@ -17,43 +16,56 @@ You are an experienced engineer specialized in Swift and familiar with the platf
The Nextcloud iOS Client is a tool to access and synchronize files from Nextcloud Server on your iPhone or iPad.
Swift, UIKit and SwiftUI are the key technologies used for building the app on iOS.
Beyond that, there is shared code in the form of the NextcloudKit library for use in macOS and iOS.
Server communication is handled by the NextcloudKit library — a separate repository (https://github.com/nextcloud/NextcloudKit) consumed as a Swift Package pinned to an exact version in `Nextcloud.xcodeproj`. Prefer its APIs over hand-rolled networking code; server API changes belong in that repo.
Other key dependencies (all Swift Packages): Realm (local database), Alamofire (HTTP), Firebase (crash reporting), OpenSSL (end-to-end encryption), VLCKit (media playback). Prefer existing dependencies over adding new ones.
Other platforms like Android are irrelevant for this project.
## Project Structure: AI Agent Handling Guidelines
| Directory | Description | Agent Action |
|-----------------|-----------------------------------------------------|----------------------|
| `.github` | GitHub CI workflows. | Try to add unit tests for new features, where applicable and makes sense. Do not overcomplicate unit tests. |
| `.github` | GitHub CI workflows (build & test, SwiftLint, extension-target builds) and issue templates. | Keep all three checks green: `xcode.yml` (builds the `Nextcloud` scheme and runs its tests against a Nextcloud server provisioned in CI), `lint.yml` (SwiftLint), `additional-targets.yml` (build-checks the extension schemes). CI skips draft PRs. |
| `iOSClient` | Main iOS client source code. | — |
| `iOSClient/SupportingFiles` | Translation files from Transifex. | Only add new strings in `en.lproj`. The rest you should ignore. |
| `iOSClient/Utility/Passcode` | Shared SwiftUI passcode UI and authentication model for the app and Share Extension; the mandatory app lock uses a dedicated window per scene. | Preserve existing credentials, lockout rules and app/extension reset behavior. |
| `iOSClient/Supporting Files` | Translation files synced with Transifex (see `iOSClient/.tx/config`). | Only add new strings to `en.lproj` (`Localizable.strings`, plurals in `Localizable.stringsdict`); never edit the other `*.lproj` dirs — Transifex overwrites them. |
| `Brand` | Branding layer: `NCBrand.swift` (app constants, colors), `Database.swift` (Realm database name and schema version), Info.plists and entitlements for all targets, launch screen and intro screens. | Bump `databaseSchemaVersion` in `Brand/Database.swift` when changing Realm models. |
| `File Provider Extension` | Contains business logic for the iOS File Provider extension. | — |
| `File Provider Extension UI` | Contains UI logic for the iOS File Provider extension. | — |
| `Share` | Contains code for the iOS Share extension. | — |
| `Widget` | Contains code for iOS Widgets. | — |
| `WidgetDashboardIntentHandler` | Contains the intent handler for the dashboard widget. | — |
| `Notification Service Extension` | Contains the push notification service extension. | — |
| `Tests` | Contains unit and UI tests. | — |
| `Action Assistant` | iOS Action extension that receives shared text from other apps and forwards it to the in-app Nextcloud Assistant. | — |
| `AppIcon.icon` | Icon Composer app-icon bundle. | Do not edit by hand; use Icon Composer. |
| `Tests` | Unit tests (`NextcloudUnitTests`), UI tests (`NextcloudUITests`) and integration tests (`NextcloudIntegrationTests`), plus `TestConstants.swift` and the `Server.sh` test-server script. | Prefer `NextcloudUnitTests` for new tests. Try to add unit tests for new features, where applicable and makes sense; do not overcomplicate them. |
Keep this table up to date: when a change adds, removes or repurposes a directory listed here, update the table in the same PR.
## General Guidance
Every new file needs to get a SPDX header in the first rows according to this template.
The year in the first line must be replaced with the year when the file is created (for example, 2026 for files first added in 2026).
The project is licensed under GPL-3.0-or-later (`LICENSE.txt`) with an Apple App Store exception (`COPYING.iOS`).
Every new file needs to get a SPDX header in the first rows according to this template.
Replace `<YEAR>` with the year the file is created and `<Author Name>` with the contributing author (Nextcloud has no CLA; copyright stays with the individual contributors).
The commenting signs need to be used depending on the file type.
```plaintext
SPDX-FileCopyrightText: <YEAR> Nextcloud GmbH and Nextcloud contributors
SPDX-License-Identifier: GPL-2.0-or-later
SPDX-FileCopyrightText: Nextcloud GmbH
SPDX-FileCopyrightText: <YEAR> <Author Name>
SPDX-License-Identifier: GPL-3.0-or-later
```
Some older files still carry legacy “Created by … All rights reserved” Xcode headers — do not copy that style into new files. The `REUSE Compliance Check` workflow enforces this on every pull request; files that cannot carry a comment (assets, translations, project files) are covered by `REUSE.toml` instead.
Avoid creating source files that implement multiple types; instead, place each type in its own dedicated source file.
## Commit and Pull Request Guidelines
- **DCO sign-off (required)**: All commits must comply with the Developer Certificate of Origin (DCO) as described in `README.md` and include a `Signed-off-by: …` line in the commit message.
- **DCO sign-off (required)**: All commits must comply with the Developer Certificate of Origin (DCO) as described in `README.md` and include a `Signed-off-by: …` line in the commit message. Sign off with `git commit -s`; the DCO status check blocks PRs otherwise.
- **Commits**: In addition to the DCO sign-off, follow the Conventional Commits format for the subject line where reasonable. Use `feat: ...`, `fix: ...`, or `refactor: ...` as appropriate in the commit message prefix.
- Include a short summary of what changed. *Example:* `fix: prevent crash on empty todo title`.
- **Pull Request**: When the agent creates a PR, it should include a description summarizing the changes and why they were made. If a GitHub issue exists, reference it (e.g., “Closes #123”). If there is any discrepancy between this section and the contribution guidance in `README.md`, the rules in `README.md` take precedence.
- Include a short summary of what changed. *Example:* `fix: prevent crash on empty file name`.
- **Pull Request**: When the agent creates a PR, it should include a description summarizing the changes and why they were made. If a GitHub issue exists, reference it (e.g., “Closes #123”). Target `master` (the default branch); `stable-XX.Y.Z` branches are only for backports. Note that `README.md` still mentions a `develop` branch — it no longer exists.
- **AI-assisted changes**: Declare AI tool use in the PR description (the org-level PR template includes an AI checkbox) and add an `Assisted-by: AGENT_NAME:MODEL_VERSION` trailer to each affected commit, per the org-wide policy in `nextcloud/.github`.
## iOS Specifics
@@ -61,16 +73,24 @@ The following details are important when working on the iOS client.
### Requirements
- Latest stable Xcode available is required to be installed in the development environment.
- Use at least the Xcode version pinned in `.github/workflows/xcode.yml` — that is what CI builds and tests with.
- A `GoogleService-Info.plist` must exist at the repo root to build; CI downloads Firebase's mock plist (see `xcode.yml`).
### Code Style
- When writing code in Swift, respect strict concurrency rules and Swift 6 compatibility.
- Write new code to be Swift 6-compatible and strict-concurrency-friendly (proper actor isolation, `Sendable` types). Note that the project currently builds in Swift 5 language mode without strict concurrency checking, so the compiler will not enforce this.
- CI runs SwiftLint on every non-draft PR using the root `.swiftlint.yml`; `Tests/`, `Brand/NCBrand.swift` and `iOSClient/NCGlobal.swift` are excluded from linting.
### Tests
- When implementing new test suites, prefer Swift Testing over XCTest for implementation.
- Do not run builds or tests locally. The user performs all Xcode build and test verification manually.
- When implementing new test suites, prefer Swift Testing over XCTest for implementation. UI tests are the exception — XCUITest requires XCTest, so new UI tests are XCTest classes subclassing `BaseUIXCTestCase` in `Tests/NextcloudUITests`.
- New unit tests go in `Tests/NextcloudUnitTests` as Swift Testing `@Suite` structs with `@testable import Nextcloud`; they need no server.
- When implementing test cases using Swift Testing, do not prefix test method names with "test".
- If the implementation of mock types is inevitable, implement them in dedicated source code files and in a generic way, so they can be reused across all tests in a test target.
- If the implementation of mock types is inevitable, implement them in dedicated source code files and in a generic way, so they can be reused across all tests in a test target. Currently no mock types or mocking library exist; reusable UI-test helpers live in `Tests/NextcloudUITests` (`UITestBackend` and its `Responses/` decodables) — extend these before adding new ones.
- If the implementation of an existing mock type does not fulfill the requirements introduced by new tests, prefer updating the existing type before implementing a mostly redundant alternative type.
- UI tests require a Nextcloud server at `http://localhost:8080` (credentials `admin`/`admin`, see `Tests/TestConstants.swift`); start one with `Tests/Server.sh` (requires Docker). CI provisions the same server.
- `NextcloudIntegrationTests` is currently an empty target: `LoginIntegrationTests.swift` is on disk but excluded from the build and references a nonexistent `EnvVars` type — do not model new tests on it.
- Verify that all tests are passing and correct them if necessary.
- Run tests the way CI does (see `.github/workflows/xcode.yml`): `xcodebuild test -scheme Nextcloud -destination "platform=iOS Simulator,name=iPhone 17,OS=27.0"` (adjust the simulator to what is installed locally). Without a local test server, restrict to `-only-testing:NextcloudUnitTests`.
+159
View File
@@ -0,0 +1,159 @@
// SPDX-FileCopyrightText: Nextcloud GmbH
// SPDX-FileCopyrightText: 2026 Marino Faggiana
// SPDX-License-Identifier: GPL-3.0-or-later
import UIKit
import NextcloudKit
import UniformTypeIdentifiers
final class ActionViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
let groupIdentifier = NCBrandOptions.shared.capabilitiesGroup
let storedLogLevel = UserDefaults(suiteName: groupIdentifier)?
.object(forKey: "Preferences_logLevel") as? Int
let logLevel = storedLogLevel.flatMap(NKLogLevel.init(rawValue:)) ?? .normal
let logDirectory = FileManager.default
.containerURL(forSecurityApplicationGroupIdentifier: groupIdentifier)?
.appendingPathComponent("Logs", isDirectory: true)
NextcloudKit.configureLogger(
logLevel: NCBrandOptions.shared.disable_log ? .disabled : logLevel,
logDirectory: logDirectory
)
view.isHidden = true
view.alpha = 0
view.backgroundColor = .clear
preferredContentSize = .zero
Task {
await handleAction()
}
}
private func handleAction() async {
guard let text = await loadText() else {
extensionContext?.completeRequest(returningItems: nil, completionHandler: nil)
return
}
NCAssistantSharedTextStore.save(text)
openMainAppForAssistantSharedText()
}
private func loadText() async -> String? {
guard let extensionItems = extensionContext?.inputItems as? [NSExtensionItem] else {
return nil
}
for extensionItem in extensionItems {
guard let attachments = extensionItem.attachments else {
continue
}
for provider in attachments {
if provider.hasItemConformingToTypeIdentifier(UTType.plainText.identifier) {
return await loadText(from: provider, typeIdentifier: UTType.plainText.identifier)
}
if provider.hasItemConformingToTypeIdentifier(UTType.utf8PlainText.identifier) {
return await loadText(from: provider, typeIdentifier: UTType.utf8PlainText.identifier)
}
if provider.hasItemConformingToTypeIdentifier(UTType.text.identifier) {
return await loadText(from: provider, typeIdentifier: UTType.text.identifier)
}
}
}
return nil
}
private func loadText(from provider: NSItemProvider, typeIdentifier: String) async -> String? {
await withCheckedContinuation { continuation in
provider.loadItem(forTypeIdentifier: typeIdentifier, options: nil) { item, _ in
let text: String?
if let string = item as? String {
text = string
} else if let attributedString = item as? NSAttributedString {
text = attributedString.string
} else if let data = item as? Data {
text = String(data: data, encoding: .utf8)
} else if let url = item as? URL {
text = try? String(contentsOf: url, encoding: .utf8)
} else {
text = nil
}
guard let text, !text.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty else {
continuation.resume(returning: nil)
return
}
continuation.resume(returning: text)
}
}
}
private func openMainAppForAssistantSharedText() {
guard let url = URL(string: "nextcloud://assistant/shared-text") else {
extensionContext?.completeRequest(returningItems: nil, completionHandler: nil)
return
}
openAssistantSharedTextURLThroughResponderChain(url)
DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) { [weak self] in
self?.extensionContext?.completeRequest(returningItems: nil, completionHandler: nil)
}
}
/// Opens the Assistant shared-text deep link from the Share extension.
///
/// Share extensions cannot use `UIApplication.shared` directly because it is not
/// extension-safe. This method walks the responder chain until it finds the hidden
/// `UIApplication` responder and invokes the modern `open(_:options:completionHandler:)`
/// Objective-C selector dynamically.
///
/// This is intentionally isolated because it relies on Objective-C runtime dispatch.
///
/// - Parameter url: Deep link URL to open in the containing application.
private func openAssistantSharedTextURLThroughResponderChain(_ url: URL) {
let selector = NSSelectorFromString("openURL:options:completionHandler:")
let applicationClass: AnyClass? = NSClassFromString("UIApplication")
var responder: UIResponder? = self
while let currentResponder = responder {
guard let applicationClass,
currentResponder.isKind(of: applicationClass),
currentResponder.responds(to: selector),
let implementation = currentResponder.method(for: selector) else {
responder = currentResponder.next
continue
}
typealias CompletionBlock = @convention(block) (Bool) -> Void
typealias OpenURLFunction = @convention(c) (AnyObject, Selector, NSURL, NSDictionary, CompletionBlock?) -> Void
let openURL = unsafeBitCast(implementation, to: OpenURLFunction.self)
let completion: CompletionBlock = { success in
if success {
nkLog(debug: "Assistant shared text deep link performed through modern responder chain")
} else {
nkLog(error: "Assistant shared text deep link modern responder chain returned false")
}
NextcloudKit.flushLogger()
}
openURL(currentResponder, selector, url as NSURL, NSDictionary(), completion)
return
}
nkLog(error: "Assistant shared text deep link failed because no UIApplication responder can open URL")
NextcloudKit.flushLogger()
}
}
@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="24765" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="ObA-dk-sSI">
<device id="retina6_12" orientation="portrait" appearance="light"/>
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="24743"/>
</dependencies>
<scenes>
<!--Image-->
<scene sceneID="7MM-of-jgj">
<objects>
<viewController title="Image" id="ObA-dk-sSI" customClass="ActionViewController" customModule="Action_Assistant" sceneMemberID="viewController">
<freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
<size key="freeformSize" width="320" height="528"/>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="X47-rx-isc" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="139" y="131"/>
</scene>
</scenes>
</document>
@@ -0,0 +1,38 @@
{
"images" : [
{
"filename" : "Senza titolo.png",
"idiom" : "universal",
"platform" : "ios",
"size" : "1024x1024"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"filename" : "Senza titolo 1.png",
"idiom" : "universal",
"platform" : "ios",
"size" : "1024x1024"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "tinted"
}
],
"filename" : "Senza titolo 2.png",
"idiom" : "universal",
"platform" : "ios",
"size" : "1024x1024"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 8.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.2 KiB

@@ -0,0 +1,6 @@
{
"info" : {
"author" : "xcode",
"version" : 1
}
}
@@ -1,8 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" width="141.485" height="99.603" xmlns:svg="http://www.w3.org/2000/svg" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:cc="http://creativecommons.org/ns#" version="1.1" viewBox="0 0 141.485 99.603">
<!-- Generator: Adobe Illustrator 29.5.1, SVG Export Plug-In . SVG Version: 2.1.0 Build 141) -->
<g id="Layer_1" inkscape:version="0.92.3 (2405546, 2018-03-11)">
<sodipodi:namedview id="namedview16" bordercolor="#666666" borderopacity="1" fit-margin-bottom="10" fit-margin-left="10" fit-margin-right="10" fit-margin-top="10" gridtolerance="10" guidetolerance="10" inkscape:bbox-nodes="true" inkscape:bbox-paths="true" inkscape:current-layer="Layer_1" inkscape:cx="-34.704986" inkscape:cy="33.920203" inkscape:pageopacity="0" inkscape:pageshadow="2" inkscape:snap-bbox="true" inkscape:snap-bbox-edge-midpoints="true" inkscape:snap-bbox-midpoints="true" inkscape:snap-page="true" inkscape:window-height="1046" inkscape:window-maximized="1" inkscape:window-width="1920" inkscape:window-x="0" inkscape:window-y="34" inkscape:zoom="2.8284271" objecttolerance="10" pagecolor="#ffffff" showgrid="false" units="px"/>
<path id="path1052" d="M70.835,22.149c-12.592,0-23.265,8.537-26.573,20.103-2.875-6.135-9.105-10.433-16.281-10.433-9.869,0-17.981,8.112-17.981,17.981s8.112,17.985,17.981,17.985c7.176,0,13.406-4.301,16.281-10.437,3.308,11.567,13.981,20.107,26.573,20.107,12.499,0,23.118-8.411,26.51-19.848,2.928,5.997,9.081,10.177,16.155,10.177,9.869,0,17.985-8.116,17.985-17.985s-8.116-17.981-17.985-17.981c-7.074,0-13.227,4.178-16.155,10.174-3.393-11.436-14.011-19.844-26.51-19.844ZM70.835,32.704c9.506,0,17.099,7.59,17.099,17.096s-7.594,17.099-17.099,17.099-17.096-7.594-17.096-17.099,7.59-17.096,17.096-17.096ZM27.981,42.374c4.165,0,7.429,3.261,7.429,7.426s-3.265,7.429-7.429,7.429-7.426-3.265-7.426-7.429,3.261-7.426,7.426-7.426ZM113.5,42.374c4.165,0,7.429,3.261,7.429,7.426s-3.265,7.429-7.429,7.429-7.426-3.265-7.426-7.429,3.261-7.426,7.426-7.426Z" inkscape:connector-curvature="0" inkscape:export-filename="Nextcloud Hub logo variants.png" inkscape:export-xdpi="300" inkscape:export-ydpi="300" fill="#fff"/>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 2.3 KiB

@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:svg="http://www.w3.org/2000/svg" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:cc="http://creativecommons.org/ns#" version="1.1" viewBox="0 0 141.49 99.6">
<!-- Generator: Adobe Illustrator 30.3.0, SVG Export Plug-In . SVG Version: 2.1.3 Build 182) -->
<defs>
<style>
.st0 {
fill: #fff;
}
</style>
</defs>
<path id="path1052" class="st0" d="M70.83,22.15c-12.59,0-23.26,8.54-26.57,20.1-2.88-6.14-9.1-10.43-16.28-10.43-9.87,0-17.98,8.11-17.98,17.98s8.11,17.99,17.98,17.99c7.18,0,13.41-4.3,16.28-10.44,3.31,11.57,13.98,20.11,26.57,20.11s23.12-8.41,26.51-19.85c2.93,6,9.08,10.18,16.15,10.18,9.87,0,17.99-8.12,17.99-17.99s-8.12-17.98-17.99-17.98c-7.07,0-13.23,4.18-16.15,10.17-3.39-11.44-14.01-19.84-26.51-19.84h0ZM70.83,32.7c9.51,0,17.1,7.59,17.1,17.1s-7.59,17.1-17.1,17.1-17.1-7.59-17.1-17.1,7.59-17.1,17.1-17.1ZM27.98,42.37c4.16,0,7.43,3.26,7.43,7.43s-3.26,7.43-7.43,7.43-7.43-3.26-7.43-7.43,3.26-7.43,7.43-7.43ZM113.5,42.37c4.17,0,7.43,3.26,7.43,7.43s-3.26,7.43-7.43,7.43-7.43-3.26-7.43-7.43,3.26-7.43,7.43-7.43Z" inkscape:connector-curvature="0" inkscape:export-filename="Nextcloud Hub logo variants.png" inkscape:export-xdpi="300" inkscape:export-ydpi="300"/>
</svg>

After

Width:  |  Height:  |  Size: 1.5 KiB

+17 -15
View File
@@ -1,26 +1,28 @@
{
"fill" : {
"solid" : "display-p3:0.10980,0.68627,1.00000,1.00000"
"linear-gradient" : [
"display-p3:0.10980,0.68627,1.00000,1.00000",
"srgb:0.00000,0.50980,0.78824,1.00000"
],
"orientation" : {
"start" : {
"x" : 0.5,
"y" : 0
},
"stop" : {
"x" : 0.5,
"y" : 0.7
}
}
},
"groups" : [
{
"layers" : [
{
"glass-specializations" : [
{
"value" : true
},
{
"idiom" : "square",
"value" : true
}
],
"hidden" : false,
"image-name" : "Nextcloud-logo-markonly-white.svg",
"name" : "Nextcloud-logo-markonly-white",
"opacity" : 1,
"image-name" : "Nextcloud-logo-white.svg",
"name" : "Nextcloud-logo-white",
"position" : {
"scale" : 7,
"scale" : 6.8,
"translation-in-points" : [
0,
0
@@ -0,0 +1,57 @@
// SPDX-FileCopyrightText: Nextcloud GmbH
// SPDX-FileCopyrightText: 2026 Marino Faggiana
// SPDX-License-Identifier: GPL-3.0-or-later
import Foundation
import Photos
import NextcloudKit
extension BackgroundUploadExtension {
/// Validates Photos access, feature settings, the active auto-upload account, and server support.
/// Configures the account's NextcloudKit session and returns `nil` when processing must be skipped.
func setupAccount() async -> tableAccount? {
guard PHPhotoLibrary.authorizationStatus(for: .readWrite) == .authorized else {
logInfo("Background upload account setup skipped: Photos authorization is not granted")
return nil
}
guard NCPreferences().shouldUseBackgroundUploadExtension else {
logInfo("Background upload account setup skipped: feature is disabled")
return nil
}
guard let account = await database.getTableAccountAsync(predicate: NSPredicate(format: "autoUploadStart == true")) else {
logInfo("Background upload account setup skipped: no Auto Upload account")
return nil
}
// The extension runs in its own process, so rebuild the in-memory session from shared account data.
NextcloudKit.shared.appendSession(
account: account.account,
urlBase: account.urlBase,
user: account.user,
userId: account.userId,
password: NCPreferences().getPassword(account: account.account),
userAgent: userAgent,
httpMaximumConnectionsPerHost: NCBrandOptions.shared.httpMaximumConnectionsPerHost,
httpMaximumConnectionsPerHostInDownload: NCBrandOptions.shared.httpMaximumConnectionsPerHostInDownload,
httpMaximumConnectionsPerHostInUpload: NCBrandOptions.shared.httpMaximumConnectionsPerHostInUpload,
groupIdentifier: NCBrandOptions.shared.capabilitiesGroup
)
guard let capabilities = await database.getCapabilities(account: account.account) else {
logError("Background upload account setup failed: capabilities not found for \(account.account)")
return nil
}
guard NCBrandOptions.shared.isServerVersion(
capabilities,
greaterOrEqualTo: .v35
) else {
logInfo("Background upload extension stopped because account \(account.account) uses a server lower than version 35")
return nil
}
return account
}
}
@@ -0,0 +1,56 @@
// SPDX-FileCopyrightText: Nextcloud GmbH
// SPDX-FileCopyrightText: 2026 Marino Faggiana
// SPDX-License-Identifier: GPL-3.0-or-later
import Foundation
import Photos
import NextcloudKit
extension BackgroundUploadExtension {
/// Builds the authenticated WebDAV PUT request that PhotoKit uses as an upload destination.
/// Applies network policy and asset timestamps, returning `nil` when URL or session data is invalid.
func buildDestination(metadata: tableMetadata, asset: PHAsset) -> URLRequest? {
guard let url = metadata.serverUrlFileName.encodedToUrl as? URL else {
logError("Invalid destination URL: \(metadata.serverUrlFileName)")
return nil
}
guard let nkSession = nkComm.nksessions.session(forAccount: metadata.account) else {
logError("Session not found for account: \(metadata.account)")
return nil
}
let wifiOnly = metadata.session == nkComm.identifierSessionUploadBackgroundWWan
let loginString = "\(nkSession.user):\(nkSession.password)"
var request = URLRequest(url: url)
guard let loginData = loginString.data(using: .utf8) else {
logError("Unable to encode credentials for account: \(metadata.account)")
return nil
}
request.httpMethod = "PUT"
request.allowsCellularAccess = !wifiOnly
request.allowsExpensiveNetworkAccess = true
request.setValue(nkSession.userAgent, forHTTPHeaderField: "User-Agent")
request.setValue("Basic \(loginData.base64EncodedString())", forHTTPHeaderField: "Authorization")
request.setValue("application/octet-stream", forHTTPHeaderField: "Content-Type")
// Let Nextcloud create missing auto-upload folders and identify PhotoKit-specific requests.
request.setValue("1", forHTTPHeaderField: "X-NC-WebDAV-Auto-Mkcol")
request.setValue("1", forHTTPHeaderField: "X-NC-PhotoKit-Upload")
if let creationDate = asset.creationDate,
creationDate.timeIntervalSince1970 > 0 {
request.setValue("\(creationDate.timeIntervalSince1970)", forHTTPHeaderField: "X-OC-CTime")
}
if let modificationDate = asset.modificationDate,
modificationDate.timeIntervalSince1970 > 0 {
request.setValue("\(modificationDate.timeIntervalSince1970)", forHTTPHeaderField: "X-OC-MTime")
}
logInfo("Destination created for \(metadata.fileName) -> \(metadata.serverUrlFileName)")
return request
}
}
@@ -0,0 +1,331 @@
// SPDX-FileCopyrightText: Nextcloud GmbH
// SPDX-FileCopyrightText: 2026 Marino Faggiana
// SPDX-License-Identifier: GPL-3.0-or-later
import Foundation
import Photos
import NextcloudKit
extension BackgroundUploadExtension {
/// Finds eligible assets and creates up to `limit` pending metadata records for their resources.
/// Confirmed transfers advance the incremental date; unfinished resources keep it from moving past them.
func createPendingMetadatas(account: tableAccount, limit: Int) async -> Bool {
guard limit > 0,
account.autoUploadImage || account.autoUploadVideo else {
return false
}
let autoUploadServerUrlBase = await database.getAccountAutoUploadServerUrlBaseAsync(
account: account.account,
urlBase: account.urlBase,
userId: account.userId
)
let livePhotoEnabled = NCPreferences().livePhoto
let fetchOptions = PHFetchOptions()
var mediaPredicates: [NSPredicate] = []
if account.autoUploadImage {
mediaPredicates.append(NSPredicate(format: "mediaType == %d", PHAssetMediaType.image.rawValue))
}
if account.autoUploadVideo {
mediaPredicates.append(NSPredicate(format: "mediaType == %d", PHAssetMediaType.video.rawValue))
}
var predicates: [NSPredicate] = [NSCompoundPredicate(orPredicateWithSubpredicates: mediaPredicates)]
if let datePredicate = account.autoUploadDatePredicate {
predicates.append(datePredicate)
}
fetchOptions.predicate = NSCompoundPredicate(andPredicateWithSubpredicates: predicates)
fetchOptions.sortDescriptors = [NSSortDescriptor(key: "creationDate", ascending: true)]
let fetchResults = autoUploadCollections(for: account).map {
PHAsset.fetchAssets(in: $0, options: fetchOptions)
}
var fetchIndexes = Array(repeating: 0, count: fetchResults.count)
var yieldedAssetIdentifiers = Set<String>()
guard let activeMetadatas = await database.getMetadatasAsync(predicate: NSPredicate(
format: "account == %@ AND autoUploadServerUrlBase == %@ AND status IN %@",
account.account, autoUploadServerUrlBase, global.metadataStatusUploadingAllMode
), limit: nil) else { return false }
let activeAssets = Dictionary(grouping: activeMetadatas, by: \.assetLocalIdentifier)
var trackedMetadataFileNames = Set(activeMetadatas.map(\.fileNameView))
var remaining = limit
var madeProgress = false
var lastUploadedDate: Date?
var canAdvanceSinceDate = true
// PhotoKit already sorts every result; merge them lazily and stop as soon as the job slots are full.
discoveryLoop: while remaining > 0,
let asset = nextAsset(from: fetchResults, indexes: &fetchIndexes, yieldedIdentifiers: &yieldedAssetIdentifiers) {
guard let current = database.getTableAccount(account: account.account),
current.autoUploadStart,
current.autoUploadSessionIdentifier == account.autoUploadSessionIdentifier else { break }
let isLivePhotoAsset = asset.mediaSubtypes.contains(.photoLive)
let isLivePhoto = isLivePhotoAsset && livePhotoEnabled
let history: [NCAutoUploadResource]
do {
history = try await NCLocalDatabase.shared.autoUploadResources(
account: account.account,
serverUrlBase: autoUploadServerUrlBase,
assetLocalIdentifier: asset.localIdentifier,
sessionIdentifier: account.autoUploadForceReupload ? account.autoUploadSessionIdentifier : nil
)
} catch {
logError("Unable to read background upload history: \(error)")
break
}
let queued = activeAssets[asset.localIdentifier] ?? []
let queuedClasses = Set(queued.map(\.classFile))
let primaryClassFile = asset.mediaType == .video ? NKTypeClassFile.video.rawValue : NKTypeClassFile.image.rawValue
let requiredClasses = isLivePhoto ? [primaryClassFile, NKTypeClassFile.video.rawValue] : [primaryClassFile]
let uploadedClasses = Set(history.filter(\.uploaded).map(\.classFile))
if requiredClasses.allSatisfy({ uploadedClasses.contains($0) }) {
if canAdvanceSinceDate { lastUploadedDate = asset.creationDate ?? lastUploadedDate }
continue
}
// Check capacity before generating a name that may advance the incremental counter.
guard requiredClasses.filter({ !uploadedClasses.contains($0) && !queuedClasses.contains($0) }).count <= remaining else { break }
guard let primaryResource = primaryUploadResource(for: asset),
let originalFileName = primaryResource.filename,
!originalFileName.isEmpty else {
logError("Upload resource not found for asset \(asset.localIdentifier)")
canAdvanceSinceDate = false
continue
}
let creationDate = asset.creationDate ?? Date()
let queuedPrimary = queued.first { $0.classFile == primaryClassFile }
let primaryFileName = queuedPrimary?.fileNameView
?? queued.first { $0.isLivePhotoVideo }?.livePhotoFile
?? history.first { $0.classFile == primaryClassFile }?.fileName
?? utilityFileSystem.createFileName(originalFileName, fileDate: creationDate, fileType: asset.mediaType)
let videoFileName = queued.first { $0.classFile == NKTypeClassFile.video.rawValue }?.fileNameView
?? queuedPrimary.flatMap { $0.isLivePhotoImage ? $0.livePhotoFile : nil }
?? history.first { $0.classFile == NKTypeClassFile.video.rawValue }?.fileName
?? (primaryFileName as NSString).deletingPathExtension + ".mov"
var uploadResources: [(resource: PHAssetResource, fileName: String, classFile: String, livePhotoFile: String)]
if isLivePhoto {
guard let pairedVideoResource = pairedVideoResource(for: asset) else {
logError("Paired video resource not found for Live Photo asset \(asset.localIdentifier)")
canAdvanceSinceDate = false
continue
}
uploadResources = [
(primaryResource, primaryFileName, NKTypeClassFile.image.rawValue, videoFileName),
(pairedVideoResource, videoFileName, NKTypeClassFile.video.rawValue, primaryFileName)
]
} else {
uploadResources = [
(primaryResource, primaryFileName, primaryClassFile, "")
]
}
// Completed components are independent from the server metadata refreshed by sync.
canAdvanceSinceDate = false
let resourcesToUpload = uploadResources.filter {
!uploadedClasses.contains($0.classFile) && !queuedClasses.contains($0.classFile) && !trackedMetadataFileNames.contains($0.fileName)
}
// Each resource selects its own pipeline: PhotoKit up to 100 MB, host-app chunks above it.
for uploadResource in resourcesToUpload {
let chunkSize = Int64(uploadResource.resource.dataSize ?? 0) > Int64(global.chunkSize) ? global.chunkSize : nil
let inserted = await createPendingMetadata(
asset: asset,
resource: uploadResource.resource,
fileName: uploadResource.fileName,
classFile: uploadResource.classFile,
livePhotoFile: uploadResource.livePhotoFile,
legacyChunkSize: chunkSize,
account: account
)
guard inserted else { break discoveryLoop }
trackedMetadataFileNames.insert(uploadResource.fileName)
remaining -= 1
madeProgress = true
}
}
if let lastUploadedDate {
await database.updateAutoUploadSinceDateIfEnabledAsync(lastUploadedDate, account: account.account, sessionIdentifier: account.autoUploadSessionIdentifier)
}
return madeProgress
}
/// Returns the next oldest unique asset across already sorted PhotoKit fetch results.
/// Only one candidate per selected collection is retained, keeping discovery memory bounded.
private func nextAsset(from fetchResults: [PHFetchResult<PHAsset>], indexes: inout [Int], yieldedIdentifiers: inout Set<String>) -> PHAsset? {
var selectedResultIndex: Int?
var selectedAsset: PHAsset?
for resultIndex in fetchResults.indices {
let result = fetchResults[resultIndex]
while indexes[resultIndex] < result.count {
let candidate = result.object(at: indexes[resultIndex])
if yieldedIdentifiers.contains(candidate.localIdentifier) {
indexes[resultIndex] += 1
continue
}
if let selectedAsset,
(candidate.creationDate ?? .distantPast) >= (selectedAsset.creationDate ?? .distantPast) {
break
}
selectedResultIndex = resultIndex
selectedAsset = candidate
break
}
}
guard let selectedResultIndex, let selectedAsset else {
return nil
}
indexes[selectedResultIndex] += 1
yieldedIdentifiers.insert(selectedAsset.localIdentifier)
return selectedAsset
}
/// Creates the transfer metadata that connects a Photos resource to its server path.
/// Large resources remain ordinary metadata for the host app; all others wait for a PhotoKit job.
private func createPendingMetadata(asset: PHAsset, resource: PHAssetResource, fileName: String, classFile: String, livePhotoFile: String, legacyChunkSize: Int?, account: tableAccount) async -> Bool {
let session = NCSession.Session(account: account.account, urlBase: account.urlBase, user: account.user, userId: account.userId)
let autoUploadServerUrlBase = await database.getAccountAutoUploadServerUrlBaseAsync(account: account.account, urlBase: account.urlBase, userId: account.userId)
let serverUrl: String
let wifiOnly = asset.mediaType == .image ? account.autoUploadWWAnPhoto : account.autoUploadWWAnVideo
if account.autoUploadCreateSubfolder {
serverUrl = utilityFileSystem.createGranularityPath(asset: asset, serverUrlBase: autoUploadServerUrlBase, granularity: account.autoUploadSubfolderGranularity)
} else {
serverUrl = autoUploadServerUrlBase
}
let metadata = await NCManageDatabaseCreateMetadata().createMetadataAsync(fileName: fileName, ocId: UUID().uuidString, serverUrl: serverUrl, session: session, sceneIdentifier: nil)
metadata.assetLocalIdentifier = asset.localIdentifier
metadata.autoUploadServerUrlBase = autoUploadServerUrlBase
metadata.nativeFormat = true
metadata.contentType = resource.contentType.preferredMIMEType ?? "application/octet-stream"
metadata.typeIdentifier = resource.contentType.identifier
metadata.classFile = classFile
metadata.livePhotoFile = livePhotoFile
metadata.size = Int64(resource.dataSize ?? 0)
metadata.width = asset.pixelWidth
metadata.height = asset.pixelHeight
if let creationDate = asset.creationDate {
metadata.creationDate = creationDate as NSDate
}
if let modificationDate = asset.modificationDate {
metadata.date = modificationDate as NSDate
}
metadata.session = wifiOnly ? nkComm.identifierSessionUploadBackgroundWWan : nkComm.identifierSessionUploadBackground
metadata.sessionSelector = global.selectorUploadAutoUpload
metadata.sessionDate = Date()
metadata.status = global.metadataStatusWaitUpload
metadata.chunk = legacyChunkSize ?? 0
metadata.backgroundUploadJobIdentifier = legacyChunkSize == nil ? "pending" : ""
do {
guard try await NCLocalDatabase.shared.recordAutoUploadTransfer(metadata, sessionIdentifier: account.autoUploadSessionIdentifier) else { return false }
} catch {
logError("Unable to register background upload transfer: \(error)")
return false
}
await database.addAutoUploadMetadatasAsync([metadata], account: account.account, sessionIdentifier: account.autoUploadSessionIdentifier)
guard await database.getMetadataAsync(predicate: NSPredicate(format: "ocId == %@", metadata.ocId)) != nil else { return false }
if legacyChunkSize == nil {
logInfo("Created pending metadata for \(fileName), account: \(account.account), asset: \(asset.localIdentifier)")
} else {
logInfo("Deferred large resource to the host app chunked upload pipeline: \(fileName), size: \(metadata.size)")
}
return true
}
/// Selects the full-size primary resource for an image or video asset when available.
/// Falls back to the standard photo or video resource and rejects unsupported media types.
private func primaryUploadResource(for asset: PHAsset) -> PHAssetResource? {
let resources = PHAssetResource.assetResources(for: asset)
switch asset.mediaType {
case .image:
return resources.first {
$0.type == .fullSizePhoto
} ?? resources.first {
$0.type == .photo
}
case .video:
return resources.first {
$0.type == .fullSizeVideo
} ?? resources.first {
$0.type == .video
}
default:
return nil
}
}
/// Selects the motion component of a Live Photo, preferring its full-size representation.
/// Returns `nil` when the asset does not expose a paired video resource.
private func pairedVideoResource(for asset: PHAsset) -> PHAssetResource? {
let resources = PHAssetResource.assetResources(for: asset)
return resources.first {
$0.type == .fullSizePairedVideo
} ?? resources.first {
$0.type == .pairedVideo
}
}
/// Resolves the explicitly selected albums or, when none are configured, the Camera Roll.
/// An unavailable explicit selection returns no collections to avoid uploading unintended assets.
private func autoUploadCollections(for account: tableAccount) -> [PHAssetCollection] {
let albumIds = NCPreferences().getAutoUploadAlbumIds(account: account.account)
if !albumIds.isEmpty {
let result = PHAssetCollection.fetchAssetCollections(withLocalIdentifiers: Array(albumIds), options: nil)
var collections: [PHAssetCollection] = []
result.enumerateObjects { collection, _, _ in
collections.append(collection)
}
if collections.isEmpty {
logInfo("Background upload skipped because the selected albums are no longer available")
}
return collections
}
let result = PHAssetCollection.fetchAssetCollections(with: .smartAlbum, subtype: .smartAlbumUserLibrary, options: nil)
guard let cameraRoll = result.firstObject else {
return []
}
return [cameraRoll]
}
}
@@ -0,0 +1,644 @@
// SPDX-FileCopyrightText: Nextcloud GmbH
// SPDX-FileCopyrightText: 2026 Marino Faggiana
// SPDX-License-Identifier: GPL-3.0-or-later
import Foundation
import Photos
import NextcloudKit
extension BackgroundUploadExtension {
/// Converts pending metadata records into PhotoKit upload jobs until the job limit is reached.
/// Persists each PhotoKit identifier so later invocations can reconcile the job with Realm state.
func createUploadJobs(account: tableAccount) async throws -> Bool {
let availableJobs = availableUploadJobSlots()
guard availableJobs > 0 else {
logInfo("No available background upload job slots")
return false
}
let predicate = NSPredicate(
format: """
status == %d AND \
backgroundUploadJobIdentifier == %@ AND \
account == %@
""",
global.metadataStatusWaitUpload,
"pending",
account.account
)
guard let metadatas = await database.getMetadatasAsync(
predicate: predicate,
sortedByKeyPath: "sessionDate",
ascending: true,
limit: availableJobs
),
!metadatas.isEmpty else {
return false
}
let library = PHPhotoLibrary.shared()
var madeProgress = false
for metadata in metadatas {
guard let currentAccount = await database.getTableAccountAsync(
predicate: NSPredicate(format: "account == %@", account.account)
), currentAccount.autoUploadStart,
currentAccount.autoUploadSessionIdentifier == account.autoUploadSessionIdentifier else {
break
}
guard let currentMetadata = await database.getMetadataAsync(predicate: NSPredicate(format: "ocId == %@", metadata.ocId)),
!currentMetadata.backgroundUploadCancellationRequested else {
continue
}
let assets = PHAsset.fetchAssets(withLocalIdentifiers: [metadata.assetLocalIdentifier], options: nil)
guard let asset = assets.firstObject else {
await database.deleteMetadataAsync(id: metadata.ocId)
madeProgress = true
logInfo("Deleted pending background upload metadata for missing asset \(metadata.assetLocalIdentifier), file: \(metadata.fileName)")
continue
}
guard let resource = uploadResource(for: asset, metadata: metadata) else {
await database.deleteMetadataAsync(id: metadata.ocId)
madeProgress = true
logInfo(
"Deleted pending background upload metadata because the resource is no longer available for asset \(metadata.assetLocalIdentifier), file: \(metadata.fileName)"
)
continue
}
guard let backgroundUploadResource = try await NCLocalDatabase.shared.autoUploadResource(for: metadata) else { continue }
if backgroundUploadResource.uploaded {
await database.deleteMetadataAsync(id: metadata.ocId)
madeProgress = true
continue
}
guard let destination = buildDestination(metadata: metadata, asset: asset) else {
continue
}
var jobIdentifier: String?
// PhotoKit job creation must happen inside its library change transaction.
try library.performChangesAndWait {
guard let current = self.database.getTableAccount(account: account.account),
current.autoUploadStart,
current.autoUploadSessionIdentifier == account.autoUploadSessionIdentifier,
let currentMetadata = self.database.getMetadata(predicate: NSPredicate(format: "ocId == %@", metadata.ocId)),
!currentMetadata.backgroundUploadCancellationRequested,
currentMetadata.backgroundUploadJobIdentifier == "pending" else { return }
let request = PHAssetResourceUploadJobChangeRequest.creationRequestForJob(destination: destination, resource: resource)
jobIdentifier = request.placeholderForCreatedAssetResourceUploadJob?.localIdentifier
}
guard let jobIdentifier, !jobIdentifier.isEmpty else {
logError("Created job has no local identifier")
continue
}
await persistMetadataState(
.uploading(jobIdentifier: jobIdentifier, incrementRetryCount: false),
metadata: metadata
)
guard let savedMetadata = await database.getMetadataAsync(predicate: NSPredicate(format: "ocId == %@", metadata.ocId)),
!savedMetadata.backgroundUploadCancellationRequested else {
_ = try await cancelRequestedUploadJobs()
continue
}
if let current = database.getTableAccount(account: account.account),
!current.autoUploadStart || current.autoUploadSessionIdentifier != account.autoUploadSessionIdentifier {
metadata.backgroundUploadCancellationRequested = true
await database.updateBackgroundUploadMetadataAsync(metadata, expectedJobIdentifier: jobIdentifier)
_ = try await cancelRequestedUploadJobs()
break
}
madeProgress = true
logInfo("Created background upload job \(jobIdentifier), file: \(metadata.fileName), resource: \(resource.filename ?? "<unknown>")")
}
return madeProgress
}
/// Cancels jobs requested by the app and recovers jobs whose identifier was not persisted after creation.
/// A job is treated as orphaned only when no pending metadata matches its asset and destination.
func cancelRequestedUploadJobs() async throws -> Bool {
let library = PHPhotoLibrary.shared()
var madeProgress = false
let cancellableJobs = PHAssetResourceUploadJob.fetchJobs(action: .process, options: nil)
for index in 0..<cancellableJobs.count {
let job = cancellableJobs.object(at: index)
let jobIdentifier = job.localIdentifier
let metadata = await resolveMetadata(for: job)
guard let metadata else {
guard try cancel(job: job, library: library) else {
logError("Unable to cancel orphan background upload job \(jobIdentifier)")
continue
}
madeProgress = true
logInfo("Cancelled orphan background upload job \(jobIdentifier)")
continue
}
guard metadata.backgroundUploadCancellationRequested else {
continue
}
guard try cancel(job: job, library: library) else {
logError("Unable to cancel job \(jobIdentifier)")
continue
}
await database.deleteMetadataAsync(id: metadata.ocId)
madeProgress = true
logInfo("Cancelled background upload job \(jobIdentifier), file: \(metadata.fileName)")
}
let retryJobs = PHAssetResourceUploadJob.fetchJobs(action: .retry, options: nil)
let acknowledgeJobs = PHAssetResourceUploadJob.fetchJobs(action: .acknowledge, options: nil)
var handledTerminalJobIdentifiers = Set<String>()
for jobs in [retryJobs, acknowledgeJobs] {
for index in 0..<jobs.count {
let job = jobs.object(at: index)
let jobIdentifier = job.localIdentifier
// Failed jobs can appear in both collections; acknowledge each one only once.
guard handledTerminalJobIdentifiers.insert(jobIdentifier).inserted else {
continue
}
let metadata = await resolveMetadata(for: job)
guard let metadata else {
guard try acknowledge(job: job, library: library) else {
logError("Unable to acknowledge orphan background upload job \(jobIdentifier)")
continue
}
madeProgress = true
logInfo("Acknowledged orphan background upload job \(jobIdentifier)")
continue
}
guard metadata.backgroundUploadCancellationRequested else {
continue
}
if !(job.responseHeaderFields?["oc-fileid"] ?? "").isEmpty {
guard await processUploadSuccess(metadata: metadata, job: job) else { continue }
await persistMetadataState(.completed, metadata: metadata)
} else if job.state == .succeeded {
logError("Stop deferred for successful job without oc-fileid: \(jobIdentifier)")
continue
}
guard try acknowledge(job: job, library: library) else {
logError("Unable to acknowledge cancelled job \(jobIdentifier)")
continue
}
if metadata.status != global.metadataStatusNormal {
await database.deleteMetadataAsync(id: metadata.ocId)
}
madeProgress = true
logInfo("Acknowledged cancelled background upload job \(jobIdentifier), state: \(job.state.rawValue)")
}
}
return madeProgress
}
/// Examines jobs for which PhotoKit offers a retry and decides whether to retry or acknowledge them.
/// Server-confirmed uploads and permanent failures are acknowledged instead of being uploaded again.
func processRetryableUploadJobs() async throws -> Bool {
let jobs = PHAssetResourceUploadJob.fetchJobs(action: .retry, options: nil)
guard jobs.count > 0 else {
return false
}
let library = PHPhotoLibrary.shared()
var madeProgress = false
for index in 0..<jobs.count {
let job = jobs.object(at: index)
let jobIdentifier = job.localIdentifier
guard let metadata = await resolveMetadata(for: job) else {
guard try acknowledge(job: job, library: library) else {
logError("Unable to acknowledge orphan retry job \(jobIdentifier)")
continue
}
madeProgress = true
logInfo("Acknowledged orphan retry job \(jobIdentifier)")
continue
}
guard !metadata.backgroundUploadCancellationRequested else {
logInfo("Skipping retry for cancellation-requested job \(jobIdentifier)")
continue
}
let sessionIdentifier = database.getTableAccount(account: metadata.account)?.autoUploadSessionIdentifier ?? ""
logUploadJobDiagnostics(job: job, action: "retry")
if hasConfirmedUploadResponse(job: job) {
// Nextcloud committed the file even though PhotoKit classified the overwrite as failed.
// First persist the successful response in Realm, including the server file identifier,
// auto-upload history, and any pending Live Photo component.
guard await processUploadSuccess(metadata: metadata, job: job) else {
continue
}
// Close local tracking before acknowledging PhotoKit. If the extension stops between
// these operations, the remaining terminal job is safely acknowledged as an orphan.
await persistMetadataState(.completed, metadata: metadata)
// Acknowledgement is the final confirmation to PhotoKit: it removes the completed job
// from the system queue and prevents PhotoKit from uploading the same resource again.
guard try acknowledge(job: job, library: library) else {
logError("Unable to acknowledge server-confirmed retry job \(jobIdentifier)")
continue
}
madeProgress = true
logInfo("Accepted server-confirmed upload for \(metadata.fileName), job: \(jobIdentifier)")
continue
}
let authenticationRequired = isAuthenticationFailure(job: job)
let retryLimitReached = !canAutomaticallyRetry(metadata: metadata)
let queueSuspended = preferences.isBackgroundUploadSuspended(account: metadata.account)
// Stop before a fourth upload, invalid credentials, or work on a suspended account queue.
if authenticationRequired || retryLimitReached || queueSuspended {
if authenticationRequired {
// Invalid credentials affect every file, so suspend the account immediately.
preferences.setBackgroundUploadSuspended(true, account: metadata.account)
} else if retryLimitReached,
!queueSuspended,
recordTerminalUploadFailure(metadata: metadata) {
logError("Suspended background upload after \(maximumConsecutiveBackgroundUploadFailures) consecutive asset failures for account \(metadata.account)")
}
await updateMetadataForUploadFailure(metadata: metadata, job: job)
guard try acknowledge(job: job, library: library) else {
logError("Unable to acknowledge stopped job \(jobIdentifier)")
continue
}
// Keep the failed transfer available for an explicit retry from the host app.
await persistMetadataState(.manualRetryRequired, metadata: metadata, sessionIdentifier: sessionIdentifier)
madeProgress = true
if authenticationRequired {
logError("Stopped background upload after authentication failure for \(metadata.fileName), job: \(jobIdentifier)")
} else if retryLimitReached {
logError("Stopped background upload after \(maximumBackgroundUploadAttempts) failed attempts for \(metadata.fileName), job: \(jobIdentifier)")
} else {
logInfo("Stopped background upload because the account queue is suspended for \(metadata.fileName), job: \(jobIdentifier)")
}
continue
}
let assets = PHAsset.fetchAssets(withLocalIdentifiers: [metadata.assetLocalIdentifier], options: nil)
guard let asset = assets.firstObject else {
guard try acknowledge(job: job, library: library) else {
logError("Unable to acknowledge retry job for missing asset \(jobIdentifier)")
continue
}
await database.deleteMetadataAsync(id: metadata.ocId)
madeProgress = true
logInfo("Acknowledged retry job and deleted metadata for missing asset \(metadata.assetLocalIdentifier), file: \(metadata.fileName)")
continue
}
guard let destination = buildDestination(metadata: metadata, asset: asset) else {
logError("Unable to rebuild destination for job \(jobIdentifier)")
continue
}
guard let retryAccount = database.getTableAccount(account: metadata.account),
retryAccount.autoUploadStart else { continue }
var retryRequested = false
try library.performChangesAndWait {
guard let current = self.database.getTableAccount(account: metadata.account),
current.autoUploadStart,
current.autoUploadSessionIdentifier == retryAccount.autoUploadSessionIdentifier,
let currentMetadata = self.database.getMetadata(predicate: NSPredicate(format: "ocId == %@", metadata.ocId)),
!currentMetadata.backgroundUploadCancellationRequested else { return }
guard let request = PHAssetResourceUploadJobChangeRequest(for: job) else {
return
}
request.retry(destination: destination)
retryRequested = true
}
guard retryRequested else {
logError("Unable to create retry request for job \(jobIdentifier)")
continue
}
// PhotoKit is about to perform the next upload attempt for the same job.
await persistMetadataState(
.uploading(jobIdentifier: jobIdentifier, incrementRetryCount: true),
metadata: metadata
)
if let current = database.getTableAccount(account: metadata.account),
!current.autoUploadStart || current.autoUploadSessionIdentifier != retryAccount.autoUploadSessionIdentifier {
metadata.backgroundUploadCancellationRequested = true
await database.updateBackgroundUploadMetadataAsync(metadata, expectedJobIdentifier: jobIdentifier)
_ = try await cancelRequestedUploadJobs()
continue
}
madeProgress = true
logInfo("Retry requested for \(metadata.fileName), job: \(jobIdentifier)")
}
return madeProgress
}
/// Records terminal job results in Realm before acknowledging them to free PhotoKit capacity.
/// Successful uploads are finalized; retryable failures create pending work for a new job.
func acknowledgeUploadJobs() async throws -> Bool {
let jobs = PHAssetResourceUploadJob.fetchJobs(action: .acknowledge, options: nil)
guard jobs.count > 0 else {
return false
}
let library = PHPhotoLibrary.shared()
var madeProgress = false
for index in 0..<jobs.count {
let job = jobs.object(at: index)
let jobIdentifier = job.localIdentifier
guard let metadata = await resolveMetadata(for: job) else {
guard try acknowledge(job: job, library: library) else {
logError("Unable to acknowledge orphan job \(jobIdentifier)")
continue
}
madeProgress = true
logInfo("Acknowledged orphan job \(jobIdentifier)")
continue
}
guard !metadata.backgroundUploadCancellationRequested else {
logInfo("Skipping normal acknowledgement for cancellation-requested job \(jobIdentifier)")
continue
}
let sessionIdentifier = database.getTableAccount(account: metadata.account)?.autoUploadSessionIdentifier ?? ""
let uploadSucceeded: Bool
let createNewJob: Bool
switch job.state {
case .succeeded:
uploadSucceeded = await processUploadSuccess(metadata: metadata, job: job)
if !uploadSucceeded && hasConfirmedUploadResponse(job: job) { continue }
createNewJob = false
case .failed:
logUploadJobDiagnostics(job: job, action: "acknowledge")
if hasConfirmedUploadResponse(job: job) {
// A valid oc-fileid takes precedence over PhotoKit's failed state for HTTP 204.
uploadSucceeded = await processUploadSuccess(metadata: metadata, job: job)
guard uploadSucceeded else { continue }
createNewJob = false
logInfo("Accepted server-confirmed upload for \(metadata.fileName), job: \(jobIdentifier)")
} else {
let authenticationRequired = isAuthenticationFailure(job: job)
let retryLimitReached = !canAutomaticallyRetry(metadata: metadata)
let queueSuspended = preferences.isBackgroundUploadSuspended(account: metadata.account)
if authenticationRequired {
// Invalid credentials affect every file, so suspend the account immediately.
preferences.setBackgroundUploadSuspended(true, account: metadata.account)
} else if retryLimitReached,
!queueSuspended,
recordTerminalUploadFailure(metadata: metadata) {
logError("Suspended background upload after \(maximumConsecutiveBackgroundUploadFailures) consecutive asset failures for account \(metadata.account)")
}
await updateMetadataForUploadFailure(metadata: metadata, job: job)
uploadSucceeded = false
createNewJob = !authenticationRequired && !retryLimitReached && !queueSuspended
}
default:
logUploadJobDiagnostics(job: job, action: "acknowledge")
logError("Unexpected state \(job.state.rawValue) for job \(jobIdentifier)")
continue
}
if uploadSucceeded {
// Persist the closed local state first. If acknowledgement is interrupted, the
// remaining PhotoKit job is harmless and will be cleaned up as an orphan next time.
await persistMetadataState(.completed, metadata: metadata)
}
// The terminal result is now stored locally; acknowledge it to release PhotoKit's job slot.
guard try acknowledge(job: job, library: library) else {
logError("Unable to acknowledge job \(jobIdentifier)")
continue
}
if !uploadSucceeded && createNewJob {
// A PhotoKit job can be retried only once; create a fresh job for the remaining attempt.
await persistMetadataState(.pendingRetry, metadata: metadata, sessionIdentifier: sessionIdentifier)
logInfo("Prepared new background upload job for \(metadata.fileName), retry: \(metadata.backgroundUploadRetryCount)")
} else if !uploadSucceeded {
// `uploadError` prevents automatic scheduling while `pending` enables manual retry.
await persistMetadataState(.manualRetryRequired, metadata: metadata, sessionIdentifier: sessionIdentifier)
logInfo("Background upload requires a manual retry for \(metadata.fileName)")
}
madeProgress = true
logInfo("Acknowledged job \(jobIdentifier), state: \(job.state.rawValue)")
}
return madeProgress
}
/// Resolves a job through its stored identifier or reconnects it to metadata left pending by an interruption.
/// Asset identity narrows the candidates and the destination URL distinguishes Live Photo components.
private func resolveMetadata(for job: PHAssetResourceUploadJob) async -> tableMetadata? {
if let metadata = await database.getMetadataAsync(backgroundUploadJobIdentifier: job.localIdentifier) {
return metadata
}
guard let resource = PHAssetResource.assetResource(forUploadJob: job),
let destinationURL = job.destination.url else {
return nil
}
let candidates = await database.getPendingBackgroundUploadMetadatasAsync(
assetLocalIdentifier: resource.assetLocalIdentifier
)
let matchingCandidates = candidates.filter { metadata in
guard let metadataURL = metadata.serverUrlFileName.encodedToUrl as? URL else {
return false
}
return metadataURL == destinationURL
}
guard matchingCandidates.count == 1,
let metadata = matchingCandidates.first else {
if matchingCandidates.count > 1 {
logError("Unable to recover job \(job.localIdentifier): multiple pending metadata match its destination")
}
return nil
}
// PhotoKit committed the job before the previous process could store its identifier in Realm.
await persistMetadataState(
.uploading(jobIdentifier: job.localIdentifier, incrementRetryCount: false),
metadata: metadata
)
logInfo(
"Recovered background upload job \(job.localIdentifier), file: \(metadata.fileName), " +
"resource: \(resource.filename ?? "<unknown>")"
)
return await database.getMetadataAsync(backgroundUploadJobIdentifier: job.localIdentifier)
}
/// Resolves the Photos resource represented by a metadata record, including Live Photo components.
/// It prefers an exact filename match before falling back to the asset's primary resource type.
private func uploadResource(for asset: PHAsset, metadata: tableMetadata) -> PHAssetResource? {
let resources = PHAssetResource.assetResources(for: asset)
if metadata.isLivePhotoVideo {
return resources.first {
$0.type == .fullSizePairedVideo
} ?? resources.first {
$0.type == .pairedVideo
}
}
if metadata.isLivePhotoImage {
return resources.first {
$0.type == .fullSizePhoto
} ?? resources.first {
$0.type == .photo
}
}
if let resource = resources.first(where: {
$0.filename?.caseInsensitiveCompare(metadata.fileName) == .orderedSame
}) {
return resource
}
switch asset.mediaType {
case .image:
return resources.first {
$0.type == .fullSizePhoto
} ?? resources.first {
$0.type == .photo
}
case .video:
return resources.first {
$0.type == .fullSizeVideo
} ?? resources.first {
$0.type == .video
}
default:
return nil
}
}
/// Confirms to PhotoKit that the terminal result has already been persisted and can be discarded.
/// Acknowledgement removes the job from the system queue and prevents any further retry for it.
/// Returns `false` if PhotoKit cannot create a change request for the supplied job.
private func acknowledge(job: PHAssetResourceUploadJob, library: PHPhotoLibrary) throws -> Bool {
var acknowledged = false
try library.performChangesAndWait {
guard let request = PHAssetResourceUploadJobChangeRequest(for: job) else {
return
}
// This is the actual confirmation to PhotoKit; it is not another server request.
request.acknowledge()
acknowledged = true
}
return acknowledged
}
/// Requests cancellation of a registered or pending PhotoKit job inside a library transaction.
/// Returns `false` if the job is no longer mutable by the time the change block executes.
private func cancel(job: PHAssetResourceUploadJob, library: PHPhotoLibrary) throws -> Bool {
var cancelled = false
try library.performChangesAndWait {
guard let request = PHAssetResourceUploadJobChangeRequest(for: job) else {
return
}
request.cancel()
cancelled = true
}
return cancelled
}
/// Computes free PhotoKit capacity by deduplicating jobs exposed through all actionable states.
/// The extension intentionally caps its own queue at 20 jobs even if the system limit is higher.
func availableUploadJobSlots() -> Int {
let actions: [PHAssetResourceUploadJob.Action] = [.process, .retry, .acknowledge]
var jobIdentifiers = Set<String>()
for action in actions {
let jobs = PHAssetResourceUploadJob.fetchJobs(action: action, options: nil)
for index in 0..<jobs.count {
jobIdentifiers.insert(jobs.object(at: index).localIdentifier)
}
}
let jobLimit = min(PHAssetResourceUploadJob.jobLimit, 20)
return max(0, jobLimit - jobIdentifiers.count)
}
/// Reports whether PhotoKit still exposes jobs requiring processing, retry, or acknowledgement.
/// This keeps the extension scheduled while system-managed upload work remains outstanding.
func hasActiveUploadJobs() -> Bool {
PHAssetResourceUploadJob.fetchJobs(action: .process, options: nil).count > 0 ||
PHAssetResourceUploadJob.fetchJobs(action: .retry, options: nil).count > 0 ||
PHAssetResourceUploadJob.fetchJobs(action: .acknowledge, options: nil).count > 0
}
}
@@ -0,0 +1,114 @@
// SPDX-FileCopyrightText: Nextcloud GmbH
// SPDX-FileCopyrightText: 2026 Marino Faggiana
// SPDX-License-Identifier: GPL-3.0-or-later
import Foundation
import NextcloudKit
extension BackgroundUploadExtension {
/// Links up to ten fully uploaded Live Photo pairs without letting one failed pair block the others.
/// Failed records remain in Realm so a later extension run or the host app can retry safely.
func processPendingLivePhotos(account: String) async -> Bool {
let livePhotos = await database.getLivePhotos(account: account, limit: 10)
var madeProgress = false
for livePhoto in livePhotos {
if await linkLivePhoto(livePhoto, account: account) {
madeProgress = true
}
// An authentication failure affects the whole account; avoid repeating it for the batch.
if preferences.isBackgroundUploadSuspended(account: account) {
break
}
}
return madeProgress
}
/// Links both server resources and removes the pending record only after both calls succeed.
private func linkLivePhoto(_ livePhoto: tableLivePhoto, account: String) async -> Bool {
let videoResult = await NextcloudKit.shared.setLivephotoAsync(
serverUrlfileNamePath: livePhoto.serverUrlFileNameVideo,
livePhotoFile: livePhoto.fileIdImage,
account: account
)
guard videoResult.error == .success else {
return await handleLivePhotoLinkFailure(
livePhoto,
component: "video",
path: livePhoto.serverUrlFileNameVideo,
error: videoResult.error,
account: account
)
}
let imageResult = await NextcloudKit.shared.setLivephotoAsync(
serverUrlfileNamePath: livePhoto.serverUrlFileNameImage,
livePhotoFile: livePhoto.fileIdVideo,
account: account
)
guard imageResult.error == .success else {
return await handleLivePhotoLinkFailure(
livePhoto,
component: "image",
path: livePhoto.serverUrlFileNameImage,
error: imageResult.error,
account: account
)
}
await database.setLivePhotoFile(
fileId: livePhoto.fileIdVideo,
livePhotoFile: livePhoto.fileIdImage
)
await database.setLivePhotoFile(
fileId: livePhoto.fileIdImage,
livePhotoFile: livePhoto.fileIdVideo
)
await database.deleteLivePhoto(
account: account,
serverUrlFileNameNoExt: livePhoto.serverUrlFileNameNoExt
)
logInfo(
"Linked Live Photo \(livePhoto.serverUrlFileNameImage) with " +
"\(livePhoto.serverUrlFileNameVideo)"
)
return true
}
/// Removes pairs whose server resource no longer exists and retains transient failures for retry.
/// Authentication errors suspend the account immediately to avoid repeating invalid requests.
private func handleLivePhotoLinkFailure(
_ livePhoto: tableLivePhoto,
component: String,
path: String,
error: NKError,
account: String
) async -> Bool {
if error.errorCode == global.errorResourceNotFound {
await database.deleteLivePhoto(
account: account,
serverUrlFileNameNoExt: livePhoto.serverUrlFileNameNoExt
)
logError("Discarded Live Photo because its \(component) resource no longer exists: \(path)")
return true
}
await database.setLivePhotoError(
account: account,
serverUrlFileNameNoExt: livePhoto.serverUrlFileNameNoExt
)
if error.errorCode == global.errorUnauthorized {
preferences.setBackgroundUploadSuspended(true, account: account)
logError("Suspended background upload after a Live Photo authentication failure for account \(account)")
}
logError("Unable to link Live Photo \(component) \(path), error: \(error.logDescription)")
return false
}
}
@@ -0,0 +1,199 @@
// SPDX-FileCopyrightText: Nextcloud GmbH
// SPDX-FileCopyrightText: 2026 Marino Faggiana
// SPDX-License-Identifier: GPL-3.0-or-later
import Foundation
import Photos
import NextcloudKit
extension BackgroundUploadExtension {
/// Reports whether another automatic upload attempt is available for the metadata.
/// The stored retry count excludes the initial upload, so the limit reserves one attempt for it.
func canAutomaticallyRetry(metadata: tableMetadata) -> Bool {
metadata.backgroundUploadRetryCount < maximumBackgroundUploadAttempts - 1
}
/// Records a terminal asset failure and suspends the account after three distinct failures.
/// Returns `true` when this failure opens the account-level circuit breaker.
@discardableResult
func recordTerminalUploadFailure(metadata: tableMetadata) -> Bool {
let assetIdentifier = metadata.assetLocalIdentifier.isEmpty ? metadata.ocIdTransfer : metadata.assetLocalIdentifier
let failureCount = preferences.recordBackgroundUploadFailure(
account: metadata.account,
assetIdentifier: assetIdentifier
)
let shouldSuspend = failureCount >= maximumConsecutiveBackgroundUploadFailures
if shouldSuspend {
preferences.setBackgroundUploadSuspended(true, account: metadata.account)
}
return shouldSuspend
}
/// Detects authentication failures from normalized response headers or the sanitized URL error.
/// The shared classification keeps retry and acknowledgement behavior consistent.
func isAuthenticationFailure(job: PHAssetResourceUploadJob) -> Bool {
let error = job.error.map { $0 as NSError }
return job.responseHeaderFields?["www-authenticate"] != nil ||
(error?.domain == NSURLErrorDomain && error?.code == URLError.userAuthenticationRequired.rawValue)
}
/// Treats a valid Nextcloud file identifier as proof that the server committed the upload.
/// This covers successful overwrites that PhotoKit may expose as failed after an HTTP 204 response.
func hasConfirmedUploadResponse(job: PHAssetResourceUploadJob) -> Bool {
guard let ocId = job.responseHeaderFields?["oc-fileid"] else {
return false
}
return !ocId.isEmpty
}
/// Logs the diagnostic values PhotoKit exposes for a failed or otherwise unexpected upload job.
/// Request headers are excluded and sensitive response header values are redacted.
func logUploadJobDiagnostics(job: PHAssetResourceUploadJob, action: String) {
let error = job.error.map { $0 as NSError }
let sensitiveHeaderNames = Set(["authorization", "cookie", "proxy-authorization", "set-cookie"])
let responseHeaders = job.responseHeaderFields?.reduce(into: [String: String]()) { result, header in
result[header.key] = sensitiveHeaderNames.contains(header.key.lowercased())
? "<redacted>"
: header.value
} ?? [:]
let state: String
let type: String
switch job.state {
case .registered:
state = "registered"
case .pending:
state = "pending"
case .failed:
state = "failed"
case .succeeded:
state = "succeeded"
case .cancelled:
state = "cancelled"
@unknown default:
state = "unknown"
}
switch job.type {
case .upload:
type = "upload"
case .downloadOnly:
type = "downloadOnly"
@unknown default:
type = "unknown"
}
var destinationComponents = job.destination.url.flatMap {
URLComponents(url: $0, resolvingAgainstBaseURL: false)
}
destinationComponents?.user = nil
destinationComponents?.password = nil
destinationComponents?.query = nil
destinationComponents?.fragment = nil
logInfo(
"PhotoKit job diagnostics, action: \(action), job: \(job.localIdentifier), " +
"state: \(state) (\(job.state.rawValue)), type: \(type) (\(job.type.rawValue)), " +
"method: \(job.destination.httpMethod ?? "<nil>"), " +
"destination: \(destinationComponents?.string ?? "<nil>"), " +
"error domain: \(error?.domain ?? "<nil>"), code: \(error?.code ?? 0), " +
"description: \(error?.localizedDescription ?? "<nil>"), " +
"failure reason: \(error?.localizedFailureReason ?? "<nil>"), " +
"recovery suggestion: \(error?.localizedRecoverySuggestion ?? "<nil>"), " +
"userInfo: \(error?.userInfo ?? [:]), headers: \(responseHeaders)"
)
}
/// Stores the terminal upload error and resets transient task state on the associated metadata.
/// Authentication failures receive a stable error code so the host app can require manual retry.
func updateMetadataForUploadFailure(metadata: tableMetadata, job: PHAssetResourceUploadJob) async {
let error: NKError
if isAuthenticationFailure(job: job) {
error = NKError(errorCode: NSURLErrorUserAuthenticationRequired, errorDescription: "Authentication required for account \(metadata.user)")
} else if let jobError = job.error {
error = NKError(error: jobError)
} else {
error = NKError(errorCode: NSURLErrorUnknown, errorDescription: "Background upload failed")
}
await persistMetadataState(.failed(error), metadata: metadata)
logError("Background upload failed for \(metadata.fileName), account: \(metadata.account), job: \(job.localIdentifier), error: \(error.logDescription)")
}
/// Applies Nextcloud response metadata and records the asset as successfully auto-uploaded.
/// A missing `oc-fileid` converts the result to an upload error and requires manual recovery.
func processUploadSuccess(metadata: tableMetadata, job: PHAssetResourceUploadJob) async -> Bool {
let succeeded = await NCBackgroundUploadExtensionManager.shared.recordUploadSuccess(metadata: metadata, job: job)
if !succeeded, !hasConfirmedUploadResponse(job: job) {
await persistMetadataState(
.failed(NKError(errorCode: NSURLErrorBadServerResponse, errorDescription: "Upload response missing oc-fileid")),
metadata: metadata
)
}
return succeeded
}
/// Applies a complete background-upload state transition and persists it in Realm.
/// Keeping related fields together prevents partially configured metadata between processing stages.
func persistMetadataState(_ state: MetadataState, metadata: tableMetadata, sessionIdentifier: String? = nil) async {
let expectedJobIdentifier = metadata.backgroundUploadJobIdentifier
switch state {
case let .uploading(jobIdentifier, incrementRetryCount):
if incrementRetryCount, metadata.backgroundUploadRetryCount < Int.max {
metadata.backgroundUploadRetryCount += 1
}
metadata.backgroundUploadJobIdentifier = jobIdentifier
metadata.backgroundUploadNextRetryDate = nil
metadata.sessionDate = Date()
metadata.sessionError = ""
metadata.errorCode = 0
metadata.errorKind = ""
metadata.status = global.metadataStatusUploading
case .pendingRetry:
if metadata.backgroundUploadRetryCount < Int.max {
metadata.backgroundUploadRetryCount += 1
}
metadata.backgroundUploadJobIdentifier = "pending"
metadata.backgroundUploadNextRetryDate = nil
metadata.sessionTaskIdentifier = 0
metadata.sessionDate = Date()
metadata.status = global.metadataStatusWaitUpload
case .manualRetryRequired:
metadata.backgroundUploadJobIdentifier = "pending"
metadata.backgroundUploadNextRetryDate = nil
case let .failed(error):
metadata.sessionTaskIdentifier = 0
metadata.sessionDate = Date()
metadata.sessionError = error.errorDescription
metadata.errorCode = error.errorCode
metadata.errorKind = error.kind?.rawValue ?? ""
metadata.status = global.metadataStatusUploadError
case .completed:
metadata.chunk = 0
metadata.sceneIdentifier = nil
metadata.session = ""
metadata.sessionError = ""
metadata.errorKind = ""
metadata.sessionDate = nil
metadata.sessionTaskIdentifier = 0
metadata.status = global.metadataStatusNormal
metadata.backgroundUploadJobIdentifier = ""
metadata.backgroundUploadRetryCount = 0
metadata.backgroundUploadNextRetryDate = nil
}
await database.updateBackgroundUploadMetadataAsync(metadata, expectedJobIdentifier: expectedJobIdentifier, sessionIdentifier: sessionIdentifier)
}
}
@@ -0,0 +1,184 @@
// SPDX-FileCopyrightText: Nextcloud GmbH
// SPDX-FileCopyrightText: 2026 Marino Faggiana
// SPDX-License-Identifier: GPL-3.0-or-later
import ExtensionFoundation
import Photos
import NextcloudKit
import OSLog
@main
final class BackgroundUploadExtension: PHBackgroundResourceUploadJobExtension {
private actor ProcessingCoordinator {
private var isProcessing = false
/// Claims the processing pass, or returns false when another invocation already owns it.
func beginProcessing() -> Bool {
guard !isProcessing else { return false }
isProcessing = true
return true
}
/// Releases the processing pass after every success or handled failure.
func endProcessing() {
isProcessing = false
}
}
private static let processingCoordinator = ProcessingCoordinator()
enum MetadataState: Sendable {
case uploading(jobIdentifier: String, incrementRetryCount: Bool)
case pendingRetry
case manualRetryRequired
case failed(NKError)
case completed
}
let global = NCGlobal.shared
let database = NCManageDatabase.shared
let utilityFileSystem = NCUtilityFileSystem()
let nkComm = NextcloudKit.shared.nkCommonInstance
let preferences = NCPreferences()
let logger = Logger(subsystem: Bundle.main.bundleIdentifier ?? "BackgroundUploadExtension", category: NCGlobal.shared.logTagBackgroundUpload)
// One initial upload followed by at most two automatic retry attempts.
let maximumBackgroundUploadAttempts = 3
// Suspend the account after this many distinct assets fail without an intervening success.
let maximumConsecutiveBackgroundUploadFailures = 3
private let isDatabaseAvailable: Bool
/// Opens the shared Realm database and configures NextcloudKit for extension use.
/// A schema mismatch is retained as initialization state so job processing can fail safely.
required init() {
NextcloudKit.configureLogger(
logLevel: NCBrandOptions.shared.disable_log ? .disabled : NCPreferences().log,
logDirectory: NCPreferences.sharedLogDirectory
)
NextcloudKit.shared.setup(groupIdentifier: NCBrandOptions.shared.capabilitiesGroup)
isDatabaseAvailable = NCManageDatabase.shared.openRealm()
if isDatabaseAvailable {
logInfo("BackgroundUploadExtension initialized, bundle: \(Bundle.main.bundleIdentifier ?? "<nil>")")
} else {
logError("BackgroundUploadExtension initialization stopped because the database schema version does not match")
}
}
/// Reconciles cancellations, retries, completed jobs, and newly discovered assets in that order.
/// Returns whether PhotoKit should continue processing, stop, or report an unrecoverable failure.
func processJobs() async -> PHBackgroundResourceUploadProcessingResult {
defer { NextcloudKit.flushLogger() }
guard isDatabaseAvailable else {
return .failure
}
guard await Self.processingCoordinator.beginProcessing() else {
logInfo("processJobs skipped because another invocation is active")
return .processing
}
let result = await processJobsPass()
await Self.processingCoordinator.endProcessing()
return result
}
/// Performs one exclusive reconciliation pass after the shared coordinator grants ownership.
private func processJobsPass() async -> PHBackgroundResourceUploadProcessingResult {
logInfo("processJobs begin")
let account = await setupAccount()
var processingStage = "cancelRequestedUploadJobs"
do {
var madeProgress = false
// Remove jobs cancelled by the user and clean up PhotoKit jobs no longer backed by metadata.
if try await cancelRequestedUploadJobs() {
madeProgress = true
}
// Inspect jobs offered for retry; confirmed uploads are acknowledged without uploading again.
processingStage = "processRetryableUploadJobs"
if try await processRetryableUploadJobs() {
madeProgress = true
}
// Persist terminal upload results before acknowledging them and releasing PhotoKit capacity.
processingStage = "acknowledgeUploadJobs"
if try await acknowledgeUploadJobs() {
madeProgress = true
}
if let account {
// Link completed Live Photo pairs unless a previous failure suspended the account queue.
if !preferences.isBackgroundUploadSuspended(account: account.account) {
processingStage = "processPendingLivePhotos"
if await processPendingLivePhotos(account: account.account) {
madeProgress = true
}
}
if preferences.isBackgroundUploadSuspended(account: account.account) {
logInfo("Background upload queue is suspended for account \(account.account)")
} else {
// Register metadata already waiting in Realm before discovering more Photos assets.
processingStage = "createUploadJobs(existing metadata)"
if try await createUploadJobs(account: account) {
madeProgress = true
}
// Fill only the remaining PhotoKit slots so discovery stays bounded for large libraries.
let availableJobs = availableUploadJobSlots()
if availableJobs > 0,
await createPendingMetadatas(account: account, limit: availableJobs) {
madeProgress = true
// Convert the metadata just discovered into executable PhotoKit upload jobs.
processingStage = "createUploadJobs(new metadata)"
if try await createUploadJobs(account: account) {
madeProgress = true
}
}
}
}
// Keep the extension scheduled while this pass progressed or PhotoKit still owns active jobs.
let hasActiveJobs = hasActiveUploadJobs()
let result: PHBackgroundResourceUploadProcessingResult = madeProgress || hasActiveJobs ? .processing : .completed
logInfo("processJobs end, madeProgress: \(madeProgress), hasActiveJobs: \(hasActiveJobs)")
return result
} catch let error as NSError where error.domain == PHPhotosErrorDomain && error.code == PHPhotosError.limitExceeded.rawValue {
logInfo("Job limit reached during \(processingStage)")
return .processing
} catch {
let error = error as NSError
logError("processJobs error during \(processingStage): " + "domain: \(error.domain), code: \(error.code), " + "description: \(error.localizedDescription), userInfo: \(error.userInfo)")
return .failure
}
}
/// Receives the PhotoKit notification that the extension process is about to terminate.
/// It currently records the lifecycle event without interrupting an active processing pass.
func willTerminate() async {
logInfo("BackgroundUploadExtension will terminate")
NextcloudKit.flushLogger()
}
/// Writes an informational message to unified logging and the persistent shared log.
func logInfo(_ message: String) {
logger.notice("\(message, privacy: .public)")
nkLog(tag: global.logTagBackgroundUpload, emoji: .info, message: message)
}
/// Writes an error to unified logging and to the persistent Nextcloud log.
/// Use this for failures that require later diagnosis from the host app.
func logError(_ message: String) {
logger.error("\(message, privacy: .public)")
nkLog(tag: global.logTagBackgroundUpload, emoji: .error, message: message)
}
}
@@ -0,0 +1,319 @@
// SPDX-FileCopyrightText: Nextcloud GmbH
// SPDX-FileCopyrightText: 2026 Marino Faggiana
// SPDX-License-Identifier: GPL-3.0-or-later
import Foundation
import Photos
import NextcloudKit
@available(iOS 27, *)
final class NCBackgroundUploadExtensionManager {
static let shared = NCBackgroundUploadExtensionManager()
private let database = NCManageDatabase.shared
private let global = NCGlobal.shared
/// Creates the shared host-app manager used to control the PhotoKit extension state.
/// Callers access this instance through `shared` so enable and disable decisions stay centralized.
private init() {}
/// Checks whether device authorization, app settings, account state, and server version allow delegation.
/// This method evaluates eligibility only and does not change the PhotoKit extension state.
func shouldUseExtension() async -> Bool {
guard PHPhotoLibrary.authorizationStatus(for: .readWrite) == .authorized else {
return false
}
guard NCPreferences().shouldUseBackgroundUploadExtension else {
return false
}
guard let account = await database.getTableAccountAsync(predicate: NSPredicate(format: "autoUploadStart == true")) else {
return false
}
let capabilities = await NKCapabilities.shared.getCapabilities(for: account.account)
guard NCBrandOptions.shared.isServerVersion(capabilities, greaterOrEqualTo: .v35) else {
nkLog(tag: global.logTagBackgroundUpload, message: "Background upload extension unavailable for account \(account.account): server version is lower than 35")
return false
}
return true
}
/// Enables the PhotoKit upload extension when eligible and refreshes its network options if active.
/// Returns the resulting PhotoKit enabled state, or `false` when eligibility or configuration fails.
func ensureEnabled() async -> Bool {
guard NCPreferences().shouldUseBackgroundUploadExtension else {
_ = await disableIfIdle()
return false
}
guard await shouldUseExtension() else {
return false
}
let library = PHPhotoLibrary.shared()
let options = PHAssetResourceUploadJobOptions()
// Per-request settings still enforce Wi-Fi-only uploads where configured by the account.
options.preventsExpensiveNetworkAccess = false
do {
if library.uploadJobExtensionEnabled {
try library.setUploadJobExtensionOptions(options)
} else {
try library.enableUploadJobExtension(with: options)
}
nkLog(tag: global.logTagBackgroundUpload, message: "Background upload extension enabled: \(library.uploadJobExtensionEnabled)")
logUploadJobSnapshot()
return library.uploadJobExtensionEnabled
} catch {
nkLog(tag: global.logTagBackgroundUpload, message: "Background upload extension enable failed: \(error)")
return false
}
}
/// Reads PhotoKit's actionable jobs without changing their state or requesting another upload.
/// Pending jobs are outstanding work, not evidence that data is currently being transferred.
private func logUploadJobSnapshot() {
let actions: [(PHAssetResourceUploadJob.Action, String)] = [
(.process, "process"),
(.retry, "retry"),
(.acknowledge, "acknowledge")
]
var jobIdentifiers = Set<String>()
for (action, actionName) in actions {
let jobs = PHAssetResourceUploadJob.fetchJobs(action: action, options: nil)
nkLog(tag: global.logTagBackgroundUpload, message: "PhotoKit queue snapshot, action: \(actionName), count: \(jobs.count)")
for index in 0..<jobs.count {
let job = jobs.object(at: index)
jobIdentifiers.insert(job.localIdentifier)
let state: String
switch job.state {
case .registered:
state = "registered"
case .pending:
state = "pending"
case .failed:
state = "failed"
case .succeeded:
state = "succeeded"
case .cancelled:
state = "cancelled"
@unknown default:
state = "unknown"
}
let error = job.error.map { $0 as NSError }
nkLog(
tag: global.logTagBackgroundUpload,
message: "PhotoKit queue job, action: \(actionName), job: \(job.localIdentifier), " +
"state: \(state) (\(job.state.rawValue)), type: \(job.type.rawValue), " +
"error domain: \(error?.domain ?? "<nil>"), code: \(error?.code ?? 0)"
)
}
}
nkLog(tag: global.logTagBackgroundUpload, message: "PhotoKit queue snapshot, unique jobs: \(jobIdentifiers.count)")
}
func recordUploadSuccess(metadata: tableMetadata, job: PHAssetResourceUploadJob) async -> Bool {
let nkComm = NextcloudKit.shared.nkCommonInstance
let preferences = NCPreferences()
let headers = job.responseHeaderFields ?? [:]
guard let ocId = headers["oc-fileid"], !ocId.isEmpty else {
// A successful response without Nextcloud metadata is a server-level compatibility error.
preferences.setBackgroundUploadSuspended(true, account: metadata.account)
logUploadMessage("Successful job without oc-fileid: \(job.localIdentifier)")
return false
}
do {
let sessionIdentifier = database.getTableAccount(account: metadata.account)?.autoUploadSessionIdentifier
guard try await NCLocalDatabase.shared.recordAutoUploadTransfer(metadata, sessionIdentifier: sessionIdentifier, uploaded: true) else { return false }
} catch {
// Keep the terminal PhotoKit job available until its success is durably recorded.
logUploadMessage("Unable to persist background upload completion: \(error)")
return false
}
// Any confirmed upload breaks the sequence of consecutive asset failures.
preferences.resetBackgroundUploadConsecutiveFailures(account: metadata.account)
let etag = nkComm.normalizedETag(
headers["oc-etag"] ?? headers["etag"]
)
let date = headers["date"]?.parsedDate(
using: "EEE, dd MMM y HH:mm:ss zzz"
)
let ownerId = headers["x-nc-ownerid"]
let permissions = headers["x-nc-permissions"]
metadata.uploadDate = (date as? NSDate) ?? NSDate()
metadata.etag = etag ?? ""
metadata.ocId = ocId
if let fileId = NCUtility().ocIdToFileId(ocId: ocId) {
metadata.fileId = fileId
}
if let ownerId, !ownerId.isEmpty {
metadata.ownerId = ownerId
if let ownerDisplayName = await NCManageDatabase.shared.getOwnerDisplayName(account: metadata.account, ownerId: ownerId) {
metadata.ownerDisplayName = ownerDisplayName
}
}
if let permissions, !permissions.isEmpty {
metadata.permissions = permissions
}
await database.replaceMetadataAsync(ocId: metadata.ocIdTransfer, metadata: metadata)
if metadata.isLivePhoto,
let capabilities = await database.getCapabilities(account: metadata.account),
capabilities.isLivePhotoServerAvailable {
await database.setLivePhotoVideo(
account: metadata.account,
serverUrlFileName: metadata.serverUrlFileName,
fileId: metadata.fileId,
classFile: metadata.classFile
)
}
do {
try await NCLocalDatabase.shared.recordPhotoLibraryAssetUpload(
account: metadata.account,
assetLocalIdentifier: metadata.assetLocalIdentifier,
classFile: metadata.classFile,
isLivePhoto: metadata.isLivePhoto,
creationDate: metadata.creationDate as Date
)
} catch {
// The server upload remains successful even if its local PhotoKit state cannot be recorded.
logUploadMessage("Unable to record uploaded photo library asset \(metadata.assetLocalIdentifier): \(error)")
}
logUploadMessage("Completed background upload for \(metadata.fileName), job: \(job.localIdentifier), ocId: \(ocId)")
return true
}
private func logUploadMessage(_ message: String) {
nkLog(tag: global.logTagBackgroundUpload, message: message)
}
/// Drains this account's jobs immediately; successful uploads are recorded before acknowledgement.
func cancelUploads(account: String) async {
defer { NextcloudKit.flushLogger() }
let library = PHPhotoLibrary.shared()
let actions: [PHAssetResourceUploadJob.Action] = [.process, .retry, .acknowledge]
var handled = Set<String>()
for action in actions {
let jobs = PHAssetResourceUploadJob.fetchJobs(action: action, options: nil)
for index in 0..<jobs.count {
let job = jobs.object(at: index)
guard handled.insert(job.localIdentifier).inserted,
let metadata = await database.getMetadataAsync(backgroundUploadJobIdentifier: job.localIdentifier),
metadata.account == account,
metadata.backgroundUploadCancellationRequested else { continue }
let confirmed = !(job.responseHeaderFields?["oc-fileid"] ?? "").isEmpty
if confirmed {
guard await recordUploadSuccess(metadata: metadata, job: job) else { continue }
metadata.status = global.metadataStatusNormal
metadata.session = ""
metadata.sessionTaskIdentifier = 0
metadata.sessionDate = nil
metadata.sessionError = ""
metadata.errorCode = 0
metadata.errorKind = ""
metadata.chunk = 0
metadata.sceneIdentifier = nil
metadata.backgroundUploadRetryCount = 0
metadata.backgroundUploadNextRetryDate = nil
await database.replaceMetadataAsync(ocId: metadata.ocIdTransfer, metadata: metadata)
} else if job.state == .succeeded {
// Keep an unverified success recoverable instead of silently losing its result.
logUploadMessage("Stop deferred for successful job without oc-fileid: \(job.localIdentifier)")
continue
}
do {
var changed = false
try library.performChangesAndWait {
guard let request = PHAssetResourceUploadJobChangeRequest(for: job) else { return }
if job.state == .registered || job.state == .pending {
request.cancel()
} else {
request.acknowledge()
}
changed = true
}
guard changed else { continue }
if confirmed {
metadata.backgroundUploadJobIdentifier = ""
metadata.backgroundUploadCancellationRequested = false
await database.replaceMetadataAsync(ocId: metadata.ocIdTransfer, metadata: metadata)
} else {
await database.deleteMetadataAsync(id: metadata.ocId)
}
logUploadMessage("Stopped background upload job: \(job.localIdentifier)")
} catch {
logUploadMessage("Unable to stop background upload job \(job.localIdentifier): \(error)")
}
}
}
_ = await disableIfIdle()
}
/// Includes queued jobs and terminal results still waiting for acknowledgement.
func hasOutstandingUploadJobs() -> Bool {
let actions: [PHAssetResourceUploadJob.Action] = [.process, .retry, .acknowledge]
return actions.contains { PHAssetResourceUploadJob.fetchJobs(action: $0, options: nil).count > 0 }
}
/// Disables the PhotoKit extension after the feature or auto upload is turned off and no jobs remain.
/// Active metadata defers disabling so cancellations and terminal results can still be reconciled.
func disableIfIdle() async -> Bool {
let featureEnabled = NCPreferences().shouldUseBackgroundUploadExtension
let account = await database.getTableAccountAsync(predicate: NSPredicate(format: "autoUploadStart == true"))
guard !featureEnabled || account == nil else {
return false
}
let predicate = NSPredicate(format: "sessionSelector == %@ AND backgroundUploadJobIdentifier != ''", global.selectorUploadAutoUpload)
let metadatas: [tableMetadata] = await database.getMetadatasAsync(predicate: predicate)
guard metadatas.isEmpty, !hasOutstandingUploadJobs() else {
nkLog(tag: global.logTagBackgroundUpload, message: "Background upload extension disable deferred: metadata or PhotoKit jobs still active")
return false
}
let library = PHPhotoLibrary.shared()
guard library.uploadJobExtensionEnabled else {
return true
}
do {
try library.disableUploadJobExtension()
nkLog(tag: global.logTagBackgroundUpload, message: "Background upload extension disabled")
return !library.uploadJobExtensionEnabled
} catch {
nkLog(tag: global.logTagBackgroundUpload, message: "Background upload extension disable failed: \(error)")
return false
}
}
}
@@ -0,0 +1,65 @@
// SPDX-FileCopyrightText: Nextcloud GmbH
// SPDX-FileCopyrightText: 2026 Marino Faggiana
// SPDX-License-Identifier: GPL-3.0-or-later
import Foundation
import NextcloudKit
import RealmSwift
import OSLog
final class NCManageDatabase {
static let shared = NCManageDatabase()
internal let core: NCManageDatabaseCore
internal let databaseURL: URL?
private let logger = Logger(subsystem: Bundle.main.bundleIdentifier ?? "BackgroundUploadExtension", category: NCGlobal.shared.logTagBackgroundUpload)
/// Creates the extension database facade and resolves the Realm file inside the shared app group.
/// A missing app-group container leaves `databaseURL` unset and causes `openRealm()` to fail safely.
private init() {
self.core = NCManageDatabaseCore()
if let dirGroup = FileManager.default.containerURL(forSecurityApplicationGroupIdentifier: NCBrandOptions.shared.capabilitiesGroup) {
self.databaseURL = dirGroup
.appendingPathComponent(NCGlobal.shared.appDatabaseNextcloud)
.appendingPathComponent(databaseName)
} else {
self.databaseURL = nil
}
}
/// Validates the shared Realm schema before installing and opening the extension configuration.
/// Returns `false` without migrating when the database is unavailable, incompatible, or cannot open.
@discardableResult
func openRealm() -> Bool {
guard let databaseURL,
let schemaVersion = try? schemaVersionAtURL(databaseURL),
schemaVersion == databaseSchemaVersion else {
logger.error("Realm was not opened because its schema version does not match the extension")
return false
}
do {
let configuration = Realm.Configuration(
fileURL: databaseURL,
schemaVersion: databaseSchemaVersion,
objectTypes: [
NCKeyValue.self, tableMetadata.self, tableLocalFile.self, tableMetadataTag.self, tableLivePhoto.self,
tableDirectory.self, tableAccount.self, tableCapabilities.self
]
)
Realm.Configuration.defaultConfiguration = configuration
let realm = try Realm(configuration: configuration)
if let url = realm.configuration.fileURL {
logger.notice("Realm is located at: \(url.path, privacy: .public)")
}
return true
} catch let error {
logger.error("Realm error: \(error.localizedDescription, privacy: .public)")
nkLog(tag: NCGlobal.shared.logTagBackgroundUpload, emoji: .error, message: "Realm error: \(error)")
isSuspendingDatabaseOperation = true
return false
}
}
}
+27
View File
@@ -0,0 +1,27 @@
<!--
- SPDX-FileCopyrightText: Nextcloud GmbH
- SPDX-FileCopyrightText: 2026 Marino Faggiana
- SPDX-License-Identifier: GPL-3.0-or-later
-->
# Background upload extension
The following diagram documents the complete background-upload flow, including asset discovery, Live Photo handling, foreground chunk routing, PhotoKit job creation, server-confirmed success, automatic retries, acknowledgements, and account-level suspension.
![Background upload extension flow](diagram.png)
## Routing summary
- A regular photo or video up to 100 MB is uploaded by PhotoKit.
- A regular resource larger than 100 MB is stored as foreground metadata and handled by the host app.
- A complete Live Photo up to 100 MB in total creates separate PhotoKit jobs for its HEIC and MOV resources.
- A complete Live Photo larger than 100 MB in total creates one metadata seed; the host app later extracts and uploads both components.
- After foreground extraction, the host app recalculates the actual chunk requirement for every concrete file using the current network.
## PhotoKit result handling
- A valid `oc-fileid` confirms that Nextcloud committed the upload, even when PhotoKit reports the job as failed after an HTTP 204 response.
- A failed upload is attempted at most three times in total: the initial upload and two automatic retries.
- Authentication failures and successful responses without `oc-fileid` suspend the account queue immediately.
- Three consecutive terminal asset failures without an intervening success suspend the account queue.
- Terminal PhotoKit jobs are acknowledged only after their result has been persisted locally.
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 MiB

+14
View File
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.security.application-groups</key>
<array>
<string>group.it.twsweb.Crypto-Cloud</string>
</array>
<key>keychain-access-groups</key>
<array>
<string>$(AppIdentifierPrefix)it.twsweb.Crypto-Cloud</string>
</array>
</dict>
</plist>
+26
View File
@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST-1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDisplayName</key>
<string>Nextcloud Assistant</string>
<key>NSExtension</key>
<dict>
<key>NSExtensionAttributes</key>
<dict>
<key>NSExtensionActivationRule</key>
<dict>
<key>NSExtensionActivationSupportsText</key>
<true/>
</dict>
</dict>
<key>NSExtensionMainStoryboard</key>
<string>MainInterface</string>
<key>NSExtensionPointIdentifier</key>
<string>com.apple.ui-services</string>
</dict>
</dict>
</plist>
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.security.application-groups</key>
<array>
<string>group.it.twsweb.Crypto-Cloud</string>
</array>
<key>keychain-access-groups</key>
<array>
<string>$(AppIdentifierPrefix)it.twsweb.Crypto-Cloud</string>
</array>
</dict>
</plist>
+13
View File
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>BackgroundUploadURLBase</key>
<string>https://cloud.nextcloud.com</string>
<key>EXAppExtensionAttributes</key>
<dict>
<key>EXExtensionPointIdentifier</key>
<string>com.apple.photos.background-upload</string>
</dict>
</dict>
</plist>
+1 -1
View File
@@ -8,4 +8,4 @@ import Foundation
//
let databaseName = "nextcloud.realm"
let tableAccountBackup = "tableAccountBackup.json"
let databaseSchemaVersion: UInt64 = 409
let databaseSchemaVersion: UInt64 = 424
-11
View File
@@ -6,17 +6,6 @@
<string>Nextcloud</string>
<key>NSExtension</key>
<dict>
<key>NSExtensionFileProviderActions</key>
<array>
<dict>
<key>NSExtensionFileProviderActionActivationRule</key>
<string>TRUEPREDICATE</string>
<key>NSExtensionFileProviderActionIdentifier</key>
<string>com.mycompany.FileProviderUI.CustomAction</string>
<key>NSExtensionFileProviderActionName</key>
<string>Custom Action</string>
</dict>
</array>
<key>NSExtensionMainStoryboard</key>
<string>MainInterface</string>
<key>NSExtensionPointIdentifier</key>
+2 -2
View File
@@ -81,10 +81,10 @@
<constraints>
<constraint firstItem="Z5d-gx-rTR" firstAttribute="centerX" secondItem="Xnz-EW-9gg" secondAttribute="centerX" id="5JN-bZ-Cfc"/>
<constraint firstItem="Z5d-gx-rTR" firstAttribute="top" relation="greaterThanOrEqual" secondItem="N4X-JQ-1c1" secondAttribute="bottom" constant="8" id="5bf-uK-zTE"/>
<constraint firstItem="o6I-qu-IDh" firstAttribute="leading" secondItem="Yku-CN-snD" secondAttribute="leading" constant="8" id="5fD-CQ-g64"/>
<constraint firstItem="o6I-qu-IDh" firstAttribute="leading" secondItem="Xnz-EW-9gg" secondAttribute="leading" constant="8" id="5fD-CQ-g64"/>
<constraint firstItem="Yyc-bK-mqW" firstAttribute="centerX" secondItem="Xnz-EW-9gg" secondAttribute="centerX" id="73g-Jz-FyB"/>
<constraint firstItem="Eu1-Gv-7Jx" firstAttribute="top" secondItem="o6I-qu-IDh" secondAttribute="bottom" constant="8" id="Eeu-jq-3mJ"/>
<constraint firstItem="Yku-CN-snD" firstAttribute="trailing" secondItem="o6I-qu-IDh" secondAttribute="trailing" constant="8" id="Hc4-PE-nDo"/>
<constraint firstItem="Xnz-EW-9gg" firstAttribute="trailing" secondItem="o6I-qu-IDh" secondAttribute="trailing" constant="8" id="Hc4-PE-nDo"/>
<constraint firstItem="o6I-qu-IDh" firstAttribute="centerX" secondItem="Xnz-EW-9gg" secondAttribute="centerX" id="XgO-Ht-bat"/>
<constraint firstItem="Yyc-bK-mqW" firstAttribute="top" secondItem="Eu1-Gv-7Jx" secondAttribute="bottom" priority="250" constant="64" id="avi-Qq-NVJ"/>
<constraint firstItem="N4X-JQ-1c1" firstAttribute="top" secondItem="Yyc-bK-mqW" secondAttribute="bottom" constant="8" id="g2S-FI-zsd"/>
+1 -1
View File
@@ -54,7 +54,7 @@ class NCIntroViewController: UIViewController, UICollectionViewDataSource, UICol
if !NCManageDatabase.shared.getAllTableAccount().isEmpty {
let navigationItemCancel = UIBarButtonItem(image: UIImage(systemName: "xmark"), style: .plain, target: self, action: #selector(actionCancel(_:)))
navigationItemCancel.tintColor = textColor
navigationItem.leftBarButtonItem = navigationItemCancel
navigationItem.rightBarButtonItem = navigationItemCancel
}
pageControl.currentPageIndicatorTintColor = textColor
+52 -23
View File
@@ -20,6 +20,44 @@ let userAgent: String = {
The codename embodies the concept of dynamic, living matter — reflecting our vision of a platform that is not only powerful and reliable, but also capable of continuous transformation and intelligent adaptation.
*/
struct NextcloudVersion: Comparable {
let major: Int
let minor: Int
let micro: Int
init(_ major: Int, _ minor: Int = 0, _ micro: Int = 0) {
self.major = major
self.minor = minor
self.micro = micro
}
init(_ capabilities: NKCapabilities.Capabilities) {
self.major = capabilities.serverVersionMajor
self.minor = capabilities.serverVersionMinor
self.micro = capabilities.serverVersionMicro
}
static let v18 = NextcloudVersion(18)
static let v20 = NextcloudVersion(20)
static let v23 = NextcloudVersion(23)
static let v24 = NextcloudVersion(24)
static let v25 = NextcloudVersion(25)
static let v26 = NextcloudVersion(26)
static let v27 = NextcloudVersion(27)
static let v28 = NextcloudVersion(28)
static let v30 = NextcloudVersion(30)
static let v31 = NextcloudVersion(31)
static let v32 = NextcloudVersion(32)
static let v32_0_2 = NextcloudVersion(32, 0, 2)
static let v33 = NextcloudVersion(33)
static let v34 = NextcloudVersion(34)
static let v35 = NextcloudVersion(35)
static func < (lhs: NextcloudVersion, rhs: NextcloudVersion) -> Bool {
(lhs.major, lhs.minor, lhs.micro) < (rhs.major, rhs.minor, rhs.micro)
}
}
final class NCBrandOptions: @unchecked Sendable {
static let shared = NCBrandOptions()
@@ -27,7 +65,7 @@ final class NCBrandOptions: @unchecked Sendable {
var brandUserAgent: String = ""
var textCopyrightNextcloudiOS: String = "Nextcloud Matheria for iOS %@ © 2026"
var textCopyrightNextcloudServer: String = "Nextcloud Server %@"
var loginBaseUrl: String = "https://cloud.nextcloud.com"
var loginBaseUrl: String = ""
var pushNotificationServerProxy: String = ""
var linkLoginHost: String = "https://nextcloud.com/install"
var linkloginPreferredProviders: String = "https://nextcloud.com/signup-ios"
@@ -37,6 +75,8 @@ final class NCBrandOptions: @unchecked Sendable {
var mobileconfig: String = "/remote.php/dav/provisioning/apple-provisioning.mobileconfig"
var appStoreUrl: String = "https://apps.apple.com/in/app/nextcloud/id1125420102"
var doNotAskPasscodeAtStartup: Bool = false
// Auto Upload default folder
var folderDefaultAutoUpload: String = "Photos"
@@ -45,21 +85,21 @@ final class NCBrandOptions: @unchecked Sendable {
var capabilitiesGroupApps: String = "group.com.nextcloud.apps"
// BRAND ONLY
var use_AppConfig: Bool = false // Don't touch me !!
var use_AppConfig: Bool = false
// Use server theming color
var use_themingColor: Bool = true
// MDM settings
var disable_intro: Bool = false
var disable_request_login_url: Bool = false
var disable_multiaccount: Bool = false
var disable_more_external_site: Bool = false
var disable_openin_file: Bool = false // Don't touch me !!
var disable_openin_file: Bool = false
var disable_crash_service: Bool = false
var disable_log: Bool = false
var disable_mobileconfig: Bool = false
var disable_show_more_nextcloud_apps_in_settings: Bool = false
var doNotAskPasscodeAtStartup: Bool = false
var disable_source_code_in_settings: Bool = false
var enforce_passcode_lock = false
var enforce_privacyScreenEnabled = false
@@ -68,23 +108,23 @@ final class NCBrandOptions: @unchecked Sendable {
var enforce_servers: [(name: String, url: String)] = []
// Internal option behaviour
var cleanUpDay: Int = 0 // Set default "Delete all cached files older than" possible days value are: 0, 1, 7, 30, 90, 180, 365
var cleanUpDay: Int = 0 // Set default "Delete all cached files older than". Possible days value are: 0, 1, 7, 30, 90, 180, 365
// Max request/download/upload concurrent
// Max request/download/upload concurrent connections per host, default is 8 (same as iOS default)
let httpMaximumConnectionsPerHost: Int = 8
let httpMaximumConnectionsPerHostInDownload: Int = 8
let httpMaximumConnectionsPerHostInUpload: Int = 8
// Max request/download/upload process
// Max request/download/upload processes
let numMaximumProcess: Int = 20
// Number of failed attempts after reset app
// Number of failed attempts before resetting the app
let resetAppPasscodeAttempts: Int = 10
let passcodeSecondsFail: Int = 60
// Info Paging
enum NCInfoPagingTab: Int, CaseIterable {
case activity, sharing
case activity, sharing, details
}
init() {
@@ -129,19 +169,8 @@ final class NCBrandOptions: @unchecked Sendable {
}
func isServerVersion(_ capabilities: NKCapabilities.Capabilities,
greaterOrEqualTo major: Int,
_ minor: Int,
_ micro: Int) -> Bool {
let server = (
capabilities.serverVersionMajor,
capabilities.serverVersionMinor,
capabilities.serverVersionMicro
)
let required = (major, minor, micro)
return server >= required
greaterOrEqualTo version: NextcloudVersion) -> Bool {
return NextcloudVersion(capabilities) >= version
}
}
@@ -149,7 +178,7 @@ final class NCBrandColor: @unchecked Sendable {
static let shared = NCBrandColor()
// This is rewrited from customet theme, default is Nextcloud color
let customer: UIColor = UIColor(red: 0.0 / 255.0, green: 130.0 / 255.0, blue: 201.0 / 255.0, alpha: 1.0) // Nextcloud : #0082C9
let customer: UIColor = UIColor(red: 0.0 / 255.0, green: 130.0 / 255.0, blue: 201.0 / 255.0, alpha: 1.0) // Nextcloud default: #0082C9
var customerText: UIColor = .white
// INTERNAL DEFINE COLORS
+2 -3
View File
@@ -30,8 +30,7 @@
<key>NSExtensionAttributes</key>
<dict>
<key>NSExtensionActivationRule</key>
<string>SUBQUERY (extensionItems, $extensionItem, SUBQUERY ($extensionItem.attachments,$attachment,(ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO "public.data")).@count == $extensionItem.attachments.@count).@count &gt; 0
</string>
<string>SUBQUERY (extensionItems, $extensionItem, SUBQUERY ($extensionItem.attachments, $attachment, (ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO "public.data" OR ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO "public.text")).@count == $extensionItem.attachments.@count).@count &gt; 0</string>
</dict>
<key>NSExtensionMainStoryboard</key>
<string>MainInterface</string>
@@ -39,4 +38,4 @@
<string>com.apple.share-services</string>
</dict>
</dict>
</plist>
</plist>
-5
View File
@@ -2,11 +2,6 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
<key>NSExtension</key>
<dict>
<key>NSExtensionAttributes</key>
-10
View File
@@ -85,16 +85,6 @@
</array>
<key>PHPhotoLibraryPreventAutomaticLimitedAccessAlert</key>
<true/>
<key>UIAppFonts</key>
<array>
<string>Inconsolata-Light.ttf</string>
<string>Inconsolata-Regular.ttf</string>
<string>Inconsolata-ExtraLight.ttf</string>
<string>Inconsolata-Medium.ttf</string>
<string>Inconsolata-Bold.ttf</string>
<string>Inconsolata-ExtraBold.ttf</string>
<string>Inconsolata-Black.ttf</string>
</array>
<key>UIApplicationSceneManifest</key>
<dict>
<key>UIApplicationSupportsMultipleScenes</key>
+2
View File
@@ -0,0 +1,2 @@
SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors
SPDX-License-Identifier: GPL-3.0-or-later
@@ -1,85 +0,0 @@
//
// NCApplicationHandle.swift
// Nextcloud
//
// Created by Marino Faggiana on 25/11/22.
// Copyright © 2022 Marino Faggiana. All rights reserved.
//
// Author Marino Faggiana <marino.faggiana@nextcloud.com>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
import Foundation
import NextcloudKit
import UIKit
import Parchment
class NCApplicationHandle: NSObject {
// class: AppDelegate
// func nextcloudPushNotificationAction(data: [String: AnyObject])
func nextcloudPushNotificationAction(data: [String: AnyObject]) -> [String: AnyObject]? {
return data
}
// class: AppDelegate
// func application(_ application: UIApplication, continue userActivity: NSUserActivity, restorationHandler: @escaping ([UIUserActivityRestoring]?) -> Void)
func applicationOpenUserActivity(_ userActivity: NSUserActivity) -> Bool {
return false
}
// class: AppDelegate
// func: application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey: Any] = [:])
func applicationOpenURL(_ url: URL) -> Bool {
return false
}
// class: NCFunctionCenter
// func: downloadedFile(_ notification: NSNotification)
func downloadedFile(selector: String, metadata: tableMetadata) {
}
// class: NCMore
// func: loadItems()
func loadItems(functionMenu: inout [NKExternalSite]) {
}
// class: NCMore
// func: tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath)
func didSelectItem(_ item: NKExternalSite, viewController: UIViewController) {
}
// class: NCSharePaging
// func pagingViewController(_: PagingViewController, viewControllerAt index: Int) -> UIViewController
func pagingViewController(_: PagingViewController, viewControllerAt index: Int, metadata: tableMetadata, topHeight: CGFloat) -> UIViewController {
return UIViewController()
}
// class: NCSharePaging
// func pagingViewController(_: PagingViewController, pagingItemAt index: Int) -> PagingItem
func pagingViewController(_: PagingViewController, pagingItemAt index: Int) -> PagingItem {
return PagingIndexItem(index: index, title: "")
}
// class: NCActionCenter
func filterPages(pages: [NCBrandOptions.NCInfoPagingTab], page: NCBrandOptions.NCInfoPagingTab, metadata: tableMetadata) -> ([NCBrandOptions.NCInfoPagingTab], NCBrandOptions.NCInfoPagingTab) {
return (pages, page)
}
// class: NCNotification
func didSelectNotification(_ notification: NKNotifications, viewController: UIViewController) -> NKNotifications? {
return notification
}
}
@@ -1,25 +1,6 @@
//
// DocumentActionViewController.swift
// File Provider Extension UI
//
// Created by Marino Faggiana on 30/01/23.
// Copyright © 2023 Marino Faggiana. All rights reserved.
//
// Author Marino Faggiana <marino.faggiana@nextcloud.com>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
// SPDX-FileCopyrightText: Nextcloud GmbH
// SPDX-FileCopyrightText: 2023 Marino Faggiana
// SPDX-License-Identifier: GPL-3.0-or-later
import UIKit
import FileProviderUI
+22 -8
View File
@@ -42,7 +42,10 @@ class FileProviderData: NSObject {
let tblAccounts = NCManageDatabase.shared.getAllTableAccount()
var matchAccount: tableAccount?
NextcloudKit.configureLogger(logLevel: (NCBrandOptions.shared.disable_log ? .disabled : NCPreferences().log))
NextcloudKit.configureLogger(
logLevel: NCBrandOptions.shared.disable_log ? .disabled : NCPreferences().log,
logDirectory: NCPreferences.sharedLogDirectory
)
if let domain {
self.domain = domain
@@ -90,7 +93,7 @@ class FileProviderData: NSObject {
return isPaginated
} else if serverUrl == NCUtilityFileSystem().getHomeServer(session: session),
let capabilities = await NextcloudKit.shared.getCapabilitiesAsync(account: session.account).capabilities,
NCBrandOptions.shared.isServerVersion(capabilities, greaterOrEqualTo: 32, 0, 2) {
NCBrandOptions.shared.isServerVersion(capabilities, greaterOrEqualTo: .v32_0_2) {
isPaginated = true
return true
}
@@ -147,10 +150,7 @@ class FileProviderData: NSObject {
func downloadComplete(fileName: String,
serverUrl: String,
etag: String?,
date: Date?,
dateLastModified: Date?,
length: Int64,
allHeaderFields: [AnyHashable: Any]?,
task: URLSessionTask,
error: NKError) async {
let taskIdentifier = task.taskIdentifier
@@ -165,6 +165,7 @@ class FileProviderData: NSObject {
}
let ocId = metadata.ocId
let etag = NextcloudKit.shared.nkCommonInstance.findHeader("oc-etag", allHeaderFields: allHeaderFields)
await NCManageDatabase.shared.setMetadataSessionAsync(ocId: ocId,
session: "",
@@ -196,7 +197,8 @@ class FileProviderData: NSObject {
ocId: String?,
etag: String?,
date: Date?,
size: Int64,
ownerId: String?,
permissions: String?,
task: URLSessionTask,
error: NKError) async {
guard let metadata = await NCManageDatabase.shared.getMetadataAsync(predicate: NSPredicate(format: "serverUrl == %@ AND fileName == %@ AND sessionTaskIdentifier == %d", serverUrl, fileName, task.taskIdentifier)) else {
@@ -225,14 +227,26 @@ class FileProviderData: NSObject {
metadata.uploadDate = (date as? NSDate) ?? NSDate()
metadata.etag = etag ?? ""
metadata.ocId = ocId
metadata.size = size
if let fileId = fileProviderUtility().ocIdToFileId(ocId: ocId) {
metadata.fileId = fileId
}
if let ownerId, !ownerId.isEmpty {
metadata.ownerId = ownerId
if let ownerDisplayName = await NCManageDatabase.shared.getOwnerDisplayName(account: metadata.account, ownerId: ownerId) {
metadata.ownerDisplayName = ownerDisplayName
}
}
if let permissions, !permissions.isEmpty {
metadata.permissions = permissions
}
metadata.sceneIdentifier = nil
metadata.session = ""
metadata.sessionError = ""
metadata.errorKind = ""
metadata.sessionSelector = ""
metadata.sessionDate = nil
metadata.sessionTaskIdentifier = 0
@@ -139,7 +139,7 @@ extension FileProviderExtension {
} else {
completionHandler(nil, NSFileProviderError(.noSuchItem, userInfo: [NSLocalizedDescriptionKey: resultsMove.error.errorDescription, NSLocalizedFailureReasonErrorKey: ""]))
completionHandler(nil, NSFileProviderError(.noSuchItem, userInfo: [NSLocalizedDescriptionKey: resultsMove.error.localizedGenericMessage, NSLocalizedFailureReasonErrorKey: ""]))
return
}
}
@@ -176,7 +176,7 @@ extension FileProviderExtension {
} else if resultsMove.error.errorCode == NCGlobal.shared.errorBadRequest {
completionHandler(nil, NSFileProviderError(.noSuchItem, userInfo: [NSLocalizedDescriptionKey: resultsMove.error.errorDescription, NSLocalizedFailureReasonErrorKey: ""]))
completionHandler(nil, NSFileProviderError(.noSuchItem, userInfo: [NSLocalizedDescriptionKey: resultsMove.error.localizedGenericMessage, NSLocalizedFailureReasonErrorKey: ""]))
return
} else {
+121
View File
@@ -0,0 +1,121 @@
Creative Commons Legal Code
CC0 1.0 Universal
CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE
LEGAL SERVICES. DISTRIBUTION OF THIS DOCUMENT DOES NOT CREATE AN
ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS
INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES
REGARDING THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS
PROVIDED HEREUNDER, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM
THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED
HEREUNDER.
Statement of Purpose
The laws of most jurisdictions throughout the world automatically confer
exclusive Copyright and Related Rights (defined below) upon the creator
and subsequent owner(s) (each and all, an "owner") of an original work of
authorship and/or a database (each, a "Work").
Certain owners wish to permanently relinquish those rights to a Work for
the purpose of contributing to a commons of creative, cultural and
scientific works ("Commons") that the public can reliably and without fear
of later claims of infringement build upon, modify, incorporate in other
works, reuse and redistribute as freely as possible in any form whatsoever
and for any purposes, including without limitation commercial purposes.
These owners may contribute to the Commons to promote the ideal of a free
culture and the further production of creative, cultural and scientific
works, or to gain reputation or greater distribution for their Work in
part through the use and efforts of others.
For these and/or other purposes and motivations, and without any
expectation of additional consideration or compensation, the person
associating CC0 with a Work (the "Affirmer"), to the extent that he or she
is an owner of Copyright and Related Rights in the Work, voluntarily
elects to apply CC0 to the Work and publicly distribute the Work under its
terms, with knowledge of his or her Copyright and Related Rights in the
Work and the meaning and intended legal effect of CC0 on those rights.
1. Copyright and Related Rights. A Work made available under CC0 may be
protected by copyright and related or neighboring rights ("Copyright and
Related Rights"). Copyright and Related Rights include, but are not
limited to, the following:
i. the right to reproduce, adapt, distribute, perform, display,
communicate, and translate a Work;
ii. moral rights retained by the original author(s) and/or performer(s);
iii. publicity and privacy rights pertaining to a person's image or
likeness depicted in a Work;
iv. rights protecting against unfair competition in regards to a Work,
subject to the limitations in paragraph 4(a), below;
v. rights protecting the extraction, dissemination, use and reuse of data
in a Work;
vi. database rights (such as those arising under Directive 96/9/EC of the
European Parliament and of the Council of 11 March 1996 on the legal
protection of databases, and under any national implementation
thereof, including any amended or successor version of such
directive); and
vii. other similar, equivalent or corresponding rights throughout the
world based on applicable law or treaty, and any national
implementations thereof.
2. Waiver. To the greatest extent permitted by, but not in contravention
of, applicable law, Affirmer hereby overtly, fully, permanently,
irrevocably and unconditionally waives, abandons, and surrenders all of
Affirmer's Copyright and Related Rights and associated claims and causes
of action, whether now known or unknown (including existing as well as
future claims and causes of action), in the Work (i) in all territories
worldwide, (ii) for the maximum duration provided by applicable law or
treaty (including future time extensions), (iii) in any current or future
medium and for any number of copies, and (iv) for any purpose whatsoever,
including without limitation commercial, advertising or promotional
purposes (the "Waiver"). Affirmer makes the Waiver for the benefit of each
member of the public at large and to the detriment of Affirmer's heirs and
successors, fully intending that such Waiver shall not be subject to
revocation, rescission, cancellation, termination, or any other legal or
equitable action to disrupt the quiet enjoyment of the Work by the public
as contemplated by Affirmer's express Statement of Purpose.
3. Public License Fallback. Should any part of the Waiver for any reason
be judged legally invalid or ineffective under applicable law, then the
Waiver shall be preserved to the maximum extent permitted taking into
account Affirmer's express Statement of Purpose. In addition, to the
extent the Waiver is so judged Affirmer hereby grants to each affected
person a royalty-free, non transferable, non sublicensable, non exclusive,
irrevocable and unconditional license to exercise Affirmer's Copyright and
Related Rights in the Work (i) in all territories worldwide, (ii) for the
maximum duration provided by applicable law or treaty (including future
time extensions), (iii) in any current or future medium and for any number
of copies, and (iv) for any purpose whatsoever, including without
limitation commercial, advertising or promotional purposes (the
"License"). The License shall be deemed effective as of the date CC0 was
applied by Affirmer to the Work. Should any part of the License for any
reason be judged legally invalid or ineffective under applicable law, such
partial invalidity or ineffectiveness shall not invalidate the remainder
of the License, and in such case Affirmer hereby affirms that he or she
will not (i) exercise any of his or her remaining Copyright and Related
Rights in the Work or (ii) assert any associated claims and causes of
action with respect to the Work, in either case contrary to Affirmer's
express Statement of Purpose.
4. Limitations and Disclaimers.
a. No trademark or patent rights held by Affirmer are waived, abandoned,
surrendered, licensed or otherwise affected by this document.
b. Affirmer offers the Work as-is and makes no representations or
warranties of any kind concerning the Work, express, implied,
statutory or otherwise, including without limitation warranties of
title, merchantability, fitness for a particular purpose, non
infringement, or the absence of latent or other defects, accuracy, or
the present or absence of errors, whether or not discoverable, all to
the greatest extent permissible under applicable law.
c. Affirmer disclaims responsibility for clearing rights of other persons
that may apply to the Work or any use thereof, including without
limitation any person's Copyright and Related Rights in the Work.
Further, Affirmer disclaims responsibility for obtaining any necessary
consents, permissions or other rights required for any use of the
Work.
d. Affirmer understands and acknowledges that Creative Commons is not a
party to this document and has no duty or obligation with respect to
this CC0 or use of the Work.
+232
View File
@@ -0,0 +1,232 @@
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright © 2007 Free Software Foundation, Inc. <https://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed.
Preamble
The GNU General Public License is a free, copyleft license for software and other kinds of works.
The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. We, the Free Software Foundation, use the GNU General Public License for most of our software; it applies also to any other work released this way by its authors. You can apply it to your programs, too.
When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things.
To protect your rights, we need to prevent others from denying you these rights or asking you to surrender the rights. Therefore, you have certain responsibilities if you distribute copies of the software, or if you modify it: responsibilities to respect the freedom of others.
For example, if you distribute copies of such a program, whether gratis or for a fee, you must pass on to the recipients the same freedoms that you received. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights.
Developers that use the GNU GPL protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License giving you legal permission to copy, distribute and/or modify it.
For the developers' and authors' protection, the GPL clearly explains that there is no warranty for this free software. For both users' and authors' sake, the GPL requires that modified versions be marked as changed, so that their problems will not be attributed erroneously to authors of previous versions.
Some devices are designed to deny users access to install or run modified versions of the software inside them, although the manufacturer can do so. This is fundamentally incompatible with the aim of protecting users' freedom to change the software. The systematic pattern of such abuse occurs in the area of products for individuals to use, which is precisely where it is most unacceptable. Therefore, we have designed this version of the GPL to prohibit the practice for those products. If such problems arise substantially in other domains, we stand ready to extend this provision to those domains in future versions of the GPL, as needed to protect the freedom of users.
Finally, every program is threatened constantly by software patents. States should not allow patents to restrict development and use of software on general-purpose computers, but in those that do, we wish to avoid the special danger that patents applied to a free program could make it effectively proprietary. To prevent this, the GPL assures that patents cannot be used to render the program non-free.
The precise terms and conditions for copying, distribution and modification follow.
TERMS AND CONDITIONS
0. Definitions.
“This License” refers to version 3 of the GNU General Public License.
“Copyright” also means copyright-like laws that apply to other kinds of works, such as semiconductor masks.
“The Program” refers to any copyrightable work licensed under this License. Each licensee is addressed as “you”. “Licensees” and “recipients” may be individuals or organizations.
To “modify” a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a “modified version” of the earlier work or a work “based on” the earlier work.
A “covered work” means either the unmodified Program or a work based on the Program.
To “propagate” a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well.
To “convey” a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays “Appropriate Legal Notices” to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion.
1. Source Code.
The “source code” for a work means the preferred form of the work for making modifications to it. “Object code” means any non-source form of a work.
A “Standard Interface” means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language.
The “System Libraries” of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A “Major Component”, in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it.
The “Corresponding Source” for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work.
The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source.
The Corresponding Source for a work in source code form is that same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures.
When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified it, and giving a relevant date.
b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to “keep intact all notices”.
c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so.
A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an “aggregate” if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways:
a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b.
d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d.
A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work.
A “User Product” is either (1) a “consumer product”, which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, “normally used” refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product.
“Installation Information” for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made.
If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM).
The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying.
7. Additional Terms.
“Additional permissions” are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or authors of the material; or
e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors.
All other non-permissive additional terms are considered “further restrictions” within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11).
However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice.
Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License.
An “entity transaction” is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it.
11. Patents.
A “contributor” is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's “contributor version”.
A contributor's “essential patent claims” are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, “control” includes the right to grant patent sublicenses in a manner consistent with the requirements of this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version.
In the following three paragraphs, a “patent license” is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To “grant” such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party.
If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. “Knowingly relying” means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it.
A patent license is “discriminatory” if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program.
13. Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU Affero General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the special requirements of the GNU Affero General Public License, section 13, concerning interaction through a network will apply to the combination as such.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of the GNU General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns.
Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU General Public License “or any later version” applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU General Public License, you may choose any version ever published by the Free Software Foundation.
If the Program specifies that a proxy can decide which future versions of the GNU General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program.
Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM “AS IS” WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the “copyright” line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode:
<program> Copyright (C) <year> <name of author>
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, your program's commands might be different; for a GUI interface, you would use an “about box”.
You should also get your employer (if you work as a programmer) or school, if any, to sign a “copyright disclaimer” for the program, if necessary. For more information on this, and how to apply and follow the GNU GPL, see <https://www.gnu.org/licenses/>.
The GNU General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read <https://www.gnu.org/philosophy/why-not-lgpl.html>.
@@ -0,0 +1,9 @@
The Nextcloud marks
Nextcloud and the Nextcloud logo is a registered trademark of Nextcloud GmbH in Germany and/or other countries.
These guidelines cover the following marks pertaining both to the product names and the logo: “Nextcloud”
and the blue/white cloud logo with or without the word Nextcloud; the service “Nextcloud Enterprise”;
and our products: “Nextcloud Files”; “Nextcloud Groupware” and “Nextcloud Talk”.
This set of marks is collectively referred to as the “Nextcloud marks.”
Use of Nextcloud logos and other marks is only permitted under the guidelines provided by the Nextcloud GmbH.
A copy can be found at https://nextcloud.com/trademarks/
+18
View File
@@ -0,0 +1,18 @@
MIT License
Copyright (c) <year> <copyright holders>
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
associated documentation files (the "Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the
following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial
portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO
EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
USE OR OTHER DEALINGS IN THE SOFTWARE.
File diff suppressed because it is too large. Load diff
@@ -0,0 +1,375 @@
{
"originHash" : "7880536aedfe5f5b326df402ac666a6126ac1b325106ab3eb7b6c78a6ef725ff",
"pins" : [
{
"identity" : "abseil-cpp-binary",
"kind" : "remoteSourceControl",
"location" : "https://github.com/google/abseil-cpp-binary.git",
"state" : {
"revision" : "26509120768c4add61cc1a63059f15f4fb49edb4",
"version" : "1.2025051202.0"
}
},
{
"identity" : "alamofire",
"kind" : "remoteSourceControl",
"location" : "https://github.com/Alamofire/Alamofire",
"state" : {
"revision" : "bda9ed57d72988a3a2ada33d824583541f86eac6",
"version" : "5.12.2"
}
},
{
"identity" : "app-check",
"kind" : "remoteSourceControl",
"location" : "https://github.com/google/app-check.git",
"state" : {
"revision" : "c7eb17e5545f36e43dc50e70da09c2e999714e16",
"version" : "12.0.0"
}
},
{
"identity" : "codescanner",
"kind" : "remoteSourceControl",
"location" : "https://github.com/twostraws/CodeScanner.git",
"state" : {
"revision" : "5e886430238944c7200fc9e10dbf2d9550dba865",
"version" : "2.5.2"
}
},
{
"identity" : "dropdown",
"kind" : "remoteSourceControl",
"location" : "https://github.com/AssistoLab/DropDown",
"state" : {
"branch" : "master",
"revision" : "2ab6f6ce19f0117d1a76ea043ef8f57722c65d16"
}
},
{
"identity" : "easytipview",
"kind" : "remoteSourceControl",
"location" : "https://github.com/marinofaggiana/EasyTipView",
"state" : {
"branch" : "master",
"revision" : "bb25a13c8fa5d65144c8e5b5d31237b80a001b07"
}
},
{
"identity" : "firebase-ios-sdk",
"kind" : "remoteSourceControl",
"location" : "https://github.com/firebase/firebase-ios-sdk",
"state" : {
"revision" : "1c35b9453868cea1ecdf9f112b5b23b8b6343854",
"version" : "13.0.1"
}
},
{
"identity" : "google-ads-on-device-conversion-ios-sdk",
"kind" : "remoteSourceControl",
"location" : "https://github.com/googleads/google-ads-on-device-conversion-ios-sdk",
"state" : {
"revision" : "0208e2681ec81f8a9c81084696f60fcce26cb7ee",
"version" : "3.7.0"
}
},
{
"identity" : "googleappmeasurement",
"kind" : "remoteSourceControl",
"location" : "https://github.com/google/GoogleAppMeasurement.git",
"state" : {
"revision" : "1a3546fb9189292e9d64db9e72add7a286c0f85a",
"version" : "13.0.1"
}
},
{
"identity" : "googledatatransport",
"kind" : "remoteSourceControl",
"location" : "https://github.com/google/GoogleDataTransport.git",
"state" : {
"revision" : "ba3358d3c3dbae8ef230b58a46b97ad65e84e974",
"version" : "10.1.1"
}
},
{
"identity" : "googleutilities",
"kind" : "remoteSourceControl",
"location" : "https://github.com/google/GoogleUtilities.git",
"state" : {
"revision" : "cc31f5ed464b111f877ce8554cbef4455d410d91",
"version" : "8.1.4"
}
},
{
"identity" : "grdb.swift",
"kind" : "remoteSourceControl",
"location" : "https://github.com/groue/GRDB.swift",
"state" : {
"revision" : "b83108d10f42680d78f23fe4d4d80fc88dab3212",
"version" : "7.11.1"
}
},
{
"identity" : "grpc-binary",
"kind" : "remoteSourceControl",
"location" : "https://github.com/google/grpc-binary.git",
"state" : {
"revision" : "9d5e9f05670c9eab8d8c22731ddd5d4d9cf867a8",
"version" : "1.83.1"
}
},
{
"identity" : "gtm-session-fetcher",
"kind" : "remoteSourceControl",
"location" : "https://github.com/google/gtm-session-fetcher.git",
"state" : {
"revision" : "724a52eea6329b7e12d3ad8300d76ca9f3895fcc",
"version" : "5.3.1"
}
},
{
"identity" : "gzipswift",
"kind" : "remoteSourceControl",
"location" : "https://github.com/1024jp/GzipSwift",
"state" : {
"revision" : "41d37421fe2cbbfae4a5593dc29d12999fb73cd7",
"version" : "7.0.0"
}
},
{
"identity" : "interop-ios-for-google-sdks",
"kind" : "remoteSourceControl",
"location" : "https://github.com/google/interop-ios-for-google-sdks.git",
"state" : {
"revision" : "040d087ac2267d2ddd4cca36c757d1c6a05fdbfe",
"version" : "101.0.0"
}
},
{
"identity" : "keychainaccess",
"kind" : "remoteSourceControl",
"location" : "https://github.com/kishikawakatsumi/KeychainAccess",
"state" : {
"revision" : "84e546727d66f1adc5439debad16270d0fdd04e7",
"version" : "4.2.2"
}
},
{
"identity" : "leveldb",
"kind" : "remoteSourceControl",
"location" : "https://github.com/firebase/leveldb.git",
"state" : {
"revision" : "a0bc79961d7be727d258d33d5a6b2f1023270ba1",
"version" : "1.22.5"
}
},
{
"identity" : "lucidbanner",
"kind" : "remoteSourceControl",
"location" : "https://github.com/marinofaggiana/LucidBanner",
"state" : {
"revision" : "408af8b2ff2451f055ff17042d8b9fb5c822d5fd",
"version" : "0.8.0"
}
},
{
"identity" : "mantis",
"kind" : "remoteSourceControl",
"location" : "https://github.com/marinofaggiana/Mantis",
"state" : {
"revision" : "d145ce2403e0d94d4926eb8510bc4966fbf1bfca",
"version" : "1.0.0"
}
},
{
"identity" : "markdownkit",
"kind" : "remoteSourceControl",
"location" : "https://github.com/bmoliveira/MarkdownKit",
"state" : {
"revision" : "39ea7a3fc7e65bcafe55152592b834859be574a5",
"version" : "1.7.3"
}
},
{
"identity" : "nanopb",
"kind" : "remoteSourceControl",
"location" : "https://github.com/firebase/nanopb.git",
"state" : {
"revision" : "3851d94a41890dea16dc3db34caf60e585cb4163",
"version" : "2.30910.1"
}
},
{
"identity" : "nextcloudkit",
"kind" : "remoteSourceControl",
"location" : "https://github.com/nextcloud/NextcloudKit",
"state" : {
"revision" : "49eee789ab676d6aba0020ccbe0d850f62e1d449",
"version" : "7.6.4"
}
},
{
"identity" : "openssl",
"kind" : "remoteSourceControl",
"location" : "https://github.com/krzyzanowskim/OpenSSL",
"state" : {
"revision" : "0a6149bff4fb00921ce0ec1811f726b166638095",
"version" : "3.6.5000"
}
},
{
"identity" : "popupview",
"kind" : "remoteSourceControl",
"location" : "https://github.com/exyte/PopupView.git",
"state" : {
"revision" : "99695337ce9e965b70e4aa14b49b1a9920017333",
"version" : "5.0.8"
}
},
{
"identity" : "promises",
"kind" : "remoteSourceControl",
"location" : "https://github.com/google/promises.git",
"state" : {
"revision" : "f4a19a3c313dc2616c70bb49d29a799fb16be837",
"version" : "2.4.1"
}
},
{
"identity" : "qrcodereader.swift",
"kind" : "remoteSourceControl",
"location" : "https://github.com/yannickl/QRCodeReader.swift",
"state" : {
"revision" : "5020b5a47199d8ba80c83a4b4fafd70e9dc9dc7f",
"version" : "10.1.1"
}
},
{
"identity" : "realm-core",
"kind" : "remoteSourceControl",
"location" : "https://github.com/realm/realm-core.git",
"state" : {
"revision" : "b4192c46305570577c4d08df790fddec5ab3aa04",
"version" : "20.1.5"
}
},
{
"identity" : "realm-swift",
"kind" : "remoteSourceControl",
"location" : "https://github.com/realm/realm-swift",
"state" : {
"revision" : "a40ced79265b644a896e393b0f3a37e7916e7de3",
"version" : "20.0.6"
}
},
{
"identity" : "swift-atomics",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-atomics.git",
"state" : {
"revision" : "0442cb5a3f98ab802acb777929fdb446bda11a34",
"version" : "1.3.1"
}
},
{
"identity" : "swift-collections",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-collections.git",
"state" : {
"revision" : "35a1edcb8ebd2bfe251d587f0b69e62af28f508c",
"version" : "1.7.3"
}
},
{
"identity" : "swift-nio",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-nio.git",
"state" : {
"revision" : "6db9d9abd92ad7399b8a564cafbb87d3507245fa",
"version" : "2.104.0"
}
},
{
"identity" : "swift-nio-ssl",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-nio-ssl",
"state" : {
"revision" : "322f3c2a4a21df31c84ca416bf65ee5e9059e440",
"version" : "2.37.5"
}
},
{
"identity" : "swift-system",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-system.git",
"state" : {
"revision" : "869129b7bf4ecc57b97d0193ad29690ca2134750",
"version" : "1.8.1"
}
},
{
"identity" : "swifter",
"kind" : "remoteSourceControl",
"location" : "https://github.com/httpswift/swifter.git",
"state" : {
"branch" : "stable",
"revision" : "1e4f51c92d7ca486242d8bf0722b99de2c3531aa"
}
},
{
"identity" : "swiftrichstring",
"kind" : "remoteSourceControl",
"location" : "https://github.com/malcommac/SwiftRichString",
"state" : {
"revision" : "9bf4b5af6bb4386865636fc504d6c588c2b65040",
"version" : "3.7.2"
}
},
{
"identity" : "swiftyjson",
"kind" : "remoteSourceControl",
"location" : "https://github.com/SwiftyJSON/SwiftyJSON",
"state" : {
"revision" : "af76cf3ef710b6ca5f8c05f3a31307d44a3c5828",
"version" : "5.0.2"
}
},
{
"identity" : "swiftyxmlparser",
"kind" : "remoteSourceControl",
"location" : "https://github.com/yahoojapan/SwiftyXMLParser",
"state" : {
"revision" : "d7a1d23f04c86c1cd2e8f19247dd15d74e0ea8be",
"version" : "5.6.0"
}
},
{
"identity" : "taglistview",
"kind" : "remoteSourceControl",
"location" : "https://github.com/ElaWorkshop/TagListView",
"state" : {
"revision" : "b30b61826736f4d9ec04aef5df891f3914423f16",
"version" : "1.4.1"
}
},
{
"identity" : "tlphotopicker",
"kind" : "remoteSourceControl",
"location" : "https://github.com/tilltue/TLPhotoPicker",
"state" : {
"revision" : "91d7bca65721928af30c6a2bb1a1f517f7862964",
"version" : "2.1.21"
}
},
{
"identity" : "vlckit-spm",
"kind" : "remoteSourceControl",
"location" : "https://github.com/tylerjonesio/vlckit-spm",
"state" : {
"revision" : "e932bbd488872fdb74f6654d28c2f291eae03daf",
"version" : "3.6.0"
}
}
],
"version" : 3
}
@@ -0,0 +1,77 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "2700"
version = "2.0">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES"
buildArchitectures = "Automatic">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "F7FB187F30401D0D00EB0AE6"
BuildableName = "BackgroundUploadExtension.appex"
BlueprintName = "BackgroundUploadExtension"
ReferencedContainer = "container:Nextcloud.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES"
shouldAutocreateTestPlan = "YES">
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = ""
selectedLauncherIdentifier = "Xcode.IDEFoundation.Launcher.PosixSpawn"
launchStyle = "0"
askForAppToLaunch = "Yes"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES"
launchAutomaticallySubstyle = "2"
queueDebuggingEnabled = "No">
<RemoteRunnable
runnableDebuggingMode = "0"
BundleIdentifier = "it.twsweb.Nextcloud"
RemotePath = "/var/containers/Bundle/Application/96505171-B093-46F6-8C0A-C5A40B9B645E/Nextcloud.app">
</RemoteRunnable>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES"
askForAppToLaunch = "Yes"
launchAutomaticallySubstyle = "2">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "F7FB187F30401D0D00EB0AE6"
BuildableName = "BackgroundUploadExtension.appex"
BlueprintName = "BackgroundUploadExtension"
ReferencedContainer = "container:Nextcloud.xcodeproj">
</BuildableReference>
</MacroExpansion>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "2640"
version = "1.7">
version = "2.0">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
@@ -56,15 +56,17 @@
buildForAnalyzing = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "F31F69412A2F6D4500162F76"
BuildableName = "NextcloudSnapshotTests.xctest"
BlueprintName = "NextcloudSnapshotTests"
BlueprintIdentifier = "AF8ED1F82757821000B8DBC4"
BuildableName = "NextcloudUnitTests.xctest"
BlueprintName = "NextcloudUnitTests"
ReferencedContainer = "container:Nextcloud.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
language = "en"
region = "US"
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
@@ -1,93 +1,125 @@
//
// NotificationService.swift
// Notification Service Extension
//
// Created by Ivan Sein on 30.01.20.
// Author Ivan Sein <ivan@nextcloud.com>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
// SPDX-FileCopyrightText: Nextcloud GmbH
// SPDX-FileCopyrightText: 2020 Ivan Sein
// SPDX-License-Identifier: GPL-3.0-or-later
import UIKit
import UserNotifications
import os
import NextcloudKit
class NotificationService: UNNotificationServiceExtension {
var contentHandler: ((UNNotificationContent) -> Void)?
var bestAttemptContent: UNMutableNotificationContent?
var request: UNNotificationRequest?
private let deliveryLock = OSAllocatedUnfairLock()
override func didReceive(_ request: UNNotificationRequest, withContentHandler contentHandler: @escaping (UNNotificationContent) -> Void) {
self.contentHandler = contentHandler
self.request = request
bestAttemptContent = (request.content.mutableCopy() as? UNMutableNotificationContent)
NextcloudKit.configureLogger(logLevel: .verbose)
NextcloudKit.configureLogger(
logLevel: .verbose,
logDirectory: NCPreferences.sharedLogDirectory
)
if let bestAttemptContent = bestAttemptContent {
bestAttemptContent.title = ""
bestAttemptContent.body = "Nextcloud notification"
do {
if let message = bestAttemptContent.userInfo["subject"] as? String {
for tableAccount in NCManageDatabase.shared.getAllTableAccount() {
guard let privateKey = NCPreferences().getPushNotificationPrivateKey(account: tableAccount.account) else {
bestAttemptContent.body = "Error retrieving private key for \(tableAccount.account)"
continue
}
guard let bestAttemptContent else { return }
let prefixData = Data(privateKey.prefix(8))
let prefixBase64 = prefixData.base64EncodedString()
nkLog(debug: "🔑 Loaded private key for \(tableAccount.account): prefix(Base64)=\(prefixBase64)")
bestAttemptContent.title = ""
bestAttemptContent.body = "Nextcloud notification"
guard let decryptedMessage = NCPushNotificationEncryption.shared().decryptPushNotification(message, withDevicePrivateKey: privateKey) else {
bestAttemptContent.body = "Error decryption for \(tableAccount.account)"
continue
}
guard let data = decryptedMessage.data(using: .utf8) else {
bestAttemptContent.body = "Error decryption data utf8 for \(tableAccount.account)"
continue
}
var matchedAccount: tableAccount?
var payload: [String: AnyObject]?
if var json = try JSONSerialization.jsonObject(with: data) as? [String: AnyObject],
let subject = json["subject"] as? String {
bestAttemptContent.body = subject
if let pref = UserDefaults(suiteName: NCBrandOptions.shared.capabilitiesGroup) {
json["account"] = tableAccount.account as AnyObject
pref.set(json, forKey: "NOTIFICATION_DATA")
pref.synchronize()
}
} else {
bestAttemptContent.body = "Error JSON Serialization for \(tableAccount.account)"
}
break
do {
if let message = bestAttemptContent.userInfo["subject"] as? String {
for tableAccount in NCManageDatabase.shared.getAllTableAccount() {
guard let privateKey = NCPreferences().getPushNotificationPrivateKey(account: tableAccount.account) else {
bestAttemptContent.body = "Error retrieving private key for \(tableAccount.account)"
continue
}
let prefixData = Data(privateKey.prefix(8))
let prefixBase64 = prefixData.base64EncodedString()
nkLog(debug: "🔑 Loaded private key for \(tableAccount.account): prefix(Base64)=\(prefixBase64)")
guard let decryptedMessage = NCPushNotificationEncryption.shared().decryptPushNotification(message, withDevicePrivateKey: privateKey) else {
bestAttemptContent.body = "Error decrypting notification for \(tableAccount.account)"
continue
}
guard let data = decryptedMessage.data(using: .utf8) else {
bestAttemptContent.body = "Error decrypting UTF8 notification data for \(tableAccount.account)"
continue
}
if var json = try JSONSerialization.jsonObject(with: data) as? [String: AnyObject],
let subject = json["subject"] as? String {
bestAttemptContent.body = subject
if let pref = UserDefaults(suiteName: NCBrandOptions.shared.capabilitiesGroup) {
json["account"] = tableAccount.account as AnyObject
pref.set(json, forKey: "NOTIFICATION_DATA")
pref.synchronize()
}
matchedAccount = tableAccount
payload = json
} else {
bestAttemptContent.body = "Error with notification JSON for \(tableAccount.account)"
}
break
}
} catch let error as NSError {
nkLog(error: "Failed : \(error.localizedDescription)")
}
} catch let error as NSError {
nkLog(error: "Failed : \(error.localizedDescription)")
}
guard let tblAccount = matchedAccount,
let nid = payload?["nid"] as? Int,
payload?["delete"] as? Bool != true,
payload?["delete-all"] as? Bool != true else {
deliver()
return
}
// NextcloudKit Session
NextcloudKit.shared.setup(groupIdentifier: NCBrandOptions.shared.capabilitiesGroup, delegate: NCNetworking.shared)
NextcloudKit.shared.appendSession(account: tblAccount.account,
urlBase: tblAccount.urlBase,
user: tblAccount.user,
userId: tblAccount.userId,
password: NCPreferences().getPassword(account: tblAccount.account),
userAgent: userAgent,
groupIdentifier: NCBrandOptions.shared.capabilitiesGroup)
Task {
let results = await NextcloudKit.shared.getNotificationsAsync(idNotification: nid,
account: tblAccount.account,
options: NKRequestOptions(timeout: 20))
if results.error == .success, let notification = results.notifications?.first {
bestAttemptContent.title = notification.message.isEmpty ? NCBrandOptions.shared.brand : notification.subject
bestAttemptContent.body = notification.message.isEmpty ? notification.subject : notification.message
}
contentHandler(bestAttemptContent)
deliver()
}
}
override func serviceExtensionTimeWillExpire() {
// Called just before the extension will be terminated by the system.
// Use this as an opportunity to deliver your "best attempt" at modified content, otherwise the original push payload will be used.
if let contentHandler = contentHandler, let bestAttemptContent = bestAttemptContent {
bestAttemptContent.title = ""
bestAttemptContent.body = "Nextcloud Notification Time Will Expire"
contentHandler(bestAttemptContent)
deliver()
}
private func deliver() {
NextcloudKit.flushLogger()
let handler = deliveryLock.withLock {
let handler = contentHandler
contentHandler = nil
return handler
}
if let handler, let bestAttemptContent {
handler(bestAttemptContent)
}
}
}
@@ -1,22 +1,5 @@
//
// Notification_Service_Extension-Bridging-Header.h
// Nextcloud
//
// Created by Ivan Sein on 30.01.20.
// Author Ivan Sein <[email protected]>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
// SPDX-FileCopyrightText: Nextcloud GmbH
// SPDX-FileCopyrightText: 2020 Ivan Sein
// SPDX-License-Identifier: GPL-3.0-or-later
#import "NCPushNotificationEncryption.h"
+2
View File
@@ -0,0 +1,2 @@
SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors
SPDX-License-Identifier: GPL-3.0-or-later
+68
View File
@@ -0,0 +1,68 @@
# SPDX-FileCopyrightText: 2026 Nextcloud GmbH and Nextcloud contributors
# SPDX-License-Identifier: GPL-3.0-or-later
version = 1
SPDX-PackageName = "Nextcloud iOS App"
SPDX-PackageSupplier = "Nextcloud GmbH <https://nextcloud.com/impressum/>"
SPDX-PackageDownloadLocation = "https://github.com/nextcloud/ios/"
[[annotations]]
path = [".gitattributes", ".gitignore", "iOSClient/.tx/config", "iOSClient/PrivacyInfo.xcprivacy", "iOSClient/Settings/Acknowledgements.rtf"]
precedence = "aggregate"
SPDX-FileCopyrightText = "2016-2024 Nextcloud GmbH and Nextcloud contributors"
SPDX-License-Identifier = "GPL-3.0-or-later"
[[annotations]]
path = ["**/*.storyboard", "**/*.xib"]
precedence = "aggregate"
SPDX-FileCopyrightText = "2016-2026 Nextcloud GmbH and Nextcloud contributors"
SPDX-License-Identifier = "GPL-3.0-or-later"
[[annotations]]
path = ["Nextcloud.xcodeproj/**"]
precedence = "aggregate"
SPDX-FileCopyrightText = "2016-2026 Nextcloud GmbH and Nextcloud contributors"
SPDX-License-Identifier = "GPL-3.0-or-later"
[[annotations]]
path = ["Brand/**", "Widget/Intent/*.lproj/*.intentdefinition"]
precedence = "aggregate"
SPDX-FileCopyrightText = "2016-2026 Nextcloud GmbH and Nextcloud contributors"
SPDX-License-Identifier = "GPL-3.0-or-later"
[[annotations]]
path = ["iOSClient/Images.xcassets/**", "Widget/Assets.xcassets/**", "Action Assistant/Images.xcassets/**"]
precedence = "aggregate"
SPDX-FileCopyrightText = "2016-2026 Nextcloud GmbH and Nextcloud contributors"
SPDX-License-Identifier = "GPL-3.0-or-later"
[[annotations]]
path = ["Animation.gif", "Nextcloud Hub.png", "Reasons to use Nextcloud.pdf", "widget.png"]
precedence = "aggregate"
SPDX-FileCopyrightText = "2017-2023 Nextcloud GmbH and Nextcloud contributors"
SPDX-License-Identifier = "GPL-3.0-or-later"
[[annotations]]
path = ["BackgroundUploadExtension/diagram.png"]
precedence = "aggregate"
SPDX-FileCopyrightText = "2026 Nextcloud GmbH and Marino Faggiana"
SPDX-License-Identifier = "GPL-3.0-or-later"
# Translations are managed on Transifex; headers here would be overwritten on sync.
[[annotations]]
path = ["iOSClient/Supporting Files/*.lproj/*.strings", "iOSClient/Supporting Files/*.lproj/*.stringsdict", "Widget/Intent/*.lproj/*.strings"]
precedence = "aggregate"
SPDX-FileCopyrightText = "2017-2025 Nextcloud translators"
SPDX-License-Identifier = "GPL-3.0-or-later"
# The Nextcloud name and logo are trademarks; see LICENSES/LicenseRef-NextcloudTrademarks.txt
[[annotations]]
path = ["AppIcon.icon/**", "Brand/Custom.xcassets/AppIcon.appiconset/**", "Brand/Custom.xcassets/logo.imageset/**", "Action Assistant/Images.xcassets/AppIcon.appiconset/**", "Widget/Assets.xcassets/AppIcon.imageset/**", "iOSClient/Images.xcassets/logo.imageset/**"]
precedence = "aggregate"
SPDX-FileCopyrightText = "Nextcloud GmbH"
SPDX-License-Identifier = "LicenseRef-NextcloudTrademarks"
[[annotations]]
path = ["iOSClient/Utility/NYMnemonic/**"]
precedence = "aggregate"
SPDX-FileCopyrightText = "2014 Nybex, Inc. <https://nybex.com>"
SPDX-License-Identifier = "MIT"
+5 -1
View File
@@ -34,7 +34,11 @@ class NCShareCell: UITableViewCell {
imageCell?.layer.cornerRadius = 6
imageCell?.layer.masksToBounds = true
if let image = UIImage.downsample(imageAt: URL(fileURLWithPath: NSTemporaryDirectory() + fileName), to: CGSize(width: 80, height: 80)) {
if let image = UIImage.downsample(
imageAt: URL(fileURLWithPath: NSTemporaryDirectory() + fileName),
to: CGSize(width: 80, height: 80),
scale: traitCollection.displayScale
) {
imageCell.image = image
imageCell.contentMode = .scaleAspectFill
} else {
+7
View File
@@ -104,6 +104,13 @@ extension NCShareExtension: UICollectionViewDataSource {
cell.setTags(tags: Array(metadata.tags))
let accessibilityLabel = [metadata.fileNameView, cell.labelInfo.text, cell.labelSubinfo.text]
.compactMap { $0?.trimmingCharacters(in: .whitespacesAndNewlines) }
.filter { !$0.isEmpty }
.joined(separator: ", ")
cell.setAccessibility(label: accessibilityLabel, value: "")
cell.accessibilityTraits = .button
cell.separator.isHidden = collectionView.numberOfItems(inSection: indexPath.section) == indexPath.row + 1
return cell
+18 -3
View File
@@ -12,7 +12,22 @@ extension NCShareExtension {
func reloadData() async {
let session = NCShareExtensionData.shared.getSession()
let layoutForView = NCManageDatabase.shared.getLayoutForView(account: session.account, key: keyLayout, serverUrl: serverUrl)
let predicate = NSPredicate(format: "account == %@ AND serverUrl == %@ AND fileName != %@ AND directory == true", session.account, serverUrl, NextcloudKit.shared.nkCommonInstance.rootFileName)
let showHiddenFiles = NCPreferences().getShowHiddenFiles(account: session.account)
let predicate = showHiddenFiles
? NSPredicate(
format: "account == %@ AND serverUrl == %@ AND fileName != %@ AND directory == true",
session.account,
serverUrl,
NextcloudKit.shared.nkCommonInstance.rootFileName
)
: NSPredicate(
format: "account == %@ AND serverUrl == %@ AND fileName != %@ AND directory == true AND NOT fileName BEGINSWITH[c] %@",
session.account,
serverUrl,
NextcloudKit.shared.nkCommonInstance.rootFileName,
"."
)
let metadatas = await NCManageDatabase.shared.getMetadatasAsync(predicate: predicate,
withLayout: layoutForView,
withAccount: session.account)
@@ -45,8 +60,8 @@ extension NCShareExtension {
if resultsReadFolder.error == .success {
self.metadataFolder = resultsReadFolder.metadataFolder
await self.reloadData()
} else {
self.showAlert(description: resultsReadFolder.error.errorDescription)
} else if let message = resultsReadFolder.error.userFriendlyMessage() {
self.showAlert(description: message)
}
}
}
@@ -34,8 +34,8 @@ extension NCShareExtension: NCAccountRequestDelegate {
vcAccountRequest.delegate = self
vcAccountRequest.dismissDidEnterBackground = true
let screenHeighMax = UIScreen.main.bounds.height - (UIScreen.main.bounds.height / 5)
let height = min(CGFloat(accounts.count * Int(vcAccountRequest.heightCell) + 45), screenHeighMax)
let maximumHeight = view.safeAreaLayoutGuide.layoutFrame.height * 0.8
let height = min(CGFloat(accounts.count * Int(vcAccountRequest.heightCell) + 45), maximumHeight)
let popup = NCPopupViewController(contentController: vcAccountRequest, popupWidth: 300, popupHeight: height + 20)
@@ -53,6 +53,7 @@ extension NCShareExtension: NCAccountRequestDelegate {
cancel(with: NCShareExtensionError.noAccount)
return
}
showAccountView()
NextcloudKit.shared.setup(groupIdentifier: NCBrandOptions.shared.capabilitiesGroup, delegate: NCNetworking.shared)
NextcloudKit.shared.appendSession(account: tblAccount.account,
+111 -43
View File
@@ -4,6 +4,7 @@
// SPDX-License-Identifier: GPL-3.0-or-later
import UIKit
import UniformTypeIdentifiers
import NextcloudKit
import LucidBanner
import SwiftUI
@@ -51,6 +52,9 @@ class NCShareExtension: UIViewController {
var token: Int?
var banner: LucidBanner?
var sceneIdentifier: String = UUID().uuidString
private var isPresentingNoAccountAlert = false
private var isPresentingPasscode = false
private var isPasscodeAuthenticated = false
// MARK: - View Life Cycle
@@ -86,7 +90,10 @@ class NCShareExtension: UIViewController {
uploadView.addGestureRecognizer(uploadGesture)
let versionNextcloudiOS = String(format: NCBrandOptions.shared.textCopyrightNextcloudiOS, utility.getVersionBuild())
NextcloudKit.configureLogger(logLevel: (NCBrandOptions.shared.disable_log ? .disabled : NCPreferences().log))
NextcloudKit.configureLogger(
logLevel: NCBrandOptions.shared.disable_log ? .disabled : NCPreferences().log,
logDirectory: NCPreferences.sharedLogDirectory
)
nkLog(start: "Start Share session " + versionNextcloudiOS)
@@ -100,11 +107,13 @@ class NCShareExtension: UIViewController {
}
NotificationCenter.default.addObserver(forName: UIApplication.willEnterForegroundNotification, object: nil, queue: nil) { _ in
if NCPreferences().presentPasscode {
NCPasscode.shared.presentPasscode(viewController: self, delegate: self) {
NCPasscode.shared.enableTouchFaceID()
}
guard !self.maintenanceMode,
self.validateAccount() else {
return
}
self.isPasscodeAuthenticated = false
self.requestPasscodeIfNeeded()
}
// Verify version
@@ -138,11 +147,8 @@ class NCShareExtension: UIViewController {
}
}
guard NCShareExtensionData.shared.getTblAccoun() != nil,
!NCPasscode.shared.isPasscodeReset else {
return showAlert(description: "_no_active_account_") {
self.cancel(with: .noAccount)
}
guard validateAccount() else {
return
}
guard let inputItems = extensionContext?.inputItems as? [NSExtensionItem] else {
@@ -150,20 +156,18 @@ class NCShareExtension: UIViewController {
return
}
NCFilesExtensionHandler(items: inputItems) { fileNames in
self.filesName = fileNames
DispatchQueue.main.async {
self.setCommandView()
Task { @MainActor in
NCFilesExtensionHandler(items: inputItems) { fileNames in
self.filesName = fileNames
DispatchQueue.main.async {
self.setCommandView()
}
}
}
if NCPreferences().presentPasscode {
NCPasscode.shared.presentPasscode(viewController: self, delegate: self) {
NCPasscode.shared.enableTouchFaceID()
}
}
self.requestPasscodeIfNeeded()
self.collectionView.reloadData()
self.collectionView.reloadData()
}
}
override func viewWillTransition(to size: CGSize, with coordinator: UIViewControllerTransitionCoordinator) {
@@ -179,6 +183,58 @@ class NCShareExtension: UIViewController {
tableView.visibleCells.forEach { $0.setNeedsLayout() }
}
private func validateAccount() -> Bool {
guard !NCPasscodeModel.isPasscodeReset else {
return showNoAccountAlert()
}
if let account = NCShareExtensionData.shared.getTblAccoun()?.account,
NCManageDatabase.shared.getTableAccount(account: account) != nil {
return true
}
guard let activeAccount = NCManageDatabase.shared.getActiveTableAccount() else {
return showNoAccountAlert()
}
clearAccountView()
accountRequestChangeAccount(account: activeAccount.account, controller: nil)
return true
}
private func showNoAccountAlert() -> Bool {
clearAccountView()
if !isPresentingNoAccountAlert {
isPresentingNoAccountAlert = true
showAlert(description: "_no_active_account_") {
self.cancel(with: .noAccount)
}
}
return false
}
private func clearAccountView() {
dataSourceTask?.cancel()
dataSourceTask = nil
dataSource = NCCollectionViewDataSource()
metadataFolder = nil
collectionView.isHidden = true
tableView.isHidden = true
commandView.isHidden = true
separatorView.isHidden = true
navigationItem.leftBarButtonItems = nil
navigationItem.title = NCBrandOptions.shared.brand
view.layoutIfNeeded()
}
func showAccountView() {
collectionView.isHidden = false
tableView.isHidden = false
commandView.isHidden = false
separatorView.isHidden = false
}
// MARK: -
func cancel(with error: NCShareExtensionError? = nil) {
@@ -283,13 +339,15 @@ class NCShareExtension: UIViewController {
guard let capabilities = NCNetworking.shared.capabilities[session.account] else {
return
}
let alertController = UIAlertController.createFolderWith(serverUrl: serverUrl, session: session, capabilities: capabilities) { error in
let alertController = UIAlertController.createFolderWith(serverUrl: serverUrl, session: session, capabilities: capabilities) { error, folderName in
let context = NCErrorContext.createFolder(folderName: folderName)
if error == .success {
Task {
await self.loadFolder()
}
} else {
self.showAlert(title: "_error_createsubfolders_upload_", description: error.errorDescription)
} else if let message = error.userFriendlyMessage(for: context) {
self.showAlert(title: context.failureTitle ?? "_error_", description: message)
}
}
self.present(alertController, animated: true)
@@ -378,7 +436,12 @@ extension NCShareExtension {
@MainActor
func uploadAndExit() async {
// A Share extension process can be reused by the system. Treat each
// explicit share operation as a new server-key validation cycle.
await NCNetworkingE2EE.beginNewServerKeyValidationCycle()
var error: NKError?
var errorContext: NCErrorContext = .generic
guard let window = self.view.window else {
return
}
@@ -403,6 +466,7 @@ extension NCShareExtension {
error = await self.upload(metadata: metadata)
if error != .success {
errorContext = .upload(fileName: metadata.fileNameView)
break
}
}
@@ -410,7 +474,11 @@ extension NCShareExtension {
if error == .success {
banner?.update(payload: LucidBannerPayload.Update(stage: .success, horizontalLayout: .centered(width: 100)), for: self.token)
} else {
banner?.update(payload: LucidBannerPayload.Update(subtitle: error?.errorDescription, stage: .error), for: self.token)
let payload = LucidBannerPayload.Update(title: errorContext.failureTitle ?? NSLocalizedString("_error_", comment: ""),
subtitle: error?.userFriendlyMessage(for: errorContext) ?? "",
stage: .error)
banner?.update(payload: payload, for: self.token)
}
Task { @MainActor in
@@ -433,12 +501,8 @@ extension NCShareExtension {
metadata.serverUrlFileName = utilityFileSystem.createServerUrl(serverUrl: metadata.serverUrl, fileName: metadata.fileName)
// CHUNK
var chunkSize = NCGlobal.shared.chunkSizeMBCellular
if NCNetworking.shared.networkReachability == NKTypeReachability.reachableEthernetOrWiFi {
chunkSize = NCGlobal.shared.chunkSizeMBEthernetOrWiFi
}
if metadata.size > chunkSize {
metadata.chunk = chunkSize
if metadata.size > self.global.chunkSize {
metadata.chunk = self.global.chunkSize
} else {
metadata.chunk = 0
}
@@ -514,18 +578,22 @@ extension NCShareExtension {
}
}
extension NCShareExtension: NCPasscodeDelegate {
func passcodeReset(_ passcodeViewController: TOPasscodeViewController) {
DispatchQueue.main.asyncAfter(deadline: .now() + 0.1) {
passcodeViewController.dismiss(animated: false)
self.cancel(with: .noAccount)
}
}
func evaluatePolicy(_ passcodeViewController: TOPasscodeViewController, isCorrectCode: Bool) {
if !isCorrectCode {
DispatchQueue.main.asyncAfter(deadline: .now() + 0.1) {
passcodeViewController.dismiss(animated: false)
extension NCShareExtension {
/// Require authentication once per foreground session without reopening after dismissal.
private func requestPasscodeIfNeeded() {
guard NCPreferences().presentPasscode,
!isPasscodeAuthenticated,
!isPresentingPasscode else { return }
isPresentingPasscode = true
// Embed in the content controller; the helper hides the outer navigation bar.
NCPasscodeView.embed(in: self) { [weak self] result in
guard let self else { return }
self.isPresentingPasscode = false
switch result {
case .authenticated:
self.isPasscodeAuthenticated = true
_ = self.validateAccount()
case .cancelled, .reset, .configured, .disabled:
self.cancel(with: .noAccount)
}
}
+4 -3
View File
@@ -1,7 +1,8 @@
// SPDX-FileCopyrightText: Nextcloud GmbH
// SPDX-FileCopyrightText: 2016 Marino Faggiana
// SPDX-License-Identifier: GPL-3.0-or-later
//
// Use this file to import your target's public headers that you would like to expose to Swift.
//
// Use this file to import your target's public headers that you would like to expose to Swift.
#import "NCEndToEndEncryption.h"
#import "UIImage+animatedGIF.h"
#import "TOPasscodeViewController.h"
@@ -1,10 +1,6 @@
//
// NextcloudIntegrationTests.swift
// NextcloudIntegrationTests
//
// Created by Milen Pivchev on 5/19/23.
// Copyright © 2023 Marino Faggiana. All rights reserved.
//
// SPDX-FileCopyrightText: Nextcloud GmbH
// SPDX-FileCopyrightText: 2023 Marino Faggiana
// SPDX-License-Identifier: GPL-3.0-or-later
import XCTest
import NextcloudKit
@@ -1,7 +0,0 @@
// SPDX-FileCopyrightText: Nextcloud GmbH
// SPDX-FileCopyrightText: 2025 Iva Horn
// SPDX-License-Identifier: GPL-3.0-or-later
// There are no unit tests yet.
// This is an empty placeholder file.
// The compiler requires at least an empty file for every target.
+116 -71
View File
@@ -1,5 +1,6 @@
// SPDX-FileCopyrightText: Nextcloud GmbH
// SPDX-FileCopyrightText: 2025 Milen Pivchev
// SPDX-FileCopyrightText: 2026 Marino Faggiana
// SPDX-License-Identifier: GPL-3.0-or-later
import Foundation
@@ -58,92 +59,136 @@ class BaseUIXCTestCase: XCTestCase {
try await Task.sleep(for: .seconds(TestConstants.controlExistenceTimeout))
}
///
/// Automation of the sign-in, if required.
///
///
/// Sign in through the app's authentication flow, supporting system authentication and the embedded fallback.
func logIn() async throws {
guard app.buttons["login"].exists else {
return
let login = app.buttons["login"]
let deadline = Date().addingTimeInterval(30)
// Startup can restore the main interface after the first accessibility snapshot.
// Wait for either destination instead of assuming that the login screen will appear.
repeat {
if app.buttons["openSidebar"].exists || app.buttons["accountSwitcher"].exists {
return
}
if login.exists && login.isHittable {
break
}
try await Task.sleep(for: .milliseconds(250))
} while Date() < deadline
guard login.exists else {
attachAuthenticationDiagnostics()
throw UITestError.waitForExistence(login)
}
login.tap()
app.buttons["login"].tap()
let serverAddressTextField = app.textFields["serverAddress"].firstMatch
guard serverAddressTextField.await() else { return }
try await aSmallMoment()
serverAddressTextField.tap()
serverAddressTextField.typeText(TestConstants.server)
let serverAddress = app.textFields["serverAddress"].firstMatch
guard serverAddress.await() else { throw UITestError.waitForExistence(serverAddress) }
serverAddress.tap()
serverAddress.typeText(TestConstants.server)
app.buttons["submitServerAddress"].tap()
try await aSmallMoment()
let webView = app.webViews.firstMatch
guard webView.await() else {
throw UITestError.waitForExistence(webView)
let webView = try await authenticationWebView()
let username = webView.textFields.firstMatch
let loginButton = webView.buttons["Log in"].firstMatch
if !username.exists, loginButton.await(timeout: 5) {
loginButton.tap()
}
// try await aSmallMoment()
let loginButton = webView.buttons["Log in"]
// try await aSmallMoment()
if loginButton.await() {
if username.await() {
username.tap()
username.typeText(TestConstants.username)
let password = webView.secureTextFields.firstMatch
guard password.await() else { throw UITestError.waitForExistence(password) }
password.tap()
password.typeText(TestConstants.password)
guard loginButton.await() else { throw UITestError.waitForExistence(loginButton) }
loginButton.tap()
}
// try await aSmallMoment()
let usernameTextField = webView.textFields.firstMatch
if usernameTextField.await() {
try await aSmallMoment()
guard usernameTextField.await() else { return }
usernameTextField.tap()
try await aSmallMoment()
usernameTextField.typeText(TestConstants.username)
try await aSmallMoment()
let passwordSecureTextField = webView.secureTextFields.firstMatch
try await aSmallMoment()
passwordSecureTextField.tap()
try await aSmallMoment()
passwordSecureTextField.typeText(TestConstants.password)
try await aSmallMoment()
webView.buttons.firstMatch.tap()
let grant = webView.buttons["Grant access"]
guard try await waitForAuthenticationConsent() else {
attachAuthenticationDiagnostics()
throw UITestError.waitForExistence(grant)
}
try await aSmallMoment()
let grantButton = webView.buttons["Grant access"]
guard grantButton.await() else {
throw UITestError.waitForExistence(grantButton)
let sidebar = app.buttons["openSidebar"].firstMatch
guard sidebar.await(timeout: 30) || app.buttons["accountSwitcher"].exists else {
attachAuthenticationDiagnostics()
throw UITestError.waitForExistence(sidebar)
}
}
grantButton.tap()
grantButton.awaitInexistence()
/// Waiting alone does not trigger interruption monitors; dismiss password prompts in their owning process.
private func waitForAuthenticationConsent() async throws -> Bool {
let browsers = [app!, XCUIApplication(bundleIdentifier: "com.apple.SafariViewService")]
let hosts = browsers + [XCUIApplication(bundleIdentifier: "com.apple.springboard")]
let deadline = Date().addingTimeInterval(30)
var passwordPromptDismissed = false
repeat {
promptSearch: for host in hosts where !passwordPromptDismissed && host.state != .notRunning {
for label in ["Not Now", "Non ora", "Ora no"] {
let button = host.buttons[label].firstMatch
if button.exists && button.isHittable {
button.tap()
passwordPromptDismissed = true
_ = button.waitForNonExistence(timeout: 5)
break promptSearch
}
}
}
for browser in browsers where browser.state != .notRunning {
let grant = browser.webViews.buttons["Grant access"].firstMatch
if grant.exists && grant.isHittable {
grant.tap()
return true
}
}
try await Task.sleep(for: .milliseconds(250))
} while Date() < deadline
return false
}
app.buttons["accountSwitcher"].await()
/// ASWebAuthenticationSession may expose its UI in SafariViewService rather than in the app hierarchy.
private func authenticationWebView() async throws -> XCUIElement {
let browsers = [app!, XCUIApplication(bundleIdentifier: "com.apple.SafariViewService")]
let promptHosts = browsers + [XCUIApplication(bundleIdentifier: "com.apple.springboard")]
// The app tries HTTPS first, even for the HTTP-only localhost test server.
// Allow the initial URLSession request to time out before its HTTP fallback starts.
let timeout = URLSessionConfiguration.default.timeoutIntervalForRequest + 30
let deadline = Date().addingTimeInterval(timeout)
repeat {
for host in promptHosts where host.state != .notRunning {
for label in ["Continue", "Allow"] {
let button = host.alerts.buttons[label].firstMatch
if button.exists && button.isHittable {
button.tap()
}
}
}
for browser in browsers where browser.state != .notRunning {
let webView = browser.webViews.firstMatch
if webView.exists {
return webView
}
}
try await Task.sleep(for: .milliseconds(250))
} while Date() < deadline
try await aSmallMoment()
attachAuthenticationDiagnostics()
throw UITestError.waitForExistence(app.webViews.firstMatch)
}
/// Keep login diagnostics in the xcresult instead of losing the context on a CI failure.
private func attachAuthenticationDiagnostics() {
let screenshot = XCTAttachment(screenshot: XCUIScreen.main.screenshot())
screenshot.name = "Authentication screen"
screenshot.lifetime = .keepAlways
add(screenshot)
for host in [app!, XCUIApplication(bundleIdentifier: "com.apple.SafariViewService"), XCUIApplication(bundleIdentifier: "com.apple.springboard")]
where host.state == .runningForeground {
let hierarchy = XCTAttachment(string: host.debugDescription)
hierarchy.name = "Authentication UI hierarchy"
hierarchy.lifetime = .keepAlways
add(hierarchy)
}
}
///
@@ -0,0 +1,390 @@
// SPDX-FileCopyrightText: Nextcloud GmbH
// SPDX-FileCopyrightText: 2026 Marino Faggiana
// SPDX-License-Identifier: GPL-3.0-or-later
import XCTest
/// Exercises real settings and app-lock flows against the standard UI-test server.
@MainActor
final class PasscodeUITests: BaseUIXCTestCase {
private let originalCode = "135790"
private let replacementCode = "246801"
private let wrongCode = "000000"
private let resetTestLockoutSeconds = 10
private var currentCode: String?
private let languageArguments = ["-AppleLanguages", "(en)", "-AppleLocale", "en_US"]
private var title: XCUIElement { app.staticTexts["passcode.title"] }
private var closeButton: XCUIElement { app.buttons["passcode.close"] }
private var lockWindow: XCUIElement { app.windows["passcode.window"] }
private var lockout: XCUIElement { app.staticTexts["passcode.lockout.remaining"] }
private var lockSetting: XCUIElement { app.buttons["settings.passcode.toggle"] }
private var changeSetting: XCUIElement { app.buttons["settings.passcode.change"] }
override func setUp() async throws {
try await super.setUp()
continueAfterFailure = false
addUIInterruptionMonitor(withDescription: "Allow Notifications", for: "Allow")
app = XCUIApplication()
app.launchArguments = ["UI_TESTING", "UI_TESTING_PASSCODE", "UI_TESTING_NO_EXIT"] + languageArguments
if name.contains("testAppResetAfterTenFailuresAcrossLockouts") {
app.launchEnvironment["UI_TESTING_PASSCODE_LOCKOUT_SECONDS"] = String(resetTestLockoutSeconds)
}
app.launch()
try await logIn()
openSettings()
XCTAssertFalse(changeSetting.exists, "Each test must start with app lock disabled.")
}
override func tearDown() async throws {
// Avoid leaving the simulator locked if an assertion interrupted a test.
if let currentCode, app != nil {
app.activate()
if lockout.exists {
_ = lockout.waitForNonExistence(timeout: 65)
}
if title.exists && !closeButton.exists {
clearPartialCode()
enter(currentCode)
}
if closeButton.exists {
closeButton.tap()
}
if !lockSetting.exists {
openSettings()
}
if changeSetting.exists {
lockSetting.tap()
enter(currentCode)
_ = title.waitForNonExistence(timeout: TestConstants.controlExistenceTimeout)
}
}
app?.terminate()
try await super.tearDown()
}
func testCreateChangeAndDisablePasscode() {
createPasscode()
changeSetting.tap()
assertTitle("Enter Passcode")
enter(originalCode)
assertTitle("Enter a new passcode")
enter(replacementCode)
assertTitle("Confirm new passcode")
enter(replacementCode)
currentCode = replacementCode
XCTAssertTrue(title.waitForNonExistence(timeout: TestConstants.controlExistenceTimeout))
lockSetting.tap()
assertTitle("Enter Passcode")
enter(originalCode)
XCTAssertTrue(app.staticTexts["passcode.error"].waitForExistence(timeout: 5))
XCTAssertEqual(app.staticTexts["passcode.error"].label, "Incorrect passcode. Try again.")
enter(replacementCode)
XCTAssertTrue(title.waitForNonExistence(timeout: TestConstants.controlExistenceTimeout))
XCTAssertFalse(changeSetting.exists)
currentCode = nil
}
/// Regression for the reported brute-force bypass when disabling app lock.
func testDisableLockoutSurvivesReopeningBackgroundAndRelaunch() {
createPasscode()
lockSetting.tap()
enter(wrongCode)
closeButton.tap()
XCTAssertTrue(title.waitForNonExistence(timeout: 5))
lockSetting.tap()
enter(wrongCode)
closeButton.tap()
XCTAssertTrue(title.waitForNonExistence(timeout: 5))
lockSetting.tap()
enter(wrongCode)
assertLockedOut()
let deadline = Date().addingTimeInterval(TimeInterval(remainingSeconds()))
// The third error promotes the request to a mandatory app lock.
XCTAssertTrue(lockWindow.waitForExistence(timeout: 5))
XCTAssertFalse(closeButton.exists)
XCTAssertFalse(lockSetting.isHittable)
assertLockedOut()
waitForCountdown(toDropBelow: 56)
assertOriginalDeadline(deadline)
// Background and foreground must preserve the mandatory lock.
backgroundAndActivate()
assertTitle("Enter Passcode")
XCTAssertFalse(closeButton.exists)
assertLockedOut()
assertOriginalDeadline(deadline)
// Relaunch without setup flags: credentials and the deadline must persist in Keychain.
app.terminate()
app.launchArguments = languageArguments
app.launch()
assertTitle("Enter Passcode")
XCTAssertFalse(closeButton.exists)
assertLockedOut()
assertOriginalDeadline(deadline)
XCTAssertTrue(lockout.waitForNonExistence(timeout: max(0, deadline.timeIntervalSinceNow) + 5))
enter(originalCode)
XCTAssertTrue(title.waitForNonExistence(timeout: TestConstants.controlExistenceTimeout))
}
/// Changing the code must enforce the same persisted protection as disabling it.
func testChangePasscodeCannotResetFailedAttemptsByReopening() {
createPasscode()
for attempt in 1...3 {
changeSetting.tap()
assertTitle("Enter Passcode")
enter(wrongCode)
if attempt < 3 {
closeButton.tap()
XCTAssertTrue(title.waitForNonExistence(timeout: 5))
}
}
assertLockedOut()
let deadline = Date().addingTimeInterval(TimeInterval(remainingSeconds()))
XCTAssertTrue(lockWindow.waitForExistence(timeout: 5))
XCTAssertFalse(closeButton.exists)
XCTAssertFalse(changeSetting.isHittable)
XCTAssertFalse(lockSetting.isHittable)
assertOriginalDeadline(deadline)
// Waiting unlocks the keypad, never the app itself.
XCTAssertTrue(lockout.waitForNonExistence(timeout: max(0, deadline.timeIntervalSinceNow) + 5))
XCTAssertTrue(lockWindow.exists)
XCTAssertFalse(closeButton.exists)
XCTAssertFalse(changeSetting.isHittable)
enter(originalCode)
XCTAssertTrue(lockWindow.waitForNonExistence(timeout: 5))
XCTAssertTrue(changeSetting.waitForExistence(timeout: 5))
}
func testBackgroundCannotBypassMandatoryAppLock() {
createPasscode()
backgroundAndActivate()
for _ in 0..<2 {
assertTitle("Enter Passcode")
XCTAssertFalse(closeButton.exists)
XCTAssertFalse(lockSetting.isHittable, "Protected settings must remain inaccessible.")
let start = app.coordinate(withNormalizedOffset: CGVector(dx: 0.5, dy: 0.25))
let end = app.coordinate(withNormalizedOffset: CGVector(dx: 0.5, dy: 0.8))
start.press(forDuration: 0.1, thenDragTo: end)
XCTAssertTrue(title.exists, "Dragging must not dismiss the mandatory lock.")
backgroundAndActivate()
}
enter(originalCode)
XCTAssertTrue(title.waitForNonExistence(timeout: TestConstants.controlExistenceTimeout))
XCTAssertTrue(lockSetting.waitForExistence(timeout: 5), "Unlocking must preserve the Settings screen.")
}
/// An informational sheet stays in the app window while the mandatory lock covers it.
func testAppLockAppearsAbovePresentedSheet() {
createPasscode()
let acknowledgements = app.buttons["Acknowledgements"]
scrollTo(acknowledgements)
acknowledgements.tap()
let close = app.buttons["settings.acknowledgements.close"]
XCTAssertTrue(close.waitForExistence(timeout: 5))
backgroundAndActivate()
guard lockWindow.waitForExistence(timeout: 5) else {
let screenshot = XCTAttachment(screenshot: XCUIScreen.main.screenshot())
screenshot.name = "App lock above acknowledgements"
screenshot.lifetime = .keepAlways
add(screenshot)
let hierarchy = XCTAttachment(string: app.debugDescription)
hierarchy.name = "App lock UI hierarchy"
hierarchy.lifetime = .keepAlways
add(hierarchy)
XCTFail("App-lock window missing after foreground. Passcode title exists: \(title.exists); acknowledgements close exists: \(close.exists).")
return
}
assertTitle("Enter Passcode")
XCTAssertFalse(close.isHittable)
enter(originalCode)
XCTAssertTrue(lockWindow.waitForNonExistence(timeout: 5))
XCTAssertTrue(close.isHittable, "Unlocking must preserve the sheet underneath.")
close.tap()
scrollTo(lockSetting, towardsTop: true)
}
/// An existing confirmation alert cannot intercept or prevent the app-lock window.
func testAppLockAppearsAbovePresentedAlert() {
createPasscode()
let advanced = app.buttons["Advanced"]
scrollTo(advanced)
advanced.tap()
let clearCache = app.buttons["Clear cache"]
scrollTo(clearCache)
clearCache.tap()
let cancel = app.alerts.firstMatch.buttons["Cancel"]
XCTAssertTrue(cancel.waitForExistence(timeout: 5))
backgroundAndActivate()
XCTAssertTrue(lockWindow.waitForExistence(timeout: 5))
assertTitle("Enter Passcode")
XCTAssertFalse(cancel.isHittable)
enter(originalCode)
XCTAssertTrue(lockWindow.waitForNonExistence(timeout: 5))
XCTAssertTrue(cancel.isHittable, "Unlocking must preserve the confirmation alert underneath.")
cancel.tap()
app.navigationBars["Advanced"].buttons["Settings"].tap()
scrollTo(lockSetting, towardsTop: true)
}
/// Waiting out each three-attempt lockout must not reset the ten-attempt app-wipe counter.
func testAppResetAfterTenFailuresAcrossLockouts() {
createPasscode()
let resetSetting = app.switches["settings.passcode.reset"]
for _ in 0..<3 where !resetSetting.isHittable {
app.swipeUp()
}
XCTAssertTrue(resetSetting.waitForExistence(timeout: 5))
// SwiftUI can expose the labelled row as a switch containing the actual control.
let nestedSwitch = resetSetting.switches.firstMatch
let resetControl = nestedSwitch.exists ? nestedSwitch : resetSetting
XCTAssertEqual(resetControl.value as? String, "0")
if nestedSwitch.exists {
resetControl.tap()
} else {
// In the English test layout the switch is at the trailing edge of the row.
resetControl.coordinate(withNormalizedOffset: CGVector(dx: 0.95, dy: 0.5)).tap()
}
let resetEnabled = XCTNSPredicateExpectation(predicate: NSPredicate(format: "value == %@", "1"), object: resetControl)
guard XCTWaiter.wait(for: [resetEnabled], timeout: 5) == .completed else {
let screenshot = XCTAttachment(screenshot: XCUIScreen.main.screenshot())
screenshot.name = "Reset setting after tap"
screenshot.lifetime = .keepAlways
add(screenshot)
let hierarchy = XCTAttachment(string: app.debugDescription)
hierarchy.name = "Reset setting UI hierarchy"
hierarchy.lifetime = .keepAlways
add(hierarchy)
XCTFail("The reset switch did not become enabled after tapping it.")
return
}
backgroundAndActivate()
assertTitle("Enter Passcode")
for attempt in 1...10 {
enter(wrongCode)
if attempt.isMultiple(of: 3) {
assertLockedOut()
XCTAssertTrue(lockout.waitForNonExistence(timeout: TimeInterval(resetTestLockoutSeconds + 5)))
XCTAssertTrue(app.buttons["passcode.digit.1"].isEnabled)
} else if attempt < 10 {
XCTAssertTrue(title.exists, "The app must remain locked until the reset threshold.")
}
}
// Wait for real cleanup, then terminate through XCTest to avoid TSan's exit finalizer.
XCTAssertTrue(app.otherElements["uiTesting.resetCompleted"].waitForExistence(timeout: 10))
currentCode = nil
app.terminate()
// Relaunch without setup flags so they cannot hide an incomplete reset.
app.launchArguments = languageArguments
app.launch()
XCTAssertTrue(app.buttons["login"].waitForExistence(timeout: TestConstants.controlExistenceTimeout))
XCTAssertFalse(title.exists, "The app reset must remove the stored passcode.")
}
private func createPasscode() {
lockSetting.tap()
assertTitle("Enter a new passcode")
enter(originalCode)
assertTitle("Confirm new passcode")
enter(originalCode)
currentCode = originalCode
XCTAssertTrue(title.waitForNonExistence(timeout: TestConstants.controlExistenceTimeout))
XCTAssertTrue(changeSetting.waitForExistence(timeout: 5))
}
private func openSettings() {
let sidebar = app.buttons["openSidebar"].firstMatch
XCTAssertTrue(sidebar.waitForExistence(timeout: TestConstants.controlExistenceTimeout))
sidebar.tap()
let settings = app.buttons["sidebarSettings"]
XCTAssertTrue(settings.waitForExistence(timeout: 5))
settings.tap()
XCTAssertTrue(lockSetting.waitForExistence(timeout: 5))
}
private func scrollTo(_ element: XCUIElement, towardsTop: Bool = false) {
for _ in 0..<6 where !element.isHittable {
if towardsTop {
app.swipeDown()
} else {
app.swipeUp()
}
}
XCTAssertTrue(element.isHittable)
}
private func enter(_ code: String) {
for digit in code {
let button = app.buttons["passcode.digit.\(digit)"]
XCTAssertTrue(button.waitForExistence(timeout: 5))
XCTAssertTrue(button.isEnabled)
button.tap()
}
}
private func clearPartialCode() {
let delete = app.buttons["passcode.delete"]
for _ in 0..<6 where delete.exists && delete.isEnabled {
delete.tap()
}
}
private func assertTitle(_ expected: String) {
XCTAssertTrue(title.waitForExistence(timeout: TestConstants.controlExistenceTimeout))
XCTAssertEqual(title.label, expected)
}
/// Wait for the Home screen and an actual background state before reactivating the app.
private func backgroundAndActivate() {
XCUIDevice.shared.press(.home)
let springboard = XCUIApplication(bundleIdentifier: "com.apple.springboard")
XCTAssertTrue(springboard.wait(for: .runningForeground, timeout: 5))
let background = NSPredicate { [app] _, _ in
MainActor.assumeIsolated {
app?.state == .runningBackground || app?.state == .runningBackgroundSuspended
}
}
XCTAssertEqual(XCTWaiter.wait(for: [XCTNSPredicateExpectation(predicate: background, object: nil)], timeout: 5), .completed)
app.activate()
XCTAssertTrue(app.wait(for: .runningForeground, timeout: 5))
}
private func assertLockedOut() {
XCTAssertTrue(lockout.waitForExistence(timeout: 5))
XCTAssertFalse(app.buttons["passcode.digit.1"].isEnabled)
}
private func remainingSeconds() -> Int {
guard let first = lockout.label.split(separator: " ").first, let seconds = Int(first) else {
XCTFail("Missing lockout countdown: \(lockout.label)")
return 0
}
return seconds
}
private func waitForCountdown(toDropBelow seconds: Int) {
let countdown = NSPredicate { [weak self] _, _ in
MainActor.assumeIsolated {
guard let self else { return false }
return self.remainingSeconds() < seconds
}
}
XCTAssertEqual(XCTWaiter.wait(for: [XCTNSPredicateExpectation(predicate: countdown, object: nil)], timeout: 10), .completed)
}
private func assertOriginalDeadline(_ deadline: Date) {
let expected = Int(deadline.timeIntervalSinceNow.rounded(.up))
XCTAssertGreaterThan(remainingSeconds(), 0)
XCTAssertLessThanOrEqual(remainingSeconds(), expected + 2, "Background, reopening or relaunch must not restart the lockout.")
XCTAssertGreaterThanOrEqual(remainingSeconds(), max(0, expected - 2), "The persisted deadline must not be shortened.")
}
}
@@ -0,0 +1,125 @@
// SPDX-FileCopyrightText: Nextcloud GmbH
// SPDX-FileCopyrightText: 2026 Marino Faggiana
// SPDX-License-Identifier: GPL-3.0-or-later
import Foundation
import NextcloudKit
import RealmSwift
import Testing
@testable import Nextcloud
@Suite("Album persistence")
struct NCAlbumsPersistenceTests {
private func configuration(fileURL: URL? = nil) -> Realm.Configuration {
Realm.Configuration(
fileURL: fileURL,
inMemoryIdentifier: fileURL == nil ? UUID().uuidString : nil,
objectTypes: [TableAlbum.self, tableMetadata.self, tableMetadataTag.self, NCKeyValue.self]
)
}
private func makePhoto() -> tableMetadata {
let metadata = tableMetadata()
metadata.account = "account"
metadata.fileId = "42"
metadata.ocId = "00000042instance"
metadata.fileName = "original.heic"
metadata.serverUrl = "https://example.com/remote.php/dav/files/user/Photos"
metadata.serverUrlFileName = metadata.serverUrl + "/" + metadata.fileName
return metadata
}
@Test("References resolve current metadata and ignore another account's files")
func metadataReference() throws {
let realm = try Realm(configuration: configuration())
let original = makePhoto()
let album = TableAlbum(album: NKPhotoAlbum(account: original.account, href: "/albums/Holiday/"))
album.photos.append(original.ocId)
#expect(album.metadatas(in: realm).isEmpty)
try realm.write { realm.add(original) }
let resolved = try #require(album.metadatas(in: realm).first)
#expect(resolved.realm == nil)
#expect(resolved.serverUrlFileName == original.serverUrlFileName)
try realm.write { original.fileNameView = "renamed.heic" }
#expect(album.metadatas(in: realm).first?.fileNameView == "renamed.heic")
let other = TableAlbum(album: NKPhotoAlbum(account: "other", href: album.href))
other.photos.append(original.ocId)
#expect(other.metadatas(in: realm).isEmpty)
}
@Test("Account cleanup deletes only its albums, leaving files and other accounts intact")
func accountIsolation() throws {
let realm = try Realm(configuration: configuration())
let original = makePhoto()
let first = TableAlbum(album: NKPhotoAlbum(account: original.account, href: "/albums/Holiday/"))
let second = TableAlbum(album: NKPhotoAlbum(account: "other", href: first.href))
first.photos.append(original.ocId)
try realm.write {
realm.add(original)
realm.add([first, second])
}
#expect(first.primaryKey != second.primaryKey)
try realm.write {
realm.delete(realm.objects(TableAlbum.self).filter("account == %@", original.account))
}
#expect(first.isInvalidated)
#expect(!second.isInvalidated)
#expect(!original.isInvalidated)
#expect(realm.objects(TableAlbum.self).count == 1)
}
@Test("A renamed album gets a new primary key while keeping its photo references")
func renamePreservesReferences() throws {
let realm = try Realm(configuration: configuration())
let original = NKPhotoAlbum(account: "account", href: "/albums/Old/")
let renamed = NKPhotoAlbum(account: original.account, href: "/albums/New%20name/", itemCount: 1)
let entry = TableAlbum(album: original)
entry.photos.append("00000042instance")
entry.photosLoaded = true
try realm.write { realm.add(entry) }
try realm.write {
let replacement = TableAlbum(album: renamed, copyingPhotosFrom: entry)
realm.delete(entry)
realm.add(replacement, update: .modified)
}
#expect(realm.object(ofType: TableAlbum.self, forPrimaryKey: original.id) == nil)
let saved = try #require(realm.object(ofType: TableAlbum.self, forPrimaryKey: renamed.id))
#expect(saved.album == renamed)
#expect(saved.photosLoaded)
#expect(Array(saved.photos) == ["00000042instance"])
try realm.write { saved.update(from: NKPhotoAlbum(account: renamed.account, href: renamed.href, itemCount: 2)) }
#expect(saved.itemCount == 2)
#expect(saved.photos.count == 1)
}
@Test("Albums and photo references survive reopening the database")
func reopenReferences() throws {
let folder = FileManager.default.temporaryDirectory.appendingPathComponent(UUID().uuidString)
try FileManager.default.createDirectory(at: folder, withIntermediateDirectories: true)
defer { try? FileManager.default.removeItem(at: folder) }
let configuration = configuration(fileURL: folder.appendingPathComponent("albums.realm"))
let album = NKPhotoAlbum(account: "account", href: "/albums/Holiday%20photos/", lastPhotoId: "42", itemCount: 1)
try autoreleasepool {
let realm = try Realm(configuration: configuration)
let original = makePhoto()
let entry = TableAlbum(album: album)
entry.photos.append(original.ocId)
entry.photosLoaded = true
try realm.write {
realm.add(original)
realm.add(entry)
}
}
try autoreleasepool {
let realm = try Realm(configuration: configuration)
let entry = try #require(realm.object(ofType: TableAlbum.self, forPrimaryKey: album.id))
#expect(entry.album == album)
#expect(entry.photosLoaded)
#expect(entry.photos.first == "00000042instance")
#expect(entry.metadatas(in: realm).first?.fileName == "original.heic")
try realm.write { entry.photos.removeAll() }
#expect(entry.photosLoaded)
#expect(entry.photos.isEmpty)
}
}
}
@@ -0,0 +1,314 @@
// SPDX-FileCopyrightText: Nextcloud GmbH
// SPDX-FileCopyrightText: 2026 Marino Faggiana
// SPDX-License-Identifier: GPL-3.0-or-later
import Foundation
import GRDB
import NextcloudKit
import Testing
@testable import Nextcloud
@Suite("Background Upload resource state")
@MainActor
struct NCAutoUploadAssetTests {
private let account = "account"
private let destination = "https://example.com/Photos"
private let assetIdentifier = "56382E82-3757-4EE9-9216-9342EFE976E0/L0/001"
private let imageClass = NKTypeClassFile.image.rawValue
private let videoClass = NKTypeClassFile.video.rawValue
private func makeDatabase() throws -> NCLocalDatabase {
let url = FileManager.default.temporaryDirectory.appendingPathComponent(UUID().uuidString).appendingPathExtension("sqlite")
return try NCLocalDatabase(databaseURL: url)
}
private func resource(video: Bool = false, session: String = "session", uploaded: Bool = false) -> NCAutoUploadResource {
NCAutoUploadResource(account: account, serverUrlBase: destination, assetLocalIdentifier: assetIdentifier, uploadSessionIdentifier: session,
classFile: video ? videoClass : imageClass, fileName: video ? "0355.mov" : "0355.heic",
uploaded: uploaded, creationDate: Date(timeIntervalSince1970: 100))
}
private func history(_ database: NCLocalDatabase, session: String? = nil) async throws -> [NCAutoUploadResource] {
try await database.autoUploadResources(account: account, serverUrlBase: destination, assetLocalIdentifier: assetIdentifier, sessionIdentifier: session)
}
private func metadata(video: Bool = false, identifier: String = "photo-transfer") -> tableMetadata {
let metadata = tableMetadata()
metadata.account = account
metadata.assetLocalIdentifier = assetIdentifier
metadata.autoUploadServerUrlBase = destination
metadata.sessionSelector = NCGlobal.shared.selectorUploadAutoUpload
metadata.ocId = identifier
metadata.ocIdTransfer = identifier
metadata.classFile = video ? videoClass : imageClass
metadata.fileNameView = video ? "0355.mov" : "0355.heic"
metadata.fileName = metadata.fileNameView
metadata.livePhotoFile = video ? "0355.heic" : "0355.mov"
metadata.creationDate = Date(timeIntervalSince1970: 100) as NSDate
return metadata
}
@Test("A Live Photo has two independently completed rows", arguments: [false, true])
func partialUpload(videoFirst: Bool) async throws {
let database = try makeDatabase()
_ = try await database.recordAutoUploadResources([resource(), resource(video: true)])
let first = metadata(video: videoFirst, identifier: "first")
let second = metadata(video: !videoFirst, identifier: "second")
try await database.recordAutoUploadTransfer(first, sessionIdentifier: "session", uploaded: true)
var rows = try await history(database)
#expect(rows.count == 2)
#expect(rows.filter(\.uploaded).map(\.classFile) == [first.classFile])
#expect(rows.first(where: { $0.classFile == second.classFile })?.uploaded == false)
try await database.recordAutoUploadTransfer(second, sessionIdentifier: "session", uploaded: true)
rows = try await history(database)
#expect(Set(rows.filter(\.uploaded).map(\.classFile)) == [imageClass, videoClass])
}
@Test("A standalone photo has one row; a missing video row is not a completed Live Photo")
func expectedComponents() async throws {
let database = try makeDatabase()
let photo = metadata()
try await database.recordAutoUploadTransfer(photo, sessionIdentifier: "session", uploaded: true)
let rows = try await history(database)
#expect(rows.count == 1)
#expect(rows.first?.classFile == imageClass)
#expect(rows.first?.fileName == photo.fileNameView)
#expect(rows.first?.uploaded == true)
#expect(rows.contains { $0.classFile == videoClass && $0.uploaded } == false)
try await database.recordAutoUploadTransfer(metadata(video: true), sessionIdentifier: "session")
let resumed = try await history(database)
#expect(resumed.count == 2)
#expect(resumed.first { $0.classFile == imageClass }?.uploaded == true)
#expect(resumed.first { $0.classFile == videoClass }?.uploaded == false)
}
@Test("Repeated discovery retains names and completed progress for each component")
func repeatedDiscovery() async throws {
let database = try makeDatabase()
_ = try await database.recordAutoUploadResources([resource(uploaded: true), resource(video: true)])
var photo = resource()
var video = resource(video: true)
photo.fileName = "0356.heic"
video.fileName = "0356.mov"
let rows = try await database.recordAutoUploadResources([photo, video])
#expect(rows.first(where: { $0.classFile == imageClass })?.fileName == "0355.heic")
#expect(rows.first(where: { $0.classFile == imageClass })?.uploaded == true)
#expect(rows.first(where: { $0.classFile == videoClass })?.fileName == "0355.mov")
#expect(rows.first(where: { $0.classFile == videoClass })?.uploaded == false)
#expect(try await history(database).count == 2)
}
@Test("Force Reupload isolates the current session; normal discovery sees previous successes")
func sessionIsolation() async throws {
let database = try makeDatabase()
_ = try await database.recordAutoUploadResources([
resource(session: "old", uploaded: true), resource(video: true, session: "old", uploaded: true),
resource(session: "current"), resource(video: true, session: "current")
])
let normal = try await history(database)
#expect(normal.count == 4)
#expect(Set(normal.filter(\.uploaded).map(\.classFile)) == [imageClass, videoClass])
let forced = try await history(database, session: "current")
#expect(forced.count == 2)
#expect(forced.allSatisfy { !$0.uploaded })
}
@Test("History and removal are scoped to account, destination and asset")
func destinationIsolation() async throws {
let database = try makeDatabase()
_ = try await database.recordAutoUploadResources([resource(), resource(video: true)])
for scope in [("other", destination, assetIdentifier), (account, "other", assetIdentifier), (account, destination, "other")] {
#expect(try await database.autoUploadResources(account: scope.0, serverUrlBase: scope.1, assetLocalIdentifier: scope.2).isEmpty)
}
try await database.removeAutoUploadResources(account: "other", serverUrlBase: destination)
#expect(try await history(database).count == 2)
try await database.removeAutoUploadResources(account: account, serverUrlBase: destination)
#expect(try await history(database).isEmpty)
}
@Test("Account removal clears every destination without clearing another account")
func accountRemoval() async throws {
let database = try makeDatabase()
let otherDestination = NCAutoUploadResource(account: account, serverUrlBase: "other", assetLocalIdentifier: assetIdentifier,
uploadSessionIdentifier: "session", classFile: imageClass, fileName: "0355.heic",
uploaded: false, creationDate: Date(timeIntervalSince1970: 100))
let otherAccount = NCAutoUploadResource(account: "other", serverUrlBase: destination, assetLocalIdentifier: assetIdentifier,
uploadSessionIdentifier: "session", classFile: imageClass, fileName: "0355.heic",
uploaded: false, creationDate: otherDestination.creationDate)
_ = try await database.recordAutoUploadResources([resource(), otherDestination, otherAccount])
try await database.recordPhotoLibraryAssetUpload(account: account, assetLocalIdentifier: assetIdentifier,
classFile: imageClass, isLivePhoto: false, creationDate: otherDestination.creationDate)
try await database.recordPhotoLibraryAssetUpload(account: "other", assetLocalIdentifier: assetIdentifier,
classFile: imageClass, isLivePhoto: false, creationDate: otherDestination.creationDate)
try await database.clearDatabase(account: account)
#expect(try await database.uploadedPhotoLibraryAssets(account: account).isEmpty)
#expect(try await database.uploadedPhotoLibraryAssets(account: "other").count == 1)
#expect(try await history(database).isEmpty)
#expect(try await database.autoUploadResources(account: account, serverUrlBase: "other", assetLocalIdentifier: assetIdentifier).isEmpty)
#expect(try await database.autoUploadResources(account: "other", serverUrlBase: destination, assetLocalIdentifier: assetIdentifier).count == 1)
}
@Test("The transfer identifier confirms completion after server ID replacement and file renaming")
func transferConfirmation() async throws {
let database = try makeDatabase()
let photo = metadata()
#expect(try await database.recordAutoUploadTransfer(photo, sessionIdentifier: "session"))
photo.ocId = "server-file-id"
photo.fileName = "renamed.heic"
photo.fileNameView = "renamed.heic"
#expect(try await database.recordAutoUploadTransfer(photo, uploaded: true))
#expect(try await database.autoUploadTransferIsUploaded(photo))
let rows = try await history(database)
#expect(rows.count == 1)
#expect(rows.first?.transferIdentifier == "photo-transfer")
#expect(rows.first?.fileName == "renamed.heic")
#expect(rows.first?.uploaded == true)
}
@Test("A late confirmation cannot complete a new forced session with identical file names")
func lateConfirmation() async throws {
let database = try makeDatabase()
let old = metadata(identifier: "old-transfer")
let current = metadata(identifier: "new-transfer")
try await database.recordAutoUploadTransfer(old, sessionIdentifier: "old")
try await database.recordAutoUploadTransfer(current, sessionIdentifier: "current")
try await database.recordAutoUploadTransfer(old, sessionIdentifier: "current", uploaded: true)
#expect(try await database.autoUploadTransferIsUploaded(old))
#expect(try await database.autoUploadTransferIsUploaded(current) == false)
#expect(try await history(database, session: "current").first?.uploaded == false)
}
@Test("Ordinary host uploads cannot create or complete extension history")
func unregisteredHostUpload() async throws {
let database = try makeDatabase()
let ordinary = metadata(identifier: "ordinary-transfer")
#expect(try await database.recordAutoUploadTransfer(ordinary, uploaded: true) == false)
#expect(try await database.autoUploadResource(for: ordinary) == nil)
let seed = metadata()
try await database.recordAutoUploadTransfer(seed, sessionIdentifier: "session")
#expect(try await database.recordAutoUploadTransfer(ordinary, uploaded: true) == false)
#expect(try await database.autoUploadTransferIsUploaded(seed) == false)
}
@Test("PhotoKit and chunk components retain independent transfers in the same session")
func independentChunkComponents() async throws {
let database = try makeDatabase()
_ = try await database.recordAutoUploadResources([resource(), resource(video: true)])
let photo = metadata(identifier: "photokit-photo")
photo.size = 5_000_000
photo.backgroundUploadJobIdentifier = "pending"
let video = metadata(video: true, identifier: "chunk-video")
video.size = 120_000_000
video.chunk = 100_000_000
try await database.recordAutoUploadTransfer(photo, sessionIdentifier: "session")
try await database.recordAutoUploadTransfer(video, sessionIdentifier: "session")
let photoResource = try await database.autoUploadResource(for: photo)
let videoResource = try await database.autoUploadResource(for: video)
#expect(photoResource?.transferIdentifier == "photokit-photo")
#expect(videoResource?.transferIdentifier == "chunk-video")
#expect(photoResource?.uploadSessionIdentifier == videoResource?.uploadSessionIdentifier)
try await database.recordAutoUploadTransfer(photo, uploaded: true)
#expect(try await database.autoUploadTransferIsUploaded(photo))
#expect(try await database.autoUploadTransferIsUploaded(video) == false)
try await database.recordAutoUploadTransfer(video, uploaded: true)
#expect(try await history(database).allSatisfy(\.uploaded))
#expect(try await history(database).count == 2)
}
@Test("Completed components survive hundreds of incremental naming proposals")
func completedPairRediscovery() async throws {
let database = try makeDatabase()
_ = try await database.recordAutoUploadResources([resource(uploaded: true), resource(video: true, uploaded: true)])
for number in 355...617 {
var photo = resource()
var video = resource(video: true)
photo.fileName = "\(number).heic"
video.fileName = "\(number).mov"
let rows = try await database.recordAutoUploadResources([photo, video])
let allUploaded = rows.allSatisfy { $0.uploaded }
#expect(allUploaded)
#expect(rows.map(\.fileName) == ["0355.heic", "0355.mov"])
}
#expect(try await history(database).count == 2)
}
@Test("Unavailable history throws instead of appearing empty or accepting a confirmation")
func unavailableDatabase() async throws {
let database = try makeDatabase()
let transfer = metadata()
try await database.recordAutoUploadTransfer(transfer, sessionIdentifier: "session")
try database.databasePool().close()
await #expect(throws: (any Error).self) {
try await history(database)
}
await #expect(throws: (any Error).self) {
try await database.recordAutoUploadTransfer(transfer, uploaded: true)
}
}
@Test("A success for another file name cannot mark the reserved component complete")
func mismatchedReservation() async throws {
let database = try makeDatabase()
_ = try await database.recordAutoUploadResources([resource()])
var completed = resource(uploaded: true)
completed.fileName = "other.heic"
let stored = try await database.recordAutoUploadResources([completed])
#expect(stored.first?.fileName == "0355.heic")
#expect(stored.first?.uploaded == false)
}
@Test("The success cache does not suppress a new attempt to the same server path")
func cachedSuccessIdentity() async {
let cache = NCMetadataUploadTranfersSuccess()
let completed = metadata(identifier: "old-attempt")
completed.account = "test-cache-" + UUID().uuidString
completed.livePhotoFile = ""
let path = destination + "/0355.heic"
completed.serverUrlFileName = path
await cache.append(metadata: completed, ocId: "server-file", date: nil, etag: nil)
#expect(completed.ocId == "old-attempt")
let cachedMetadatas = await cache.getAll()
cachedMetadatas.first?.ocIdTransfer = "changed-outside-cache"
#expect(await cache.exists(serverUrlFileName: path))
#expect(await cache.exists(serverUrlFileName: path, transferIdentifier: "old-attempt"))
#expect(await cache.exists(serverUrlFileName: path, transferIdentifier: "new-attempt") == false)
let reuploaded = metadata(identifier: "new-attempt")
reuploaded.account = completed.account
reuploaded.livePhotoFile = ""
reuploaded.serverUrlFileName = path
await cache.append(metadata: reuploaded, ocId: "server-file", date: nil, etag: nil)
#expect(await cache.count() == 2)
#expect(await cache.exists(serverUrlFileName: path, transferIdentifier: "old-attempt"))
#expect(await cache.exists(serverUrlFileName: path, transferIdentifier: "new-attempt"))
await cache.append(metadata: reuploaded, ocId: "server-file", date: nil, etag: nil)
#expect(await cache.count() == 2)
}
@Test("The new component table preserves existing photo-library state")
func existingSchema() async throws {
let url = FileManager.default.temporaryDirectory.appendingPathComponent(UUID().uuidString).appendingPathExtension("sqlite")
let oldDatabase = try DatabaseQueue(path: url.path)
var migrator = DatabaseMigrator()
migrator.registerMigration("initialSchema") { database in
try database.create(table: "photoLibraryAsset") { table in
table.column("account", .text).notNull()
table.column("assetLocalIdentifier", .text).notNull()
table.column("photoUploaded", .boolean)
table.column("videoUploaded", .boolean)
table.column("creationDate", .datetime).notNull()
table.primaryKey(["account", "assetLocalIdentifier"])
}
}
try migrator.migrate(oldDatabase)
let photo = NCPhotoLibraryAsset(account: account, assetLocalIdentifier: "photo", photoUploaded: true,
videoUploaded: nil, creationDate: Date(timeIntervalSince1970: 100))
try await oldDatabase.write { try photo.insert($0) }
let database = try NCLocalDatabase(databaseURL: url)
#expect(try await database.uploadedPhotoLibraryAssets(account: account) == [photo])
_ = try await database.recordAutoUploadResources([resource(), resource(video: true)])
try await database.clearDBCache()
#expect(try await history(database).isEmpty)
#expect(try await database.uploadedPhotoLibraryAssets(account: account).isEmpty)
}
}
@@ -0,0 +1,95 @@
// SPDX-FileCopyrightText: Nextcloud GmbH
// SPDX-FileCopyrightText: 2026 Marino Faggiana
// SPDX-License-Identifier: GPL-3.0-or-later
import Foundation
import Testing
@testable import Nextcloud
@Suite("Auto Upload incremental date backup compatibility")
@MainActor
struct NCAutoUploadDateTests {
@Test("Whole-library discovery stays unfiltered as upload progress advances")
func wholeLibraryDiscoveryIgnoresProgress() {
let account = tableAccount()
account.autoUploadAllPhotos = true
for date in [nil, Date(timeIntervalSince1970: 100), Date(timeIntervalSince1970: 200)] {
account.autoUploadSinceDate = date
#expect(account.autoUploadDatePredicate == nil)
}
}
@Test("Date-limited discovery includes the boundary and newer assets, and switching to all removes the filter")
func dateLimitedDiscovery() throws {
let account = tableAccount()
account.autoUploadSinceDate = Date(timeIntervalSince1970: 100)
let predicate = try #require(account.autoUploadDatePredicate)
#expect(!predicate.evaluate(with: ["creationDate": Date(timeIntervalSince1970: 99)]))
#expect(predicate.evaluate(with: ["creationDate": Date(timeIntervalSince1970: 100)]))
#expect(predicate.evaluate(with: ["creationDate": Date(timeIntervalSince1970: 101)]))
account.autoUploadAllPhotos = true
#expect(account.autoUploadDatePredicate == nil)
account.autoUploadAllPhotos = false
#expect(account.autoUploadDatePredicate != nil)
}
@Test("Account backup preserves the incremental restart date")
func backupRoundTrip() throws {
let account = tableAccount()
account.autoUploadSinceDate = Date(timeIntervalSince1970: 100)
let data = try JSONEncoder().encode(account.tableAccountToCodable())
let decoded = try JSONDecoder().decode(tableAccountCodable.self, from: data)
#expect(tableAccount(codableObject: decoded).autoUploadSinceDate == account.autoUploadSinceDate)
}
@Test("A whole-library selection remains unfiltered after account restore")
func wholeLibraryRoundTrip() throws {
let account = tableAccount()
account.autoUploadAllPhotos = true
let data = try JSONEncoder().encode(account.tableAccountToCodable())
let decoded = try JSONDecoder().decode(tableAccountCodable.self, from: data)
#expect(tableAccount(codableObject: decoded).autoUploadSinceDate == nil)
}
@Test("Backups with the removed discovery field preserve the restart date")
func removedDiscoveryFieldCompatibility() throws {
let account = tableAccount()
account.autoUploadSinceDate = Date(timeIntervalSince1970: 100)
let data = try JSONEncoder().encode(account.tableAccountToCodable())
var json = try #require(JSONSerialization.jsonObject(with: data) as? [String: Any])
// An obsolete discovery cursor must not override a user-selected restart date.
json["autoUploadDiscoveryDate"] = Date(timeIntervalSince1970: 200).timeIntervalSinceReferenceDate
let oldData = try JSONSerialization.data(withJSONObject: json)
let decoded = try JSONDecoder().decode(tableAccountCodable.self, from: oldData)
#expect(tableAccount(codableObject: decoded).autoUploadSinceDate == account.autoUploadSinceDate)
}
@Test("Whole-library selection survives backup with a nonempty progress date")
func wholeLibrarySelectionWithProgress() throws {
let account = tableAccount()
account.autoUploadAllPhotos = true
account.autoUploadSinceDate = Date(timeIntervalSince1970: 100)
let data = try JSONEncoder().encode(account.tableAccountToCodable())
let decoded = try JSONDecoder().decode(tableAccountCodable.self, from: data)
let restored = tableAccount(codableObject: decoded)
#expect(restored.autoUploadAllPhotos)
#expect(restored.autoUploadSinceDate == account.autoUploadSinceDate)
#expect(restored.autoUploadDatePredicate == nil)
}
@Test("Older backups infer the library selection from their existing date")
func previousBackupSelectionCompatibility() throws {
let dates: [Date?] = [nil, Date(timeIntervalSince1970: 100)]
for date in dates {
let account = tableAccount()
account.autoUploadSinceDate = date
let data = try JSONEncoder().encode(account.tableAccountToCodable())
var json = try #require(JSONSerialization.jsonObject(with: data) as? [String: Any])
json.removeValue(forKey: "autoUploadAllPhotos")
let oldData = try JSONSerialization.data(withJSONObject: json)
let decoded = try JSONDecoder().decode(tableAccountCodable.self, from: oldData)
#expect(tableAccount(codableObject: decoded).autoUploadAllPhotos == (date == nil))
}
}
}
@@ -0,0 +1,99 @@
// SPDX-FileCopyrightText: Nextcloud GmbH
// SPDX-FileCopyrightText: 2026 Marino Faggiana
// SPDX-License-Identifier: GPL-3.0-or-later
import AVFoundation
import Foundation
import Testing
@testable import Nextcloud
@Suite("NCCameraRoll image format conversion")
struct NCCameraRollTests {
@Test("Animated and lossless formats retain their filenames")
func formatsPreserved() {
for fileName in ["animation.gif", "image.png", "animation.webp", "image.tiff", "image.jpg"] {
let fileExtension = (fileName as NSString).pathExtension
#expect(!NCCameraRoll.shouldConvertToJPEG(fileExtension: fileExtension, nativeFormat: false))
#expect(
NCCameraRoll.outputFileName(
for: fileName,
sourceFileExtension: fileExtension,
nativeFormat: false
) == fileName
)
}
}
@Test("Compatibility formats are converted to JPEG")
func compatibilityFormatsConverted() {
for fileName in ["image.heic", "image.heif", "image.dng"] {
let fileExtension = (fileName as NSString).pathExtension
#expect(NCCameraRoll.shouldConvertToJPEG(fileExtension: fileExtension, nativeFormat: false))
#expect(
NCCameraRoll.outputFileName(
for: fileName,
sourceFileExtension: fileExtension,
nativeFormat: false
) == "image.jpg"
)
}
}
@Test("Native format preserves HEIC, HEIF and RAW filenames")
func nativeFormatsPreserved() {
for fileName in ["image.heic", "image.heif", "image.dng"] {
let fileExtension = (fileName as NSString).pathExtension
#expect(!NCCameraRoll.shouldConvertToJPEG(fileExtension: fileExtension, nativeFormat: true))
#expect(
NCCameraRoll.outputFileName(
for: fileName,
sourceFileExtension: fileExtension,
nativeFormat: true
) == fileName
)
}
}
@Test("Generated upload names keep their base name")
func generatedNameConverted() {
#expect(
NCCameraRoll.outputFileName(
for: "2026-08-04 09-30-00.heic",
sourceFileExtension: "heic",
nativeFormat: false
) == "2026-08-04 09-30-00.jpg"
)
}
@Test("Video passthrough retains its original container")
func videoContainerPreserved() {
#expect(NCCameraRoll.videoOutputFileType(fileExtension: "mov") == .mov)
#expect(NCCameraRoll.videoOutputFileType(fileExtension: "MP4") == .mp4)
#expect(NCCameraRoll.videoOutputFileType(fileExtension: "m4v") == .m4v)
#expect(NCCameraRoll.videoOutputFileType(fileExtension: "jpg") == nil)
}
@Test("Concurrent extractions use distinct temporary paths")
func extractionTemporaryPathsAreUnique() {
let directory = FileManager.default.temporaryDirectory
let firstURL = NCCameraRoll.extractionTemporaryURL(
fileName: "26-08-04 10-51-42 7473.jpg",
ocId: "camera-roll-transfer",
directory: directory
)
let secondURL = NCCameraRoll.extractionTemporaryURL(
fileName: "26-08-04 10-51-42 7473.jpg",
ocId: "camera-roll-transfer",
directory: directory
)
#expect(firstURL != secondURL)
#expect(firstURL.deletingLastPathComponent() == directory)
#expect(firstURL.pathExtension == "uploading")
#expect(firstURL.lastPathComponent.contains("camera-roll-transfer"))
}
}
@@ -0,0 +1,117 @@
// SPDX-FileCopyrightText: Nextcloud GmbH
// SPDX-FileCopyrightText: 2026 Marino Faggiana
// SPDX-License-Identifier: GPL-3.0-or-later
import Foundation
import NextcloudKit
import Testing
@testable import Nextcloud
@Suite("Document editor MIME type recognition")
struct NCDocumentEditorSupportTests {
private let word = "application/vnd.openxmlformats-officedocument.wordprocessingml.document"
private let spreadsheet = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
@Test("Server MIME types work even without a filename extension")
func extensionlessDocument() {
#expect(NCDocumentEditorSupport.supportsMimetype([word], contentType: word, fileName: "Document"))
}
@Test("MIME type comparison ignores case, whitespace and parameters")
func normalizedServerType() {
#expect(NCDocumentEditorSupport.supportsMimetype(
["application/pdf"], contentType: " APPLICATION/PDF; charset=binary ", fileName: "document.pdf"
))
}
@Test("Apple PDF type identifiers match the server MIME type")
func appleTypeIdentifier() {
#expect(NCDocumentEditorSupport.supportsMimetype(
["application/pdf"], contentType: "com.adobe.pdf", fileName: "Document"
))
}
@Test("Office extensions identify files with missing or generic MIME types",
arguments: ["", "application/octet-stream", "application/zip"])
func genericOfficeType(contentType: String) {
#expect(NCDocumentEditorSupport.supportsMimetype([word], contentType: contentType, fileName: "Document.DOCX"))
#expect(NCDocumentEditorSupport.supportsMimetype([spreadsheet], contentType: contentType, fileName: "Sheet.xlsx"))
}
@Test("An explicitly supported generic MIME type is retained",
arguments: ["application/octet-stream", "application/zip"])
func supportedGenericType(contentType: String) {
#expect(NCDocumentEditorSupport.supportsMimetype(
[contentType], contentType: contentType, fileName: "document.docx"
))
}
@Test("A specific server MIME type takes precedence over the filename")
func authoritativeServerType() {
#expect(!NCDocumentEditorSupport.supportsMimetype([word], contentType: "text/plain", fileName: "document.docx"))
}
@Test("Unsupported and empty MIME types do not match substrings")
func unsupportedType() {
#expect(!NCDocumentEditorSupport.supportsMimetype([word], contentType: "document", fileName: "file.unknown"))
#expect(!NCDocumentEditorSupport.supportsMimetype([word], contentType: "", fileName: "file.unknown"))
#expect(!NCDocumentEditorSupport.supportsMimetype([], contentType: word, fileName: "document.docx"))
}
@Test("HTML compatibility does not advertise Office editors without HTML support")
func officeHTMLRequiresSupport() throws {
for identifier in ["richdocuments", "onlyoffice", "eurooffice"] {
let editor = try makeEditor(identifier: identifier, mimetypes: [word])
#expect(!NCDocumentEditorSupport.supportsDirectEditingEditor(
editor, contentType: "text/html", fileName: "page.html"
))
}
}
@Test("An Office editor can explicitly advertise optional HTML support")
func optionalHTMLSupport() throws {
let editor = try makeEditor(identifier: "richdocuments", mimetypes: [word], optionalMimetypes: ["text/html"])
#expect(NCDocumentEditorSupport.supportsDirectEditingEditor(
editor, contentType: "text/html", fileName: "page.html"
))
}
@Test("Nextcloud Text retains HTML and Markdown compatibility")
func textCompatibility() throws {
let editor = try makeEditor(identifier: "text", mimetypes: ["text/plain", "text/markdown"])
#expect(NCDocumentEditorSupport.supportsDirectEditingEditor(
editor, contentType: "text/html", fileName: "page.html"
))
#expect(NCDocumentEditorSupport.supportsDirectEditingEditor(
editor, contentType: "text/x-markdown", fileName: "notes.md"
))
}
@Test("Editors advertising Markdown retain the existing MIME alias")
func advertisedMarkdownAlias() throws {
let editor = try makeEditor(identifier: "richdocuments", mimetypes: ["text/markdown"])
#expect(NCDocumentEditorSupport.supportsDirectEditingEditor(
editor, contentType: "text/x-markdown", fileName: "notes.md"
))
}
@Test("Optional Office types and generic MIME inference select the editor")
func optionalOfficeSupport() throws {
let editor = try makeEditor(identifier: "richdocuments", mimetypes: [], optionalMimetypes: [spreadsheet])
#expect(NCDocumentEditorSupport.supportsDirectEditingEditor(
editor, contentType: "application/octet-stream", fileName: "sheet.xlsx"
))
}
private func makeEditor(identifier: String, mimetypes: [String], optionalMimetypes: [String] = []) throws -> NKDirectEditingEditor {
let data = try JSONSerialization.data(withJSONObject: [
"id": identifier,
"name": identifier,
"mimetypes": mimetypes,
"optionalMimetypes": optionalMimetypes,
"secure": true
])
return try JSONDecoder().decode(NKDirectEditingEditor.self, from: data)
}
}
@@ -0,0 +1,110 @@
// SPDX-FileCopyrightText: Nextcloud GmbH
// SPDX-FileCopyrightText: 2026 Marino Faggiana
// SPDX-License-Identifier: GPL-3.0-or-later
import Foundation
import Testing
@testable import Nextcloud
@Suite("End-to-end key set archive")
struct NCEndToEndKeySetArchiveTests {
@Test("Archiving does not change the active credentials")
func preservesNormalActiveCredentials() throws {
let account = "e2ee-archive-\(UUID().uuidString)"
let preferences = NCPreferences()
defer {
preferences.clearAllKeysEndToEnd(account: account)
}
setKeySet(on: preferences, account: account)
try preferences.archiveCurrentEndToEndKeySet(account: account)
#expect(preferences.isEndToEndEnabled(account: account))
#expect(preferences.getEndToEndCertificate(account: account) == "certificate")
#expect(preferences.getEndToEndPrivateKey(account: account) == "private-key")
#expect(preferences.getEndToEndPublicKey(account: account) == "public-key")
#expect(preferences.getEndToEndPassphrase(account: account) == "passphrase")
}
@Test("Archiving preserves active credentials after they are cleared")
func preservesActiveCredentials() throws {
let account = "e2ee-archive-\(UUID().uuidString)"
let preferences = NCPreferences()
defer {
preferences.clearAllKeysEndToEnd(account: account)
}
setKeySet(on: preferences, account: account)
let archivedKeySet = try preferences.archiveCurrentEndToEndKeySet(account: account)
let snapshot = try #require(archivedKeySet)
preferences.clearCurrentKeysEndToEnd(account: account)
#expect(preferences.getEndToEndCertificate(account: account) == nil)
#expect(preferences.getEndToEndPrivateKey(account: account) == nil)
#expect(preferences.getEndToEndPublicKey(account: account) == nil)
#expect(preferences.getEndToEndPassphrase(account: account) == nil)
let archivedKeySets = try preferences.getArchivedEndToEndKeySets(account: account)
#expect(archivedKeySets == [snapshot])
#expect(snapshot.certificate == "certificate")
#expect(snapshot.privateKey == "private-key")
#expect(snapshot.publicKey == "public-key")
#expect(snapshot.passphrase == "passphrase")
}
@Test("Explicit local removal also clears stale server-key state")
func removalClearsStaleState() {
let account = "e2ee-archive-\(UUID().uuidString)"
let preferences = NCPreferences()
preferences.setEndToEndServerKeyStale(account: account, stale: true)
preferences.clearAllKeysEndToEnd(account: account)
#expect(!preferences.isEndToEndServerKeyStale(account: account))
}
@Test("Archiving the same credentials does not create duplicates")
func avoidsDuplicates() throws {
let account = "e2ee-archive-\(UUID().uuidString)"
let preferences = NCPreferences()
defer {
preferences.clearAllKeysEndToEnd(account: account)
}
setKeySet(on: preferences, account: account)
let firstArchivedKeySet = try preferences.archiveCurrentEndToEndKeySet(account: account)
let secondArchivedKeySet = try preferences.archiveCurrentEndToEndKeySet(account: account)
let firstSnapshot = try #require(firstArchivedKeySet)
let secondSnapshot = try #require(secondArchivedKeySet)
#expect(secondSnapshot.identifier == firstSnapshot.identifier)
#expect(try preferences.getArchivedEndToEndKeySets(account: account).count == 1)
}
@Test("A partial setup is archived when it contains usable key material")
func preservesPartialKeyMaterial() throws {
let account = "e2ee-archive-\(UUID().uuidString)"
let preferences = NCPreferences()
defer {
preferences.clearAllKeysEndToEnd(account: account)
}
preferences.setEndToEndPrivateKey(account: account, privateKey: "private-key")
let archivedKeySet = try preferences.archiveCurrentEndToEndKeySet(account: account)
let snapshot = try #require(archivedKeySet)
#expect(snapshot.privateKey == "private-key")
#expect(snapshot.certificate == nil)
#expect(snapshot.publicKey == nil)
#expect(snapshot.passphrase == nil)
}
private func setKeySet(on preferences: NCPreferences, account: String) {
preferences.setEndToEndCertificate(account: account, certificate: "certificate")
preferences.setEndToEndPrivateKey(account: account, privateKey: "private-key")
preferences.setEndToEndPublicKey(account: account, publicKey: "public-key")
preferences.setEndToEndPassphrase(account: account, passphrase: "passphrase")
}
}
@@ -0,0 +1,148 @@
// SPDX-FileCopyrightText: Nextcloud GmbH
// SPDX-FileCopyrightText: 2026 Marino Faggiana
// SPDX-License-Identifier: GPL-3.0-or-later
import Foundation
import Testing
@testable import Nextcloud
@Suite("End-to-end key set resolver")
struct NCEndToEndKeySetResolverTests {
@Test("The active key set has priority over archived key sets")
func activeKeySetHasPriority() throws {
let active = try #require(makeKeySet(identifier: "active"))
let archived = try #require(makeKeySet(identifier: "archived"))
let access = NCEndToEndKeySetResolver().select(
currentKeySet: active,
archivedKeySets: [archived],
canDecrypt: { _ in true }
)
#expect(access == .active(active))
#expect(access.canWrite)
#expect(access.writeAccessError == .success)
}
@Test("Equivalent PEM formatting identifies the same public key")
func equivalentPublicKeysMatch() {
let compact = "-----BEGIN PUBLIC KEY-----\nYWJjZA==\n-----END PUBLIC KEY-----"
let wrapped = "-----BEGIN PUBLIC KEY-----\nYWJj\nZA==\n-----END PUBLIC KEY-----\n"
let empty = "-----BEGIN PUBLIC KEY-----\n-----END PUBLIC KEY-----"
#expect(NCNetworkingE2EE().publicKeysMatch(compact, wrapped))
#expect(!NCNetworkingE2EE().publicKeysMatch(compact, "different-key"))
#expect(!NCNetworkingE2EE().publicKeysMatch(empty, empty))
}
@Test("A stale local key is excluded from active write access")
func staleKeyIsNotActive() throws {
let account = "e2ee-stale-\(UUID().uuidString)"
let preferences = NCPreferences()
defer {
preferences.clearAllKeysEndToEnd(account: account)
}
preferences.setEndToEndCertificate(account: account, certificate: "certificate")
preferences.setEndToEndPrivateKey(account: account, privateKey: "private-key")
preferences.setEndToEndPublicKey(account: account, publicKey: "public-key")
preferences.setEndToEndPassphrase(account: account, passphrase: "passphrase")
try preferences.archiveCurrentEndToEndKeySet(account: account)
preferences.setEndToEndServerKeyStale(account: account, stale: true)
let resolver = NCEndToEndKeySetResolver(preferences: preferences)
let archivedKeySets = try preferences.getArchivedEndToEndKeySets(account: account)
let archivedKeySet = try #require(archivedKeySets.last)
let access = resolver.select(
currentKeySet: resolver.currentKeySet(account: account),
archivedKeySets: archivedKeySets,
canDecrypt: { _ in true }
)
#expect(access == .archived(archivedKeySet))
#expect(!access.canWrite)
}
@Test("The most recently archived matching key set is selected")
func newestArchivedKeySetHasPriority() throws {
let oldest = try #require(makeKeySet(identifier: "oldest"))
let newest = try #require(makeKeySet(identifier: "newest"))
let access = NCEndToEndKeySetResolver().select(
currentKeySet: nil,
archivedKeySets: [oldest, newest],
canDecrypt: { _ in true }
)
#expect(access == .archived(newest))
#expect(access.isReadOnly)
#expect(access.writeAccessError.errorCode == NCGlobal.shared.errorE2EEReadOnly)
}
@Test("Access is unavailable when no key set can decrypt metadata")
func unavailableWithoutMatchingKeySet() throws {
let active = try #require(makeKeySet(identifier: "active"))
let archived = try #require(makeKeySet(identifier: "archived"))
let access = NCEndToEndKeySetResolver().select(
currentKeySet: active,
archivedKeySets: [archived],
canDecrypt: { _ in false }
)
#expect(access == .unavailable)
#expect(!access.canWrite)
#expect(!access.isReadOnly)
#expect(access.writeAccessError.errorCode == NCGlobal.shared.errorE2EENoUserFound)
}
@Test("A V2 child folder inherits its encrypted root metadata key")
func childFolderUsesRootEncryptedMetadataKey() {
let encryptedMetadataKey = NCEndToEndKeySetResolver().encryptedMetadataKey(
users: nil,
userId: "user",
rootEncryptedMetadataKey: "root-key"
)
#expect(encryptedMetadataKey == "root-key")
}
@Test("A V2 child folder with an empty users array inherits its encrypted root metadata key")
func childFolderWithEmptyUsersUsesRootEncryptedMetadataKey() {
let encryptedMetadataKey = NCEndToEndKeySetResolver().encryptedMetadataKey(
users: [],
userId: "user",
rootEncryptedMetadataKey: "root-key"
)
#expect(encryptedMetadataKey == "root-key")
}
@Test("A V2 root never falls back to a previously saved user key")
func rootWithoutCurrentUserDoesNotUseSavedKey() {
let otherUser = NCEndToEndMetadata.E2eeV2.Users(
userId: "other-user",
certificate: "certificate",
encryptedMetadataKey: "other-key"
)
let encryptedMetadataKey = NCEndToEndKeySetResolver().encryptedMetadataKey(
users: [otherUser],
userId: "user",
rootEncryptedMetadataKey: "saved-root-key"
)
#expect(encryptedMetadataKey == nil)
}
private func makeKeySet(identifier: String) -> NCEndToEndKeySet? {
NCEndToEndKeySet(
certificate: "certificate-" + identifier,
privateKey: "private-key-" + identifier,
publicKey: "public-key-" + identifier,
passphrase: "passphrase-" + identifier,
identifier: identifier,
archivedAt: Date(timeIntervalSince1970: 0)
)
}
}
@@ -0,0 +1,278 @@
// SPDX-FileCopyrightText: Nextcloud GmbH
// SPDX-FileCopyrightText: 2026 Marino Faggiana
// SPDX-License-Identifier: GPL-3.0-or-later
import Testing
import UIKit
@testable import Nextcloud
@Suite("Image zoom view")
@MainActor
struct NCImageZoomViewTests {
@Test("Replacing an image preserves its zoom scale and focal point")
func preservesZoomStateWhenImageChanges() throws {
let (coordinator, scrollView, imageView) = makeZoomView(
imageSize: CGSize(width: 400, height: 300)
)
scrollView.setZoomScale(3, animated: false)
scrollView.contentOffset = CGPoint(x: 220, y: 70)
let zoomState = try #require(coordinator.zoomState())
imageView.image = makeImage(
size: CGSize(width: 300, height: 400)
)
coordinator.layoutImageView(preserving: zoomState)
let restoredZoomState = try #require(coordinator.zoomState())
#expect(abs(restoredZoomState.zoomScale - zoomState.zoomScale) < 0.001)
#expect(abs(restoredZoomState.normalizedCenter.x - zoomState.normalizedCenter.x) < 0.001)
#expect(abs(restoredZoomState.normalizedCenter.y - zoomState.normalizedCenter.y) < 0.001)
}
@Test("Relayout without a saved state resets zoom")
func resetsZoomWithoutSavedState() {
let (coordinator, scrollView, imageView) = makeZoomView(
imageSize: CGSize(width: 400, height: 300)
)
scrollView.setZoomScale(3, animated: false)
imageView.image = makeImage(
size: CGSize(width: 800, height: 600)
)
coordinator.layoutImageViewResettingZoom()
#expect(scrollView.zoomScale == scrollView.minimumZoomScale)
#expect(coordinator.zoomState() == nil)
}
@Test("A full orientation round trip preserves zoom and focal point")
func preservesZoomStateAfterOrientationRoundTrip() throws {
let (coordinator, scrollView, _) = makeZoomView(
imageSize: CGSize(width: 400, height: 300)
)
scrollView.setZoomScale(3, animated: false)
scrollView.contentOffset = CGPoint(x: 0, y: 70)
coordinator.recordCurrentZoomState()
let zoomState = try #require(coordinator.zoomState())
for _ in 0..<3 {
scrollView.bounds = CGRect(
origin: scrollView.bounds.origin,
size: CGSize(width: 480, height: 320)
)
coordinator.layoutImageViewPreservingOnBoundsChange()
// UIKit can deliver automatic scrolling after a rotation finishes.
scrollView.contentOffset = .zero
coordinator.scrollViewDidScroll(scrollView)
scrollView.bounds = CGRect(
origin: scrollView.bounds.origin,
size: CGSize(width: 320, height: 480)
)
coordinator.layoutImageViewPreservingOnBoundsChange()
let restoredZoomState = try #require(coordinator.zoomState())
#expect(abs(restoredZoomState.zoomScale - zoomState.zoomScale) < 0.001)
#expect(abs(restoredZoomState.normalizedCenter.x - zoomState.normalizedCenter.x) < 0.001)
#expect(abs(restoredZoomState.normalizedCenter.y - zoomState.normalizedCenter.y) < 0.001)
}
}
@Test("Images remain fitted and centered through an upper-region round trip", arguments: [
CGSize(width: 400, height: 300),
CGSize(width: 300, height: 400),
CGSize(width: 400, height: 400)
])
func centersImageThroughFoldRoundTrip(imageSize: CGSize) {
let (coordinator, scrollView, imageView) = makeZoomView(imageSize: imageSize)
// UIScrollView rounds offsets to physical pixels; an exact center can fall halfway between them.
let centeringTolerance = 0.5 / max(scrollView.traitCollection.displayScale, 1) + 0.001
for size in [CGSize(width: 320, height: 480), CGSize(width: 320, height: 220), CGSize(width: 320, height: 480)] {
scrollView.bounds.size = size
coordinator.layoutImageViewPreservingOnBoundsChange()
let scale = min(size.width / imageSize.width, size.height / imageSize.height)
#expect(abs(imageView.frame.width - imageSize.width * scale) < 0.001)
#expect(abs(imageView.frame.height - imageSize.height * scale) < 0.001)
let visibleCenter = imageView.convert(
CGPoint(x: imageView.bounds.midX, y: imageView.bounds.midY),
to: scrollView
)
#expect(abs(visibleCenter.x - scrollView.bounds.midX) < centeringTolerance)
#expect(abs(visibleCenter.y - scrollView.bounds.midY) < centeringTolerance)
#expect(coordinator.zoomState() == nil)
}
}
@Test("Folding and unfolding retain the zoomed image focal point")
func preservesImageZoomThroughFoldRoundTrip() throws {
let (coordinator, scrollView, _) = makeZoomView(imageSize: CGSize(width: 400, height: 300))
scrollView.setZoomScale(3, animated: false)
scrollView.contentOffset = CGPoint(x: 320, y: 120)
coordinator.recordCurrentZoomState()
let savedState = try #require(coordinator.zoomState())
for size in [CGSize(width: 320, height: 220), CGSize(width: 320, height: 480)] {
scrollView.bounds.size = size
coordinator.layoutImageViewPreservingOnBoundsChange()
let restoredState = try #require(coordinator.zoomState())
#expect(abs(restoredState.zoomScale - savedState.zoomScale) < 0.001)
#expect(abs(restoredState.normalizedCenter.x - savedState.normalizedCenter.x) < 0.001)
#expect(abs(restoredState.normalizedCenter.y - savedState.normalizedCenter.y) < 0.001)
}
}
@Test("Double-tap zoom survives view recreation and rotation")
func preservesDoubleTapZoomAfterViewRecreation() throws {
var persistedZoomState: NCImageZoomView.ZoomState?
let (firstCoordinator, firstScrollView, firstImageView) = makeZoomView(
imageSize: CGSize(width: 400, height: 300),
onZoomStateChanged: { persistedZoomState = $0 }
)
firstCoordinator.toggleZoom(
at: CGPoint(
x: firstImageView.bounds.midX,
y: firstImageView.bounds.midY
),
animated: false
)
let expectedZoomState = try #require(persistedZoomState)
#expect(abs(firstScrollView.zoomScale - expectedZoomState.zoomScale) < 0.001)
let (restoredCoordinator, restoredScrollView, _) = makeZoomView(
imageSize: CGSize(width: 400, height: 300),
initialZoomState: expectedZoomState
)
restoredScrollView.bounds = CGRect(
origin: restoredScrollView.bounds.origin,
size: CGSize(width: 480, height: 320)
)
restoredCoordinator.layoutImageViewPreservingOnBoundsChange()
let restoredZoomState = try #require(restoredCoordinator.zoomState())
#expect(abs(restoredZoomState.zoomScale - expectedZoomState.zoomScale) < 0.001)
#expect(abs(restoredZoomState.normalizedCenter.x - expectedZoomState.normalizedCenter.x) < 0.001)
#expect(abs(restoredZoomState.normalizedCenter.y - expectedZoomState.normalizedCenter.y) < 0.001)
}
@Test("Live Photo playback uses the still image zoom and focal point")
func livePhotoPlaybackPreservesZoomState() {
let zoomState = NCImageZoomView.ZoomState(
zoomScale: 3,
normalizedCenter: CGPoint(x: 0.6, y: 0.55)
)
let layout = NCLivePhotoPlaybackLayout(
containerSize: CGSize(width: 320, height: 480),
photoSize: CGSize(width: 400, height: 300),
zoomState: zoomState
)
#expect(abs(layout.frame.width - 960) < 0.001)
#expect(abs(layout.frame.height - 720) < 0.001)
#expect(abs(
layout.frame.origin.x + layout.frame.width * zoomState.normalizedCenter.x - 160
) < 0.001)
#expect(abs(
layout.frame.origin.y + layout.frame.height * zoomState.normalizedCenter.y - 240
) < 0.001)
}
@Test("Live Photo playback remains aspect-fit without zoom")
func livePhotoPlaybackUsesAspectFitWithoutZoom() {
let layout = NCLivePhotoPlaybackLayout(
containerSize: CGSize(width: 320, height: 480),
photoSize: CGSize(width: 400, height: 300),
zoomState: nil
)
#expect(layout.frame == CGRect(x: 0, y: 120, width: 320, height: 240))
}
@Test("Live Photo playback clamps transient elastic zoom")
func livePhotoPlaybackClampsElasticZoom() {
let layout = NCLivePhotoPlaybackLayout(
containerSize: CGSize(width: 320, height: 480),
photoSize: CGSize(width: 400, height: 300),
zoomState: NCImageZoomView.ZoomState(
zoomScale: 20,
normalizedCenter: CGPoint(x: 0.5, y: 0.5)
)
)
#expect(layout.frame == CGRect(x: -640, y: -360, width: 1_600, height: 1_200))
}
@Test("Persisted zoom state clamps transient elastic zoom")
func persistedZoomStateClampsElasticZoom() throws {
var persistedZoomState: NCImageZoomView.ZoomState?
let (coordinator, scrollView, _) = makeZoomView(
imageSize: CGSize(width: 400, height: 300),
onZoomStateChanged: { persistedZoomState = $0 }
)
// Allow the test scroll view to reproduce the temporary value that
// UIScrollView can report while bouncesZoom is active.
scrollView.maximumZoomScale = 20
scrollView.setZoomScale(20, animated: false)
coordinator.scrollViewDidEndZooming(
scrollView,
with: nil,
atScale: scrollView.zoomScale
)
let zoomState = try #require(persistedZoomState)
#expect(zoomState.zoomScale == coordinator.maximumZoomScale)
}
private func makeZoomView(
imageSize: CGSize,
initialZoomState: NCImageZoomView.ZoomState? = nil,
onZoomStateChanged: @escaping (NCImageZoomView.ZoomState?) -> Void = { _ in }
) -> (
NCImageZoomView.Coordinator,
NCImageZoomView.NCZoomScrollView,
UIImageView
) {
let coordinator = NCImageZoomView.Coordinator()
let scrollView = NCImageZoomView.NCZoomScrollView(
frame: CGRect(x: 0, y: 0, width: 320, height: 480)
)
let imageView = UIImageView(
image: makeImage(size: imageSize)
)
scrollView.minimumZoomScale = 1
scrollView.maximumZoomScale = 5
scrollView.delegate = coordinator
scrollView.addSubview(imageView)
coordinator.minimumZoomScale = 1
coordinator.maximumZoomScale = 5
coordinator.scrollView = scrollView
coordinator.imageView = imageView
coordinator.onZoomStateChanged = onZoomStateChanged
coordinator.restorePersistedZoomState(initialZoomState)
coordinator.layoutImageView(preserving: initialZoomState)
return (coordinator, scrollView, imageView)
}
private func makeImage(size: CGSize) -> UIImage {
UIGraphicsImageRenderer(size: size).image { context in
UIColor.black.setFill()
context.fill(CGRect(origin: .zero, size: size))
}
}
}
@@ -0,0 +1,555 @@
// SPDX-FileCopyrightText: Nextcloud GmbH
// SPDX-FileCopyrightText: 2026 Marino Faggiana
// SPDX-License-Identifier: GPL-3.0-or-later
import SwiftUI
import Testing
import UIKit
import NextcloudKit
@testable import Nextcloud
@Suite("Adaptive media layout")
@MainActor
struct NCMediaAdaptiveLayoutViewTests {
@Test("Adaptive navigation remains within the available middle area", arguments: [CGFloat(-1), 0, 20, 49, 100, 330, 500])
func navigationFitsSmallAndLargeRegions(height: CGFloat) {
let navigationHeight = NCMediaAdaptiveControlsLayout.navigationHeight(availableHeight: height)
#expect(navigationHeight >= 0)
#expect(navigationHeight <= max(0, height - NCMediaAdaptiveControlsLayout.spacing))
#expect(navigationHeight <= NCMediaAdaptiveControlsLayout.actionsHeight)
if height >= NCMediaAdaptiveControlsLayout.actionsHeight + NCMediaAdaptiveControlsLayout.spacing {
#expect(navigationHeight == NCMediaAdaptiveControlsLayout.actionsHeight)
}
}
@Test("Folded video playback stays black and unfolded playback retains its policy", arguments: [false, true])
func videoPlaybackBackground(isChromeHidden: Bool) {
let folded = ncViewerVideoPlaybackBackgroundStyle(for: nil, isChromeHidden: isChromeHidden, isFoldedLayout: true)
let unfolded = ncViewerVideoPlaybackBackgroundStyle(for: nil, isChromeHidden: isChromeHidden, isFoldedLayout: false)
for appearance in [UIUserInterfaceStyle.light, .dark] {
let traits = UITraitCollection(userInterfaceStyle: appearance)
#expect(UIColor.ncViewerBackground(folded).resolvedColor(with: traits).isEqual(UIColor.black))
let expected = UIColor.ncViewerBackground(ncViewerBackgroundStyle(for: nil, isChromeHidden: isChromeHidden)).resolvedColor(with: traits)
#expect(UIColor.ncViewerBackground(unfolded).resolvedColor(with: traits).isEqual(expected))
}
}
@Test("Control appearance follows the viewer background", arguments: [ColorScheme.light, .dark])
func controlAppearanceMatchesBackground(inherited: ColorScheme) {
#expect(ncViewerAdaptiveControlsColorScheme(for: .system, inherited: inherited) == inherited)
#expect(ncViewerAdaptiveControlsColorScheme(for: .black, inherited: inherited) == .dark)
#expect(ncViewerAdaptiveControlsColorScheme(for: .white, inherited: inherited) == .light)
}
@Test("Normal and adaptive media share the standard appearance and tap behavior", arguments: [false, true])
func normalBackgroundPreservesAppearanceAndChrome(isChromeHidden: Bool) {
let style = ncViewerBackgroundStyle(for: nil, isChromeHidden: isChromeHidden)
let panelStyle = ncViewerAdaptivePanelBackgroundStyle(contentStyle: style)
for appearance in [UIUserInterfaceStyle.light, .dark] {
let traits = UITraitCollection(userInterfaceStyle: appearance)
let expected = (isChromeHidden ? UIColor.black : UIColor.systemBackground).resolvedColor(with: traits)
#expect(UIColor.ncViewerBackground(style).resolvedColor(with: traits).isEqual(expected))
#expect(UIColor.ncViewerBackground(panelStyle).resolvedColor(with: traits).isEqual(expected))
}
}
@Test("Adaptive video footer retains its host and reserves the shared bottom lane")
func videoFooterPreservesHostOnResize() throws {
let metadata = tableMetadata()
metadata.ocId = "video-footer"
metadata.classFile = NKTypeClassFile.video.rawValue
let model = NCMediaViewerModel(
currentMetadata: metadata, ocIds: [metadata.ocId],
session: NCSession().getSession(account: ""), loader: NCMediaViewerLoader()
)
let controls = NCVideoAdaptiveControlsView(state: NCVideoControlsState())
// Give Auto Layout a fixed container; the hosted SwiftUI content must not size the test root.
let container = UIView(frame: CGRect(x: 0, y: 0, width: 430, height: 330))
container.addSubview(controls)
NSLayoutConstraint.activate([
controls.leadingAnchor.constraint(equalTo: container.leadingAnchor),
controls.trailingAnchor.constraint(equalTo: container.trailingAnchor),
controls.topAnchor.constraint(equalTo: container.topAnchor),
controls.bottomAnchor.constraint(equalTo: container.bottomAnchor)
])
controls.configurePaging(model: model, onSelectPage: { _ in })
let host = try #require(controls.pagingFooterView.subviews.first)
for height in [CGFloat(330), 500] {
container.frame.size.height = height
container.setNeedsLayout()
container.layoutIfNeeded()
#expect(controls.bounds.size == CGSize(width: 430, height: height))
let middleHeight = max(
0, height - NCMediaAdaptiveActionsView.preferredHeight - NCMediaViewerThumbnail.preferredHeight - 20 - NCMediaAdaptiveControlsLayout.thumbnailBottomInset
)
let navigationHeight = min(max(0, middleHeight - 5), NCMediaAdaptiveControlsLayout.actionsHeight)
#expect(controls.pagingFooterView.frame.maxY == height)
#expect(controls.pagingFooterView.frame.height == navigationHeight + NCMediaViewerThumbnail.preferredHeight + 15 + NCMediaAdaptiveControlsLayout.thumbnailBottomInset)
#expect(controls.pagingFooterView.subviews.first === host)
#expect(controls.bottomControlsView.frame.maxY <= controls.pagingFooterView.frame.minY)
}
controls.configurePaging(model: nil, onSelectPage: { _ in })
container.layoutIfNeeded()
#expect(controls.pagingFooterView.subviews.isEmpty)
#expect(controls.pagingFooterView.frame == .zero)
}
@Test("Adaptive controls share playback state without adding a navigation bar")
func separateAdaptiveControls() throws {
let normalControls = NCVideoControlsView()
let adaptiveControls = NCVideoAdaptiveControlsView(state: normalControls.state)
adaptiveControls.configureAdaptiveActions(closeAction: UIAction { _ in }, moreButton: UIButton(type: .system))
#expect(adaptiveControls.actionsContainerView.superview === adaptiveControls)
#expect(!adaptiveControls.subviews.contains { $0 is UINavigationBar })
#expect(!normalControls.subviews.contains { $0 is UINavigationBar })
normalControls.updateProgress(progress: 0.5, elapsedText: "1:00", remainingText: "−1:00")
adaptiveControls.updatePlaybackOptions(isRepeatEnabled: true, isAutoAdvanceEnabled: true)
#expect(adaptiveControls.state.progress == 0.5)
#expect(normalControls.state.isRepeatEnabled)
#expect(normalControls.state.isAutoAdvanceEnabled)
#expect(normalControls.state === adaptiveControls.state)
}
@Test("Standalone adaptive buttons preserve Close and Info actions")
func adaptiveButtonsInvokeActions() throws {
var closed = false
var informationRequested = false
let moreButton = UIButton(type: .system)
let actions = NCMediaAdaptiveActionsView(
closeAction: UIAction { _ in closed = true },
moreButton: moreButton,
infoAction: UIAction { _ in informationRequested = true }
)
let closeButton = try #require(actions.arrangedSubviews.first as? UIButton)
let informationButton = try #require(actions.informationButton)
let visibleButtons = actions.arrangedSubviews.compactMap { $0 as? UIButton }.filter { !$0.isHidden }
#expect(visibleButtons.count == 3)
#expect(visibleButtons.contains { $0 === closeButton })
#expect(visibleButtons.contains { $0 === informationButton })
closeButton.sendActions(for: .touchUpInside)
informationButton.sendActions(for: .touchUpInside)
#expect(closed)
#expect(informationRequested)
#expect(actions.arrangedSubviews.last === moreButton)
#expect(!actions.arrangedSubviews.contains { $0 is UINavigationBar })
}
@Test("Reused or neighboring video covers cannot remove the selected cover actions")
func videoCoverActionsKeepTheirOwner() throws {
let state = NCMediaAdaptiveControlsState()
let oldOwner = UUID()
let currentOwner = UUID()
let neighborOwner = UUID()
var played: [String] = []
var cancelled = false
let oldControls = NCVideoPlaybackCoverPresentation(
isPlayEnabled: true,
isLoading: false,
isLaunchingPlayback: false,
statusMessage: nil,
onCancel: nil,
onPlay: { played.append("old") }
)
let currentControls = NCVideoPlaybackCoverPresentation(
isPlayEnabled: false,
isLoading: true,
isLaunchingPlayback: false,
statusMessage: "Downloading",
onCancel: { cancelled = true },
onPlay: { played.append("current") }
)
state.setVideoCoverControls(oldControls, for: "selected", owner: oldOwner)
state.setVideoCoverControls(currentControls, for: "selected", owner: currentOwner)
state.setVideoCoverControls(oldControls, for: "neighbor", owner: neighborOwner)
state.removeVideoCoverControls(for: "selected", owner: oldOwner)
state.removeVideoCoverControls(for: "neighbor", owner: neighborOwner)
let controls = try #require(state.videoCoverControls(for: "selected"))
#expect(controls.isLoading)
#expect(!controls.isPlayEnabled)
#expect(controls.statusMessage == "Downloading")
controls.onPlay()
controls.onCancel?()
#expect(played == ["current"])
#expect(cancelled)
#expect(state.videoCoverControls(for: "neighbor") == nil)
state.removeVideoCoverControls(for: "selected", owner: currentOwner)
#expect(state.videoCoverControls(for: "selected") == nil)
}
@Test("Media folding retains the paging host and uses independent controls", arguments: [NKTypeClassFile.image.rawValue, NKTypeClassFile.audio.rawValue])
func mediaFoldingPreservesPagingHost(classFile: String) throws {
let metadata = tableMetadata()
metadata.ocId = "image"
metadata.classFile = classFile
let model = NCMediaViewerModel(
currentMetadata: metadata,
ocIds: [metadata.ocId],
session: NCSession().getSession(account: ""),
loader: NCMediaViewerLoader()
)
let state = NCMediaAdaptiveControlsState()
let controller = NCMediaAdaptiveLayoutController(
mediaView: NCMediaViewerPagingView(
model: model,
contextMenuController: nil,
navigationBar: nil,
onVisibleMetadataChanged: { _ in },
onZoomChanged: { _ in },
onClose: { _ in }
),
normalControlsView: NCImageControlsView(model: model),
adaptiveControlsView: NCMediaAdaptiveControlsView(
model: model,
state: state,
makeActionsView: { UIView() }
),
onLayoutModeChanged: { _ in }
)
controller.loadViewIfNeeded()
let view = controller.layoutView
view.isLayoutEnabled = false
let mediaView = try #require(controller.mediaController.view)
view.frame = CGRect(x: 0, y: 0, width: 800, height: 600)
view.layoutIfNeeded()
#expect(!view.isLayoutEnabled)
#expect(controller.adaptiveControlsController == nil)
view.isLayoutEnabled = true
view.updateLayout(divisionFrames: [CGRect(x: 0, y: 280, width: 800, height: 40)])
let adaptiveController = try #require(controller.adaptiveControlsController)
#expect(adaptiveController.rootView.state === state)
#expect(adaptiveController.parent === controller)
#expect(mediaView.frame.height == 280)
#expect(controller.normalControlsController.view.superview?.isHidden == true)
// Updating the lower presentation must reach the retained host, not create a new one.
let updatedState = NCMediaAdaptiveControlsState()
controller.adaptiveControlsView = NCMediaAdaptiveControlsView(
model: model,
state: updatedState,
makeActionsView: { UIView() }
)
#expect(adaptiveController.rootView.state === updatedState)
#expect(controller.adaptiveControlsController === adaptiveController)
view.updateLayout(divisionFrames: [])
#expect(controller.mediaController.view === mediaView)
#expect(mediaView.frame == view.bounds)
#expect(controller.adaptiveControlsController === adaptiveController)
#expect(adaptiveController.view.isHidden)
#expect(controller.normalControlsController.view.superview?.isHidden == false)
}
@Test("A disabled container can be enabled and turned off again")
func experimentalLayoutRequiresEnabling() {
let videoView = UIView()
let normalControlsView = UIView()
let adaptiveControlsView = UIView()
let view = NCMediaAdaptiveLayoutView(
mediaView: videoView,
normalControlsView: normalControlsView,
isLayoutEnabled: false,
adaptiveControlsView: { adaptiveControlsView }
)
view.frame = CGRect(x: 0, y: 0, width: 800, height: 600)
let fold = CGRect(x: 0, y: 280, width: 800, height: 40)
var modes: [Bool] = []
view.onLayoutModeChanged = { modes.append($0) }
#expect(!view.isLayoutEnabled)
view.layoutIfNeeded()
view.updateLayout(divisionFrames: [fold])
#expect(!view.isFoldedLayout)
#expect(videoView.frame == view.bounds)
#expect(!normalControlsView.isHidden)
#expect(adaptiveControlsView.superview == nil)
#expect(view.subviews.count == 2)
#expect(!videoView.translatesAutoresizingMaskIntoConstraints)
#expect(!normalControlsView.translatesAutoresizingMaskIntoConstraints)
#expect(view.constraints.count == 8)
#expect(view.constraints.allSatisfy { $0.isActive })
#expect(modes.isEmpty)
view.isLayoutEnabled = true
view.updateLayout(divisionFrames: [fold])
#expect(view.isFoldedLayout)
#expect(normalControlsView.isHidden)
#expect(!adaptiveControlsView.isHidden)
view.isLayoutEnabled = false
view.layoutIfNeeded()
view.updateLayout(divisionFrames: [fold])
#expect(!view.isFoldedLayout)
#expect(videoView.frame == view.bounds)
#expect(!normalControlsView.isHidden)
#expect(adaptiveControlsView.isHidden)
#expect(modes == [true, false])
}
@Test("A container can start enabled without activating normal layout constraints")
func startsWithAdaptiveLayoutEnabled() {
let mediaView = UIView()
let normalControlsView = UIView()
let adaptiveControlsView = UIView()
let view = NCMediaAdaptiveLayoutView(
mediaView: mediaView,
normalControlsView: normalControlsView,
isLayoutEnabled: true,
adaptiveControlsView: { adaptiveControlsView }
)
view.frame = CGRect(x: 0, y: 0, width: 800, height: 600)
#expect(mediaView.translatesAutoresizingMaskIntoConstraints)
#expect(normalControlsView.translatesAutoresizingMaskIntoConstraints)
#expect(view.constraints.isEmpty)
view.updateLayout(divisionFrames: [CGRect(x: 0, y: 280, width: 800, height: 40)])
#expect(view.isFoldedLayout)
#expect(mediaView.frame.height == 280)
#expect(adaptiveControlsView.frame.minY == 320)
view.isLayoutEnabled = false
view.layoutIfNeeded()
#expect(view.constraints.count == 8)
#expect(view.constraints.allSatisfy { $0.isActive })
#expect(!view.isFoldedLayout)
#expect(mediaView.frame == view.bounds)
}
@Test("Disabled mode does not create adaptive controls and preserves normal visibility")
func disabledModePreservesNormalControls() {
let videoView = UIView()
let normalControlsView = UIView()
var creationCount = 0
var modes: [Bool] = []
let view = NCMediaAdaptiveLayoutView(
mediaView: videoView,
normalControlsView: normalControlsView,
isLayoutEnabled: false,
adaptiveControlsView: {
creationCount += 1
return UIView()
}
)
view.onLayoutModeChanged = { modes.append($0) }
normalControlsView.isHidden = true
normalControlsView.alpha = 0
view.frame = CGRect(x: 0, y: 0, width: 800, height: 600)
view.layoutIfNeeded()
view.updateLayout(divisionFrames: [CGRect(x: 0, y: 280, width: 800, height: 40)])
#expect(creationCount == 0)
#expect(modes.isEmpty)
#expect(normalControlsView.isHidden)
#expect(normalControlsView.alpha == 0)
#expect(videoView.frame == view.bounds)
#expect(normalControlsView.frame == view.bounds)
normalControlsView.isHidden = false
normalControlsView.alpha = 1
view.frame = CGRect(x: 0, y: 0, width: 600, height: 800)
view.layoutIfNeeded()
#expect(creationCount == 0)
#expect(modes.isEmpty)
#expect(!normalControlsView.isHidden)
#expect(normalControlsView.alpha == 1)
#expect(videoView.frame == view.bounds)
#expect(normalControlsView.frame == view.bounds)
}
@Test("Folding and unfolding preserve the video surface and controls")
func foldingPreservesViews() {
let videoView = UIView()
let controlsView = UIView()
let adaptiveControlsView = UIView()
let view = NCMediaAdaptiveLayoutView(
mediaView: videoView,
normalControlsView: controlsView,
adaptiveControlsView: { adaptiveControlsView }
)
view.isLayoutEnabled = true
view.frame = CGRect(x: 0, y: 0, width: 800, height: 600)
var modes: [Bool] = []
view.onLayoutModeChanged = { modes.append($0) }
view.updateLayout(divisionFrames: [])
#expect(videoView.frame == view.bounds)
#expect(controlsView.frame == view.bounds)
let fold = CGRect(x: -10, y: 280, width: 820, height: 40)
view.updateLayout(divisionFrames: [fold])
#expect(view.isFoldedLayout)
#expect(videoView.frame == CGRect(x: 0, y: 0, width: 800, height: 280))
#expect(adaptiveControlsView.frame == CGRect(x: 0, y: 320, width: 800, height: 280))
#expect(controlsView.isHidden)
#expect(!adaptiveControlsView.isHidden)
view.updateLayout(divisionFrames: [fold])
#expect(modes == [true])
view.updateLayout(divisionFrames: [])
#expect(!view.isFoldedLayout)
#expect(videoView.frame == view.bounds)
#expect(controlsView.frame == view.bounds)
#expect(modes == [true, false])
#expect(!controlsView.isHidden)
#expect(adaptiveControlsView.isHidden)
#expect(view.subviews.count == 3)
#expect(view.subviews[0] === videoView)
#expect(view.subviews[1] === controlsView)
#expect(view.subviews[2] === adaptiveControlsView)
}
@Test("An enabled experiment creates lower controls only when a fold becomes active")
func unfoldedExperimentDoesNotCreateLowerControls() {
var creationCount = 0
let lowerControls = UIView()
let normalControls = UIView()
let view = NCMediaAdaptiveLayoutView(
mediaView: UIView(),
normalControlsView: normalControls,
isLayoutEnabled: true,
adaptiveControlsView: {
creationCount += 1
return lowerControls
}
)
view.frame = CGRect(x: 0, y: 0, width: 800, height: 600)
view.updateLayout(divisionFrames: [])
view.updateLayout(divisionFrames: [CGRect(x: 380, y: 0, width: 40, height: 600)])
#expect(creationCount == 0)
#expect(!normalControls.isHidden)
let fold = CGRect(x: 0, y: 280, width: 800, height: 40)
view.updateLayout(divisionFrames: [fold])
view.updateLayout(divisionFrames: [])
view.updateLayout(divisionFrames: [fold])
#expect(creationCount == 1)
#expect(view.isFoldedLayout)
#expect(lowerControls.superview === view)
}
@Test("Enabled mode without a fold preserves normal chrome while resizing", arguments: [
CGSize(width: 390, height: 844),
CGSize(width: 844, height: 390),
CGSize(width: 1024, height: 1366),
CGSize(width: 420, height: 600)
])
func resizingWithoutFoldPreservesNormalChrome(size: CGSize) {
let mediaView = UIView()
let normalControls = UIView()
normalControls.isHidden = true
var creationCount = 0
var modes: [Bool] = []
let view = NCMediaAdaptiveLayoutView(
mediaView: mediaView,
normalControlsView: normalControls,
isLayoutEnabled: true,
adaptiveControlsView: {
creationCount += 1
return UIView()
}
)
view.onLayoutModeChanged = { modes.append($0) }
for boundsSize in [CGSize(width: 800, height: 600), size, CGSize(width: 800, height: 600)] {
view.frame = CGRect(origin: .zero, size: boundsSize)
view.updateLayout(divisionFrames: [])
#expect(mediaView.frame == view.bounds)
#expect(normalControls.frame == view.bounds)
#expect(normalControls.isHidden)
#expect(!view.isFoldedLayout)
}
#expect(creationCount == 0)
#expect(modes.isEmpty)
#expect(mediaView.superview === view)
#expect(normalControls.superview === view)
}
@Test("Unavailable adaptive controls preserve the normal layout and can recover")
func unavailableLowerControlsKeepNormalLayout() {
let mediaView = UIView()
let normalControls = UIView()
let lowerControls = UIView()
var available = false
var modes: [Bool] = []
let view = NCMediaAdaptiveLayoutView(
mediaView: mediaView,
normalControlsView: normalControls,
isLayoutEnabled: true,
adaptiveControlsView: { available ? lowerControls : nil }
)
view.onLayoutModeChanged = { modes.append($0) }
view.frame = CGRect(x: 0, y: 0, width: 800, height: 600)
let fold = CGRect(x: 0, y: 280, width: 800, height: 40)
view.updateLayout(divisionFrames: [fold])
#expect(!view.isFoldedLayout)
#expect(mediaView.frame == view.bounds)
#expect(!normalControls.isHidden)
#expect(modes.isEmpty)
available = true
view.updateLayout(divisionFrames: [fold])
#expect(view.isFoldedLayout)
#expect(mediaView.frame.height == 280)
#expect(!lowerControls.isHidden)
#expect(normalControls.isHidden)
#expect(modes == [true])
}
@Test("Other regions retain the normal layout", arguments: [
CGRect(x: 380, y: 0, width: 40, height: 600),
CGRect(x: 0, y: 300, width: 800, height: 0),
CGRect(x: 0, y: 700, width: 800, height: 40),
CGRect(x: 0, y: 0, width: 800, height: 40),
CGRect(x: 0, y: 560, width: 800, height: 40),
CGRect(x: 200, y: 280, width: 100, height: 40)
])
func ignoresNonHorizontalDivisions(frame: CGRect) {
let videoView = UIView()
let controlsView = UIView()
let adaptiveControlsView = UIView()
let view = NCMediaAdaptiveLayoutView(
mediaView: videoView,
normalControlsView: controlsView,
adaptiveControlsView: { adaptiveControlsView }
)
view.isLayoutEnabled = true
view.frame = CGRect(x: 0, y: 0, width: 800, height: 600)
view.updateLayout(divisionFrames: [frame])
#expect(!view.isFoldedLayout)
#expect(videoView.frame == view.bounds)
#expect(controlsView.frame == view.bounds)
}
@Test("The layout follows changing fold geometry and view size")
func followsFoldGeometry() {
let videoView = UIView()
let controlsView = UIView()
let adaptiveControlsView = UIView()
let view = NCMediaAdaptiveLayoutView(
mediaView: videoView,
normalControlsView: controlsView,
adaptiveControlsView: { adaptiveControlsView }
)
view.isLayoutEnabled = true
view.frame = CGRect(x: 0, y: 0, width: 600, height: 800)
view.updateLayout(divisionFrames: [CGRect(x: 0, y: 370, width: 600, height: 60)])
#expect(videoView.frame == CGRect(x: 0, y: 0, width: 600, height: 370))
#expect(adaptiveControlsView.frame == CGRect(x: 0, y: 430, width: 600, height: 370))
view.updateLayout(divisionFrames: [CGRect(x: 0, y: 350, width: 600, height: 100)])
#expect(videoView.frame.height == 350)
#expect(adaptiveControlsView.frame.minY == 450)
#expect(adaptiveControlsView.frame.height == 350)
}
}
@@ -0,0 +1,77 @@
// SPDX-FileCopyrightText: Nextcloud GmbH
// SPDX-FileCopyrightText: 2026 Marino Faggiana
// SPDX-License-Identifier: GPL-3.0-or-later
import Testing
@testable import Nextcloud
@Suite("Media playback completion options")
@MainActor
struct NCMediaPlaybackOptionsTests {
@Test("Playback stops when no completion option is enabled")
func stopsByDefault() {
let options = NCMediaPlaybackOptions(preferences: nil)
#expect(options.completionAction == .stop)
}
@Test("Automatic advance plays the next compatible item")
func advancesAutomatically() {
let options = NCMediaPlaybackOptions(preferences: nil)
options.toggleAutoAdvance()
#expect(options.completionAction == .playNextItem)
}
@Test("Disabling repeat restores normal stop behavior")
func disablingRepeatRestoresStop() {
let options = NCMediaPlaybackOptions(preferences: nil)
options.toggleRepeat()
#expect(options.completionAction == .repeatCurrentItem)
options.toggleRepeat()
#expect(options.completionAction == .stop)
}
@Test("Repeat takes precedence over automatic advance")
func repeatTakesPrecedence() {
let options = NCMediaPlaybackOptions(preferences: nil)
options.toggleAutoAdvance()
options.toggleRepeat()
#expect(options.completionAction == .repeatCurrentItem)
options.toggleRepeat()
#expect(options.completionAction == .playNextItem)
}
@Test("Playback options restore and save their preferences")
func persistsPlaybackOptions() {
let preferences = NCPreferences()
let originalRepeat = preferences.mediaViewerRepeatCurrentItem
let originalAutoAdvance = preferences.mediaViewerAutoAdvance
defer {
preferences.mediaViewerRepeatCurrentItem = originalRepeat
preferences.mediaViewerAutoAdvance = originalAutoAdvance
}
preferences.mediaViewerRepeatCurrentItem = true
preferences.mediaViewerAutoAdvance = false
let options = NCMediaPlaybackOptions(preferences: preferences)
#expect(options.isRepeatEnabled)
#expect(!options.isAutoAdvanceEnabled)
options.toggleRepeat()
options.toggleAutoAdvance()
#expect(!preferences.mediaViewerRepeatCurrentItem)
#expect(preferences.mediaViewerAutoAdvance)
}
}
@@ -0,0 +1,66 @@
// SPDX-FileCopyrightText: Nextcloud GmbH
// SPDX-FileCopyrightText: 2026 Marino Faggiana
// SPDX-License-Identifier: GPL-3.0-or-later
import Testing
import UIKit
@testable import Nextcloud
@Suite("Media viewer floating title")
@MainActor
struct NCMediaViewerFloatingTitleViewTests {
@Test("Preserves the system foreground color")
func preservesSystemForegroundColor() throws {
let titleView = NCMediaViewerFloatingTitleView()
titleView.update(
primaryText: "Photo.jpg",
secondaryText: "13 Aug 2026 at 09:17"
)
let titleButton = try #require(
titleView.subviews.first as? UIButton
)
titleView.frame = CGRect(x: 0, y: 0, width: 300, height: 44)
titleView.layoutIfNeeded()
let configuration = try #require(titleButton.configuration)
let transformer = try #require(
configuration.titleTextAttributesTransformer
)
var incoming = AttributeContainer()
incoming.uiKit.foregroundColor = .white
let outgoing = transformer(incoming)
#expect(configuration.baseForegroundColor == nil)
#expect(titleButton.isEnabled)
#expect(titleButton.isUserInteractionEnabled)
#expect(titleButton.state == .normal)
#expect(titleButton.tintAdjustmentMode == .normal)
#expect(
titleView.hitTest(
CGPoint(x: titleView.bounds.midX, y: titleView.bounds.midY),
with: nil
) == nil
)
#expect(titleButton.titleLabel?.text == "Photo.jpg")
#expect(titleButton.subtitleLabel?.text == "13 Aug 2026 at 09:17")
#expect(outgoing.uiKit.foregroundColor == .white)
#expect(
outgoing.uiKit.font == UIFont.systemFont(
ofSize: 13,
weight: .semibold
)
)
let normalTextColor = titleButton.titleLabel?.textColor
titleView.tintAdjustmentMode = .dimmed
titleView.layoutIfNeeded()
#expect(titleButton.isEnabled)
#expect(titleButton.state == .normal)
#expect(titleButton.tintAdjustmentMode == .normal)
#expect(titleButton.titleLabel?.text == "Photo.jpg")
#expect(titleButton.titleLabel?.textColor == normalTextColor)
}
}
@@ -0,0 +1,209 @@
// SPDX-FileCopyrightText: Nextcloud GmbH
// SPDX-FileCopyrightText: 2026 Marino Faggiana
// SPDX-License-Identifier: GPL-3.0-or-later
import Testing
import NextcloudKit
@testable import Nextcloud
@Suite("Media viewer model")
@MainActor
struct NCMediaViewerModelTests {
@Test("Duplicate media identifiers produce a single viewer page")
func removesDuplicateIdentifiers() {
let metadata = tableMetadata()
metadata.ocId = "current"
let model = NCMediaViewerInitialModel(
currentMetadata: metadata,
ocIds: ["first", "current", "current", "last", "first"]
)
#expect(model.normalizedOcIds == ["first", "current", "last"])
#expect(model.currentSelectedIndex == 1)
}
@Test("Missing current media is inserted before the supplied identifiers")
func insertsMissingCurrentIdentifier() {
let metadata = tableMetadata()
metadata.ocId = "current"
let model = NCMediaViewerInitialModel(
currentMetadata: metadata,
ocIds: ["next", "next"]
)
#expect(model.normalizedOcIds == ["current", "next"])
#expect(model.currentSelectedIndex == 0)
}
@Test("Programmatic paging deactivates media until the target settles")
func programmaticPagingActivatesOnlySettledTarget() {
let model = makeViewerModel()
#expect(model.activePageIndex == 0)
model.beginPageTransition(
to: 1,
shouldAutoPlay: true
)
#expect(model.pageTransition == .programmatic(targetIndex: 1))
#expect(model.selectedIndex == 0)
#expect(model.activePageIndex == nil)
#expect(model.autoPlayTargetIndex == 1)
model.finishPageTransition(at: 1)
#expect(model.pageTransition == .idle)
#expect(model.selectedIndex == 1)
#expect(model.activePageIndex == 1)
#expect(model.autoPlayTargetIndex == 1)
}
@Test("Interactive paging keeps intermediate pages inactive")
func interactivePagingKeepsIntermediatePagesInactive() {
let model = makeViewerModel()
model.beginPageTransition(
to: nil,
shouldAutoPlay: false
)
model.updateSelectedIndexDuringTransition(1)
#expect(model.pageTransition == .interactive)
#expect(model.selectedIndex == 1)
#expect(model.activePageIndex == nil)
model.finishPageTransition(at: 1)
#expect(model.pageTransition == .idle)
#expect(model.activePageIndex == 1)
}
@Test("Settling on an unexpected page cancels pending autoplay")
func unexpectedSettledPageCancelsAutoPlay() {
let model = makeViewerModel()
model.beginPageTransition(
to: 2,
shouldAutoPlay: true
)
model.finishPageTransition(at: 1)
#expect(model.pageTransition == .idle)
#expect(model.activePageIndex == 1)
#expect(model.autoPlayTargetIndex == nil)
}
@Test("Selection updates are ignored outside an interactive transition")
func ignoresTransitionUpdatesWhileIdle() {
let model = makeViewerModel()
model.updateSelectedIndexDuringTransition(1)
#expect(model.selectedIndex == 0)
#expect(model.activePageIndex == 0)
}
@Test("Loading a page does not implicitly change the selection")
func loadingDoesNotSelectPage() async {
let model = makeViewerModel()
await model.displayPage(at: 1)
#expect(model.selectedIndex == 0)
#expect(model.activePageIndex == 0)
}
@Test("Regular image previews do not require the original file")
func regularImagePreviewDoesNotRequireOriginal() {
let metadata = imageMetadata(fileName: "photo.HEIC")
let policy = NCMediaViewerLoadingPolicy.standard
#expect(!policy.shouldDownloadOriginalImage(
for: metadata,
hasUsablePreview: true
))
}
@Test("GIF and SVG images always require the original file")
func specialImageFormatsRequireOriginal() {
let policy = NCMediaViewerLoadingPolicy.standard
#expect(policy.shouldDownloadOriginalImage(
for: imageMetadata(fileName: "animation.GIF"),
hasUsablePreview: true
))
#expect(policy.shouldDownloadOriginalImage(
for: imageMetadata(fileName: "drawing.svg"),
hasUsablePreview: true
))
}
@Test("A missing preview falls back to the original file")
func missingPreviewRequiresOriginal() {
let metadata = imageMetadata(fileName: "photo.jpg")
let policy = NCMediaViewerLoadingPolicy.standard
#expect(policy.shouldDownloadOriginalImage(
for: metadata,
hasUsablePreview: false
))
}
@Test("The internal switch restores automatic original downloads")
func internalSwitchEnablesOriginalDownloads() {
let metadata = imageMetadata(fileName: "photo.jpg")
let policy = NCMediaViewerLoadingPolicy(
automaticallyDownloadsOriginalImages: true,
automaticallyDownloadsLivePhotoResources: false
)
#expect(policy.shouldDownloadOriginalImage(
for: metadata,
hasUsablePreview: true
))
}
@Test("Live Photo resources remain on demand unless their switch is enabled")
func livePhotoResourcesRespectInternalSwitch() {
let metadata = imageMetadata(fileName: "live-photo.heic")
metadata.livePhotoFile = "live-photo.mov"
#expect(!NCMediaViewerLoadingPolicy.standard.shouldDownloadLivePhotoResources(
for: metadata
))
let automaticPolicy = NCMediaViewerLoadingPolicy(
automaticallyDownloadsOriginalImages: false,
automaticallyDownloadsLivePhotoResources: true
)
#expect(automaticPolicy.shouldDownloadLivePhotoResources(for: metadata))
#expect(automaticPolicy.shouldDownloadOriginalImage(
for: metadata,
hasUsablePreview: true
))
}
private func makeViewerModel() -> NCMediaViewerModel {
let metadata = tableMetadata()
metadata.ocId = "first"
return NCMediaViewerModel(
currentMetadata: metadata,
ocIds: ["first", "second", "third"],
session: NCSession().getSession(account: ""),
loader: NCMediaViewerLoader()
)
}
private func imageMetadata(fileName: String) -> tableMetadata {
let metadata = tableMetadata()
metadata.classFile = NKTypeClassFile.image.rawValue
metadata.fileName = fileName
metadata.fileNameView = fileName
return metadata
}
}
@@ -0,0 +1,132 @@
// SPDX-FileCopyrightText: Nextcloud GmbH
// SPDX-FileCopyrightText: 2026 Marino Faggiana
// SPDX-License-Identifier: GPL-3.0-or-later
import Foundation
import NextcloudKit
import Testing
@testable import Nextcloud
@Suite("Photo library assets")
struct NCPhotoLibraryAssetTests {
@Test("A photo is complete after its component is uploaded")
func photoUpload() async throws {
let database = try makeDatabase()
try await database.recordPhotoLibraryAssetUpload(
account: "account",
assetLocalIdentifier: "photo",
classFile: NKTypeClassFile.image.rawValue,
isLivePhoto: false,
creationDate: Date()
)
#expect(try await database.uploadedPhotoLibraryAssets(account: "account").map(\.assetLocalIdentifier) == ["photo"])
}
@Test("A Live Photo requires both components")
func livePhotoUpload() async throws {
let database = try makeDatabase()
try await database.recordPhotoLibraryAssetUpload(
account: "account",
assetLocalIdentifier: "live-photo",
classFile: NKTypeClassFile.image.rawValue,
isLivePhoto: true,
creationDate: Date()
)
#expect(try await database.uploadedPhotoLibraryAssets(account: "account").isEmpty)
try await database.recordPhotoLibraryAssetUpload(
account: "account",
assetLocalIdentifier: "live-photo",
classFile: NKTypeClassFile.video.rawValue,
isLivePhoto: true,
creationDate: Date()
)
#expect(try await database.uploadedPhotoLibraryAssets(account: "account").map(\.assetLocalIdentifier) == ["live-photo"])
}
@Test("Repeated discovery and upload confirmation are idempotent")
func repeatedUpdates() async throws {
let database = try makeDatabase()
let creationDate = Date()
try await database.recordPhotoLibraryAssetUpload(
account: "account",
assetLocalIdentifier: "asset",
classFile: NKTypeClassFile.image.rawValue,
isLivePhoto: false,
creationDate: creationDate
)
try await database.recordPhotoLibraryAssetUpload(
account: "account",
assetLocalIdentifier: "asset",
classFile: NKTypeClassFile.image.rawValue,
isLivePhoto: false,
creationDate: creationDate
)
#expect(try await database.uploadedPhotoLibraryAssets(account: "account").count == 1)
}
@Test("Assets are isolated by account and removed after Photos cleanup")
func accountIsolationAndRemoval() async throws {
let database = try makeDatabase()
for account in ["first", "second"] {
try await database.recordPhotoLibraryAssetUpload(
account: account,
assetLocalIdentifier: "shared-identifier",
classFile: NKTypeClassFile.video.rawValue,
isLivePhoto: false,
creationDate: Date()
)
}
try await database.removePhotoLibraryAssets(account: "first", assetLocalIdentifiers: ["shared-identifier"])
#expect(try await database.uploadedPhotoLibraryAssets(account: "first").isEmpty)
#expect(try await database.uploadedPhotoLibraryAssets(account: "second").map(\.assetLocalIdentifier) == ["shared-identifier"])
}
@Test("Clearing the local database removes uploaded asset state")
func clearDatabase() async throws {
let database = try makeDatabase()
try await database.recordPhotoLibraryAssetUpload(
account: "account",
assetLocalIdentifier: "photo",
classFile: NKTypeClassFile.image.rawValue,
isLivePhoto: false,
creationDate: Date()
)
try await database.clearDBCache()
#expect(try await database.uploadedPhotoLibraryAssets(account: "account").isEmpty)
}
@Test("A Live Photo can complete when its video is uploaded first")
func livePhotoVideoFirst() async throws {
let database = try makeDatabase()
try await database.recordPhotoLibraryAssetUpload(
account: "account",
assetLocalIdentifier: "live-photo",
classFile: NKTypeClassFile.video.rawValue,
isLivePhoto: true,
creationDate: Date()
)
#expect(try await database.uploadedPhotoLibraryAssets(account: "account").isEmpty)
try await database.recordPhotoLibraryAssetUpload(
account: "account",
assetLocalIdentifier: "live-photo",
classFile: NKTypeClassFile.image.rawValue,
isLivePhoto: true,
creationDate: Date()
)
#expect(try await database.uploadedPhotoLibraryAssets(account: "account").map(\.assetLocalIdentifier) == ["live-photo"])
}
private func makeDatabase() throws -> NCLocalDatabase {
let databaseURL = FileManager.default.temporaryDirectory
.appendingPathComponent(UUID().uuidString)
.appendingPathExtension("sqlite")
return try NCLocalDatabase(databaseURL: databaseURL)
}
}
@@ -0,0 +1,110 @@
// SPDX-FileCopyrightText: Nextcloud GmbH
// SPDX-FileCopyrightText: 2026 Marino Faggiana
// SPDX-License-Identifier: GPL-3.0-or-later
import Testing
@testable import Nextcloud
@Suite("Video playback presentation context")
struct NCVideoPlaybackPresentationContextTests {
@Test("User-initiated playback starts with visible controls")
func userInitiatedPlaybackShowsControls() {
var context = NCVideoPlaybackPresentationContext(
startReason: .userInitiated
)
context.prepareForPlaybackStart()
#expect(context.shouldShowControlsOnStart)
#expect(context.playbackTransition == .idle)
#expect(!context.shouldSuppressAutomaticControlsPresentation)
}
@Test("Automatic advancement starts without presenting controls")
func automaticAdvanceSuppressesControls() {
var context = NCVideoPlaybackPresentationContext(
startReason: .automaticAdvance
)
context.prepareForPlaybackStart()
#expect(!context.shouldShowControlsOnStart)
#expect(context.playbackTransition == .automaticStart)
#expect(context.shouldSuppressAutomaticControlsPresentation)
context.finishPlaybackTransition()
#expect(context.playbackTransition == .idle)
#expect(!context.shouldSuppressAutomaticControlsPresentation)
#expect(context.shouldShowControlsOnStart)
}
@Test("Repeat restart suppresses automatic control presentation")
func repeatRestartSuppressesControls() {
var context = NCVideoPlaybackPresentationContext(
startReason: .userInitiated
)
context.beginRepeatRestart()
#expect(context.playbackTransition == .repeatRestart)
#expect(context.shouldSuppressAutomaticControlsPresentation)
context.finishPlaybackTransition()
#expect(context.playbackTransition == .idle)
#expect(!context.shouldSuppressAutomaticControlsPresentation)
}
@Test("Seeking is represented by the shared transition state")
func seekingUsesSharedTransition() {
var context = NCVideoPlaybackPresentationContext(
startReason: .userInitiated
)
context.beginSeeking()
#expect(context.interaction == .seeking)
#expect(context.isSeeking)
#expect(context.shouldSuppressAutomaticControlsPresentation)
context.finishSeeking()
#expect(!context.isSeeking)
}
@Test("Playback callbacks preserve seeking and complete automatic start")
func playbackCallbackPreservesSeekingAndCompletesAutomaticStart() {
var context = NCVideoPlaybackPresentationContext(
startReason: .automaticAdvance
)
context.prepareForPlaybackStart()
context.beginSeeking()
context.finishPlaybackTransition()
#expect(context.isSeeking)
#expect(context.playbackTransition == .idle)
#expect(context.shouldShowControlsOnStart)
#expect(context.shouldSuppressAutomaticControlsPresentation)
context.finishSeeking()
#expect(!context.shouldSuppressAutomaticControlsPresentation)
}
@Test("Reset clears playback and interaction transitions")
func resetClearsAllTransitions() {
var context = NCVideoPlaybackPresentationContext(
startReason: .automaticAdvance
)
context.prepareForPlaybackStart()
context.beginSeeking()
context.reset()
#expect(context.playbackTransition == .idle)
#expect(context.interaction == .idle)
#expect(!context.shouldSuppressAutomaticControlsPresentation)
}
}
@@ -0,0 +1,131 @@
// SPDX-FileCopyrightText: Nextcloud GmbH
// SPDX-FileCopyrightText: 2026 Milen Pivchev
// SPDX-License-Identifier: GPL-3.0-or-later
import Foundation
import NextcloudKit
import Testing
@testable import Nextcloud
@Suite("Error messages shown to people")
struct NKErrorUserFriendlyMessageTests {
static let shownKinds = NKError.Kind.allCases.filter { $0 != .cancelled }
private func localized(_ key: String) -> String {
NSLocalizedString(key, comment: "")
}
@Test("Nothing is shown for success or cancellation")
func silentErrors() {
#expect(NKError.success.userFriendlyMessage() == nil)
#expect(NKError.cancelled.userFriendlyMessage(for: .upload(fileName: "a.jpg")) == nil)
#expect(NKError(errorCode: NCGlobal.shared.errorTaskCancelled, errorDescription: "Task cancelled").userFriendlyMessage() == nil)
}
@Test("Keeps text the app wrote itself")
func appMessages() {
#expect(NKError(errorCode: NCGlobal.shared.errorOfflineNotAllowed, errorDescription: "_offline_not_allowed_").userFriendlyMessage() == localized("_offline_not_allowed_"))
#expect(NKError(errorCode: NCGlobal.shared.errorE2EELock, errorDescription: "Already translated").userFriendlyMessage() == "Already translated")
}
@Test("Replaces technical server text")
func technicalServerText() throws {
let error = NKError(errorCode: 409, errorDescription: "Parent node does not exist")
let generic = try #require(error.userFriendlyMessage())
#expect(error.userFriendlyMessage(for: .createFolder(folderName: "a/b")) == generic)
#expect(generic != error.errorDescription)
#expect(!generic.contains("409"))
}
@Test("Uses the generic message unless the operation needs its own")
func operationMessages() {
let forbidden = NKError(errorCode: 403, errorDescription: "403: Forbidden")
let generic = forbidden.userFriendlyMessage()
#expect(generic != nil)
#expect(forbidden.userFriendlyMessage(for: .delete(fileName: "a.jpg")) == generic)
#expect(forbidden.userFriendlyMessage(for: .rename) == generic)
#expect(forbidden.userFriendlyMessage(for: .upload(fileName: "a.jpg")) == generic)
}
@Test("Doesn't guess the cause of a document failure")
func documentMessages() {
let forbidden = NKError(errorCode: 403, errorDescription: "403: Forbidden")
let notFound = NKError(errorCode: 404, errorDescription: "404: Not found")
#expect(forbidden.userFriendlyMessage(for: .createDocument(fileName: "a.md")) == localized("_error_occurred_"))
#expect(forbidden.userFriendlyMessage(for: .openDocument(fileName: "a.md")) == localized("_error_occurred_"))
#expect(notFound.userFriendlyMessage(for: .openDocument(fileName: "a.md")) == notFound.userFriendlyMessage())
#expect(NKError(error: CancellationError()).userFriendlyMessage() == nil)
}
@Test("Words different kinds of failure differently")
func kindMessages() {
let timeout = NKError(errorCode: NSURLErrorTimedOut, errorDescription: "The request timed out.").userFriendlyMessage()
let quota = NKError(errorCode: 507, errorDescription: "507: Storage quota is reached").userFriendlyMessage()
let unknown = NKError(errorCode: 418, errorDescription: "418: I'm a teapot").userFriendlyMessage()
#expect(Set([timeout, quota, unknown]).count == 3)
#expect(quota != "507: Storage quota is reached")
}
@Test("Every kind has a translated message", arguments: NKErrorUserFriendlyMessageTests.shownKinds)
func everyKind(kind: NKError.Kind) {
let message = NKError(errorCode: -1, errorDescription: "Technical", kind: kind).userFriendlyMessage()
#expect(message != nil)
#expect(message != "Technical")
}
@Test("Maps transfer events and saved statuses to operations")
func contexts() {
let global = NCGlobal.shared
#expect(NCErrorContext(networkingStatus: global.networkingStatusUploaded, fileName: "a.jpg") == .upload(fileName: "a.jpg"))
#expect(NCErrorContext(networkingStatus: global.networkingStatusCopyMove, fileName: "a.jpg") == .moveOrCopy(fileName: "a.jpg"))
#expect(NCErrorContext(networkingStatus: global.networkingStatusReloadAvatar, fileName: "") == .generic)
#expect(NCErrorContext(metadataStatus: global.metadataStatusWaitCreateFolder, fileName: "Photos") == .createFolder(folderName: "Photos"))
#expect(NCErrorContext(metadataStatus: global.metadataStatusDownloadError, fileName: "a.jpg") == .download(fileName: "a.jpg"))
}
@Test("Titles say what failed")
func failureTitles() throws {
let contexts: [NCErrorContext] = [.upload(fileName: "f"), .download(fileName: "f"), .delete(fileName: "f"), .rename, .moveOrCopy(fileName: "f"), .createFolder(folderName: "f"), .favorite(fileName: "f"), .createDocument(fileName: "f"), .openDocument(fileName: "f")]
#expect(NCErrorContext.generic.failureTitle == nil)
#expect(NCErrorContext.upload(fileName: "IMG_0042.jpg").failureTitle?.contains("IMG_0042.jpg") == true)
for context in contexts {
let title = try #require(context.failureTitle)
#expect(!title.hasPrefix("_"))
}
}
@Test("Words saved transfer errors")
func savedErrors() {
let metadata = tableMetadata()
metadata.fileNameView = "a.jpg"
metadata.status = NCGlobal.shared.metadataStatusUploadError
metadata.errorCode = 507
metadata.sessionError = "507: Storage quota is reached"
#expect(metadata.sessionErrorMessage == NKError(errorCode: 507, errorDescription: "").userFriendlyMessage())
metadata.errorCode = 412
metadata.errorKind = NKError.Kind.alreadyExists.rawValue
#expect(metadata.sessionErrorMessage == NKError(errorCode: 412, errorDescription: "", kind: .alreadyExists).userFriendlyMessage())
metadata.errorKind = "notAKind"
#expect(metadata.sessionErrorMessage == NKError(errorCode: 412, errorDescription: "").userFriendlyMessage())
metadata.errorCode = NSURLErrorCancelled
metadata.sessionError = "Transfer was cancelled."
#expect(metadata.sessionErrorMessage != "Transfer was cancelled.")
#expect(!metadata.sessionErrorMessage.isEmpty)
}
}
@@ -1,7 +0,0 @@
// SPDX-FileCopyrightText: Nextcloud GmbH
// SPDX-FileCopyrightText: 2025 Iva Horn
// SPDX-License-Identifier: GPL-3.0-or-later
// There are no unit tests yet.
// This is an empty placeholder file.
// The compiler requires at least an empty file for every target.
Executable → Regular
+6
View File
@@ -1,5 +1,8 @@
#!/usr/bin/env zsh
# SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors
# SPDX-License-Identifier: GPL-3.0-or-later
# The fixed Docker container name for the Nextcloud server.
CONTAINER_NAME="xcode-test-server"
@@ -22,6 +25,9 @@ docker run \
echo "Please wait until the server is provisioned…"
sleep 20
# Keep web authentication labels consistent with the UI tests.
docker exec --user www-data $CONTAINER_NAME php /var/www/html/occ config:system:set force_language --value=en
# Enable File Download Limit App.
docker exec $CONTAINER_NAME su www-data -c "git clone --depth 1 -b $SERVER_VERSION https://github.com/nextcloud/files_downloadlimit.git /var/www/html/apps/files_downloadlimit/"
docker exec $CONTAINER_NAME su www-data -c "php /var/www/html/occ app:enable files_downloadlimit"
Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.6 KiB

+7 -2
View File
@@ -99,7 +99,12 @@ func getDashboardDataEntry(configuration: DashboardIntent?, isPreview: Bool, dis
// LOG
let versionNextcloudiOS = String(format: NCBrandOptions.shared.textCopyrightNextcloudiOS, utility.getVersionBuild())
NextcloudKit.configureLogger(logLevel: (NCBrandOptions.shared.disable_log ? .disabled : NCPreferences().log))
NextcloudKit.configureLogger(
logLevel: NCBrandOptions.shared.disable_log ? .disabled : NCPreferences().log,
logDirectory: NCPreferences.sharedLogDirectory
)
defer { NextcloudKit.flushLogger() }
nkLog(debug: "Start \(NCBrandOptions.shared.brand) dashboard widget session " + versionNextcloudiOS)
// Widget
@@ -200,7 +205,7 @@ func getDashboardDataEntry(configuration: DashboardIntent?, isPreview: Bool, dis
let footerText = "Dashboard " + NSLocalizedString("_of_", comment: "") + " " + activeTableAccount.displayName + alias
if resultsDashboardWidget.error != .success {
return(DashboardDataEntry(date: Date(), datas: datasPlaceholder, dashboard: tableDashboard, buttons: buttons, isPlaceholder: true, isEmpty: false, titleImage: titleImage, title: title, footerImage: "xmark.icloud", footerText: resultsDashboardWidget.error.errorDescription, account: activeTableAccount.account))
return(DashboardDataEntry(date: Date(), datas: datasPlaceholder, dashboard: tableDashboard, buttons: buttons, isPlaceholder: true, isEmpty: false, titleImage: titleImage, title: title, footerImage: "xmark.icloud", footerText: resultsDashboardWidget.error.localizedGenericMessage, account: activeTableAccount.account))
} else {
return(DashboardDataEntry(date: Date(), datas: datas, dashboard: tableDashboard, buttons: buttons, isPlaceholder: false, isEmpty: datas.isEmpty, titleImage: titleImage, title: title, footerImage: "checkmark.icloud", footerText: footerText, account: activeTableAccount.account))
}
+7 -2
View File
@@ -162,7 +162,12 @@ func getFilesDataEntry(configuration: AccountIntent?, isPreview: Bool, displaySi
// LOG
let versionNextcloudiOS = String(format: NCBrandOptions.shared.textCopyrightNextcloudiOS, utility.getVersionBuild())
NextcloudKit.configureLogger(logLevel: (NCBrandOptions.shared.disable_log ? .disabled : NCPreferences().log))
NextcloudKit.configureLogger(
logLevel: NCBrandOptions.shared.disable_log ? .disabled : NCPreferences().log,
logDirectory: NCPreferences.sharedLogDirectory
)
defer { NextcloudKit.flushLogger() }
nkLog(debug: "Start \(NCBrandOptions.shared.brand) widget session " + versionNextcloudiOS)
let options = NKRequestOptions(timeout: 30, queue: NextcloudKit.shared.nkCommonInstance.backgroundQueue)
@@ -233,7 +238,7 @@ func getFilesDataEntry(configuration: AccountIntent?, isPreview: Bool, displaySi
let footerText = "Files " + NSLocalizedString("_of_", comment: "") + " " + activeTableAccount.displayName + alias
if results.error != .success {
return(FilesDataEntry(date: Date(), datas: datasPlaceholder, isPlaceholder: true, isEmpty: false, userId: activeTableAccount.userId, url: activeTableAccount.urlBase, account: activeTableAccount.account, tile: title, footerImage: "xmark.icloud", footerText: results.error.errorDescription))
return(FilesDataEntry(date: Date(), datas: datasPlaceholder, isPlaceholder: true, isEmpty: false, userId: activeTableAccount.userId, url: activeTableAccount.urlBase, account: activeTableAccount.account, tile: title, footerImage: "xmark.icloud", footerText: results.error.localizedGenericMessage))
} else {
return(FilesDataEntry(date: Date(), datas: datas, isPlaceholder: false, isEmpty: datas.isEmpty, userId: activeTableAccount.userId, url: activeTableAccount.urlBase, account: activeTableAccount.account, tile: title, footerImage: "checkmark.icloud", footerText: footerText))
}
+1 -1
View File
@@ -138,7 +138,7 @@ struct FilesWidgetView: View {
.frame(maxWidth: .infinity)
Link(destination: entry.isPlaceholder ? linkNoAction : linkActionVoiceMemo) {
Image("microphone")
Image(systemName: "mic.fill")
.resizable()
.renderingMode(.template)
.scaledToFit()
+5 -3
View File
@@ -67,13 +67,15 @@ struct ToolbarWidgetView: View {
})
Link(destination: entry.isPlaceholder ? linkNoAction : linkActionVoiceMemo, label: {
Image("microphone")
Image(systemName: "mic.fill")
.resizable()
.renderingMode(.template)
.scaledToFit()
.foregroundColor(entry.isPlaceholder ? Color(.systemGray4) : Color(NCBrandColor.shared.getText(account: entry.account)))
.padding()
.frame(width: sizeButton - 32, height: sizeButton - 32)
.padding(16)
.background(entry.isPlaceholder ? Color(.systemGray4) : Color(NCBrandColor.shared.getElement(account: entry.account)))
.clipShape(Circle())
.scaledToFit()
.frame(width: geo.size.width / 4, height: sizeButton)
})
}
+4 -2
View File
@@ -1,5 +1,7 @@
// SPDX-FileCopyrightText: Nextcloud GmbH
// SPDX-FileCopyrightText: 2016 Marino Faggiana
// SPDX-License-Identifier: GPL-3.0-or-later
//
// Use this file to import your target's public headers that you would like to expose to Swift.
//
// Use this file to import your target's public headers that you would like to expose to Swift.
#import "UIImage+animatedGIF.h"
@@ -1,25 +1,6 @@
//
// IntentHandler.swift
// WidgetDashboardIntentHandler
//
// Created by Marino Faggiana on 08/10/22.
// Copyright © 2022 Marino Faggiana. All rights reserved.
//
// Author Marino Faggiana <marino.faggiana@nextcloud.com>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
// SPDX-FileCopyrightText: Nextcloud GmbH
// SPDX-FileCopyrightText: 2022 Marino Faggiana
// SPDX-License-Identifier: GPL-3.0-or-later
import Intents
import RealmSwift
@@ -36,7 +36,8 @@ struct NCAccountSettingsView: View {
Image(uiImage: avatar)
.resizable()
.scaledToFit()
.frame(width: UIScreen.main.bounds.width, height: 65)
.frame(height: 65)
.frame(maxWidth: .infinity)
if let statusImage = status.statusImage {
ZStack {
Circle()
@@ -137,7 +138,7 @@ struct NCAccountSettingsView: View {
if let account = model.tblAccount?.account {
NavigationLink(destination: NCUserStatusView(account: account, controller: model.controller)) {
HStack {
Image(systemName: "moon.fill")
Image(systemName: "moon")
.font(.icon())
.foregroundStyle(Color(NCBrandColor.shared.iconImageColor))
.frame(width: 26)
@@ -151,7 +152,7 @@ struct NCAccountSettingsView: View {
if let account = model.tblAccount?.account {
NavigationLink(destination: NCStatusMessageView(account: account, controller: model.controller)) {
HStack {
Image(systemName: "message.fill")
Image(systemName: "message")
.font(.icon())
.foregroundStyle(Color(NCBrandColor.shared.iconImageColor))
.frame(width: 26)
+84 -40
View File
@@ -8,6 +8,7 @@ import NextcloudKit
@MainActor
class NCAccount: NSObject {
private static var accountsCheckingRemoteUser: Set<String> = []
let database = NCManageDatabase.shared
let appDelegate = (UIApplication.shared.delegate as? AppDelegate)!
let global = NCGlobal.shared
@@ -33,16 +34,16 @@ class NCAccount: NSObject {
httpMaximumConnectionsPerHostInDownload: NCBrandOptions.shared.httpMaximumConnectionsPerHostInDownload,
httpMaximumConnectionsPerHostInUpload: NCBrandOptions.shared.httpMaximumConnectionsPerHostInUpload,
groupIdentifier: NCBrandOptions.shared.capabilitiesGroup)
let resultsGetUserProfile = await NextcloudKit.shared.getUserProfileAsync(account: account) { task in
Task {
let identifier = await NCNetworking.shared.networkingTasks.createIdentifier(account: account,
name: "getUserProfile")
await NCNetworking.shared.networkingTasks.track(identifier: identifier, task: task)
}
}
let resultsGetUserProfile = await NextcloudKit.shared.getUserProfileAsync(account: account)
guard resultsGetUserProfile.error == .success, let userProfile = resultsGetUserProfile.userProfile else {
NextcloudKit.shared.nkCommonInstance.nksessions.remove(account: account)
let alertController = UIAlertController(title: NSLocalizedString("_error_", comment: ""), message: resultsGetUserProfile.error.errorDescription, preferredStyle: .alert)
let error = resultsGetUserProfile.error == .success ? NKError.invalidData : resultsGetUserProfile.error
nkLog(error: "Getting the user profile failed: \(error.logDescription)")
let alertController = UIAlertController(title: NSLocalizedString("_error_", comment: ""), message: error.userFriendlyMessage() ?? error.localizedGenericMessage, preferredStyle: .alert)
alertController.addAction(UIAlertAction(title: NSLocalizedString("_ok_", comment: ""), style: .default, handler: { _ in }))
viewController.present(alertController, animated: true)
@@ -89,20 +90,10 @@ class NCAccount: NSObject {
func changeAccount(_ account: String, userProfile: NKUserProfile?, controller: NCMainTabBarController?) async {
if let tblAccount = await database.setAccountActiveAsync(account) {
// Set account
controller?.account = account
// Set User Profile
if let userProfile {
await database.setAccountUserProfileAsync(account: account, userProfile: userProfile)
}
// Networking Certificate
NCNetworking.shared.activeAccountCertificate(account: account)
// Subscribing Push Notification
await NCPushNotification.shared.subscribingNextcloudServerPushNotification(account: tblAccount.account, urlBase: tblAccount.urlBase)
// Start the service
Task(priority: .utility) {
await NCService().startRequestServicesServer(account: account, controller: controller)
}
// Capabilities
if let capabilities = await self.database.getCapabilities(account: account) {
// set theming color
@@ -111,13 +102,24 @@ class NCAccount: NSObject {
// Networking Process
await NCNetworkingProcess.shared.setCurrentAccount(account)
// Update the account and the file context together, before starting network requests.
controller?.account = account
NCNetworking.shared.activeAccountCertificate(account: account)
// Color
NotificationCenter.default.postOnMainThread(name: self.global.notificationCenterChangeTheming, userInfo: ["account": account])
// Notification
if let controller {
NotificationCenter.default.postOnMainThread(name: self.global.notificationCenterChangeUser, userInfo: ["account": account, "controller": controller])
NotificationCenter.default.post(name: Notification.Name(self.global.notificationCenterChangeUser), object: nil, userInfo: ["account": account, "controller": controller])
} else {
NotificationCenter.default.postOnMainThread(name: self.global.notificationCenterChangeUser, userInfo: ["account": account])
NotificationCenter.default.post(name: Notification.Name(self.global.notificationCenterChangeUser), object: nil, userInfo: ["account": account])
}
// Subscribing Push Notification
await NCPushNotification.shared.subscribingNextcloudServerPushNotification(account: tblAccount.account, urlBase: tblAccount.urlBase)
// Start the service
Task(priority: .utility) {
await NCService().startRequestServicesServer(account: account, controller: controller)
}
}
}
@@ -145,11 +147,21 @@ class NCAccount: NSObject {
}
// Remove account in all database
database.clearDatabase(account: account)
do {
try await NCLocalDatabase.shared.clearDatabase(account: account)
} catch {
nkLog(error: "Unable to clear GRDB data for account \(account): \(error)")
}
} else {
// Remove account
await database.clearTableAsync(tableAccount.self, account: account)
// Remove autoupload
await database.clearTableAsync(tableAutoUploadTransfer.self, account: account)
do {
try await NCLocalDatabase.shared.removeAutoUploadResources(account: account)
} catch {
nkLog(error: "Unable to remove background upload history for account \(account): \(error)")
}
}
// Remove session in NextcloudKit
NextcloudKit.shared.nkCommonInstance.nksessions.remove(account: account)
@@ -189,40 +201,72 @@ class NCAccount: NSObject {
}
func checkRemoteUser(account: String, controller: NCMainTabBarController?) async {
guard Self.accountsCheckingRemoteUser.insert(account).inserted else {
return
}
defer { Self.accountsCheckingRemoteUser.remove(account) }
let token = NCPreferences().getPassword(account: account)
guard let tblAccount = await NCManageDatabase.shared.getTableAccountAsync(predicate: NSPredicate(format: "account == %@", account)) else {
return
}
let windowScene = SceneManager.shared.getWindowScene(controller: controller)
await showErrorBanner(windowScene: windowScene, text: String(format: NSLocalizedString("_account_unauthorized_", comment: ""), account), errorCode: NCGlobal.shared.errorUnauthorized401)
let resultsWipe = await NextcloudKit.shared.getRemoteWipeStatusAsync(serverUrl: tblAccount.urlBase, token: token, account: account) { task in
Task {
let identifier = await NCNetworking.shared.networkingTasks.createIdentifier(account: account,
path: tblAccount.urlBase,
name: "getRemoteWipeStatus")
await NCNetworking.shared.networkingTasks.track(identifier: identifier, task: task)
}
guard let session = NextcloudKit.shared.nkCommonInstance.nksessions.session(forAccount: account),
session.password == token else {
return
}
// A stored 401 may belong to an inconsistent or outdated request. Verify with the server.
let result = await NextcloudKit.shared.getUserProfileAsync(account: account, options: NKRequestOptions(checkInterceptor: false))
guard !Task.isCancelled,
remoteUserCredentialsMatch(session, token: token) else {
return
}
if result.error == .success, result.userProfile?.userId == session.userId {
NCNetworking.shared.removeUnauthorizedAccount(account)
return
}
guard result.responseData?.response?.statusCode == NCGlobal.shared.errorUnauthorized else {
// Network failures and other responses do not confirm invalid credentials.
return
}
let windowScene = SceneManager.shared.getWindowScene(controller: controller)
await showErrorBanner(windowScene: windowScene, text: String(format: NSLocalizedString("_account_unauthorized_", comment: ""), account), errorCode: NCGlobal.shared.errorUnauthorized)
let resultsWipe = await NextcloudKit.shared.getRemoteWipeStatusAsync(serverUrl: tblAccount.urlBase, token: token, account: account)
// REMOVE ACCOUNT
guard !Task.isCancelled,
remoteUserCredentialsMatch(session, token: token) else {
return
}
await NCAccount().deleteAccount(account, wipe: resultsWipe.wipe)
if resultsWipe.wipe {
let resultsSetWipe = await NextcloudKit.shared.setRemoteWipeCompletitionAsync(serverUrl: tblAccount.urlBase, token: token, account: tblAccount.account) { task in
Task {
let identifier = await NCNetworking.shared.networkingTasks.createIdentifier(account: tblAccount.account,
path: tblAccount.urlBase,
name: "setRemoteWipeCompletition")
await NCNetworking.shared.networkingTasks.track(identifier: identifier, task: task)
}
}
nkLog(debug: "Set Remote Wipe Completition error code: \(resultsSetWipe.error.errorCode)")
let resultsSetWipe = await NextcloudKit.shared.setRemoteWipeCompletitionAsync(serverUrl: tblAccount.urlBase, token: token, account: tblAccount.account)
nkLog(debug: "Set Remote Wipe Completition result: \(resultsSetWipe.error.logDescription)")
}
if !account.isEmpty, controller == nil || controller?.account == account {
await switchToFirstAvailableAccount(controller: controller)
}
}
private func remoteUserCredentialsMatch(_ session: NKSession, token: String) -> Bool {
guard let currentSession = NextcloudKit.shared.nkCommonInstance.nksessions.session(forAccount: session.account) else {
return false
}
return currentSession.urlBase == session.urlBase
&& currentSession.user == session.user
&& currentSession.userId == session.userId
&& currentSession.password == session.password
&& NCPreferences().getPassword(account: session.account) == token
}
/// Presents the login (or intro) screen if no account remains.
func switchToFirstAvailableAccount(controller: NCMainTabBarController?) async {
let accounts = await NCManageDatabase.shared.getAccountsAsync()
if let accounts,
account.count > 0,
let account = accounts.first {
await changeAccount(account, userProfile: nil, controller: controller)
} else {
@@ -41,12 +41,7 @@ import NextcloudKit
func getStatus(account: String) {
Task {
let result = await NextcloudKit.shared.getUserStatusAsync(account: account) { task in
Task {
let identifier = await NCNetworking.shared.networkingTasks.createIdentifier(account: account, name: "getUserStatus")
await NCNetworking.shared.networkingTasks.track(identifier: identifier, task: task)
}
}
let result = await NextcloudKit.shared.getUserStatusAsync(account: account)
if result.error == .success {
emojiText = result.icon ?? "😀"
@@ -58,12 +53,7 @@ import NextcloudKit
func clearStatus(account: String) {
Task {
let result = await NextcloudKit.shared.clearMessageAsync(account: account) { task in
Task {
let identifier = await NCNetworking.shared.networkingTasks.createIdentifier(account: account, name: "clearMessage")
await NCNetworking.shared.networkingTasks.track(identifier: identifier, task: task)
}
}
let result = await NextcloudKit.shared.clearMessageAsync(account: account)
if result.error != .success {
await showErrorBanner(windowScene: self.windowScene, error: result.error)
@@ -73,12 +63,7 @@ import NextcloudKit
func getPredefinedStatusTexts(account: String) {
Task {
let result = await NextcloudKit.shared.getUserStatusPredefinedStatusesAsync(account: account) { task in
Task {
let identifier = await NCNetworking.shared.networkingTasks.createIdentifier(account: account, name: "getUserStatusPredefinedStatuses")
await NCNetworking.shared.networkingTasks.track(identifier: identifier, task: task)
}
}
let result = await NextcloudKit.shared.getUserStatusPredefinedStatusesAsync(account: account)
if result.error == .success {
predefinedStatuses = isXcodeRunningForPreviews ? createStatusesForPreview() : result.userStatuses ?? []
@@ -90,12 +75,7 @@ import NextcloudKit
func submitStatus(account: String) {
Task {
let result = await NextcloudKit.shared.setCustomMessageUserDefinedAsync(statusIcon: emojiText, message: statusText, clearAt: getClearAt(clearAfterString), account: account) { task in
Task {
let identifier = await NCNetworking.shared.networkingTasks.createIdentifier(account: account, name: "setCustomMessageUserDefined")
await NCNetworking.shared.networkingTasks.track(identifier: identifier, task: task)
}
}
let result = await NextcloudKit.shared.setCustomMessageUserDefinedAsync(statusIcon: emojiText, message: statusText, clearAt: getClearAt(clearAfterString), account: account)
if result.error != .success {
await showErrorBanner(windowScene: self.windowScene, error: result.error)
@@ -105,13 +85,7 @@ import NextcloudKit
func setAccountUserStatus(account: String) {
Task {
let result = await NextcloudKit.shared.getUserStatusAsync(account: account) { task in
Task {
let identifier = await NCNetworking.shared.networkingTasks.createIdentifier(account: account,
name: "getUserStatus")
await NCNetworking.shared.networkingTasks.track(identifier: identifier, task: task)
}
}
let result = await NextcloudKit.shared.getUserStatusAsync(account: account)
if result.error == .success {
await NCManageDatabase.shared.setAccountUserStatusAsync(userStatusClearAt: result.clearAt,
@@ -43,12 +43,7 @@ import NextcloudKit
func getStatus(account: String) {
Task {
let result = await NextcloudKit.shared.getUserStatusAsync(account: account) { task in
Task {
let identifier = await NCNetworking.shared.networkingTasks.createIdentifier(account: self.account, name: "getUserStatus")
await NCNetworking.shared.networkingTasks.track(identifier: identifier, task: task)
}
}
let result = await NextcloudKit.shared.getUserStatusAsync(account: account)
if result.error == .success {
selectedStatus = result.status
@@ -60,10 +55,8 @@ import NextcloudKit
func setStatus(account: String) {
Task {
let result = await NextcloudKit.shared.setUserStatusAsync(status: selectedStatus ?? "", account: account) { task in
Task {
let identifier = await NCNetworking.shared.networkingTasks.createIdentifier(account: self.account, name: "setUserStatus")
await NCNetworking.shared.networkingTasks.track(identifier: identifier, task: task)
let result = await NextcloudKit.shared.setUserStatusAsync(status: selectedStatus ?? "", account: account) { _ in
Task { @MainActor in
self.canDismiss = true
}
}
@@ -76,12 +69,7 @@ import NextcloudKit
func setAccountUserStatus(account: String) {
Task {
let result = await NextcloudKit.shared.getUserStatusAsync(account: account) { task in
Task {
let identifier = await NCNetworking.shared.networkingTasks.createIdentifier(account: self.account, name: "getUserStatus")
await NCNetworking.shared.networkingTasks.track(identifier: identifier, task: task)
}
}
let result = await NextcloudKit.shared.getUserStatusAsync(account: account)
if result.error != .success {
await showErrorBanner(windowScene: windowScene, error: result.error)
+3 -2
View File
@@ -17,7 +17,7 @@
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" rowHeight="-1" estimatedRowHeight="-1" sectionHeaderHeight="20" sectionFooterHeight="1" translatesAutoresizingMaskIntoConstraints="NO" id="X49-xg-JXO">
<rect key="frame" x="0.0" y="48" width="414" height="848"/>
<rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<prototypes>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="default" indentationWidth="10" reuseIdentifier="tableCell" rowHeight="50" id="ggj-aE-fnh" customClass="NCActivityTableViewCell" customModule="Nextcloud" customModuleProvider="target">
@@ -59,6 +59,7 @@
<constraint firstItem="fcO-YL-MuT" firstAttribute="top" secondItem="i35-U4-bEk" secondAttribute="top" constant="3" id="faC-by-km5"/>
</constraints>
</tableViewCellContentView>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<connections>
<outlet property="avatar" destination="LQ8-cO-794" id="2PE-uD-pug"/>
<outlet property="icon" destination="xNG-sf-PnA" id="hxb-Vr-oQX"/>
@@ -78,7 +79,7 @@
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints>
<constraint firstItem="X49-xg-JXO" firstAttribute="trailing" secondItem="USa-eR-a1s" secondAttribute="trailing" id="5we-Fh-GVu"/>
<constraint firstItem="X49-xg-JXO" firstAttribute="top" secondItem="USa-eR-a1s" secondAttribute="top" id="E1U-4Q-6uu"/>
<constraint firstItem="X49-xg-JXO" firstAttribute="top" secondItem="vOO-VC-ekK" secondAttribute="top" id="E1U-4Q-6uu"/>
<constraint firstAttribute="bottom" secondItem="X49-xg-JXO" secondAttribute="bottom" id="aHq-g4-dUG"/>
<constraint firstItem="X49-xg-JXO" firstAttribute="leading" secondItem="USa-eR-a1s" secondAttribute="leading" id="pfF-ag-f7x"/>
</constraints>
+78 -56
View File
@@ -15,6 +15,8 @@ class NCActivity: UIViewController, NCSharePagingContent {
var height: CGFloat = 0
var metadata: tableMetadata?
var showComments: Bool = false
var usesGroupedBackground: Bool = false
private var activityTasks: [URLSessionTask] = []
let utilityFileSystem = NCUtilityFileSystem()
let utility = NCUtility()
@@ -55,13 +57,14 @@ class NCActivity: UIViewController, NCSharePagingContent {
super.viewDidLoad()
navigationController?.setNavigationBarAppearance()
view.backgroundColor = .systemBackground
view.backgroundColor = usesGroupedBackground ? .systemGroupedBackground : .systemBackground
self.title = NSLocalizedString("_activity_", comment: "")
tableView.allowsSelection = false
tableView.separatorColor = UIColor.clear
tableView.contentInset = insets
tableView.backgroundColor = .systemBackground
tableView.backgroundColor = usesGroupedBackground ? .systemGroupedBackground : .systemBackground
tableView.hideTopScrollEdgeEffect()
if showComments {
setupComments()
@@ -75,13 +78,7 @@ class NCActivity: UIViewController, NCSharePagingContent {
commentView = Bundle.main.loadNibNamed("NCActivityCommentView", owner: self, options: nil)?.first as? NCActivityCommentView
commentView?.setup(account: metadata.account) { newComment in
guard let newComment = newComment, !newComment.isEmpty, let metadata = self.metadata else { return }
NextcloudKit.shared.putComments(fileId: metadata.fileId, message: newComment, account: metadata.account) { task in
Task {
let identifier = await NCNetworking.shared.networkingTasks.createIdentifier(account: metadata.account,
path: metadata.fileId,
name: "putComments")
await NCNetworking.shared.networkingTasks.track(identifier: identifier, task: task)
}
NextcloudKit.shared.putComments(fileId: metadata.fileId, message: newComment, account: metadata.account) { _ in
} completion: { _, _, error in
if error == .success {
self.commentView?.newCommentField.text?.removeAll()
@@ -89,8 +86,7 @@ class NCActivity: UIViewController, NCSharePagingContent {
} else {
Task {
await showErrorBanner(windowScene: self.windowScene,
text: error.errorDescription,
errorCode: error.errorCode)
error: error)
}
}
}
@@ -106,12 +102,8 @@ class NCActivity: UIViewController, NCSharePagingContent {
override func viewWillDisappear(_ animated: Bool) {
super.viewWillDisappear(animated)
Task {
await NCNetworking.shared.networkingTasks.cancel(identifier: "NCActivity")
}
// Cancel Queue & Retrieves Properties
NCNetworking.shared.downloadThumbnailActivityQueue.cancelAll()
activityTasks.forEach { $0.cancel() }
activityTasks.removeAll()
}
override func viewWillLayoutSubviews() {
@@ -120,7 +112,7 @@ class NCActivity: UIViewController, NCSharePagingContent {
tableView.tableHeaderView = commentView
commentView?.leadingAnchor.constraint(equalTo: view.leadingAnchor).isActive = true
commentView?.trailingAnchor.constraint(equalTo: view.trailingAnchor).isActive = true
viewContainerConstraint.constant = height - 10
viewContainerConstraint.constant = height
}
func makeTableFooterView() -> UIView {
@@ -164,25 +156,25 @@ extension NCActivity: UITableViewDelegate {
label.text = utility.getTitleFromDate(sectionDates[section])
label.textAlignment = .center
let blur = UIBlurEffect(style: .systemMaterial)
let blurredEffectView = UIVisualEffectView(effect: blur)
blurredEffectView.layer.cornerRadius = 11
blurredEffectView.layer.masksToBounds = true
let pill = UIView()
pill.backgroundColor = .systemGray5
pill.layer.cornerRadius = 11
pill.layer.masksToBounds = true
view.addSubview(blurredEffectView)
view.addSubview(pill)
view.addSubview(label)
blurredEffectView.translatesAutoresizingMaskIntoConstraints = false
pill.translatesAutoresizingMaskIntoConstraints = false
label.translatesAutoresizingMaskIntoConstraints = false
NSLayoutConstraint.activate([
blurredEffectView.topAnchor.constraint(equalTo: view.topAnchor),
blurredEffectView.centerXAnchor.constraint(equalTo: view.centerXAnchor),
blurredEffectView.widthAnchor.constraint(equalToConstant: label.intrinsicContentSize.width + 30),
blurredEffectView.heightAnchor.constraint(equalToConstant: 22),
pill.topAnchor.constraint(equalTo: view.topAnchor),
pill.centerXAnchor.constraint(equalTo: view.centerXAnchor),
pill.widthAnchor.constraint(equalToConstant: label.intrinsicContentSize.width + 30),
pill.heightAnchor.constraint(equalToConstant: 22),
label.topAnchor.constraint(equalTo: view.topAnchor),
label.centerXAnchor.constraint(equalTo: view.centerXAnchor),
label.centerYAnchor.constraint(equalTo: blurredEffectView.centerYAnchor)
label.centerYAnchor.constraint(equalTo: pill.centerYAnchor)
])
return view
@@ -225,6 +217,8 @@ extension NCActivity: UITableViewDataSource {
cell.delegate = self
cell.configureAvatarMenu()
/*
// Avatar
let fileName = NCSession.shared.getFileName(urlBase: metadata.urlBase, user: comment.actorId)
let results = NCManageDatabase.shared.getImageAvatarLoaded(fileName: fileName)
@@ -235,11 +229,13 @@ extension NCActivity: UITableViewDataSource {
cell.avatarImage?.image = results.image
}
if let tblAvatar = results.tblAvatar,
!tblAvatar.loaded,
NCNetworking.shared.downloadAvatarQueue.operations.filter({ ($0 as? NCOperationDownloadAvatar)?.fileName == fileName }).isEmpty {
NCNetworking.shared.downloadAvatarQueue.addOperation(NCOperationDownloadAvatar(user: comment.actorId, fileName: fileName, account: account, view: tableView))
}
*/
// Username
cell.labelUser.text = comment.actorDisplayName
@@ -300,17 +296,41 @@ extension NCActivity: UITableViewDataSource {
cell.configureAvatarMenu()
let fileName = NCSession.shared.getFileName(urlBase: session.urlBase, user: activity.user)
let results = NCManageDatabase.shared.getImageAvatarLoaded(fileName: fileName)
if results.image == nil {
cell.avatar?.image = utility.loadUserImage(for: activity.user, displayName: nil, urlBase: session.urlBase)
} else {
cell.avatar?.image = results.image
let fileNameLocalPath = self.utilityFileSystem.createServerUrl(serverUrl: utilityFileSystem.directoryUserData, fileName: fileName)
if let image = UIImage(contentsOfFile: fileNameLocalPath) {
cell.avatar?.image = image
}
let user = activity.user
let idActivity = activity.idActivity
let account = session.account
if !(results.tblAvatar?.loaded ?? false),
NCNetworking.shared.downloadAvatarQueue.operations.filter({ ($0 as? NCOperationDownloadAvatar)?.fileName == fileName }).isEmpty {
NCNetworking.shared.downloadAvatarQueue.addOperation(NCOperationDownloadAvatar(user: activity.user, fileName: fileName, account: session.account, view: tableView))
Task {
let etagResource = await database.getTableAvatarAsync(fileName: fileName)?.etag
await NCTransferCoordinator.shared.start(identifier: fileName,
priority: .userInitiated) {
let results = await NextcloudKit.shared.downloadAvatarAsync(
user: user,
fileNameLocalPath: fileNameLocalPath,
sizeImage: NCGlobal.shared.avatarSize,
avatarSizeRounded: NCGlobal.shared.avatarSizeRounded,
etagResource: etagResource,
account: account)
if results.error == .success,
let image = results.imageAvatar,
let etag = results.etag,
etag != etagResource {
await self.database.addAvatarAsync(fileName: fileName, etag: etag)
await MainActor.run {
guard
let cell = self.tableView.cellForRow(at: indexPath) as? NCActivityTableViewCell,
cell.idActivity == idActivity else {
return
}
cell.avatar?.image = image
}
}
}
}
} else {
cell.subjectLeadingConstraint.constant = -30
@@ -419,21 +439,14 @@ extension NCActivity {
guard showComments, let metadata = metadata else { return }
disptachGroup?.enter()
NextcloudKit.shared.getComments(fileId: metadata.fileId, account: metadata.account) { task in
Task {
let identifier = await NCNetworking.shared.networkingTasks.createIdentifier(account: metadata.account,
path: metadata.fileId,
name: "getComments")
await NCNetworking.shared.networkingTasks.track(identifier: identifier, task: task)
}
NextcloudKit.shared.getComments(fileId: metadata.fileId, account: metadata.account) { _ in
} completion: { _, comments, _, error in
if error == .success, let comments = comments {
self.database.addComments(comments, account: metadata.account, objectId: metadata.fileId)
} else if error.errorCode != NCGlobal.shared.errorResourceNotFound {
Task {
await showErrorBanner(windowScene: self.windowScene,
text: error.errorDescription,
errorCode: error.errorCode)
error: error)
}
}
@@ -447,11 +460,14 @@ extension NCActivity {
/// Check if most recent activivities are loaded, if not trigger reload
func checkRecentActivity(disptachGroup: DispatchGroup) {
Task {
// If is already in-flight, do nothing
if await NCNetworking.shared.networkingTasks.isReading(identifier: "NCActivity") {
return
}
activityTasks.removeAll {
$0.state == .completed || $0.state == .canceling
}
if activityTasks.contains(where: {
$0.state == .running || $0.state == .suspended
}) {
return
}
guard let result = database.getLatestActivityId(account: session.account), metadata == nil, hasActivityToLoad else {
@@ -467,8 +483,11 @@ extension NCActivity {
objectType: objectType,
previews: true,
account: session.account) { task in
Task {
await NCNetworking.shared.networkingTasks.track(identifier: "NCActivity", task: task)
Task { @MainActor in
self.activityTasks.removeAll {
$0.state == .completed || $0.state == .canceling
}
self.activityTasks.append(task)
}
} completion: { account, _, activityFirstKnown, activityLastGiven, _, error in
defer { disptachGroup.leave() }
@@ -499,8 +518,11 @@ extension NCActivity {
objectType: objectType,
previews: true,
account: session.account) { task in
Task {
await NCNetworking.shared.networkingTasks.track(identifier: "NCActivity", task: task)
Task { @MainActor in
self.activityTasks.removeAll {
$0.state == .completed || $0.state == .canceling
}
self.activityTasks.append(task)
}
} completion: { account, activities, activityFirstKnown, activityLastGiven, _, error in
defer { disptachGroup.leave() }
Loaded 100 of 754 files, more files were not shown because too many files have changed in this diff. Show more