Skip to content

Commit

Permalink
[feature/darkmode] iOS 13 dark mode support (#489)
Browse files Browse the repository at this point in the history
* Naming improvements based on latest SDK:
- uploads use new OCCoreOptionAutomaticConflictResolutionNameStyle option to automatically resolve naming conflicts during upload
- Duplicate action uses the new OCCore name suggestion API to
	- determine naming conflicts and resolve them automatically
	- match the name style of the file to duplicate, f.ex.
		- duplicating "File copy.jpg" will create "File copy 2.jpg"
		- duplicating "File (1).jpg" will create "File (2).jpg"
		- duplicating "File Kopie 2.jpg" will create "File Kopie 3.jpg"
- folder creation uses the new OCCore name suggestion API to
	- detect naming conflicts beforehand
	- pre-fill the new folder name name with an unused name directly

* #393 added an activity indicator which will be shown, if offline copies will be deleted to give the user a UI feedback

* - Change SDK branch to master

* #76 user can import files using the iOS share sheet. all file types are accepted.

* - using new SDK with fixes for requesting core
- minor code fixes

* - Log device, version and locale information at the beginning of every log file using new SDK protocol
- Show SDK commit hash in Settings

* fixed crash, changed bookmark name to shortname

* changed UIAlertViewController for account selection to CardViewController style for testing

* fixed icon badge creation for fastlane lane In-House Enterprise IPA generation

* install librsvg for fastlane via sh

* moved import file code to own class

* added option to automatically resolve name conflicts, if file name already exists

* Changed app version to 1.1.0

* enabled beta build and warning

*  Keep the gallery alive after doing some action over an item (#447)

* Rename updates the currently visible file in the gallery

* Keeping gallery alive fix

- Don’t pop to the root view controller on destructive action by default
- Only pop to the root if all items have been deleted
- Select next item upon deletion of the current ones
- Update UIPageViewController data source if number of items changes due e.g. to duplication or deletion

* Small fixes

* Fixed review findings

* Media player implemented using AVKit (#429)

* Media player implemented using AVKit

* Added possibility to stream audio / video

* Improved error handling

* Fixed review finding

* Added background audio, airplay and PiP mode

* Propagating safe area to the main view of AVPlayerViewController

* Another fix for safe area considering layout of AVPlayerViewController

* Updated to latest develop version of SDK

* Display error message in case file couldn’t be preview e.g. due to file corruption (#427)

* Fixed UI test for creating folder, need to return a fixed name, because suggestion is not working in tests

* added a description header and changed typo

* - fixed showing the directory picker controller, after the card view was dismissed
- use the current development SDK

* Version Bump to 126

* - create local copy of import file, if needed
- fixed create folder action
- delete local copy, if needed
- code review changes

* - improved duplicate item deletion behaviour
	- add additional safeguard so duplicate files are only deleted if they were actually duplicated (previously non-duplicate files could be removed if duplication or folder creation failed)
	- remove temporary container folder, too
- add 2 second delay before returning the core to give the core an opportunity to schedule the upload on a NSURLSession

* Version Bump to 127

* changed back signing identity

* Version Bump to 128

* added required CFBundleTypeName key

* Version Bump to 129

* updated changelog

* use formSheet presentation style for the iPad when showing the document picker

* Fix for images not being displayed in the gallery

* Version Bump to 130

* Version Bump to 131

* [fix/sharing-search] Fixed min length for searching sharing users (#455)

* #454 used correct comparator for sharingSearchMinLength and set a new default value, if capability does not exists

* added a constant for defaultSharingSearchMinLength value

* - Update ios-sdk to address finding (1) in ios-app #446

* Preventing updating UI in DisplayViewController while item is being changed

- Not calling present(item:) while meta data of OCItem is being updated
- Elliminated an assumption in MediaDisplayViewController that render renderSpecificView() can be called only once.
- Making sure that AVPlayer is not re-created upon changes in OCItem but that rather AVPlayerItem is replaced.

* Fixed a small warning

* Tried to improve gallery logic concerning items modification

- Watch out if the modification does still includes the item with local ID of the currently visible item.
- Take care of failed move but watching out for reappearing items

* Added a setting allowing to decide user if media files shall be streamed

* - Add debug output to Display*ViewController
- Fix SwiftLint warnings

* Fixed handling of deleted / moved item in the gallery

* Another small fix for handling of failed item move

* Version Bump to 132

* Added LSSupportsOpeningDocumentsInPlace key to Info.plist

* Fixed Info.plist and added LSHandlerRank property

* Fix for #455 issue: no search request triggered

* show always the account selection sheet and added a note, that only one file can be imported at once

* use securtiy scoped file operation for importing a file

* Fix for the PR #447 (keep gallery alive) (#465)

* Keeping track of individual OCItems in DisplayViewController instances

But loading the list of items in the gallery only once and not reacting to any changes (moving, deleting)

* Removed query stop call in DisplayHostViewController

Since this query is not created there but just passed from the parent view.

* Removing more button if the currently viewed file got moved or deleted

* Fixed updating UI after renaming current item

* Fixed a warning

* Fixed issues in the gallery

* - Minor fixes

* [feature/bundle-import] Add support for certain bundle formats to the share sheet (#471)

* - Add support for import of bundle-based document formats through transparent zipping
	- moved previous FileProvider functionality into ownCloudApp.framework
	- new method OCCore.importItemNamed() ensures correct handling of bundle-based document formats
	- fixes finding (4) in #445
- Changed LSSupportsOpeningDocumentsInPlace to NO address two issues:
	- the app is now listed as "Copy to ownCloud" (previously "Open in ownCloud", which was technically not correct)
	- previously, documents using "Open to ownCloud" would no longer open in f.ex. Pages, but in the ownCloud app when selected in the Files app

* - Refactored ImportFilesController around using NSFileCoordinator, fixing finding (1) in #471

* changed path for moved Info.plist for target ownCloudAppFramework

* Version Bump to 133

* [feature/sort direction] Allow sorting asc/desc for all sort methods (#474)

* #470 added change sort direction asc/desc for all sort methods

* - removed comments
- changed translation keys

* fixes sort comparator for sort method "shared"

* use correct images for sort direction asc and desc

* updated choosing sort method from a tableView/Popover instead of a UIAlertViewController

* set maximum width for popover and set arrow direction

* Added show sort direction in UISegmentControl

* - make sure arrows of popovers appear in same color as the popover contents
- fix issue where direction was toggled during setup of SortBar (setting of initial value from user defaults), so logging in, logging out and logging in would change the sort direction
- reset sort direction to ascendant when switching sort methods
- SortMethodTableViewController
	- remove extraneous instance lets
	- enforce row height used for table view height calculation
	- change table view height calculation to account for the last divider (which could look a bit off if present)

* tap on segment control was fired twice, because there was a missing check, if selected segment changed

* fixed changing width on selecting an other segment

* fixed jumping width of sortSegmentControl items by setting the same width for all items by calculating the longest width before

* [fix/index-bar] Make Index Bar available in general file list (#469)

* #413 show index bar in general file list
- Index bar is only visible, if sorting is "Sort by name"
- Index bar is only visible, if more than one different letters are available
- Index bar is only visible, if more items are available as visible

* - adopt to new sort methods
- reverse index list, if sort direction is descendant

* Version Bump to 134

* Version Bump to 135

* Version Bump to 136

*  Change behaviour of default expiration date (#476)

* Enabling expiration date switch if default expiration date is configured

Checking files_sharing.public.expire_date.expire_date.days server capability. If it is set then it is used as default date and the switch is enabled even if the expiration date is not enforced.

* Fixed QA issue (1)

* Fixed QA finding (2): limiting the date range if expiration date is enforced

* Permission increasing UX in reshares (#467)

* Not showing permissions which can’t be elevated

Affecting items shared with the current users which are being reshared

* Fixed an issue with wrong permissions displayed when creating public link

- Checking if permissions can be elevated for the public link
- Only viable options are displayed

* Fixed a trailing whitespace warning

* Fixed another compiler warning

* Inhereting permissions from the share when creating public link

* Fixed QA finding (4)

* Fixed QA finding (1)

* Fixed QA finding (2)

* Version Bump to 137

* [feature/itempolicy] Item Policy / Available Offline support (#456)

* Available Offline Support
- new MakeAvailableOfflineAction and MakeUnavailableOfflineAction actions
- new Available Offline Library section
	- easy access to all files available offline via Available Offline
	- new ItemPolicyTableViewController and ItemPolicyCell prepared for reuse for presenting other item policies
- Design: added SVG/TVG/PNG icons and cloud symbols for make available offline / make unavailable offline

ClientItemCell changes
- new ClientItemResolvingCell can resolve item from LocalID or path, new superclass of ShareClientItemCell and ItemPolicyCell
- string to use as content for title and detail are now provided via titleLabelString(for:) and detailLabelString(for:), updated via updateLabels(with:), making customization easier
- support for new available offline badge

ProgressSummarizer changes
- changed ProgressSummary from a struct to a class, addressing issue #451 ("Waiting for server response..." message sometimes not disappearing)

* - Adopt OCClaim to ensure files aren't deleted while they are being used in
	- DisplayViewController
	- DownloadItemsHUDViewController
	- FileListTableViewController
	- File Provider
- Add new Storage Settings to allow control over how long unused local copies are kept around
- DisplayViewController now uses OCClaims to ensure files aren't deleted while they are being viewed
- ClientItemCell uses new SDK APIs to
	- show "available offline" badges for folders
	- to indicate if an item has been made available offline directly (solid icon) or indirectly (dimmed icon)
	- keep the cloud status icon updated following changes
- Change "+" icon to "•••" icon in file list, rename plusButton to folderAction everywhere
- Action.provideAlertAction() now applies padding to images if necessary so their text aligns at the same horizontal offset
- Fix typo in BookmarkInfoViewController and change wording from "Delete Offline Copies" to "Delete Local Copies" for consistency
- Update swiftlint.yml to silence ownCloudScreenshotsTests warnings

* - Update ios-sdk

* - Make changes requested in code review, adding missing localizable strings and removing extraneous code

* - Update SDK

* - Add downloadTriggerIdentifier and availableOfflinePolicyCoverage as properties that trigger the update of an item's visual representation (addressing finding 6 in #456)
- Update make available offline action to use new convertExistingLocalDownloads option (addressing finding 2 in #456)
- Update SDK (addressing finding 5 in #456)

* Items in moved Available Offline folders should no longer be cleared locally and re-downloaded, following under the hood improvements in the ios-sdk

* - Add initial support for cookies via SDK update

* - Temporarily disable some UI tests broken due to lack of database running

* - Fix issue (11) in #456 by updating the lastUsed date of already downloaded items when they are viewed

* - Added slider type to StaticTableViewRow
- changed storage settings to allow picking a timeframe via slider rather than a list of time frames

* - Change text from "Remove" to "Make unavailable offline" in Quick Access > Available Offline list (addressing issue (9))

* - Update BookmarkInfoViewController to provide users with the choice to also remove local copies of items marked as Available Offline, issuing a warning and giving the users a way to cancel, addressing issue (12) in #456.

* - Update ios-sdk
- Take advantage of the new key-value store and OCCoreSkipAvailableOfflineKey to make sure available offline files are not immediately downloaded again after clearing the vault from local copies of available offline files.
- Logging into an account removes any previously set OCCoreSkipAvailableOfflineKey from the key value store
- Move Bookmark locking to an OCBookmarkManager category (next stop: use the new key-value store and bake support for locking bookmarks directly into the SDK)

* - Add missing localization

* Update SDK with latest fixes

* - Fix SettingsTests bugs

* - Apply additional fixes to UI tests and disable the remaining failing ones

* - Wait for connection initialization to complete before requesting sharing info
- Use latest SDK with cookie filtering

* - Turn off Request/Response log tags only filter in project file

* - Disable cookie support

* - Address (13) via SDK update

* link against newest development SDK

* Fixes for UI testing:
- use new SDK version that returns errors if the SQLite DB has not been opened
- MockOCCore.state now returns .running to avoid queueing of PROPFINDs

* - Fix unit tests

* - UI testing: make MockOCCore.state no longer return .running due to side effects
- fixed conflicting constraints in two places

* - force-delete bookmarks in UI tests if timeout has passed, log error but don't assert in that case
- handle case where a swipe on table cells in DeleteBookmarkTests triggers deletion outright

* - Further hardening of SettingsTests against timing differences local vs. CI

* - make SettingsTest.testCheckMoreItems() more robust

* iOS 13 dark mode support:
- detects dark / light mode changes and applies a different ThemeStyle as needed
- added ThemeStyle.darkStyleIdentifier so ThemeStyles can indicate their dark counter part (or their lack thereof, in case of the dark theme)
- add setting "Follow system light / dark appearance" to Settings > Theme

* Version Bump to 138

* [feature/reorder buttons] Reorder Navigation Bar Actions (#478)

* Available Offline Support
- new MakeAvailableOfflineAction and MakeUnavailableOfflineAction actions
- new Available Offline Library section
	- easy access to all files available offline via Available Offline
	- new ItemPolicyTableViewController and ItemPolicyCell prepared for reuse for presenting other item policies
- Design: added SVG/TVG/PNG icons and cloud symbols for make available offline / make unavailable offline

ClientItemCell changes
- new ClientItemResolvingCell can resolve item from LocalID or path, new superclass of ShareClientItemCell and ItemPolicyCell
- string to use as content for title and detail are now provided via titleLabelString(for:) and detailLabelString(for:), updated via updateLabels(with:), making customization easier
- support for new available offline badge

ProgressSummarizer changes
- changed ProgressSummary from a struct to a class, addressing issue #451 ("Waiting for server response..." message sometimes not disappearing)

* - Adopt OCClaim to ensure files aren't deleted while they are being used in
	- DisplayViewController
	- DownloadItemsHUDViewController
	- FileListTableViewController
	- File Provider
- Add new Storage Settings to allow control over how long unused local copies are kept around
- DisplayViewController now uses OCClaims to ensure files aren't deleted while they are being viewed
- ClientItemCell uses new SDK APIs to
	- show "available offline" badges for folders
	- to indicate if an item has been made available offline directly (solid icon) or indirectly (dimmed icon)
	- keep the cloud status icon updated following changes
- Change "+" icon to "•••" icon in file list, rename plusButton to folderAction everywhere
- Action.provideAlertAction() now applies padding to images if necessary so their text aligns at the same horizontal offset
- Fix typo in BookmarkInfoViewController and change wording from "Delete Offline Copies" to "Delete Local Copies" for consistency
- Update swiftlint.yml to silence ownCloudScreenshotsTests warnings

* - Update ios-sdk

* - Make changes requested in code review, adding missing localizable strings and removing extraneous code

* #477 reorganize navigation bar with create and more button and moved select button to sort menu

* added safeAreaLayoutGuide.rightAnchor

* - Update SDK

* changed "Select" image

* - Add downloadTriggerIdentifier and availableOfflinePolicyCoverage as properties that trigger the update of an item's visual representation (addressing finding 6 in #456)
- Update make available offline action to use new convertExistingLocalDownloads option (addressing finding 2 in #456)
- Update SDK (addressing finding 5 in #456)

* Items in moved Available Offline folders should no longer be cleared locally and re-downloaded, following under the hood improvements in the ios-sdk

* - Temporarily disable some UI tests broken due to lack of database running

* - Fix issue (11) in #456 by updating the lastUsed date of already downloaded items when they are viewed

* - Added slider type to StaticTableViewRow
- changed storage settings to allow picking a timeframe via slider rather than a list of time frames

* - Change text from "Remove" to "Make unavailable offline" in Quick Access > Available Offline list (addressing issue (9))

* - Update BookmarkInfoViewController to provide users with the choice to also remove local copies of items marked as Available Offline, issuing a warning and giving the users a way to cancel, addressing issue (12) in #456.

* addresses:
- missing multiselection UI in toolbar
- missing select all / deselect all button in navigation bar

* set if selectButton should be shown

* disable temporary some tests due to bitrise failures

* Version Bump to 139

* Feature/task scheduling (#484)

* #386 Added relevant classes

* First draft of the scheduled task manager

* Just changed some comments

* Implemented background fetch

* Implemented background update fetch

* Clean up of the code

* Fixed merge problems from previous commit

And eliminated some warnings

* Small changes in background fetch operation

* Some refactoring done

* Added some user defaults for media upload

* Available Offline Support
- new MakeAvailableOfflineAction and MakeUnavailableOfflineAction actions
- new Available Offline Library section
	- easy access to all files available offline via Available Offline
	- new ItemPolicyTableViewController and ItemPolicyCell prepared for reuse for presenting other item policies
- Design: added SVG/TVG/PNG icons and cloud symbols for make available offline / make unavailable offline

ClientItemCell changes
- new ClientItemResolvingCell can resolve item from LocalID or path, new superclass of ShareClientItemCell and ItemPolicyCell
- string to use as content for title and detail are now provided via titleLabelString(for:) and detailLabelString(for:), updated via updateLabels(with:), making customization easier
- support for new available offline badge

ProgressSummarizer changes
- changed ProgressSummary from a struct to a class, addressing issue #451 ("Waiting for server response..." message sometimes not disappearing)

* UI for bookmark / upload path selection

* Added dummy implementation of media upload task

* - Adopt OCClaim to ensure files aren't deleted while they are being used in
	- DisplayViewController
	- DownloadItemsHUDViewController
	- FileListTableViewController
	- File Provider
- Add new Storage Settings to allow control over how long unused local copies are kept around
- DisplayViewController now uses OCClaims to ensure files aren't deleted while they are being viewed
- ClientItemCell uses new SDK APIs to
	- show "available offline" badges for folders
	- to indicate if an item has been made available offline directly (solid icon) or indirectly (dimmed icon)
	- keep the cloud status icon updated following changes
- Change "+" icon to "•••" icon in file list, rename plusButton to folderAction everywhere
- Action.provideAlertAction() now applies padding to images if necessary so their text aligns at the same horizontal offset
- Fix typo in BookmarkInfoViewController and change wording from "Delete Offline Copies" to "Delete Local Copies" for consistency
- Update swiftlint.yml to silence ownCloudScreenshotsTests warnings

* - Update ios-sdk

* - Make changes requested in code review, adding missing localizable strings and removing extraneous code

* - Update SDK

* Refactored current implementation of media upload

* Added method to fetch photos from photo library

* - Add downloadTriggerIdentifier and availableOfflinePolicyCoverage as properties that trigger the update of an item's visual representation (addressing finding 6 in #456)
- Update make available offline action to use new convertExistingLocalDownloads option (addressing finding 2 in #456)
- Update SDK (addressing finding 5 in #456)

* Items in moved Available Offline folders should no longer be cleared locally and re-downloaded, following under the hood improvements in the ios-sdk

* - Add initial support for cookies via SDK update

* First draft of instant photo upload implementation

* Calling task completion handler after upload was finished

* - Temporarily disable some UI tests broken due to lack of database running

* - Fix issue (11) in #456 by updating the lastUsed date of already downloaded items when they are viewed

* - Added slider type to StaticTableViewRow
- changed storage settings to allow picking a timeframe via slider rather than a list of time frames

* - Change text from "Remove" to "Make unavailable offline" in Quick Access > Available Offline list (addressing issue (9))

* - Update BookmarkInfoViewController to provide users with the choice to also remove local copies of items marked as Available Offline, issuing a warning and giving the users a way to cancel, addressing issue (12) in #456.

* Fixed QA finding (1)

* Using PHAsset.creationDate to check which media files shall be instantly uploaded

* Fixed naming of class / group

* Moved Tasks folder

* Fixed some review findings

* - Fix issue where a busy bookmark alert is followed by duplicating the bookmark

* Fixed some review findings

* Improved background update fetching

* Fixed some issues in media upload

* Fixed a type in settings key

* Improvements in the instant media upload task

* Added missing returnCore in the selection of the instant upload path

* Fixed QA finding (3)

* Fixes for the correct core returning / requesting

* Small cosmetic code changes

* Fixed video and serialized photo / video uploads

* Moved upload() method to UploadBaseAction class

* Some refactoring in InstantMediaUploadTaskExtension

* Improvements for bookmark / path selection for instant upload

* Remove instant upload configuration if bookmark is not available

* minor refactoring

* Added possibility to cancel account selection

* Small fix: reset the path if new account is selected

* Using item tracking instead of OCQuery

- Disabling instant photo upload if target directory is removed
- Item tracking is potentially faster since it can use cached item information and is not always issuing PROPFIND

* Made some ivars private

* Detect in settings that instant upload path is gone

In this case instant upload is disabled

* - Update ios-sdk
- Take advantage of the new key-value store and OCCoreSkipAvailableOfflineKey to make sure available offline files are not immediately downloaded again after clearing the vault from local copies of available offline files.
- Logging into an account removes any previously set OCCoreSkipAvailableOfflineKey from the key value store
- Move Bookmark locking to an OCBookmarkManager category (next stop: use the new key-value store and bake support for locking bookmarks directly into the SDK)

* - Add missing localization

* Update SDK with latest fixes

* - Fix SettingsTests bugs

* - Apply additional fixes to UI tests and disable the remaining failing ones

* - Wait for connection initialization to complete before requesting sharing info
- Use latest SDK with cookie filtering

* - Turn off Request/Response log tags only filter in project file

* - Disable cookie support

* - Address (13) via SDK update

* link against newest development SDK

* Showing warning that instant upload was disabled

* Fixes for UI testing:
- use new SDK version that returns errors if the SQLite DB has not been opened
- MockOCCore.state now returns .running to avoid queueing of PROPFINDs

* - Fix unit tests

* Added alert shown when in settings when instant upload is disabled

* Added fetchUpdates() within which target folder tracking is started

* - UI testing: make MockOCCore.state no longer return .running due to side effects
- fixed conflicting constraints in two places

* - force-delete bookmarks in UI tests if timeout has passed, log error but don't assert in that case
- handle case where a swipe on table cells in DeleteBookmarkTests triggers deletion outright

* - Further hardening of SettingsTests against timing differences local vs. CI

* - make SettingsTest.testCheckMoreItems() more robust

* Update to the latest changes in the SDK

Those changes reduce memory consumption used for hash calculation

* Change required to accomodate latest SDK changes

* Less parallel photo uploads

* - update SDK to address stuck sync action issues
- no longer auto-open the last selected bookmark when launched by iOS in the background. Instead, the last selected bookmark is now auto-openend only when the app comes to the foreground.
- update FileProviderInterfaceManager to better support the case where the app ships without File Provider.

* Fixed compilation warning

* - Add ATS exemption for File Provider

* - Update SDK

* - Update SDK + add colored debugging option to scheme

* Addressed code review comments

* Removed unneeded weak self

* Removed another unwanted weak self

* - Fix OCEvent-dropping issue via SDK update with fix
- Make UploadMediaAction use OCBackgroundTask to protect while exporting

* - Added missing OCBackgroundTask.start call in UploadMediaAction
- Update SDK

* Fixed missing copyright information and some warnings

* Version Bump to 140

* Media upload pending flag added

- Displaying a warning alert on the next launch, in case media upload couldn’t be completed due e.g. app being terminated in a backround or even due to an app crash.
- Fixed an issue with DispatchGroup.notify() called prematurely in MediaUploadQueue.uploadAssets()

* - Clarify comment

* - sortbar was sometimes hidden
- fixing layout issue

* fixed location identifier for actions

* Added more logs in PHAsset+Upload extension

* - extend ThemeCollection and Theme support throughout the app, fixing the remaining issues with iOS 13 light/dark mode
- ownCloudApp: add annotated properties using ObjC associated values

* - Fix infinite loop / crash on trait changes
- Improve status bar style changes on dark / light mode changes

* - Make Issues view controller themeable / add dark/light mode support

* Version Bump to 141

* Version Bump to 142

* Version Bump to 143

* - new ThemedAlertController automatically adapts to the current style, can be used as drop-in replacement for UIAlertController (which it subclasses)
- make MoreViewHeader fully Themeable (fixing issues when switching between dark/light mode when visible), including TVG icons
- remove hard-coded background color for header in SharingTableViewController
- make NamingViewController use a blur effect and keyboard that match the current dark/light mode
- make ClientItemCell fully Themeable, including TVG icons
- add option to StaticTableViewRow to allow picking different icon tint colors that adapt with dark/light mode changes
- make use of that option in LibraryTableViewController
- fix magnification glass color in GroupSharingTableViewController and make it fully Themeable
- fix SortBar popover content inset issue (iOS 13 only)
- fix UISearchBar theme application / magnification glass color in NSObject+ThemeApplication
- add support for UIVisualEffectView to NSObject+ThemeApplication
- ThemeCollection improvements and fixes
	- add new properties keyboardAppearance and backgroundBlurEffectStyle
	- provide tableRowHighlightColors.backgroundColor to fix issue when overriding system-wide dark mode
- adopt Themeable for CardPresentationController, fixing wrong background color when dragging up a card that was already open before a theme change

* - Address review issues

* solved merge conflict error

* fixed colors in UISegmentedControl for iOS 13

* set tintColor to UIRefreshControl

* Only show theme selection, if follow system appearance is not enabled

* fixed iOS 13 content inset issue for popover

* set the tint color in ThemedAlertController

* set the UITableViewCell interface style for a better, multi-selection circle and disclosure indicator color

* UIActivityIndicator is no longer working proper in iOS 13. Removed this UI element from UISearchBar and showing a message view instead

* fixed default value of system UI appearance

* - Fix finding (7) in #502

* - Fix finding (3) in #502 by translating OCErrorDomain errors to NSCocoaErrorDomain before return (on iOS 13 only)

* Show available Themes for current system appearance mode, if enabled

* code refactoring

* solved some UI updating animations

* changed theme selection again and show system appearance in theme selection list

* - set the tint color for cells so that checkmark will match the same tint color
- changed icon for available offline action

* System was not shown as selected value
  • Loading branch information
felix-schwarz authored and hosy committed Oct 9, 2019
1 parent a89cd68 commit 5189a20
Show file tree
Hide file tree
Showing 60 changed files with 827 additions and 264 deletions.
28 changes: 14 additions & 14 deletions ownCloud File Provider/FileProviderExtension.m
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ - (NSFileProviderItem)itemForIdentifier:(NSFileProviderItemIdentifier)identifier

if (outError != NULL)
{
*outError = [returnError resolvedError];
*outError = [returnError translatedError];
}

return item;
Expand Down Expand Up @@ -238,7 +238,7 @@ - (void)startProvidingItemAtURL:(NSURL *)provideAtURL completionHandler:(void (^

FPLogCmd(@"Completed with error=%@", error);

completionHandler([error resolvedError]);
completionHandler([error translatedError]);
}];

return;
Expand Down Expand Up @@ -387,15 +387,15 @@ - (void)createDirectoryWithName:(NSString *)directoryName inParentItemIdentifier
{
FPLogCmd(@"Completed with collission with existingItem=%@ (locally detected)", existingItem);
// completionHandler(nil, [NSError fileProviderErrorForCollisionWithItem:existingItem]); // This is what we should do according to docs
completionHandler(nil, [OCError(OCErrorItemAlreadyExists) resolvedError]); // This is what we need to do to avoid users running into issues using the broken Files "Duplicate" action
completionHandler(nil, [OCError(OCErrorItemAlreadyExists) translatedError]); // This is what we need to do to avoid users running into issues using the broken Files "Duplicate" action
return;
}

[self.core createFolder:directoryName inside:parentItem options:@{
// OCCoreOptionPlaceholderCompletionHandler : [^(NSError * _Nullable error, OCItem * _Nullable item) {
// FPLogCmd(@"Completed placeholder creation with item=%@, error=%@", item, error);
//
// completionHandler(item, [error resolvedError]);
// completionHandler(item, [error translatedError]);
// } copy]
} resultHandler:^(NSError *error, OCCore *core, OCItem *item, id parameter) {
if (error != nil)
Expand All @@ -409,15 +409,15 @@ - (void)createDirectoryWithName:(NSString *)directoryName inParentItemIdentifier
{
FPLogCmd(@"Completed with collission with existingItem=%@ (server response)", existingItem);
// completionHandler(nil, [NSError fileProviderErrorForCollisionWithItem:existingItem]); // This is what we should do according to docs
completionHandler(nil, [OCError(OCErrorItemAlreadyExists) resolvedError]); // This is what we need to do to avoid users running into issues using the broken Files "Duplicate" action
completionHandler(nil, [OCError(OCErrorItemAlreadyExists) translatedError]); // This is what we need to do to avoid users running into issues using the broken Files "Duplicate" action
return;
}
}
}

FPLogCmd(@"Completed with item=%@, error=%@", item, error);

completionHandler(item, [error resolvedError]);
completionHandler(item, [error translatedError]);
}];
}
else
Expand All @@ -443,7 +443,7 @@ - (void)reparentItemWithIdentifier:(NSFileProviderItemIdentifier)itemIdentifier
[self.core moveItem:item to:parentItem withName:((newName != nil) ? newName : item.name) options:nil resultHandler:^(NSError *error, OCCore *core, OCItem *item, id parameter) {
FPLogCmd(@"Completed with item=%@, error=%@", item, error);

completionHandler(item, [error resolvedError]);
completionHandler(item, [error translatedError]);
}];
}
else
Expand All @@ -460,7 +460,7 @@ - (void)reparentItemWithIdentifier:(NSFileProviderItemIdentifier)itemIdentifier
}

FPLogCmd(@"Completed with item=%@ or parentItem=%@ not found, error=%@", item, parentItem, error);
completionHandler(nil, error);
completionHandler(nil, [error translatedError]);
}
}

Expand All @@ -477,7 +477,7 @@ - (void)renameItemWithIdentifier:(NSFileProviderItemIdentifier)itemIdentifier to

[self.core renameItem:item to:itemName options:nil resultHandler:^(NSError *error, OCCore *core, OCItem *item, id parameter) {
FPLogCmd(@"Completed with item=%@, error=%@", item, error);
completionHandler(item, [error resolvedError]);
completionHandler(item, [error translatedError]);
}];
}
else
Expand All @@ -500,7 +500,7 @@ - (void)deleteItemWithIdentifier:(NSFileProviderItemIdentifier)itemIdentifier co

[self.core deleteItem:item requireMatch:YES resultHandler:^(NSError *error, OCCore *core, OCItem *item, id parameter) {
FPLogCmd(@"Completed with error=%@", error);
completionHandler([error resolvedError]);
completionHandler([error translatedError]);
}];
}
else
Expand Down Expand Up @@ -556,7 +556,7 @@ - (void)importDocumentAtURL:(NSURL *)fileURL toParentItemIdentifier:(NSFileProvi
OCCoreOptionImportByCopying : @(importByCopying)
} placeholderCompletionHandler:^(NSError *error, OCItem *item) {
FPLogCmd(@"Completed with placeholderItem=%@, error=%@", item, error);
completionHandler(item, [error resolvedError]);
completionHandler(item, [error translatedError]);
} resultHandler:^(NSError *error, OCCore *core, OCItem *item, id parameter) {
if ([error.domain isEqual:OCHTTPStatusErrorDomain] && (error.code == OCHTTPStatusCodePRECONDITION_FAILED))
{
Expand Down Expand Up @@ -606,7 +606,7 @@ - (void)setFavoriteRank:(NSNumber *)favoriteRank forItemIdentifier:(NSFileProvid

[self.core updateItem:item properties:@[ OCItemPropertyNameLocalAttributes ] options:nil resultHandler:^(NSError *error, OCCore *core, OCItem *item, id parameter) {
FPLogCmd(@"Completed with item=%@, error=%@", item, error);
completionHandler(item, [error resolvedError]);
completionHandler(item, [error translatedError]);
}];
}
else
Expand Down Expand Up @@ -641,7 +641,7 @@ - (void)setTagData:(NSData *)tagData forItemIdentifier:(NSFileProviderItemIdenti

[self.core updateItem:item properties:@[ OCItemPropertyNameLocalAttributes ] options:nil resultHandler:^(NSError *error, OCCore *core, OCItem *item, id parameter) {
FPLogCmd(@"Completed with item=%@, error=%@", item, error);
completionHandler(item, [error resolvedError]);
completionHandler(item, [error translatedError]);
}];
}
else
Expand Down Expand Up @@ -675,7 +675,7 @@ - (void)trashItemWithIdentifier:(NSFileProviderItemIdentifier)itemIdentifier com

[self.core deleteItem:item requireMatch:YES resultHandler:^(NSError *error, OCCore *core, OCItem *item, id parameter) {
FPLogCmd(@"Completed with error=%@", error);
completionHandler(nil, [error resolvedError]);
completionHandler(nil, [error translatedError]);
}];
}
else
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ - (void)requestNextThumbnail
if (!isOngoing)
{
dispatch_async(dispatch_get_global_queue(QOS_CLASS_DEFAULT, 0), ^{
self.perThumbnailCompletionHandler(itemIdentifier, thumbnail.data, (thumbnail==nil) ? nil : [error resolvedError]);
self.perThumbnailCompletionHandler(itemIdentifier, thumbnail.data, (thumbnail==nil) ? nil : [error translatedError]);

OCLogDebug(@"Replied %ld: %@ -> thumbnailData=%d, error=%@", self.cursorPosition-1, itemFromDatabase.name, (thumbnail.data != nil), error);

Expand Down
2 changes: 1 addition & 1 deletion ownCloud File Provider/NSError+MessageResolution.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ NS_ASSUME_NONNULL_BEGIN

@interface NSError (MessageResolution)

- (NSError *)resolvedError;
- (NSError *)translatedError;

@end

Expand Down
58 changes: 56 additions & 2 deletions ownCloud File Provider/NSError+MessageResolution.m
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,13 @@

@implementation NSError (MessageResolution)

- (NSError *)resolvedError
- (NSError *)resolvedErrorWithTranslation:(BOOL)withTranslation
{
if ([self.domain isEqual:OCErrorDomain])
{
NSErrorDomain errorDomain = self.domain;
NSInteger errorCode = self.code;

NSString *localizedDescription = self.localizedDescription;
NSString *localizedFailureReason = self.localizedFailureReason;

Expand All @@ -40,10 +43,61 @@ - (NSError *)resolvedError
resolvedDict[NSLocalizedFailureReasonErrorKey] = localizedFailureReason;
}

return ([NSError errorWithDomain:self.domain code:self.code userInfo:resolvedDict]);
if (withTranslation)
{
errorDomain = NSCocoaErrorDomain;

resolvedDict[NSUnderlyingErrorKey] = self;

switch ((OCError)self.code)
{
case OCErrorItemAlreadyExists:
errorCode = NSFileWriteFileExistsError;
break;

case OCErrorItemNotFound:
case OCErrorItemDestinationNotFound:
case OCErrorFileNotFound:
errorCode = NSFileNoSuchFileError;
break;

case OCErrorFeatureNotImplemented:
case OCErrorItemOperationForbidden:
errorCode = NSFeatureUnsupportedError;
break;

case OCErrorItemInsufficientPermissions:
errorCode = NSFileWriteNoPermissionError;
break;

case OCErrorCancelled:
errorCode = NSUserCancelledError;
break;

case OCErrorInsufficientStorage:
errorCode = NSFileWriteOutOfSpaceError;
break;

default:
errorCode = NSFileReadUnknownError;
break;
}
}

return ([NSError errorWithDomain:errorDomain code:errorCode userInfo:resolvedDict]);
}

return (self);
}

- (NSError *)translatedError
{
if (@available(iOS 13, *))
{
return ([self resolvedErrorWithTranslation:YES]);
}

return ([self resolvedErrorWithTranslation:NO]);
}

@end
2 changes: 1 addition & 1 deletion ownCloud File Provider/OCItem+FileProviderItem.m
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ - (void)setUploadingError:(NSError *)uploadingError
sOCItemUploadingErrors = [NSMutableDictionary new];
}

sOCItemUploadingErrors[self.localID] = [uploadingError resolvedError];
sOCItemUploadingErrors[self.localID] = [uploadingError translatedError];
}
}
}
Expand Down
Loading

0 comments on commit 5189a20

Please sign in to comment.