Skip to content

Commit 9219b19

Browse files
TSI-amrutwaghmareharshada-15-tsys
authored andcommitted
NMC 1997 - Sharing customisation
unused changes
1 parent 1eee6f8 commit 9219b19

File tree

2 files changed

+53
-1
lines changed

2 files changed

+53
-1
lines changed

iOSClient/Networking/NCService.swift

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

169+
// File Sharing
170+
if NCGlobal.shared.capabilityFileSharingApiEnabled {
171+
let home = self.utilityFileSystem.getHomeServer(urlBase: self.appDelegate.urlBase, userId: self.appDelegate.userId)
172+
NextcloudKit.shared.readShares(parameters: NKShareParameter()) { account, shares, data, error in
173+
if error == .success {
174+
NCManageDatabase.shared.deleteTableShare(account: account)
175+
if let shares = shares, !shares.isEmpty {
176+
NCManageDatabase.shared.addShare(account: account, home: home, shares: shares)
177+
NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterReloadDataSource)
178+
}
179+
}
180+
}
181+
}
182+
169183
// File Sharing
170184
if NCGlobal.shared.capabilityFileSharingApiEnabled {
171185
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
@@ -205,6 +205,44 @@ class NCShare: UIViewController, NCShareNetworkingDelegate, NCSharePagingContent
205205
textField?.layer.borderColor = NCBrandColor.shared.brand.cgColor
206206
}
207207

208+
@objc func keyboardWillHide(notification: Notification) {
209+
if view.frame.origin.y != 0 {
210+
self.view.frame.origin.y = 0
211+
}
212+
textField?.layer.borderColor = NCBrandColor.shared.label.cgColor
213+
}
214+
215+
@objc func keyboardWillShow(notification: Notification) {
216+
if UIDevice.current.userInterfaceIdiom == .phone {
217+
if (UIScreen.main.bounds.width < 374 || UIDevice.current.orientation.isLandscape) {
218+
if let keyboardSize = (notification.userInfo?[UIResponder.keyboardFrameEndUserInfoKey] as? NSValue)?.cgRectValue {
219+
if view.frame.origin.y == 0 {
220+
self.tableView.scrollToRow(at: IndexPath(row: 0, section: 0), at: .top, animated: false)
221+
self.view.frame.origin.y -= keyboardSize.height
222+
}
223+
}
224+
} else if UIScreen.main.bounds.height < 850 {
225+
if view.frame.origin.y == 0 {
226+
self.tableView.scrollToRow(at: IndexPath(row: 0, section: 0), at: .top, animated: false)
227+
self.view.frame.origin.y -= 70
228+
}
229+
} else {
230+
if view.frame.origin.y == 0 {
231+
self.tableView.scrollToRow(at: IndexPath(row: 0, section: 0), at: .top, animated: false)
232+
self.view.frame.origin.y -= 40
233+
}
234+
}
235+
}
236+
237+
if UIDevice.current.userInterfaceIdiom == .pad, UIDevice.current.orientation.isLandscape {
238+
if view.frame.origin.y == 0 {
239+
self.tableView.scrollToRow(at: IndexPath(row: 0, section: 0), at: .top, animated: false)
240+
self.view.frame.origin.y -= 230
241+
}
242+
}
243+
textField?.layer.borderColor = NCBrandColor.shared.brand.cgColor
244+
}
245+
208246
@objc func keyboardWillHide(notification: Notification) {
209247
if view.frame.origin.y != 0 {
210248
self.view.frame.origin.y = 0
@@ -285,7 +323,7 @@ class NCShare: UIViewController, NCShareNetworkingDelegate, NCSharePagingContent
285323
}
286324

287325
func checkEnforcedPassword(shareType: Int, completion: @escaping (String?) -> Void) {
288-
guard NCCapabilities.shared.getCapabilities(account: session.account).capabilityFileSharingPubPasswdEnforced,
326+
guard NCGlobal.shared.capabilityFileSharingPubPasswdEnforced,
289327
shareType == shareCommon.SHARE_TYPE_LINK || shareType == shareCommon.SHARE_TYPE_EMAIL
290328
else { return completion(nil) }
291329

0 commit comments

Comments
 (0)