Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[feature/sync-ng] Sync NG #76

Open
wants to merge 220 commits into
base: develop
Choose a base branch
from
Open

[feature/sync-ng] Sync NG #76

wants to merge 220 commits into from

Conversation

felix-schwarz
Copy link
Collaborator

@felix-schwarz felix-schwarz commented Dec 8, 2020

Description

The next step for the Sync Engine, eliminating known pain points:

  • decoupling of action execution / result handling and result delivery to process-bound completionHandlers via OCSignals.
  • removal of active sync action tracking information from OCItems
  • condensing of Sync Action data: reference OCItems via Local ID rather than storing and working on OCItem copies embedded into Sync Actions

Related Issue

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

	- recognizing normalized paths
	- recognizing unnormalized / malformed paths
- OCCore
	- absence of parent items is now used as indication that a sub item of the absent parent item does not exist
	- [OCCore trackItemAtPath:trackingHandler:] now returns OCErrorUnnormalizedPath when passing unnormalized paths (containing f.ex. "//", "." or "..")
- new tests covering the new & improved functionality
- adds additional parameters to token request to ensure the retrieval of a refresh_token in case the OIDC provider isn't configured to this by default
- improve URL construction for absolute URLs (avoid leading double-slash)
- add new -[OCAuthenticationMethodOAuth2 retrieveEndpointInformationForConnection:] method to dynamically retrieve endpoints if needed (like for OIDC)
- add additional details to OCHTTPPipeline logging
- remove unused source code (OCWaitConditionPendingRequest)
- disabling background NSURLSession usage for apps running under iOS 13.1+ and having a FileProvider
- add auto-resume flag when downloading files

OCHTTPPipeline:
- add support for auto-resume of downloads
- updated `CONFIGURATION.md` to document the change
- OCAppIdentity: added appVersion and appBuildNumber properties
- UIDevice+ModelID: category allowing to retrieve the device's model identifier
- OCHTTPPipeline:
	- OCHTTPPipeline.userAgent builds, caches and returns the User-Agent
	- injects User-Agent into requests before sending them out
	- new OCClassSettingsIdentifierHTTP and OCHTTPPipelineSettingUserAgent
- OCDatabase: removed leftover debug message
- add ability to register classes for keys globally (use this sparingly)
- avoid unneeded deserializations when notifying observers of new values: if there's no observer for a key, there's no need to deserialize it

OCProcessManager:
- make property-like method sharedProcessManager an actual property
…lability across supported platforms

	- Adapt code to compile File Provider support code only on iOS and Mac Catalyst
…at's used in startAuthenticationSession

	- added new OCAuthenticationBrowserSession class to allow plugging in alternative OAuth2 session providers
		- added OCAuthenticationBrowserSessionUIWebView as an implementation based on UIWebView, available right in the SDK as an option to work around issues in certain MDM software
	- added new OCClassSettings parameter "oa2-browser-session-class" to specify a class to use as alternative OAuth2 session providers
		- use "oc:authentication-oauth2.oa2-browser-session-class=string:UIWebView" as environment variable to use the OCAuthenticationBrowserSessionUIWebView class for OAuth2
	- added OC_FEATURE_AVAILABLE_AUTHENTICATION_SESSION availability macro

- add tvOS target and devices to ownCloudSDK target
	- fix dependencies and availability issues
…n-compatible APIs may be used (which silences a warning about this not being the case in a version of ownCloudApp with OCLicense*)
- SyncEngine: add preflight completion handler support
- LocalImport: make sure the placeholder completion handler is only called *after* the placeholder item is also in the database (fixes owncloud/enterprise#3642)
- CreateFolder: make sure the placeholder completion handler is only called *after* the placeholder item is also in the database (for future-proofing / consistency)
- OCItem: add -syncActivityDescription to provide a description of the OCItem sync activity contents
- adding .latestVersionOfLocalItem convenience attribute that retrieves (and caches) the latest version of an item

OCSyncActionUpload:
- use .latestVersionOfLocalItem instead of .localItem to fix an issue where a file was added offline, then updated offline, so that the activeSyncRecords of the OCItem got inconsistent:
	- upload file -> item has activeSyncRecord A
	- update file -> item has activeSyncRecords A, B
	- A: actually upload file -> item has no activeSyncRecords
	- B: actually update file -> item has activeSyncRecords A, spinning forever
- fix related issue that preflight could add a placeholder item to the database more than once, by only adding the placeholder as a new item if it has no databaseID yet
- OCConnection
	- new method to retrieve the path for a private link
- OCError
	- two new error codes indicating private link formatting or resolution errors
- OCCore
	- new method to retrieve the OCItem for a private link
	- make trackItem method more robust when targeting directories with non-OCPath-conforming paths (missing a trailing "/")
- OCItem+OCXMLObjectCreation
	- add support for extracting resolved private link paths
- Unit Tests
	- 4 new unit tests for the new OCConnection and OCCore methods
- expose background change scan activity via OCActivityIdentifierPendingServerScanJobsSummary activity identifier
- new OCBookmarkUserInfoKey type for OCBookmark.userInfo keys
- new OCBookmarkUserInfoKeyStatusInfo key holding the status.php contents of the last valid & non-maintenance connection to a server
- replace left-over usage of NSUUID* with OCBookmarkUUID in OCBookmarkManager

OCConnection:
- update OCBookmark.userInfo[OCBookmarkUserInfoKeyStatusInfo] on every successful connect
- add "email" to scope
- make scope configurable via ClassSettings
- document `oidc-scope` in CONFIGURATION.md
	- NSError category to simplify detecting NSErrors representing a network error/network failure
- OCConnection:
	- new OCConnection.authSignals that authentication methods can use to schedule their requests - allows the core to define conditions for these
- OCAuthenticationMethodOAuth2:
	- change token refresh to wait for network availability before sending token requests
	- taking advantage of new OCConnection.authSignals
	- fixing an unnecessary scheduling loop when no network connection is available and the token needs to be refreshed
- OCCore:
	- add new ready state (OCCoreStateReady) that is reached after setting up the infrastructure but before contacting the server
	- work around compiler bug in -[OCCore stopQuery:] that could crash the app
- OCCore+ConnectionStatus:
	- add new network available signal (OCConnectionSignalIDNetworkAvailable)
	- (re)starts background update checks and item task list scheduling when the connection is coming online
- OCCoreServerStatusSignalProvider:
	- allow providing the exact error when reporting that the connection was refused
	- uses the localizedDescription of the error as .shortDescription, if available
- OCCore+ItemList:
	- faster duplicate scheduled task detection
	- ensure OCQuerys are updated promptly even if there's already an item list task for the same path, resulting in queueing
	- fix bug that could permanently halt the item list task scheduling queue when offline
	- re-attempt update of item list tasks that failed and were put back in "new" state
	- ensure thread-safe use of _itemListTasksByPath
	- fix bug that led to deletion of scheduled background scans when offline
	- ensure scheduled background scans only take place when network is available (utilizing new OCConnectionSignalIDNetworkAvailable)
	- detect and avoid duplicate scheduling of jobs
- OCCoreItemListTask:
	- add new updateIfNew method to update only those sets whose state is "new"
	- add support for injecting required signal options depending on whether a PROPFIND is scheduled for a query or background scan
felix-schwarz and others added 16 commits November 17, 2020 14:39
Co-authored-by: Michael Neuwert <mn@neuwert-media.com>
	- new API for observing updates to a class setting or select attributes
	- long-term goal: unified, simplified interface to OCClassSettings
- OCClassSettings:
	- OCClassSettingsChangedNotification: posted with object=nil if any value could have changed, posted with the flat identifier if a specific setting has changed
	- provides a standard way to notify interested parties about changes
	- posts OCClassSettingsChangedNotification whenever sources are added or removed
- OCClassSettingsUserPreferences
	- adds new APIs to check if users are allowed to change a setting via OCClassSettingsUserPreferences methods
	- adds new MDM options to allow or disallow users to change specific settings
	- posts OCClassSettingsChangedNotification whenever a value is changed by the user
- OCClassSettingsFlatSourceManagedConfiguration:
	- posts OCClassSettingsChangedNotification whenever new values are pushed via MDM
- OCKeychain:
	- return an NSError for -wipe instead of a BOOL
…erences flags

- OCClassSetting:
	- fix enumeration error
	- add unit tests
	- make include public
	- clarify and extend redirection policies:
		- "forbidden" becomes "handle locally"
		- "validate connection" - triggering the connection validator - becomes the new default
	- extended redirection support in OCHTTPRequest:
		- new maximumRedirectionDepth property to indicate maximum number of redirections to follow
		- new redirectionHistory property keeping track of NSURLs queried as part of redirection handling
- OCConnection:
	- new status validation method +validateStatus:; replace all instances of checks for maintenance mode with it
	- add Connection Validator that kicks in if a HTTP Request with "ValidateConnection" redirection policy receives a redirection response
	- demote OCConnectionTransparentTemporaryRedirect option from "advanced" to "debug", turn off by default
- OCHostSimulator
	- move OCHostSimulator+CookieRedirect from ownCloudMocking to ownCloudSDK/OCHostSimulator+BuiltIn
	- add new "simple-apm" cookie redirection simulating APM Host Simulator Extension and rebuild documentation
- OCCore:
	- enable cookie support by default
	- switch from detection URLs to detection requests
	- use Detection ID to consolidate requests prior to performing them
	- authentication methods now perform a PROPFIND rather than a GET request on the WebDAV endpoint
	- when contacting the bare WebDAV endpoint, the URL is now slash-terminated
- Connection Validator
	- new error code for failed validation
	- preparations for second stage of validation if first stage fails (but commented out for now as it's not clear that's needed and would complicate the implementation by multiplying the possible outcomes)
	- code comment describing how the Connection Validator works
	- handle failed validation like maintenance mode, but with custom error in status line
- add "recovering-apm" Host Simulator that makes bogus redirects for the first 30 seconds, then becomes a "simple-apm" that wants to set cookies
	- allow setting the internally tracked _lastUsername with new method

- OCAuthenticationMethodOAuth2 + OCAuthenticationMethodOpenIDConnect:
	- add headers to prefill user name where available and supported by the server
	- comment out support for OAuth2 due to crashes in the web view in Simulator and on device
	- implement Connection Validator II - following the latest flow diagram
	- update code comments explaining the structure
	- factor out the Connection Validator to its own method
@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@felix-schwarz felix-schwarz changed the base branch from master to develop December 8, 2020 21:43
… non-critical requests

- OCProcessManager: add additional observation and debug output for tracking app/extension state
	- centralize management of X-Request-ID header in OCHTTPRequest
	- replace all header field strings with OCHTTPHeaderFieldNames
	- extended and more uniform log messages to make following a request through the OCHTTPPipeline much easier
	- move the majority of debug messages to the verbose level
	- log old and new X-Request-ID when recreating it, to allow connecting the dots
	- avoid requesting the full header dictionary when just interested in a single one
	- log type (Bearer, Basic, …) from Authorization header and only replace the actually confidential part with "[redacted]"
	- add debugging description to OCHTTPRequest
- OCHTTP bugfixes
	- ensure that only one representation (object or data) is kept in an OCHTTPPipelineTask at a time, to avoid inconsistencies
	- drop request data if requestID is changed
- OCLogger
	- migrate privacy mask and log level to OCClassSetting + observation
	- fix bug where log level changes didn't propagate across processes
- OCClassSettings
	- fix bugs related to change notifications timing
	- implement cross-process notifications for user settings
- General
	- move frequently logged debug messages that are very specific and aren't needed 98% of the time to the verbose logging level
@delete-merged-branch delete-merged-branch bot deleted the branch develop June 21, 2023 08:10
@delete-merged-branch delete-merged-branch bot deleted the branch develop January 17, 2024 21:26
felix-schwarz added a commit that referenced this pull request Apr 29, 2024
- port over OCSignal integration for OCSyncRecord, OCCore+SyncEngine and OCEvent from feature/sync-ng (#76)
- completely remove OCSyncRecord.resultHandler and replace it with OCSignalUUID
- remove OCSyncRecord.resultHandler save/recovery code from OCDatabase
- add OCCodableDict and OCMutableCodableDict types
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants