|
@@ -44,12 +44,13 @@ class NCService: NSObject, OCNetworkingDelegate {
|
|
self.requestUserProfile()
|
|
self.requestUserProfile()
|
|
self.requestServerCapabilities()
|
|
self.requestServerCapabilities()
|
|
self.requestActivityServer()
|
|
self.requestActivityServer()
|
|
|
|
+ self.requestServerStatus()
|
|
}
|
|
}
|
|
|
|
|
|
//MARK: -
|
|
//MARK: -
|
|
//MARK: Internal request Service API NC
|
|
//MARK: Internal request Service API NC
|
|
|
|
|
|
- @objc private func requestServerCapabilities() {
|
|
|
|
|
|
+ private func requestServerCapabilities() {
|
|
|
|
|
|
if (appDelegate.activeAccount == nil || appDelegate.activeAccount.count == 0 || appDelegate.maintenanceMode == true) {
|
|
if (appDelegate.activeAccount == nil || appDelegate.activeAccount.count == 0 || appDelegate.maintenanceMode == true) {
|
|
return
|
|
return
|
|
@@ -63,7 +64,7 @@ class NCService: NSObject, OCNetworkingDelegate {
|
|
appDelegate.addNetworkingOperationQueue(appDelegate.netQueue, delegate: self, metadataNet: metadataNet)
|
|
appDelegate.addNetworkingOperationQueue(appDelegate.netQueue, delegate: self, metadataNet: metadataNet)
|
|
}
|
|
}
|
|
|
|
|
|
- @objc private func requestUserProfile() {
|
|
|
|
|
|
+ private func requestUserProfile() {
|
|
|
|
|
|
if (appDelegate.activeAccount == nil || appDelegate.activeAccount.count == 0 || appDelegate.maintenanceMode == true) {
|
|
if (appDelegate.activeAccount == nil || appDelegate.activeAccount.count == 0 || appDelegate.maintenanceMode == true) {
|
|
return
|
|
return
|
|
@@ -77,7 +78,7 @@ class NCService: NSObject, OCNetworkingDelegate {
|
|
appDelegate.addNetworkingOperationQueue(appDelegate.netQueue, delegate: self, metadataNet: metadataNet)
|
|
appDelegate.addNetworkingOperationQueue(appDelegate.netQueue, delegate: self, metadataNet: metadataNet)
|
|
}
|
|
}
|
|
|
|
|
|
- @objc private func requestActivityServer() {
|
|
|
|
|
|
+ private func requestActivityServer() {
|
|
|
|
|
|
if (appDelegate.activeAccount == nil || appDelegate.activeAccount.count == 0 || appDelegate.maintenanceMode == true) {
|
|
if (appDelegate.activeAccount == nil || appDelegate.activeAccount.count == 0 || appDelegate.maintenanceMode == true) {
|
|
return
|
|
return
|
|
@@ -107,6 +108,22 @@ class NCService: NSObject, OCNetworkingDelegate {
|
|
//appDelegate.addNetworkingOperationQueue(appDelegate.netQueue, delegate: self, metadataNet: metadataNet)
|
|
//appDelegate.addNetworkingOperationQueue(appDelegate.netQueue, delegate: self, metadataNet: metadataNet)
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ private func requestServerStatus() {
|
|
|
|
+
|
|
|
|
+ let ocNetworking = OCnetworking.init(delegate: nil, metadataNet: nil, withUser: appDelegate.activeUser, withUserID: appDelegate.activeUserID, withPassword: appDelegate.activePassword, withUrl: appDelegate.activeUrl)
|
|
|
|
+ ocNetworking?.serverStatus(appDelegate.activeUrl, success: { (serverProductName, versionMajor, versionMicro, versionMinor) in
|
|
|
|
+
|
|
|
|
+ if serverProductName == "owncloud" {
|
|
|
|
+ self.appDelegate.messageNotification("_warning_", description: "_warning_owncloud_", visible: true, delay: TimeInterval(k_dismissAfterSecond), type: TWMessageBarMessageType.info, errorCode: Int(k_CCErrorInternalError))
|
|
|
|
+ } else if versionMajor <= k_nextcloud_unsupported {
|
|
|
|
+ self.appDelegate.messageNotification("_warning_", description: "_warning_unsupported_", visible: true, delay: TimeInterval(k_dismissAfterSecond), type: TWMessageBarMessageType.info, errorCode: Int(k_CCErrorInternalError))
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }, failure: { (message, errorCode) in
|
|
|
|
+ //
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+
|
|
//MARK: -
|
|
//MARK: -
|
|
//MARK: Delegate Service API NC
|
|
//MARK: Delegate Service API NC
|
|
|
|
|
|
@@ -220,7 +237,7 @@ class NCService: NSObject, OCNetworkingDelegate {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- @objc func getUserProfileSuccessFailure(_ metadataNet: CCMetadataNet!, userProfile: OCUserProfile?, message: String?, errorCode: Int) {
|
|
|
|
|
|
+ func getUserProfileSuccessFailure(_ metadataNet: CCMetadataNet!, userProfile: OCUserProfile?, message: String?, errorCode: Int) {
|
|
|
|
|
|
// Check Active Account
|
|
// Check Active Account
|
|
if (metadataNet.account != appDelegate.activeAccount) {
|
|
if (metadataNet.account != appDelegate.activeAccount) {
|
|
@@ -286,7 +303,7 @@ class NCService: NSObject, OCNetworkingDelegate {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- @objc func getExternalSitesServerSuccessFailure(_ metadataNet: CCMetadataNet!, listOfExternalSites: [Any]?, message: String?, errorCode: Int) {
|
|
|
|
|
|
+ func getExternalSitesServerSuccessFailure(_ metadataNet: CCMetadataNet!, listOfExternalSites: [Any]?, message: String?, errorCode: Int) {
|
|
|
|
|
|
// Check Active Account
|
|
// Check Active Account
|
|
if (metadataNet.account != appDelegate.activeAccount) {
|
|
if (metadataNet.account != appDelegate.activeAccount) {
|
|
@@ -313,7 +330,7 @@ class NCService: NSObject, OCNetworkingDelegate {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- @objc func getActivityServerSuccessFailure(_ metadataNet: CCMetadataNet!, listOfActivity: [Any]?, message: String?, errorCode: Int) {
|
|
|
|
|
|
+ func getActivityServerSuccessFailure(_ metadataNet: CCMetadataNet!, listOfActivity: [Any]?, message: String?, errorCode: Int) {
|
|
|
|
|
|
// Check Active Account
|
|
// Check Active Account
|
|
if (metadataNet.account != appDelegate.activeAccount) {
|
|
if (metadataNet.account != appDelegate.activeAccount) {
|
|
@@ -340,7 +357,7 @@ class NCService: NSObject, OCNetworkingDelegate {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- @objc func getNotificationServerSuccessFailure(_ metadataNet: CCMetadataNet!, listOfNotifications: [Any]?, message: String?, errorCode: Int) {
|
|
|
|
|
|
+ func getNotificationServerSuccessFailure(_ metadataNet: CCMetadataNet!, listOfNotifications: [Any]?, message: String?, errorCode: Int) {
|
|
|
|
|
|
// Check Active Account
|
|
// Check Active Account
|
|
if (metadataNet.account != appDelegate.activeAccount) {
|
|
if (metadataNet.account != appDelegate.activeAccount) {
|