Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/ios.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarino Faggiana <ios@nextcloud.com>2022-08-04 16:17:06 +0300
committerGitHub <noreply@github.com>2022-08-04 16:17:06 +0300
commitf92b3d737a41dc9ca2475c5bec7c685fa71b989b (patch)
treea5cf5fd0516f634df3caf16eae1915bcbcd0de29
parent2ff12a46b91d18ec45d9c8a4c4e4e815a8b89585 (diff)
parent2ff2808cd9b7444449c3208fb4b97eeb2f687ac9 (diff)
Merge pull request #2103 from nextcloud/fix/WrongSharing
Fix/wrong sharing
-rw-r--r--Nextcloud.xcodeproj/project.pbxproj4
-rw-r--r--iOSClient/Data/NCManageDatabase+Metadata.swift2
-rw-r--r--iOSClient/Main/NCFunctionCenter.swift19
-rw-r--r--iOSClient/Menu/NCMedia+Menu.swift4
-rw-r--r--iOSClient/Share/NCShare.swift1
-rw-r--r--iOSClient/Utility/NCUtility.swift8
6 files changed, 27 insertions, 11 deletions
diff --git a/Nextcloud.xcodeproj/project.pbxproj b/Nextcloud.xcodeproj/project.pbxproj
index 168e029a8..009689bc0 100644
--- a/Nextcloud.xcodeproj/project.pbxproj
+++ b/Nextcloud.xcodeproj/project.pbxproj
@@ -2997,7 +2997,7 @@
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
- CURRENT_PROJECT_VERSION = 14;
+ CURRENT_PROJECT_VERSION = 15;
DEVELOPMENT_TEAM = 6JLRKY9ZV7;
ENABLE_BITCODE = YES;
ENABLE_STRICT_OBJC_MSGSEND = YES;
@@ -3060,7 +3060,7 @@
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
- CURRENT_PROJECT_VERSION = 14;
+ CURRENT_PROJECT_VERSION = 15;
DEVELOPMENT_TEAM = 6JLRKY9ZV7;
ENABLE_BITCODE = YES;
ENABLE_STRICT_OBJC_MSGSEND = YES;
diff --git a/iOSClient/Data/NCManageDatabase+Metadata.swift b/iOSClient/Data/NCManageDatabase+Metadata.swift
index 3ec6cad5d..0a818f3f3 100644
--- a/iOSClient/Data/NCManageDatabase+Metadata.swift
+++ b/iOSClient/Data/NCManageDatabase+Metadata.swift
@@ -357,7 +357,7 @@ extension NCManageDatabase {
// update
// Workaround: check lock bc no etag changes if lock runs out in directory
// https://github.com/nextcloud/server/issues/8477
- if result.status == NCGlobal.shared.metadataStatusNormal && (result.etag != metadata.etag || result.fileNameView != metadata.fileNameView || result.date != metadata.date || result.permissions != metadata.permissions || result.hasPreview != metadata.hasPreview || result.note != metadata.note || result.lock != metadata.lock) {
+ if result.status == NCGlobal.shared.metadataStatusNormal && (result.etag != metadata.etag || result.fileNameView != metadata.fileNameView || result.date != metadata.date || result.permissions != metadata.permissions || result.hasPreview != metadata.hasPreview || result.note != metadata.note || result.lock != metadata.lock || result.shareType != metadata.shareType || result.sharePermissionsCloudMesh != metadata.sharePermissionsCloudMesh || result.sharePermissionsCollaborationServices != metadata.sharePermissionsCollaborationServices) {
ocIdsUdate.append(metadata.ocId)
realm.add(tableMetadata.init(value: metadata), update: .all)
} else if result.status == NCGlobal.shared.metadataStatusNormal && addCompareLivePhoto && result.livePhoto != metadata.livePhoto {
diff --git a/iOSClient/Main/NCFunctionCenter.swift b/iOSClient/Main/NCFunctionCenter.swift
index 9c5551305..fcfeb2fbd 100644
--- a/iOSClient/Main/NCFunctionCenter.swift
+++ b/iOSClient/Main/NCFunctionCenter.swift
@@ -178,14 +178,21 @@ import Photos
func openShare(viewController: UIViewController, metadata: tableMetadata, indexPage: NCGlobal.NCSharePagingIndex) {
- let shareNavigationController = UIStoryboard(name: "NCShare", bundle: nil).instantiateInitialViewController() as! UINavigationController
- let shareViewController = shareNavigationController.topViewController as! NCSharePaging
+ let serverUrlFileName = metadata.serverUrl + "/" + metadata.fileName
+ NCUtility.shared.startActivityIndicator(backgroundView: viewController.view, blurEffect: false)
+ NCNetworking.shared.readFile(serverUrlFileName: serverUrlFileName, queue: .main) { account, metadata, errorCode, errorDescription in
+ NCUtility.shared.stopActivityIndicator()
+ if let metadata = metadata, errorCode == 0 {
+ let shareNavigationController = UIStoryboard(name: "NCShare", bundle: nil).instantiateInitialViewController() as! UINavigationController
+ let shareViewController = shareNavigationController.topViewController as! NCSharePaging
- shareViewController.metadata = metadata
- shareViewController.indexPage = indexPage
+ shareViewController.metadata = metadata
+ shareViewController.indexPage = indexPage
- shareNavigationController.modalPresentationStyle = .formSheet
- viewController.present(shareNavigationController, animated: true, completion: nil)
+ shareNavigationController.modalPresentationStyle = .formSheet
+ viewController.present(shareNavigationController, animated: true, completion: nil)
+ }
+ }
}
// MARK: -
diff --git a/iOSClient/Menu/NCMedia+Menu.swift b/iOSClient/Menu/NCMedia+Menu.swift
index 629107aff..a963d3302 100644
--- a/iOSClient/Menu/NCMedia+Menu.swift
+++ b/iOSClient/Menu/NCMedia+Menu.swift
@@ -53,7 +53,7 @@ extension NCMedia {
actions.append(
NCMenuAction(
- title: NSLocalizedString(filterClassTypeImage ? "_media_viewimage_show_" : "_media_viewimage_hide_", comment: ""),
+ title: NSLocalizedString("_media_viewimage_hide_", comment: ""),
icon: NCUtility.shared.loadImage(named: "photo"),
selected: filterClassTypeImage,
on: true,
@@ -67,7 +67,7 @@ extension NCMedia {
actions.append(
NCMenuAction(
- title: NSLocalizedString(filterClassTypeVideo ? "_media_viewvideo_show_" : "_media_viewvideo_hide_", comment: ""),
+ title: NSLocalizedString("_media_viewvideo_hide_", comment: ""),
icon: NCUtility.shared.loadImage(named: "video"),
selected: filterClassTypeVideo,
on: true,
diff --git a/iOSClient/Share/NCShare.swift b/iOSClient/Share/NCShare.swift
index ce6d53a66..e9712cfe9 100644
--- a/iOSClient/Share/NCShare.swift
+++ b/iOSClient/Share/NCShare.swift
@@ -185,6 +185,7 @@ class NCShare: UIViewController, NCShareNetworkingDelegate, NCSharePagingContent
@IBAction func searchFieldDidEndOnExit(textField: UITextField) {
guard let searchString = textField.text, !searchString.isEmpty else { return }
+ if searchString.contains("@"), !NCUtility.shared.isValidEmail(searchString) { return }
networking?.getSharees(searchString: searchString)
}
diff --git a/iOSClient/Utility/NCUtility.swift b/iOSClient/Utility/NCUtility.swift
index edbb2fe13..3c1be5e23 100644
--- a/iOSClient/Utility/NCUtility.swift
+++ b/iOSClient/Utility/NCUtility.swift
@@ -1036,6 +1036,14 @@ class NCUtility: NSObject {
}
return ownerId
}
+
+ // https://stackoverflow.com/questions/25471114/how-to-validate-an-e-mail-address-in-swift
+ func isValidEmail(_ email: String) -> Bool {
+
+ let emailRegEx = "[A-Z0-9a-z._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,64}"
+ let emailPred = NSPredicate(format:"SELF MATCHES %@", emailRegEx)
+ return emailPred.evaluate(with: email)
+ }
}
// MARK: -