Refactor share types and permissions#3862
Merged
marinofaggiana merged 2 commits intomasterfrom Nov 10, 2025
Merged
Conversation
Signed-off-by: Milen Pivchev <milen.pivchev@gmail.com>
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR refactors the share-related code by migrating from custom constants (NCShareCommon.shareType* and NCSharePermissions.permission*Share) to using NextcloudKit's built-in NKShare.ShareType and NKShare.Permission enums. This standardizes the codebase to use the external library's type system, reducing code duplication and improving maintainability.
Key changes:
- Removed duplicate share type and permission constants from
NCShareCommonandNCSharePermissions - Replaced all usages with
NKShare.ShareType.<type>.rawValueandNKShare.Permission.<permission>.rawValuethroughout the codebase - Added
import NextcloudKitto files that now referenceNKSharetypes
Reviewed Changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| iOSClient/Share/TransientShare.swift | Updated to use NKShare.Permission.create and NKShare.ShareType.publicLink instead of custom constants |
| iOSClient/Share/NCShareUserCell.swift | Migrated share type comparisons to use NKShare.ShareType enums (team, federatedCloud, federatedGroup, talkConversation, email) |
| iOSClient/Share/NCSharePermissions.swift | Removed duplicate permission constants, replaced with NKShare.Permission enum values; retained composite permission values that don't have direct equivalents |
| iOSClient/Share/NCShareNetworking.swift | Updated share type checks to use NKShare.ShareType.publicLink |
| iOSClient/Share/NCShareNavigationTitleSetting.swift | Added NextcloudKit import and updated to use NKShare.ShareType.publicLink |
| iOSClient/Share/NCShareLinkCell.swift | Added NextcloudKit import and migrated to NKShare.ShareType.email |
| iOSClient/Share/NCShareCommon.swift | Removed duplicate share type constants and simplified getImageShareType to use NKShare.ShareType with typealias; added NextcloudKit import |
| iOSClient/Share/NCShare.swift | Updated all share type comparisons to use NKShare.ShareType enums throughout the file |
| iOSClient/Share/Advanced/NCShareDateCell.swift | Migrated switch statements to use NKShare.ShareType values for expiration date logic |
| iOSClient/Share/Advanced/NCShareCells.swift | Updated permission bit flag mappings to use NKShare.Permission enum; added trailing newline |
| iOSClient/Share/Advanced/NCShareAdvancePermission.swift | Updated share type checks and permission handling to use NKShare types |
| iOSClient/Menu/NCShare+Menu.swift | Migrated share type comparisons and permission calculations to use NKShare enums |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: Milen Pivchev <milen.pivchev@gmail.com>
marinofaggiana
approved these changes
Nov 10, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implements: nextcloud/NextcloudKit#199
Prerequisite: nextcloud/NextcloudKit#200