Skip to content

Commit

Permalink
[fix/sdkupdates] SDK updates, improved maintenance mode support and b…
Browse files Browse the repository at this point in the history
…ugfixes (#200)

* - Minor memory optimizations - Updated to latest SDK

* - Save changes prior to merge with master

* - Convert to Swift 4.2

* - Further Swift 4.2 changes

* - Update to latest SDK develop commit

* - Adapting APP to latest SDK changes
	- maintenance mode support
	- replacing uses of reachability monitor with OCCore.connectionStatus

* - Added back ownCloudUI.framework to copy phase of ownCloud target
- Updated to latest SDK

* - Add support for OCLogToggle in Settings
- App now logs current log settings at launch

* - Fix issues in ClientQueryViewController related to UITableView not reloading when its view controller is not "visible":
	- no longer uses items from table view cells to initiate actions
	- detects if UITableView.reloadData is set to do nothing and repeats the call in viewWillAppear
- The fixed issue was causing #178 and possibly others

* - Remove last traces of OCMocking.framework from ownCloud app target, make sure it's only built, linked to and copied in the ownCloudTests target

* - Fix EarlGrey/CocoaPods workspace / build errors

* - Adopt new OCLogger tags APIs in Log.swift and FileProviderExtension

* - Update SDK

* - Remove superfluous [FP] from log message

* - Make sure DisplayViewController uses the updated version of an item after downloading it instead of the (now) outdated original version

* - Update to latest SDK

* - Fixing thumbnail aspect ratio and removing duplicate code in NamingViewController (#141)

* - Update SDK

* - Exit editing mode in the server list when the user selects an existing or adds a new bookmark (as reported by @mneuwert)

* - Adapt app code base to change in OCError Swift conversion (following OCErrorAuthorizationCancelled typo correction)

* - Fix #152: if the user cancels OAuth2, an error is no longer shown (and errors are better to read with recent SDK updates)

* - Update to latest SDK

* - Make ProgressSummarizer only consider Progress objects with descriptions, resolving "ghost" progress bars without any information in them

* - Adapt to change of name of OCConnectionIssue to OCIssue

* - Update to latest SDK
- ConnectionIssueViewController
        - added option to provide a block to be called when dismissal has finished
        - normalize code formatting
- UIAlertController+OCIssue
        - added option to provide a completionHandler that's called when the user made a choice
- ClientRootViewController
        - switched issue and alert presentation to use a AsyncSequentialQueue to present them in order and not on top of each other
        - fixed a bug where a UIViewController that's in the process of being dismissed led to a failure to present alerts and issues

* - Make DisplayViewController use OCCoreOptionReturnImmediatelyIfOfflineOrUnavailable and fix a typo (#179)

* - Added priority summaries to ProgressSummarizer
- Fixed a crash bug in ImageDisplayViewController
- Removed core connection status interpretation from ClientQueryViewController
- Added core connection status tracking to ClientRootViewController and utilize priority summaries to display offline or server in maintenance mode status messages

* - Switching to fix/sdkUpdates branch

* Version Bump to 91

* Delete unneeded workspace file ownCloud.xcworkspace/xcshareddata/

* Version Bump to 92

* Version Bump to 93

* - Update ios-sdk to latest ios-sdk master
  • Loading branch information
felix-schwarz authored and jesmrec committed Jan 15, 2019
1 parent d5c171c commit 6f7c4dd
Show file tree
Hide file tree
Showing 18 changed files with 334 additions and 227 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,4 @@ Easy starting points are also reviewing [pull requests](https://github.com/owncl
* Also you can check other [channels](https://talk.owncloud.com/directory) for support.

**License:** [GPLv3](https://github.com/owncloud/ios-app/LICENSE)

2 changes: 1 addition & 1 deletion ios-sdk
Submodule ios-sdk updated 109 files
4 changes: 2 additions & 2 deletions ownCloud File Provider/FileProviderExtension.m
Original file line number Diff line number Diff line change
Expand Up @@ -701,11 +701,11 @@ - (OCCore *)core
return (_core);
}

- (void)core:(OCCore *)core handleError:(NSError *)error issue:(OCConnectionIssue *)issue
- (void)core:(OCCore *)core handleError:(NSError *)error issue:(OCIssue *)issue
{
OCLogDebug(@"CORE ERROR: error=%@, issue=%@", error, issue);

if (issue.type == OCConnectionIssueTypeMultipleChoice)
if (issue.type == OCIssueTypeMultipleChoice)
{
[issue cancel];
}
Expand Down
16 changes: 8 additions & 8 deletions ownCloud.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,8 @@
DC42244A207CAFAA0006A2A6 /* Theme.swift in Sources */ = {isa = PBXBuildFile; fileRef = DC422449207CAFAA0006A2A6 /* Theme.swift */; };
DC42244C207CAFBB0006A2A6 /* ThemeCollection.swift in Sources */ = {isa = PBXBuildFile; fileRef = DC42244B207CAFBB0006A2A6 /* ThemeCollection.swift */; };
DC422450207CB2500006A2A6 /* NSObject+ThemeApplication.swift in Sources */ = {isa = PBXBuildFile; fileRef = DC42244F207CB2500006A2A6 /* NSObject+ThemeApplication.swift */; };
DC434D1320D7A8F100740056 /* UIAlertController+OCConnectionIssue.swift in Sources */ = {isa = PBXBuildFile; fileRef = DC434D1220D7A8F100740056 /* UIAlertController+OCConnectionIssue.swift */; };
DC4FEAE7209E3A7700D4476B /* OCConnectionIssue+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = DC4FEAE6209E3A7700D4476B /* OCConnectionIssue+Extension.swift */; };
DC434D1320D7A8F100740056 /* UIAlertController+OCIssue.swift in Sources */ = {isa = PBXBuildFile; fileRef = DC434D1220D7A8F100740056 /* UIAlertController+OCIssue.swift */; };
DC4FEAE7209E3A7700D4476B /* OCIssue+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = DC4FEAE6209E3A7700D4476B /* OCIssue+Extension.swift */; };
DC4FEAEA209E48E800D4476B /* DispatchQueueTools.swift in Sources */ = {isa = PBXBuildFile; fileRef = DC4FEAE9209E48E800D4476B /* DispatchQueueTools.swift */; };
DC6428D02081406800493A01 /* CollapsibleProgressBar.swift in Sources */ = {isa = PBXBuildFile; fileRef = DC6428CF2081406800493A01 /* CollapsibleProgressBar.swift */; };
DC680576212DF548006C3B1F /* CertificateManagementViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = DC680575212DF548006C3B1F /* CertificateManagementViewController.swift */; };
Expand Down Expand Up @@ -489,8 +489,8 @@
DC422449207CAFAA0006A2A6 /* Theme.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Theme.swift; sourceTree = "<group>"; };
DC42244B207CAFBB0006A2A6 /* ThemeCollection.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ThemeCollection.swift; sourceTree = "<group>"; };
DC42244F207CB2500006A2A6 /* NSObject+ThemeApplication.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "NSObject+ThemeApplication.swift"; sourceTree = "<group>"; };
DC434D1220D7A8F100740056 /* UIAlertController+OCConnectionIssue.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIAlertController+OCConnectionIssue.swift"; sourceTree = "<group>"; };
DC4FEAE6209E3A7700D4476B /* OCConnectionIssue+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "OCConnectionIssue+Extension.swift"; sourceTree = "<group>"; };
DC434D1220D7A8F100740056 /* UIAlertController+OCIssue.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIAlertController+OCIssue.swift"; sourceTree = "<group>"; };
DC4FEAE6209E3A7700D4476B /* OCIssue+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "OCIssue+Extension.swift"; sourceTree = "<group>"; };
DC4FEAE9209E48E800D4476B /* DispatchQueueTools.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DispatchQueueTools.swift; sourceTree = "<group>"; };
DC6428CF2081406800493A01 /* CollapsibleProgressBar.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CollapsibleProgressBar.swift; sourceTree = "<group>"; };
DC680575212DF548006C3B1F /* CertificateManagementViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CertificateManagementViewController.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -749,7 +749,7 @@
DCE974BB207EACA60069FC2B /* UIImage+Extension.swift */,
DC018F8220A0F56300135198 /* UIView+Animation.swift */,
6E83C78320A33C180066EC23 /* LAContext+Extension.swift */,
DC434D1220D7A8F100740056 /* UIAlertController+OCConnectionIssue.swift */,
DC434D1220D7A8F100740056 /* UIAlertController+OCIssue.swift */,
DC248C66213E7DB00067FE94 /* NSLayoutConstraint+Extension.swift */,
6EADE9362192E235006821B3 /* UIImagePickerController+Extension.swift */,
);
Expand Down Expand Up @@ -1094,7 +1094,7 @@
23EC77572137F3DD0032D4E6 /* OCExtensionType+Extension.swift */,
DCE5E8B72080D8D9005F60CE /* OCItem+Extension.swift */,
DC136581208223F000FC0F60 /* OCBookmark+Extension.swift */,
DC4FEAE6209E3A7700D4476B /* OCConnectionIssue+Extension.swift */,
DC4FEAE6209E3A7700D4476B /* OCIssue+Extension.swift */,
);
path = "SDK Extensions";
sourceTree = "<group>";
Expand Down Expand Up @@ -1675,8 +1675,8 @@
DC321261207EB01B00DB171D /* ThemeImage.swift in Sources */,
DC7DBA54207FA80C00E7337D /* TVGImage.swift in Sources */,
6E586CFE2199A75900F680C4 /* MoveAction.swift in Sources */,
DC4FEAE7209E3A7700D4476B /* OCConnectionIssue+Extension.swift in Sources */,
DC434D1320D7A8F100740056 /* UIAlertController+OCConnectionIssue.swift in Sources */,
DC4FEAE7209E3A7700D4476B /* OCIssue+Extension.swift in Sources */,
DC434D1320D7A8F100740056 /* UIAlertController+OCIssue.swift in Sources */,
6E586D002199A78E00F680C4 /* DeleteAction.swift in Sources */,
DC3317CE2084966700E36C8F /* ThemeTableViewCell.swift in Sources */,
6E83C77E20A32C1B0066EC23 /* SettingsSection.swift in Sources */,
Expand Down
8 changes: 5 additions & 3 deletions ownCloud/Bookmarks/BookmarkViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ class BookmarkViewController: StaticTableViewController {
if issue != nil {
// Parse issue for display
if let displayIssues = issue?.prepareForDisplay() {
if displayIssues.displayLevel.rawValue >= OCConnectionIssueLevel.warning.rawValue {
if displayIssues.displayLevel.rawValue >= OCIssueLevel.warning.rawValue {
// Present issues if the level is >= warning
let issuesViewController = ConnectionIssueViewController(displayIssues: displayIssues, completion: { [weak self] (response) in
switch response {
Expand Down Expand Up @@ -374,19 +374,21 @@ class BookmarkViewController: StaticTableViewController {
self.bookmark?.authenticationData = authMethodData
self.userActionSave()
} else {
var issue : OCConnectionIssue?
var issue : OCIssue?
let nsError = error as NSError?

if let embeddedIssue = nsError?.embeddedIssue() {
issue = embeddedIssue
} else {
issue = OCConnectionIssue(forError: error, level: .error, issueHandler: nil)
issue = OCIssue(forError: error, level: .error, issueHandler: nil)
}

if nsError?.isOCError(withCode: .authorizationFailed) == true {
// Shake
self.navigationController?.view.shakeHorizontally()
self.updateInputFocus(fallbackRow: self.passwordRow)
} else if nsError?.isOCError(withCode: .authorizationCancelled) == true {
// User cancelled authorization, no reaction needed
} else {
let issuesViewController = ConnectionIssueViewController(displayIssues: issue?.prepareForDisplay(), completion: { [weak self] (response) in
switch response {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,50 +7,53 @@
//

/*
* Copyright (C) 2018, ownCloud GmbH.
*
* This code is covered by the GNU Public License Version 3.
*
* For distribution utilizing Apple mechanisms please see https://owncloud.org/contribute/iOS-license-exception/
* You should have received a copy of this license along with this program. If not, see <http://www.gnu.org/licenses/gpl-3.0.en.html>.
*
*/
* Copyright (C) 2018, ownCloud GmbH.
*
* This code is covered by the GNU Public License Version 3.
*
* For distribution utilizing Apple mechanisms please see https://owncloud.org/contribute/iOS-license-exception/
* You should have received a copy of this license along with this program. If not, see <http://www.gnu.org/licenses/gpl-3.0.en.html>.
*
*/

import UIKit
import ownCloudSDK
import ownCloudUI

enum ConnectionResponse {
case cancel
case approve
case dismiss
case cancel
case approve
case dismiss
}

class ConnectionIssueViewController: IssuesViewController {

private var displayIssues : DisplayIssues?
private var displayIssues : DisplayIssues?
private var dismissedHandler : (() -> Void)?

required init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
}
required init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
}

init(displayIssues issues: DisplayIssues?, buttons: [IssueButton]? = nil, title: String? = nil) {
super.init(buttons: buttons, title: title)

init(displayIssues issues: DisplayIssues?, buttons: [IssueButton]? = nil, title: String? = nil) {
super.init(buttons: buttons, title: title)
displayIssues = issues
}

displayIssues = issues
}
convenience init(displayIssues issues: DisplayIssues?, title: String? = nil, completion:@escaping (ConnectionResponse) -> Void, dismissedHandler dismissedHandlerBlock: (() -> Void)? = nil) {
var useButtons : [IssueButton]?
var useTitle = title

convenience init(displayIssues issues: DisplayIssues?, title: String? = nil, completion:@escaping (ConnectionResponse) -> Void) {
var useButtons : [IssueButton]?
var useTitle = title
self.init(displayIssues: issues, buttons: nil, title: useTitle)

self.init(displayIssues: issues, buttons: nil, title: useTitle)
self.dismissedHandler = dismissedHandlerBlock

if let displayLevel = issues?.displayLevel {
switch displayLevel {
if let displayLevel = issues?.displayLevel {
switch displayLevel {
case .informal:
if title == nil {
useTitle = "Review Connection".localized
useTitle = "Review Connection".localized
}

useButtons = [
Expand All @@ -61,7 +64,7 @@ class ConnectionIssueViewController: IssuesViewController {

case .warning:
if title == nil {
useTitle = "Review Connection".localized
useTitle = "Review Connection".localized
}

useButtons = [
Expand All @@ -76,88 +79,95 @@ class ConnectionIssueViewController: IssuesViewController {

case .error:
if title == nil {
useTitle = "Error".localized
useTitle = "Error".localized
}

useButtons = [
IssueButton(title: "OK".localized, type: .approve, action: { [weak self] in
completion(.dismiss)
self?.dismiss(animated: true)}, accessibilityIdentifier: "ok-button")
]
}

self.headerTitle = useTitle
self.buttons = useButtons
}
}

self.headerTitle = useTitle
self.buttons = useButtons
override func viewDidLoad() {
super.viewDidLoad()
self.tableView?.dataSource = self
}
}

override func viewDidLoad() {
super.viewDidLoad()
self.tableView?.dataSource = self
}
override func dismiss(animated flag: Bool, completion: (() -> Void)? = nil) {
super.dismiss(animated: flag) {
completion?()
self.dismissedHandler?()
}
}
}

extension ConnectionIssueViewController {
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
if let issue = displayIssues?.displayIssues[indexPath.row], issue.type == OCConnectionIssueType.certificate {
OCCertificateDetailsViewNode.certificateDetailsViewNodes(for: issue.certificate, withValidationCompletionHandler: { (certificateNodes) in
let certDetails: NSAttributedString = OCCertificateDetailsViewNode .attributedString(withCertificateDetails: certificateNodes)
DispatchQueue.main.async {
let issuesVC = CertificateViewController(localizedDescription: certDetails)
issuesVC.modalPresentationStyle = .overCurrentContext
self.present(issuesVC, animated: true, completion: nil)
}
})
}
}
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
if let issue = displayIssues?.displayIssues[indexPath.row], issue.type == OCIssueType.certificate {
OCCertificateDetailsViewNode.certificateDetailsViewNodes(for: issue.certificate, withValidationCompletionHandler: { (certificateNodes) in
let certDetails: NSAttributedString = OCCertificateDetailsViewNode .attributedString(withCertificateDetails: certificateNodes)
DispatchQueue.main.async {
let issuesVC = CertificateViewController(localizedDescription: certDetails)
issuesVC.modalPresentationStyle = .overCurrentContext
self.present(issuesVC, animated: true, completion: nil)
}
})
}
}
}

extension ConnectionIssueViewController: UITableViewDataSource {

func numberOfSections(in tableView: UITableView) -> Int {
return 1
}

func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return displayIssues?.displayIssues.count ?? 0
}

func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: IssuesViewControllerCellIdentifier, for: indexPath)
let issue = (displayIssues?.displayIssues[indexPath.row])!
cell.detailTextLabel?.text = issue.localizedDescription
cell.textLabel?.text = issue.localizedTitle
cell.textLabel?.numberOfLines = 0

var color: UIColor = .black
cell.selectionStyle = .none

if issue.type == OCConnectionIssueType.certificate {
cell.accessoryType = .disclosureIndicator
cell.accessoryView?.backgroundColor = .blue
} else {
cell.accessoryType = .none
func numberOfSections(in tableView: UITableView) -> Int {
return 1
}

func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return displayIssues?.displayIssues.count ?? 0
}

switch issue.level {
case .warning:
color = Theme.shared.activeCollection.warningColor
case .informal:
color = Theme.shared.activeCollection.informativeColor
case .error:
color = Theme.shared.activeCollection.errorColor
}

cell.textLabel?.attributedText = NSAttributedString(string: issue.localizedTitle, attributes: [
.foregroundColor : color,
.font : UIFont.systemFont(ofSize: 18, weight: .semibold)
])

cell.detailTextLabel?.attributedText = NSAttributedString(string: issue.localizedDescription, attributes: [
.foregroundColor : UIColor(hex: 0x4F4F4F),
.font : UIFont.systemFont(ofSize: 15, weight: .regular)
])
cell.detailTextLabel?.numberOfLines = 0
return cell
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: IssuesViewControllerCellIdentifier, for: indexPath)
let issue = (displayIssues?.displayIssues[indexPath.row])!
cell.detailTextLabel?.text = issue.localizedDescription
cell.textLabel?.text = issue.localizedTitle
cell.textLabel?.numberOfLines = 0

var color: UIColor = .black
cell.selectionStyle = .none

if issue.type == OCIssueType.certificate {
cell.accessoryType = .disclosureIndicator
cell.accessoryView?.backgroundColor = .blue
} else {
cell.accessoryType = .none
}

switch issue.level {
case .warning:
color = Theme.shared.activeCollection.warningColor
case .informal:
color = Theme.shared.activeCollection.informativeColor
case .error:
color = Theme.shared.activeCollection.errorColor
}

cell.textLabel?.attributedText = NSAttributedString(string: issue.localizedTitle, attributes: [
.foregroundColor : color,
.font : UIFont.systemFont(ofSize: 18, weight: .semibold)
])

cell.detailTextLabel?.attributedText = NSAttributedString(string: issue.localizedDescription, attributes: [
.foregroundColor : UIColor(hex: 0x4F4F4F),
.font : UIFont.systemFont(ofSize: 15, weight: .regular)
])
cell.detailTextLabel?.numberOfLines = 0
return cell
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,14 @@ class CreateFolderAction : Action {
// MARK: - Action implementation
override func run() {
guard context.items.count > 0 else {
completed(with: NSError(ocError: OCError.itemNotFound))
completed(with: NSError(ocError: .itemNotFound))
return
}

let item = context.items.first

guard item != nil else {
completed(with: NSError(ocError: OCError.itemNotFound))
completed(with: NSError(ocError: .itemNotFound))
return
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,15 @@ class DuplicateAction : Action {
// MARK: - Action implementation
override func run() {
guard context.items.count > 0, let core = self.core else {
completed(with: NSError(ocError: OCError.itemNotFound))
completed(with: NSError(ocError: .itemNotFound))
return
}

let item = context.items[0]
let rootItem = item.parentItem(from: core)

guard rootItem != nil else {
completed(with: NSError(ocError: OCError.itemNotFound))
completed(with: NSError(ocError: .itemNotFound))
return
}

Expand Down
Loading

0 comments on commit 6f7c4dd

Please sign in to comment.