Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Nextcloud.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -5798,7 +5798,7 @@
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 0;
CURRENT_PROJECT_VERSION = 1;
DEAD_CODE_STRIPPING = YES;
DEBUG_INFORMATION_FORMAT = dwarf;
DEVELOPMENT_TEAM = NKUJUXUJ3B;
Expand Down Expand Up @@ -5866,7 +5866,7 @@
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 0;
CURRENT_PROJECT_VERSION = 1;
DEAD_CODE_STRIPPING = YES;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
DEVELOPMENT_TEAM = NKUJUXUJ3B;
Expand Down
16 changes: 16 additions & 0 deletions iOSClient/Data/NCManageDatabase+Metadata.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1004,6 +1004,22 @@ extension NCManageDatabase {
}
}

/// Returns detached (unmanaged) copies of `tableMetadata` objects matching the provided ocIds.
///
/// - Parameter ocIds: Array of ocId strings used to fetch corresponding metadata.
/// - Returns: An array of detached `tableMetadata` objects. Empty if no matches are found.
func getMetadatasFromOcIdsAsync(_ ocIds: [String]) async -> [tableMetadata] {
guard !ocIds.isEmpty else { return [] }

return await core.performRealmReadAsync { realm in
realm.objects(tableMetadata.self)
.where {
$0.ocId.in(ocIds)
}
.map { $0.detachedCopy() }
} ?? []
}

func getMetadataFromOcIdAndocIdTransferAsync(_ ocId: String?) async -> tableMetadata? {
guard let ocId else {
return nil
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,6 @@ extension NCCollectionViewCommon: NCCollectionViewCommonSelectTabBarDelegate {

NCSelectOpen.shared.openView(items: metadatas, controller: self.controller)
}

}

func share() {
Expand Down
25 changes: 24 additions & 1 deletion iOSClient/Media/NCMedia+Command.swift
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,30 @@ extension NCMedia {
}

extension NCMedia: NCMediaSelectTabBarDelegate {
func move() {
Task {
let ocIds = self.fileSelect.map { $0 }
let metadatas = await database.getMetadatasFromOcIdsAsync(ocIds)

setEditMode(false)

NCSelectOpen.shared.openView(items: metadatas, controller: self.controller)
}
}

func share() {
Task {
let ocIds = self.fileSelect.map { $0 }
let metadatas = await database.getMetadatasFromOcIdsAsync(ocIds)

setEditMode(false)
await NCCreate().createActivityViewController(
selectedMetadata: metadatas,
controller: self.controller,
sender: nil)
}
}

func delete() {
let ocIds = self.fileSelect.map { $0 }
var alertStyle = UIAlertController.Style.actionSheet
Expand Down Expand Up @@ -140,5 +164,4 @@ extension NCMedia: NCMediaSelectTabBarDelegate {
}
}
}

}
36 changes: 22 additions & 14 deletions iOSClient/Media/NCMediaSelectTabBar.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import UIKit
import SwiftUI

protocol NCMediaSelectTabBarDelegate: AnyObject {
func move()
func share()
func delete()
}

Expand Down Expand Up @@ -86,21 +88,27 @@ struct MediaTabBarSelectView: View {
var body: some View {
VStack {
Spacer().frame(height: sizeClass == .compact ? 5 : 10)

HStack {
Spacer().frame(maxWidth: .infinity)
Group {
if tabBarSelect.selectCount == 0 {
Text(NSLocalizedString("_select_photos_", comment: ""))
.cappedFont(.body, maxDynamicType: .accessibility2)
} else if tabBarSelect.selectCount == 1 {
Text(String(tabBarSelect.selectCount) + " " + NSLocalizedString("_selected_photo_", comment: ""))
.cappedFont(.body, maxDynamicType: .accessibility2)
} else {
Text(String(tabBarSelect.selectCount) + " " + NSLocalizedString("_selected_photos_", comment: ""))
.cappedFont(.body, maxDynamicType: .accessibility2)
}
Button {
tabBarSelect.delegate?.share()
} label: {
Image(systemName: "square.and.arrow.up")
.font(.icon())
}
.frame(minWidth: 250, maxWidth: .infinity)
.tint(Color(NCBrandColor.shared.iconImageColor))
.frame(maxWidth: .infinity)
.disabled(tabBarSelect.selectCount == 0)

Button {
tabBarSelect.delegate?.move()
} label: {
Image(systemName: "rectangle.portrait.and.arrow.right")
.font(.icon())
}
.tint(Color(NCBrandColor.shared.iconImageColor))
.frame(maxWidth: .infinity)
.disabled(tabBarSelect.selectCount == 0)

Button {
tabBarSelect.delegate?.delete()
Expand All @@ -109,8 +117,8 @@ struct MediaTabBarSelectView: View {
.font(.icon())
}
.tint(.red)
.disabled(tabBarSelect.selectCount == 0)
.frame(maxWidth: .infinity)
.disabled(tabBarSelect.selectCount == 0)
}
.frame(maxWidth: .infinity)
}
Expand Down
Loading