Skip to content

Commit 371d6d1

Browse files
TSI-amrutwaghmareharshada-15-tsys
authored andcommitted
NMC 1997 - Sharing customisation
unused changes
1 parent 74f7cf5 commit 371d6d1

2 files changed

Lines changed: 53 additions & 1 deletion

File tree

iOSClient/Networking/NCService.swift

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,20 @@ class NCService: NSObject {
193193
NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterChangeTheming, userInfo: ["account": account])
194194
}
195195

196+
// File Sharing
197+
if NCGlobal.shared.capabilityFileSharingApiEnabled {
198+
let home = self.utilityFileSystem.getHomeServer(urlBase: self.appDelegate.urlBase, userId: self.appDelegate.userId)
199+
NextcloudKit.shared.readShares(parameters: NKShareParameter()) { account, shares, data, error in
200+
if error == .success {
201+
NCManageDatabase.shared.deleteTableShare(account: account)
202+
if let shares = shares, !shares.isEmpty {
203+
NCManageDatabase.shared.addShare(account: account, home: home, shares: shares)
204+
NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterReloadDataSource)
205+
}
206+
}
207+
}
208+
}
209+
196210
// File Sharing
197211
if NCGlobal.shared.capabilityFileSharingApiEnabled {
198212
let home = self.utilityFileSystem.getHomeServer(urlBase: self.appDelegate.urlBase, userId: self.appDelegate.userId)

iOSClient/Share/NCShare.swift

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,44 @@ class NCShare: UIViewController, NCShareNetworkingDelegate, NCSharePagingContent
151151
textField?.layer.borderColor = NCBrandColor.shared.brand.cgColor
152152
}
153153

154+
@objc func keyboardWillHide(notification: Notification) {
155+
if view.frame.origin.y != 0 {
156+
self.view.frame.origin.y = 0
157+
}
158+
textField?.layer.borderColor = NCBrandColor.shared.label.cgColor
159+
}
160+
161+
@objc func keyboardWillShow(notification: Notification) {
162+
if UIDevice.current.userInterfaceIdiom == .phone {
163+
if (UIScreen.main.bounds.width < 374 || UIDevice.current.orientation.isLandscape) {
164+
if let keyboardSize = (notification.userInfo?[UIResponder.keyboardFrameEndUserInfoKey] as? NSValue)?.cgRectValue {
165+
if view.frame.origin.y == 0 {
166+
self.tableView.scrollToRow(at: IndexPath(row: 0, section: 0), at: .top, animated: false)
167+
self.view.frame.origin.y -= keyboardSize.height
168+
}
169+
}
170+
} else if UIScreen.main.bounds.height < 850 {
171+
if view.frame.origin.y == 0 {
172+
self.tableView.scrollToRow(at: IndexPath(row: 0, section: 0), at: .top, animated: false)
173+
self.view.frame.origin.y -= 70
174+
}
175+
} else {
176+
if view.frame.origin.y == 0 {
177+
self.tableView.scrollToRow(at: IndexPath(row: 0, section: 0), at: .top, animated: false)
178+
self.view.frame.origin.y -= 40
179+
}
180+
}
181+
}
182+
183+
if UIDevice.current.userInterfaceIdiom == .pad, UIDevice.current.orientation.isLandscape {
184+
if view.frame.origin.y == 0 {
185+
self.tableView.scrollToRow(at: IndexPath(row: 0, section: 0), at: .top, animated: false)
186+
self.view.frame.origin.y -= 230
187+
}
188+
}
189+
textField?.layer.borderColor = NCBrandColor.shared.brand.cgColor
190+
}
191+
154192
@objc func keyboardWillHide(notification: Notification) {
155193
if view.frame.origin.y != 0 {
156194
self.view.frame.origin.y = 0
@@ -230,7 +268,7 @@ class NCShare: UIViewController, NCShareNetworkingDelegate, NCSharePagingContent
230268
}
231269

232270
func checkEnforcedPassword(shareType: Int, completion: @escaping (String?) -> Void) {
233-
guard NCCapabilities.shared.getCapabilities(account: session.account).capabilityFileSharingPubPasswdEnforced,
271+
guard NCGlobal.shared.capabilityFileSharingPubPasswdEnforced,
234272
shareType == shareCommon.SHARE_TYPE_LINK || shareType == shareCommon.SHARE_TYPE_EMAIL
235273
else { return completion(nil) }
236274

0 commit comments

Comments
 (0)