Skip to content
Closed
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
1 change: 1 addition & 0 deletions iOSClient/Data/NCManageDatabase+Account.swift
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ class tableAccount: Object, NCUserBaseUrl {
@objc dynamic var autoUploadFull: Bool = false
@objc dynamic var autoUploadImage: Bool = false
@objc dynamic var autoUploadVideo: Bool = false
@objc dynamic var autoUploadFavoritesOnly: Bool = false
@objc dynamic var autoUploadWWAnPhoto: Bool = false
@objc dynamic var autoUploadWWAnVideo: Bool = false
@objc dynamic var backend = ""
Expand Down
8 changes: 6 additions & 2 deletions iOSClient/Networking/NCAutoUpload.swift
Original file line number Diff line number Diff line change
Expand Up @@ -227,12 +227,16 @@ class NCAutoUpload: NSObject {
}
let idAsset = account.account + asset.localIdentifier + creationDateString
if !(idAssets?.contains(idAsset) ?? false) {
newAssets.append(asset)
if ((asset.isFavorite && account.autoUploadFavoritesOnly) || !account.autoUploadFavoritesOnly) {
newAssets.append(asset)
}
}
}
} else {
assets.enumerateObjects { asset, _, _ in
newAssets.append(asset)
if ((asset.isFavorite && account.autoUploadFavoritesOnly) || !account.autoUploadFavoritesOnly) {
newAssets.append(asset)
}
}
}
completion(newAssets)
Expand Down
6 changes: 6 additions & 0 deletions iOSClient/Settings/AutoUpload/NCAutoUploadModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ class NCAutoUploadModel: ObservableObject, ViewOnAppearHandling {
@Published var autoUploadVideo: Bool = false
/// A state variable that indicates whether auto upload for videos is enabled or not
@Published var autoUploadWWAnVideo: Bool = false
/// A state variable that indicates whether only assets marked as favorites should be uploaded
@Published var autoUploadFavoritesOnly: Bool = false
/// A state variable that indicates whether auto upload for full resolution photos is enabled or not
@Published var autoUploadFull: Bool = false
/// A state variable that indicates whether auto upload creates subfolders based on date or not
Expand Down Expand Up @@ -149,6 +151,10 @@ class NCAutoUploadModel: ObservableObject, ViewOnAppearHandling {
func handleAutoUploadWWAnVideoChange(newValue: Bool) {
updateAccountProperty(\.autoUploadWWAnVideo, value: newValue)
}

func handleAutoUploadFavoritesOnlyChange(newValue: Bool) {
updateAccountProperty(\.autoUploadFavoritesOnly, value: newValue)
}

/// Updates the auto-upload full content setting.
func handleAutoUploadFullChange(newValue: Bool) {
Expand Down
9 changes: 9 additions & 0 deletions iOSClient/Settings/AutoUpload/NCAutoUploadView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,15 @@ struct NCAutoUploadView: View {
}
.font(.system(size: 16))
})
/// Only upload favorites if desired
Section(content: {
Toggle(NSLocalizedString("_autoupload_favorites_", comment: ""), isOn: $model.autoUploadFavoritesOnly)
.tint(Color(NCBrandColor.shared.brandElement))
.onChange(of: model.autoUploadFavoritesOnly) { newValue in
model.handleAutoUploadFavoritesOnlyChange(newValue: newValue)
}
.font(.system(size: 16))
})
/// Auto Upload create subfolder
Section(content: {
Toggle(NSLocalizedString("_autoupload_create_subfolder_", comment: ""), isOn: $model.autoUploadCreateSubfolder)
Expand Down
Binary file modified iOSClient/Supporting Files/de.lproj/Localizable.strings
Binary file not shown.
1 change: 1 addition & 0 deletions iOSClient/Supporting Files/en.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -390,6 +390,7 @@
"_autoupload_background_" = "Auto upload in the background";
"_autoupload_photos_" = "Auto upload photos";
"_autoupload_videos_" = "Auto upload videos";
"_autoupload_favorites_" = "Upload favorites only";
"_autoupload_description_" = "New photos/videos will be automatically uploaded to your server.";
"_autoupload_description_background_" = "This option requires the use of GPS to trigger the detection of new photos/videos in the camera roll once the location changes significantly";
"_autoupload_background_title_" = "Limitations";
Expand Down