Skip to content
Open
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
50 changes: 39 additions & 11 deletions Nextcloud.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,11 @@
AABD0C8A2D5F67A400F009E6 /* XCUIElement.swift in Sources */ = {isa = PBXBuildFile; fileRef = AABD0C892D5F67A200F009E6 /* XCUIElement.swift */; };
AABD0C9B2D5F73FC00F009E6 /* Placeholder.swift in Sources */ = {isa = PBXBuildFile; fileRef = AABD0C9A2D5F73FA00F009E6 /* Placeholder.swift */; };
AAE330042D2ED20200B04903 /* NCShareNavigationTitleSetting.swift in Sources */ = {isa = PBXBuildFile; fileRef = AAE330032D2ED1FF00B04903 /* NCShareNavigationTitleSetting.swift */; };
AAFC0D042F9AA10000F0A001 /* NCFocusedAutoUploadIntroView.swift in Sources */ = {isa = PBXBuildFile; fileRef = AAFC0D012F9AA10000F0A001 /* NCFocusedAutoUploadIntroView.swift */; };
AAFC0D052F9AA10000F0A001 /* NCFocusedAutoUploadProgressView.swift in Sources */ = {isa = PBXBuildFile; fileRef = AAFC0D022F9AA10000F0A001 /* NCFocusedAutoUploadProgressView.swift */; };
AAFC0D062F9AA10000F0A001 /* NCFocusedAutoUploadScreenDimmer.swift in Sources */ = {isa = PBXBuildFile; fileRef = AAFC0D032F9AA10000F0A001 /* NCFocusedAutoUploadScreenDimmer.swift */; };
AAFC0D092F9AA10000F0A001 /* NCFocusedAutoUploadCloudAnimation.swift in Sources */ = {isa = PBXBuildFile; fileRef = AAFC0D082F9AA10000F0A001 /* NCFocusedAutoUploadCloudAnimation.swift */; };
AAFC0D0B2F9AA10000F0A001 /* NCAutoUploadCounter.swift in Sources */ = {isa = PBXBuildFile; fileRef = AAFC0D0A2F9AA10000F0A001 /* NCAutoUploadCounter.swift */; };
AB6000012F60000100FE2775 /* NCTagEditorModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = AB6000002F60000100FE2775 /* NCTagEditorModel.swift */; };
AB6000032F60000200FE2775 /* NCTagEditorView.swift in Sources */ = {isa = PBXBuildFile; fileRef = AB6000022F60000200FE2775 /* NCTagEditorView.swift */; };
AF1A9B6427D0CA1E00F17A9E /* UIAlertController+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = AF1A9B6327D0CA1E00F17A9E /* UIAlertController+Extension.swift */; };
Expand Down Expand Up @@ -743,7 +748,7 @@
F7C30E01291BD2610017149B /* NCNetworkingE2EERename.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7C30DFF291BD2610017149B /* NCNetworkingE2EERename.swift */; };
F7C55C512FB4A658004A974F /* NCAssistantInputModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7C55C502FB4A651004A974F /* NCAssistantInputModel.swift */; };
F7C55C7C2FB5AEF7004A974F /* UniformTypeIdentifiers.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F7C55C7B2FB5AEF7004A974F /* UniformTypeIdentifiers.framework */; };
F7C55C882FB5AEF7004A974F /* Action Assistant.appex in Embed Foundation Extensions */ = {isa = PBXBuildFile; fileRef = F7C55C7A2FB5AEF7004A974F /* Action Assistant.appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; };
F7C55C882FB5AEF7004A974F /* Assistant Action.appex in Embed Foundation Extensions */ = {isa = PBXBuildFile; fileRef = F7C55C7A2FB5AEF7004A974F /* Assistant Action.appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; };
F7C55C8D2FB5B02C004A974F /* NCAssistantSharedTextStore.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7FFFC9D2FB300440015441E /* NCAssistantSharedTextStore.swift */; };
F7C55C8E2FB5B03D004A974F /* NCGlobal.swift in Sources */ = {isa = PBXBuildFile; fileRef = F702F2CE25EE5B5C008F8E80 /* NCGlobal.swift */; };
F7C55C8F2FB5B045004A974F /* NCBrand.swift in Sources */ = {isa = PBXBuildFile; fileRef = F76B3CCD1EAE01BD00921AC9 /* NCBrand.swift */; };
Expand Down Expand Up @@ -1131,7 +1136,7 @@
2C33C48623E2C475005F963B /* Notification Service Extension.appex in Embed Foundation Extensions */,
F7C9739928F17131002C43E2 /* WidgetDashboardIntentHandler.appex in Embed Foundation Extensions */,
F7346E1C28B0EF5E006CE2D2 /* Widget.appex in Embed Foundation Extensions */,
F7C55C882FB5AEF7004A974F /* Action Assistant.appex in Embed Foundation Extensions */,
F7C55C882FB5AEF7004A974F /* Assistant Action.appex in Embed Foundation Extensions */,
);
name = "Embed Foundation Extensions";
runOnlyForDeploymentPostprocessing = 0;
Expand Down Expand Up @@ -1231,6 +1236,11 @@
AACCAB632CFE04F700DA1786 /* lo */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = lo; path = lo.lproj/Localizable.strings; sourceTree = "<group>"; };
AACCAB642CFE04F700DA1786 /* lo */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = lo; path = lo.lproj/InfoPlist.strings; sourceTree = "<group>"; };
AAE330032D2ED1FF00B04903 /* NCShareNavigationTitleSetting.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NCShareNavigationTitleSetting.swift; sourceTree = "<group>"; };
AAFC0D012F9AA10000F0A001 /* NCFocusedAutoUploadIntroView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NCFocusedAutoUploadIntroView.swift; sourceTree = "<group>"; };
AAFC0D022F9AA10000F0A001 /* NCFocusedAutoUploadProgressView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NCFocusedAutoUploadProgressView.swift; sourceTree = "<group>"; };
AAFC0D032F9AA10000F0A001 /* NCFocusedAutoUploadScreenDimmer.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NCFocusedAutoUploadScreenDimmer.swift; sourceTree = "<group>"; };
AAFC0D082F9AA10000F0A001 /* NCFocusedAutoUploadCloudAnimation.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NCFocusedAutoUploadCloudAnimation.swift; sourceTree = "<group>"; };
AAFC0D0A2F9AA10000F0A001 /* NCAutoUploadCounter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NCAutoUploadCounter.swift; sourceTree = "<group>"; };
AB6000002F60000100FE2775 /* NCTagEditorModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NCTagEditorModel.swift; sourceTree = "<group>"; };
AB6000022F60000200FE2775 /* NCTagEditorView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NCTagEditorView.swift; sourceTree = "<group>"; };
AF1A9B6327D0CA1E00F17A9E /* UIAlertController+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIAlertController+Extension.swift"; sourceTree = "<group>"; };
Expand Down Expand Up @@ -1737,7 +1747,7 @@
F7C30DFC291BD0B80017149B /* NCNetworkingE2EEDelete.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NCNetworkingE2EEDelete.swift; sourceTree = "<group>"; };
F7C30DFF291BD2610017149B /* NCNetworkingE2EERename.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NCNetworkingE2EERename.swift; sourceTree = "<group>"; };
F7C55C502FB4A651004A974F /* NCAssistantInputModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NCAssistantInputModel.swift; sourceTree = "<group>"; };
F7C55C7A2FB5AEF7004A974F /* Action Assistant.appex */ = {isa = PBXFileReference; explicitFileType = "wrapper.app-extension"; includeInIndex = 0; path = "Action Assistant.appex"; sourceTree = BUILT_PRODUCTS_DIR; };
F7C55C7A2FB5AEF7004A974F /* Assistant Action.appex */ = {isa = PBXFileReference; explicitFileType = "wrapper.app-extension"; includeInIndex = 0; path = "Assistant Action.appex"; sourceTree = BUILT_PRODUCTS_DIR; };
F7C55C7B2FB5AEF7004A974F /* UniformTypeIdentifiers.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UniformTypeIdentifiers.framework; path = System/Library/Frameworks/UniformTypeIdentifiers.framework; sourceTree = SDKROOT; };
F7C55CC32FB5CE74004A974F /* ActionViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ActionViewController.swift; sourceTree = "<group>"; };
F7C55CC42FB5CE74004A974F /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = "<group>"; };
Expand Down Expand Up @@ -2188,6 +2198,15 @@
path = StatusMessage;
sourceTree = "<group>";
};
F3896B062FCF2CF300DA2B18 /* Utility */ = {
isa = PBXGroup;
children = (
AAFC0D032F9AA10000F0A001 /* NCFocusedAutoUploadScreenDimmer.swift */,
AAFC0D0A2F9AA10000F0A001 /* NCAutoUploadCounter.swift */,
);
path = Utility;
sourceTree = "<group>";
};
F389C9F32CEE381E00049762 /* SelectAlbum */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -2661,9 +2680,13 @@
F76882162C0DD1E7001CF441 /* AutoUpload */ = {
isa = PBXGroup;
children = (
F3896B062FCF2CF300DA2B18 /* Utility */,
F39A1EE12D0AF8A200DAD522 /* Albums.swift */,
F768821B2C0DD1E7001CF441 /* NCAutoUploadView.swift */,
F71D2FB62E09BBD700B751CC /* NCAutoUploadModel.swift */,
AAFC0D012F9AA10000F0A001 /* NCFocusedAutoUploadIntroView.swift */,
AAFC0D022F9AA10000F0A001 /* NCFocusedAutoUploadProgressView.swift */,
AAFC0D082F9AA10000F0A001 /* NCFocusedAutoUploadCloudAnimation.swift */,
);
path = AutoUpload;
sourceTree = "<group>";
Expand Down Expand Up @@ -3313,7 +3336,7 @@
C0046CDA2A17B98400D87C9D /* NextcloudUITests.xctest */,
F7F1FBA62E27D13700C79E20 /* Frameworks */,
F31165012F9674A1009A1E37 /* AppIcon.icon */,
F7C55C7A2FB5AEF7004A974F /* Action Assistant.appex */,
F7C55C7A2FB5AEF7004A974F /* Assistant Action.appex */,
);
sourceTree = "<group>";
};
Expand Down Expand Up @@ -3710,9 +3733,9 @@
productReference = F7CE8AFA1DC1F8D8009CAE48 /* Nextcloud.app */;
productType = "com.apple.product-type.application";
};
F7C55C792FB5AEF7004A974F /* Action Assistant */ = {
F7C55C792FB5AEF7004A974F /* Assistant Action */ = {
isa = PBXNativeTarget;
buildConfigurationList = F7C55C8C2FB5AEF7004A974F /* Build configuration list for PBXNativeTarget "Action Assistant" */;
buildConfigurationList = F7C55C8C2FB5AEF7004A974F /* Build configuration list for PBXNativeTarget "Assistant Action" */;
buildPhases = (
F7C55C762FB5AEF7004A974F /* Sources */,
F7C55C772FB5AEF7004A974F /* Frameworks */,
Expand All @@ -3722,12 +3745,12 @@
);
dependencies = (
);
name = "Action Assistant";
name = "Assistant Action";
packageProductDependencies = (
F7C55C9E2FB5B83A004A974F /* NextcloudKit */,
);
productName = "Action Assistant";
productReference = F7C55C7A2FB5AEF7004A974F /* Action Assistant.appex */;
productReference = F7C55C7A2FB5AEF7004A974F /* Assistant Action.appex */;
productType = "com.apple.product-type.app-extension";
};
F7C9738F28F17131002C43E2 /* WidgetDashboardIntentHandler */ = {
Expand Down Expand Up @@ -3915,7 +3938,7 @@
F7346E0F28B0EF5B006CE2D2 /* Widget */,
F7C9738F28F17131002C43E2 /* WidgetDashboardIntentHandler */,
F71459B41D12E3B700CAFEEC /* Share */,
F7C55C792FB5AEF7004A974F /* Action Assistant */,
F7C55C792FB5AEF7004A974F /* Assistant Action */,
F771E3CF20E2392D00AFB62D /* File Provider Extension */,
F70716E22987F81400E72C1D /* File Provider Extension UI */,
2C33C47E23E2C475005F963B /* Notification Service Extension */,
Expand Down Expand Up @@ -4785,6 +4808,11 @@
F76D364628A4F8BF00214537 /* NCActivityIndicator.swift in Sources */,
F3A047992BD2668800658E7B /* NCAssistantModel.swift in Sources */,
F76882322C0DD1E7001CF441 /* NCAutoUploadView.swift in Sources */,
AAFC0D042F9AA10000F0A001 /* NCFocusedAutoUploadIntroView.swift in Sources */,
AAFC0D052F9AA10000F0A001 /* NCFocusedAutoUploadProgressView.swift in Sources */,
AAFC0D062F9AA10000F0A001 /* NCFocusedAutoUploadScreenDimmer.swift in Sources */,
AAFC0D092F9AA10000F0A001 /* NCFocusedAutoUploadCloudAnimation.swift in Sources */,
AAFC0D0B2F9AA10000F0A001 /* NCAutoUploadCounter.swift in Sources */,
F36E64F72B9245210085ABB5 /* NCCollectionViewCommon+SelectTabBarDelegate.swift in Sources */,
F79A65C62191D95E00FF6DCC /* NCSelect.swift in Sources */,
F75D19E325EFE09000D74598 /* NCContextMenuTrash.swift in Sources */,
Expand Down Expand Up @@ -5015,7 +5043,7 @@
};
F7C55C872FB5AEF7004A974F /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = F7C55C792FB5AEF7004A974F /* Action Assistant */;
target = F7C55C792FB5AEF7004A974F /* Assistant Action */;
targetProxy = F7C55C862FB5AEF7004A974F /* PBXContainerItemProxy */;
};
F7C9739828F17131002C43E2 /* PBXTargetDependency */ = {
Expand Down Expand Up @@ -6184,7 +6212,7 @@
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
F7C55C8C2FB5AEF7004A974F /* Build configuration list for PBXNativeTarget "Action Assistant" */ = {
F7C55C8C2FB5AEF7004A974F /* Build configuration list for PBXNativeTarget "Assistant Action" */ = {
isa = XCConfigurationList;
buildConfigurations = (
F7C55C892FB5AEF7004A974F /* Debug */,
Expand Down
22 changes: 22 additions & 0 deletions iOSClient/Data/NCManageDatabase+AutoUpload.swift
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,28 @@ extension NCManageDatabase {
}
}

func countAutoUploadMetadatasAsync(account: String,
autoUploadServerUrlBase: String) async -> (pending: Int, failed: Int) {
let global = NCGlobal.shared
let pendingStatuses = global.metadatasStatusInWaitingDownloadUpload + global.metadatasStatusDownloadingUploading
let failedStatuses = [global.metadataStatusUploadError]

let result = await core.performRealmReadAsync { realm -> (pending: Int, failed: Int) in
let scope = realm.objects(tableMetadata.self)
.filter("account == %@ AND autoUploadServerUrlBase == %@ AND directory == false AND sessionSelector == %@",
account,
autoUploadServerUrlBase,
global.selectorUploadAutoUpload)

let pendingCount = scope.filter("status IN %@", pendingStatuses).count
let failedCount = scope.filter("status IN %@", failedStatuses).count

return (pending: pendingCount, failed: failedCount)
}

return result ?? (pending: 0, failed: 0)
}

func existsAutoUpload(account: String,
autoUploadServerUrlBase: String) -> Bool {
return core.performRealmRead { realm in
Expand Down
1 change: 1 addition & 0 deletions iOSClient/DeepLink/NCDeepLinkHandler.swift
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ class NCDeepLinkHandler {
navigationController.popToRootViewController(animated: false)

let autoUploadView = NCAutoUploadView(model: NCAutoUploadModel(controller: controller), albumModel: AlbumModel(controller: controller))
.environment(NCAutoUploadCounter())
let autoUploadController = UIHostingController(rootView: autoUploadView)
navigationController.pushViewController(autoUploadController, animated: true)
}
Expand Down
24 changes: 24 additions & 0 deletions iOSClient/More/NCMoreModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,17 @@ final class NCMoreModel: ObservableObject {
@Published var quotaProgress: Double = 0
@Published var quotaExternalSiteTitle: String = ""
@Published var quotaExternalSiteUrl: String?
@Published var autoUploadStart: Bool = false

private weak var controller: NCMainTabBarController?
var account: String {
controller?.account ?? ""
}

var session: NCSession.Session {
NCSession.shared.getSession(controller: controller)
}

private let database = NCManageDatabase.shared
private let utilityFileSystem = NCUtilityFileSystem()

Expand Down Expand Up @@ -166,6 +171,8 @@ final class NCMoreModel: ObservableObject {
return
}

autoUploadStart = tableAccount.autoUploadStart

var functionItems: [Item] = []
var externalSiteItems: [Item] = []
var settingsItems: [Item] = []
Expand Down Expand Up @@ -510,6 +517,23 @@ final class NCMoreModel: ObservableObject {
navigationController.pushViewController(settingsController, animated: true)
}

/// Opens the SwiftUI auto-upload screen, injecting the shared counter so the row and the
/// screen observe the same source.
func openAutoUpload(counter: NCAutoUploadCounter) {
guard let controller,
let navigationController = controller.currentNavigationController() else {
return
}

let autoUploadView = NCAutoUploadView(model: NCAutoUploadModel(controller: controller),
albumModel: AlbumModel(controller: controller))
.environment(counter)

let hostingController = UIHostingController(rootView: autoUploadView)

navigationController.pushViewController(hostingController, animated: true)
}

/// Opens an app using a custom URL scheme.
///
/// If the app is not installed or the scheme cannot be handled, the fallback URL is opened.
Expand Down
Loading
Loading