From 7783b40f50ba60f8629c473d854274210e9f4dd2 Mon Sep 17 00:00:00 2001 From: Felix Schwarz Date: Mon, 22 Nov 2021 10:02:47 +0100 Subject: [PATCH] [feature/custom-app-scheme] Custom app/auth schemes (#1060) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * - add support and documentation for DISABLE_APPSTORE_LICENSING build flag * - ReleaseNotesHostViewController: remove unused reference to StoreKit - OCLicenseDuration: make sure SKProductSubscriptionPeriod conversion code is excluded when using the DISABLE_APPSTORE_LICENSING build flag * - add support for app.custom-app-scheme and app.custom-auth-scheme to Fastfile - add documentation for new custom scheme Branding.plist parameters * - remove test values from Branding.plist * - move build options from `app.` space to `build.` space and rename options accordingly - add legacy support for previously used Branding.plist build customization option names - add `BuildOptions` class to `ownCloudApp` framework to make build customization options visible in documentation * - ensure BuildOptions class is actually loaded/initialized * - update Xcode to 12.5.1 for GitHub workflow configuration-documentation.yml * - adapt code in `ImportPasteboardAction.swift` to also compile in Xcode 12.4 * Configuration documentation updated Co-authored-by: felix-schwarz Co-authored-by: Matthias Hühne --- doc/BUILD_CUSTOMIZATION.md | 76 +++++++++++ doc/CONFIGURATION.json | 120 +++++++++++++++++- docs/modules/ROOT/pages/ios_mdm_tables.adoc | 103 ++++++++++++++- fastlane/Fastfile | 43 +++++++ .../Base.lproj/Intents.intentdefinition | 8 +- ownCloud.xcodeproj/project.pbxproj | 16 +++ .../ImportPasteboardAction.swift | 8 +- ownCloud/Resources/Info.plist | 4 +- ownCloudAppFramework/Building/BuildOptions.h | 28 ++++ ownCloudAppFramework/Building/BuildOptions.m | 77 +++++++++++ 10 files changed, 466 insertions(+), 17 deletions(-) create mode 100644 doc/BUILD_CUSTOMIZATION.md create mode 100644 ownCloudAppFramework/Building/BuildOptions.h create mode 100644 ownCloudAppFramework/Building/BuildOptions.m diff --git a/doc/BUILD_CUSTOMIZATION.md b/doc/BUILD_CUSTOMIZATION.md new file mode 100644 index 000000000..e758f3ef7 --- /dev/null +++ b/doc/BUILD_CUSTOMIZATION.md @@ -0,0 +1,76 @@ +# Build Flags + +## Description + +Build Flags can be used to control the inclusion or exclusion of certain functionality or features. + +## Usage in Branding + +A space-separated list of flags can be specified in the `Branding.plist` with the key `build.flags`, f.ex.: + +```xml +build.flags +DISABLE_BACKGROUND_LOCATION +``` + +## Flags + +The following options can be used as `build.flags`: + +### `DISABLE_BACKGROUND_LOCATION` + +Removes the following from the app: +- the option for location-triggered background uploads from Settings +- the location description keys from the app's `Info.plist` + +Not used by default. + +### `DISABLE_APPSTORE_LICENSING` + +Removes the following from the app: +- App Store integration for OCLicense +- App Store related view controllers and settings section + + +# Custom Schemes + +## Description + +The app uses two URL schemes: +- `oc` for authentication +- `owncloud` for private links + +Both schemes are part of the app's `Info.plist`, which can only be changed at build time. + +## Usage in Branding + +### Private Links + +The default `owncloud` app URL scheme in `Info.plist` can be changed by providing an alternative scheme name in the `Branding.plist` with the key `build.custom-app-scheme`, f.ex.: + +```xml +build.custom-app-scheme +myscheme +``` + +### Authentication + +The default `oc` app URL scheme in `Info.plist` can be changed by providing an alternative scheme name in the `Branding.plist` with the key `build.custom-auth-scheme`, f.ex.: + +```xml +build.custom-auth-scheme +ms +``` + +The change in the `Info.plist` is only necessary when an external browser is used for authentication via OAuth2 or OIDC. In that case, the scheme must also be changed in the regular options for OIDC and OAuth2 authentication methods: + +```xml +authentication-oauth2.oa2-redirect-uri +ms://ios.owncloud.com +authentication-oauth2.oidc-redirect-uri +ms://ios.owncloud.com +``` + +Depending on OAuth2 and OIDC implementation on the server side: +- it may be necessary to also adapt the registered redirect URI on the server +- authentication could fail if not adapted on the server diff --git a/doc/CONFIGURATION.json b/doc/CONFIGURATION.json index 8f986c203..a84949d7d 100644 --- a/doc/CONFIGURATION.json +++ b/doc/CONFIGURATION.json @@ -1,4 +1,18 @@ [ + { + "autoExpansion" : "none", + "category" : "Account", + "categoryTag" : "account", + "classIdentifier" : "account", + "className" : "ownCloud.ServerListTableViewController", + "defaultValue" : false, + "description" : "Skip \"Account\" screen / automatically open \"Files\" screen after login", + "flatIdentifier" : "account.auto-connect", + "key" : "auto-connect", + "label" : "account.auto-connect", + "status" : "supported", + "type" : "bool" + }, { "autoExpansion" : "none", "category" : "Actions", @@ -462,6 +476,10 @@ "key" : "browser-session-class", "label" : "authentication.browser-session-class", "possibleValues" : [ + { + "description" : "Replace `http` with `awb` and `https` with `awbs` to delegate browser sessions to the AirWatch browser.", + "value" : "AWBrowser" + }, { "description" : "Replace http and https with custom schemes to delegate browser sessions to a different app.", "value" : "CustomScheme" @@ -645,6 +663,19 @@ "status" : "advanced", "type" : "string" }, + { + "autoExpansion" : "none", + "category" : "Branding", + "categoryTag" : "branding", + "classIdentifier" : "branding", + "className" : "Branding", + "description" : "URL to open when selecting the \"Send feedback\" option. Allows the use of all placeholders provided in `http.user-agent`.", + "flatIdentifier" : "branding.send-feedback-url", + "key" : "send-feedback-url", + "label" : "Feedback URL", + "status" : "advanced", + "type" : "string" + }, { "autoExpansion" : "none", "category" : "Branding", @@ -677,7 +708,7 @@ "categoryTag" : "branding", "classIdentifier" : "branding", "className" : "Branding", - "defaultValue" : "https://doc.owncloud.com/ios-app/", + "defaultValue" : "https://doc.owncloud.com/ios-app/latest/", "description" : "URL to documentation for the app. Opened when selecting \"Documentation\" in the settings.", "flatIdentifier" : "branding.url-documentation", "key" : "url-documentation", @@ -727,6 +758,19 @@ "status" : "advanced", "type" : "urlString" }, + { + "autoExpansion" : "none", + "category" : "Branding", + "categoryTag" : "branding", + "classIdentifier" : "branding", + "className" : "Branding", + "description" : "Default values for user defaults. Allows overriding default settings.", + "flatIdentifier" : "branding.user-defaults-default-values", + "key" : "user-defaults-default-values", + "label" : "branding.user-defaults-default-values", + "status" : "advanced", + "type" : "dictionary" + }, { "autoExpansion" : "none", "category" : "Browser Session", @@ -753,6 +797,47 @@ "status" : "advanced", "type" : "string" }, + { + "autoExpansion" : "none", + "category" : "Build", + "categoryTag" : "build", + "classIdentifier" : "build", + "className" : "BuildOptions", + "defaultValue" : "owncloud", + "description" : "Name of the URL scheme to use for private links. Must be provided in Branding.plist at build time. For documentation, please see doc/BUILD_CUSTOMIZATION.md.", + "flatIdentifier" : "build.custom-app-scheme", + "key" : "custom-app-scheme", + "label" : "build.custom-app-scheme", + "status" : "supported", + "type" : "string" + }, + { + "autoExpansion" : "none", + "category" : "Build", + "categoryTag" : "build", + "classIdentifier" : "build", + "className" : "BuildOptions", + "defaultValue" : "oc", + "description" : "Name of the URL scheme to use for OAuth2/OIDC authentication. Must be provided in Branding.plist at build time. The authentication redirect URI parameters must also be changed accordingly in Branding.plist and on the server side. For documentation, please see doc/BUILD_CUSTOMIZATION.md.", + "flatIdentifier" : "build.custom-auth-scheme", + "key" : "custom-auth-scheme", + "label" : "build.custom-auth-scheme", + "status" : "supported", + "type" : "string" + }, + { + "autoExpansion" : "none", + "category" : "Build", + "categoryTag" : "build", + "classIdentifier" : "build", + "className" : "BuildOptions", + "description" : "A set of space separated flags to customize the build. Must be provided in Branding.plist at build time. For documentation, please see doc/BUILD_CUSTOMIZATION.md.", + "flatIdentifier" : "build.flags", + "key" : "flags", + "label" : "build.flags", + "status" : "supported", + "type" : "string" + }, { "autoExpansion" : "none", "category" : "Connection", @@ -1207,8 +1292,7 @@ "categoryTag" : "connection", "classIdentifier" : "core", "className" : "OCCore", - "defaultValue" : 10, - "description" : "Minimum number of seconds until the next scan for changes, measured from the completion of the previous scan.", + "description" : "Minimum number of milliseconds until the next scan for changes, measured from the completion of the previous scan. If no value is provided, uses the poll interval provided in the server's capabilities (in milliseconds) if it is greater or equal 5 seconds. Defaults to 10 seconds otherwise.", "flatIdentifier" : "core.scan-for-changes-interval", "key" : "scan-for-changes-interval", "label" : "core.scan-for-changes-interval", @@ -1409,6 +1493,22 @@ "status" : "debugOnly", "type" : "bool" }, + { + "autoExpansion" : "none", + "category" : "Localization", + "categoryTag" : "localization", + "classIdentifier" : "locale", + "className" : "OCLocaleFilterClassSettings", + "defaultValue" : { + + }, + "description" : "Dictionary with localization overrides where the key is the English string whose localization should be overridden, and the value is a dictionary where the keys are the language codes (f.ex. \"en\", \"de\") and the values the translations to use.", + "flatIdentifier" : "locale.overrides", + "key" : "overrides", + "label" : "Localization Overrides", + "status" : "advanced", + "type" : "dictionary" + }, { "autoExpansion" : "none", "category" : "Logging", @@ -1731,6 +1831,20 @@ "status" : "advanced", "type" : "int" }, + { + "autoExpansion" : "none", + "category" : "Passcode", + "categoryTag" : "passcode", + "classIdentifier" : "passcode", + "className" : "AppLockSettings", + "defaultValue" : false, + "description" : "Controls wether the biometrical unlock will be enabled automatically.", + "flatIdentifier" : "passcode.use-biometrical-unlock", + "key" : "use-biometrical-unlock", + "label" : "passcode.use-biometrical-unlock", + "status" : "advanced", + "type" : "bool" + }, { "autoExpansion" : "none", "category" : "Release Notes", diff --git a/docs/modules/ROOT/pages/ios_mdm_tables.adoc b/docs/modules/ROOT/pages/ios_mdm_tables.adoc index e024de363..fe6fb3575 100644 --- a/docs/modules/ROOT/pages/ios_mdm_tables.adoc +++ b/docs/modules/ROOT/pages/ios_mdm_tables.adoc @@ -1,4 +1,24 @@ +tag::account[] +[cols="1,2,3,4a,5",options=header] +|=== +|Key +|Type +|Default +|Description +|Status + + +|account.auto-connect +|bool +|`false` +|Skip "Account" screen / automatically open "Files" screen after login +|supported `candidate` + +|=== +end::account[] + + tag::actions[] [cols="1,2,3,4a,5",options=header] |=== @@ -249,6 +269,9 @@ tag::authentication[] !=== ! Value ! Description +! `AWBrowser` +! Replace `http` with `awb` and `https` with `awbs` to delegate browser sessions to the AirWatch browser. + ! `CustomScheme` ! Replace http and https with custom schemes to delegate browser sessions to a different app. @@ -382,6 +405,14 @@ branding.send-feedback-address |Email address to send feedback to. Set to `null` to disable this feature. |advanced `candidate` +|**Feedback URL** + + + +branding.send-feedback-url +|string +| +|URL to open when selecting the "Send feedback" option. Allows the use of all placeholders provided in `http.user-agent`. +|advanced `candidate` + |branding.theme-definitions |dictionaryArray | @@ -398,7 +429,7 @@ branding.send-feedback-address + branding.url-documentation |urlString -|`https://doc.owncloud.com/ios-app/` +|`https://doc.owncloud.com/ios-app/latest/` |URL to documentation for the app. Opened when selecting "Documentation" in the settings. |advanced `candidate` @@ -426,6 +457,12 @@ branding.url-terms-of-use |URL to terms of use for the app. Opened when selecting "Terms Of Use" in the settings. |advanced `candidate` +|branding.user-defaults-default-values +|dictionary +| +|Default values for user defaults. Allows overriding default settings. +|advanced `candidate` + |`Profile` + **Allow URL configuration** + + @@ -597,6 +634,38 @@ tag::browsersession[] end::browsersession[] +tag::build[] +[cols="1,2,3,4a,5",options=header] +|=== +|Key +|Type +|Default +|Description +|Status + + +|build.custom-app-scheme +|string +|`owncloud` +|Name of the URL scheme to use for private links. Must be provided in Branding.plist at build time. For documentation, please see doc/BUILD_CUSTOMIZATION.md. +|supported `candidate` + +|build.custom-auth-scheme +|string +|`oc` +|Name of the URL scheme to use for OAuth2/OIDC authentication. Must be provided in Branding.plist at build time. The authentication redirect URI parameters must also be changed accordingly in Branding.plist and on the server side. For documentation, please see doc/BUILD_CUSTOMIZATION.md. +|supported `candidate` + +|build.flags +|string +| +|A set of space separated flags to customize the build. Must be provided in Branding.plist at build time. For documentation, please see doc/BUILD_CUSTOMIZATION.md. +|supported `candidate` + +|=== +end::build[] + + tag::connection[] [cols="1,2,3,4a,5",options=header] |=== @@ -673,8 +742,8 @@ The following placeholders can be used to make it dynamic: |core.scan-for-changes-interval |int -|`10` -|Minimum number of seconds until the next scan for changes, measured from the completion of the previous scan. +| +|Minimum number of milliseconds until the next scan for changes, measured from the completion of the previous scan. If no value is provided, uses the poll interval provided in the server's capabilities (in milliseconds) if it is greater or equal 5 seconds. Defaults to 10 seconds otherwise. |advanced `candidate` |connection.allow-background-url-sessions @@ -896,6 +965,28 @@ tag::licensing[] end::licensing[] +tag::localization[] +[cols="1,2,3,4a,5",options=header] +|=== +|Key +|Type +|Default +|Description +|Status + + +|**Localization Overrides** + + + +locale.overrides +|dictionary +|`map[]` +|Dictionary with localization overrides where the key is the English string whose localization should be overridden, and the value is a dictionary where the keys are the language codes (f.ex. "en", "de") and the values the translations to use. +|advanced `candidate` + +|=== +end::localization[] + + tag::logging[] [cols="1,2,3,4a,5",options=header] |=== @@ -1173,6 +1264,12 @@ tag::passcode[] |Controls how many passcode digits are at least required for passcode lock. |advanced `candidate` +|passcode.use-biometrical-unlock +|bool +|`false` +|Controls wether the biometrical unlock will be enabled automatically. +|advanced `candidate` + |=== end::passcode[] diff --git a/fastlane/Fastfile b/fastlane/Fastfile index 01a47e959..29aab037c 100644 --- a/fastlane/Fastfile +++ b/fastlane/Fastfile @@ -468,6 +468,8 @@ end appName = "ownCloud" appBuildFlags = "" + appCustomAppScheme = "" + appCustomAuthScheme = "" themeFolder = "ownCloud/Resources/Theming/" themePath = themeFolder + "Branding.plist" if !values[:APP_NAME].nil? @@ -480,11 +482,38 @@ end end if File.exist?("../" + themePath) + # Extract from Branding.plist + tmpAppBuildFlags = get_info_plist_value(path: themePath, key: "build.flags") + if tmpAppBuildFlags && !tmpAppBuildFlags.empty? + appBuildFlags = tmpAppBuildFlags + end + + tmpAppCustomAppScheme = get_info_plist_value(path: themePath, key: "build.custom-app-scheme") + if tmpAppCustomAppScheme && !tmpAppCustomAppScheme.empty? + appCustomAppScheme = tmpAppCustomAppScheme + end + + tmpAuthCustomAuthScheme = get_info_plist_value(path: themePath, key: "build.custom-auth-scheme") + if tmpAuthCustomAuthScheme && !tmpAuthCustomAuthScheme.empty? + appCustomAuthScheme = tmpAuthCustomAuthScheme + end + + # Fallback (legacy key name support) tmpAppBuildFlags = get_info_plist_value(path: themePath, key: "app.build-flags") if tmpAppBuildFlags && !tmpAppBuildFlags.empty? appBuildFlags = tmpAppBuildFlags end + tmpAppCustomAppScheme = get_info_plist_value(path: themePath, key: "app.custom-app-scheme") + if tmpAppCustomAppScheme && !tmpAppCustomAppScheme.empty? + appCustomAppScheme = tmpAppCustomAppScheme + end + + tmpAuthCustomAuthScheme = get_info_plist_value(path: themePath, key: "app.custom-auth-scheme") + if tmpAuthCustomAuthScheme && !tmpAuthCustomAuthScheme.empty? + appCustomAuthScheme = tmpAuthCustomAuthScheme + end + # Set the Git commit hash for the ios-app and ios-sdk repository into the Branding.plist commit = sh "git rev-parse --short HEAD" sdkcommit = sh "git -C ../ios-sdk/ rev-parse --short HEAD" @@ -498,6 +527,8 @@ end puts "App Name: " + appName puts "App Build Flags: " + appBuildFlags + puts "Custom App Scheme: " + appCustomAppScheme + puts "Custom Auth Scheme: " + appCustomAuthScheme # Special handling for app build flag DISABLE_BACKGROUND_LOCATION needed: # calls to set_info_plist_value before building with xcodebuild @@ -510,6 +541,18 @@ end sh "mv ../ownCloud/Resources/Info.plist.mod ../ownCloud/Resources/Info.plist" end + # update_url_schemes can't seem to reach the second URL scheme ("oc") for authentication + # so using sed and a XML property instead + if !appCustomAppScheme.empty? + sh 'sed "s#owncloud#' + appCustomAppScheme + '#" ../ownCloud/Resources/Info.plist >../ownCloud/Resources/Info.plist.mod' + sh "mv ../ownCloud/Resources/Info.plist.mod ../ownCloud/Resources/Info.plist" + end + + if !appCustomAuthScheme.empty? + sh 'sed "s#oc#' + appCustomAuthScheme + '#" ../ownCloud/Resources/Info.plist >../ownCloud/Resources/Info.plist.mod' + sh "mv ../ownCloud/Resources/Info.plist.mod ../ownCloud/Resources/Info.plist" + end + set_info_plist_value(path: "ownCloud/Resources/Info.plist", key: "CFBundleDisplayName", value: appName) set_info_plist_value(path: "ownCloud/Resources/Info.plist", key: "CFBundleName", value: appName) diff --git a/ownCloud Intents/Base.lproj/Intents.intentdefinition b/ownCloud Intents/Base.lproj/Intents.intentdefinition index 663871b86..024b80fc0 100644 --- a/ownCloud Intents/Base.lproj/Intents.intentdefinition +++ b/ownCloud Intents/Base.lproj/Intents.intentdefinition @@ -126,11 +126,11 @@ INIntentDefinitionNamespace K5U8aR INIntentDefinitionSystemVersion - 20D91 + 21A559 INIntentDefinitionToolsBuildVersion - 12D4e + 13A233 INIntentDefinitionToolsVersion - 12.4 + 13.0 INIntents @@ -2441,8 +2441,6 @@ Confirmation - INIntentParameterSupportsDynamicEnumeration - INIntentParameterSupportsResolution INIntentParameterTag diff --git a/ownCloud.xcodeproj/project.pbxproj b/ownCloud.xcodeproj/project.pbxproj index af4cb46a9..54af8ddc4 100644 --- a/ownCloud.xcodeproj/project.pbxproj +++ b/ownCloud.xcodeproj/project.pbxproj @@ -415,6 +415,8 @@ DCD1300A23A191C000255779 /* LicenseOfferButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = DCD1300923A191C000255779 /* LicenseOfferButton.swift */; }; DCD1301123A23F4E00255779 /* OCLicenseManager+AppStore.swift in Sources */ = {isa = PBXBuildFile; fileRef = DCD1301023A23F4E00255779 /* OCLicenseManager+AppStore.swift */; }; DCD2D40622F06ECA0071FB8F /* DataSettingsSection.swift in Sources */ = {isa = PBXBuildFile; fileRef = DCD2D40522F06ECA0071FB8F /* DataSettingsSection.swift */; }; + DCD71E7F27427463001592C6 /* BuildOptions.h in Headers */ = {isa = PBXBuildFile; fileRef = DCD71E7C2742745D001592C6 /* BuildOptions.h */; }; + DCD71E8027427463001592C6 /* BuildOptions.m in Sources */ = {isa = PBXBuildFile; fileRef = DCD71E7D2742745D001592C6 /* BuildOptions.m */; }; DCD8109A23984AF2003B0053 /* OCLicenseDuration.h in Headers */ = {isa = PBXBuildFile; fileRef = DCD810922398492C003B0053 /* OCLicenseDuration.h */; settings = {ATTRIBUTES = (Public, ); }; }; DCD8109B23984AF6003B0053 /* OCLicenseDuration.m in Sources */ = {isa = PBXBuildFile; fileRef = DCD810932398492C003B0053 /* OCLicenseDuration.m */; }; DCD954DF247D62FA00E184E6 /* MessageTableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = DCD954DE247D62FA00E184E6 /* MessageTableViewController.swift */; }; @@ -1400,6 +1402,8 @@ DCD2D40522F06ECA0071FB8F /* DataSettingsSection.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DataSettingsSection.swift; sourceTree = ""; }; DCD344A5205BD0C000189B9A /* openssl.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = openssl.framework; sourceTree = BUILT_PRODUCTS_DIR; }; DCD344AF205BD0FA00189B9A /* openssl.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = openssl.xcodeproj; path = "ios-sdk/ownCloudUI/openssl/framework/openssl.xcodeproj"; sourceTree = ""; }; + DCD71E7C2742745D001592C6 /* BuildOptions.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = BuildOptions.h; sourceTree = ""; }; + DCD71E7D2742745D001592C6 /* BuildOptions.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = BuildOptions.m; sourceTree = ""; }; DCD810922398492C003B0053 /* OCLicenseDuration.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = OCLicenseDuration.h; sourceTree = ""; }; DCD810932398492C003B0053 /* OCLicenseDuration.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = OCLicenseDuration.m; sourceTree = ""; }; DCD954DE247D62FA00E184E6 /* MessageTableViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MessageTableViewController.swift; sourceTree = ""; }; @@ -2678,6 +2682,7 @@ DCC0855E2293F1FD008CC05C /* ownCloudApp.h */, DC774E5A22F44E2A000B11A1 /* Display Settings */, DC6A0E4F26EA9E2B0076B533 /* AppLock Settings */, + DCD71E7827427446001592C6 /* Building */, DCB2C05C250C1ECD001083CA /* Branding */, DCF2DA6F24C82C820026D790 /* File Provider Services */, DCC5E443232654C1002E5B84 /* Foundation Extensions */, @@ -2839,6 +2844,15 @@ path = Issues; sourceTree = ""; }; + DCD71E7827427446001592C6 /* Building */ = { + isa = PBXGroup; + children = ( + DCD71E7D2742745D001592C6 /* BuildOptions.m */, + DCD71E7C2742745D001592C6 /* BuildOptions.h */, + ); + path = Building; + sourceTree = ""; + }; DCDC208923991296003CFF5B /* Transactions */ = { isa = PBXGroup; children = ( @@ -3211,6 +3225,7 @@ DC66F3A523965A1400CF4812 /* NSDate+RFC3339.h in Headers */, DC0030C22350B1CE00BB8570 /* NSData+Encoding.h in Headers */, DCCD77792604C91600098573 /* NSDate+ComputedTimes.h in Headers */, + DCD71E7F27427463001592C6 /* BuildOptions.h in Headers */, DCB458ED2604A7D4006A02AB /* OCQueryCondition+SearchSegmenter.h in Headers */, DCC5E4472326564F002E5B84 /* NSObject+AnnotatedProperties.h in Headers */, DC66F3AB23965C9C00CF4812 /* OCLicenseAppStoreReceiptInAppPurchase.h in Headers */, @@ -4328,6 +4343,7 @@ DC0030C12350B1CE00BB8570 /* NSData+Encoding.m in Sources */, DC774E5F22F44E57000B11A1 /* ZIPArchive.m in Sources */, DCDBB60B2525306000FAD707 /* NotificationAuthErrorForwarder.m in Sources */, + DCD71E8027427463001592C6 /* BuildOptions.m in Sources */, DC080CE5238AE3F40044C5D2 /* OCLicenseAppStoreProvider.m in Sources */, DC6A0E5526EA9E740076B533 /* AppLockSettings.m in Sources */, DCC0857F2293F48D008CC05C /* DisplaySettings.m in Sources */, diff --git a/ownCloud/Client/Actions/Actions+Extensions/ImportPasteboardAction.swift b/ownCloud/Client/Actions/Actions+Extensions/ImportPasteboardAction.swift index 6382d7a4a..134e71177 100644 --- a/ownCloud/Client/Actions/Actions+Extensions/ImportPasteboardAction.swift +++ b/ownCloud/Client/Actions/Actions+Extensions/ImportPasteboardAction.swift @@ -55,15 +55,15 @@ class ImportPasteboardAction : Action { // MARK: - Action implementation override func run() { - var rootItem : OCItem? + var importToRootItem : OCItem? if let root = context.query?.rootItem { - rootItem = root + importToRootItem = root } else if let root = context.preferences?["rootItem"] as? OCItem { // KeyCommands send the rootItem via Preferences, because if a table view cell is selected, we need the folder root item - rootItem = root + importToRootItem = root } - guard context.items.count > 0, let core = self.core, let rootItem = rootItem else { + guard context.items.count > 0, let core = self.core, let rootItem = importToRootItem else { completed(with: NSError(ocError: .insufficientParameters)) return } diff --git a/ownCloud/Resources/Info.plist b/ownCloud/Resources/Info.plist index 55fd9a37f..ea8d3ca81 100644 --- a/ownCloud/Resources/Info.plist +++ b/ownCloud/Resources/Info.plist @@ -49,7 +49,7 @@ com.owncloud.com CFBundleURLSchemes - owncloud + owncloud @@ -59,7 +59,7 @@ com.owncloud.auth CFBundleURLSchemes - oc + oc diff --git a/ownCloudAppFramework/Building/BuildOptions.h b/ownCloudAppFramework/Building/BuildOptions.h new file mode 100644 index 000000000..afed93620 --- /dev/null +++ b/ownCloudAppFramework/Building/BuildOptions.h @@ -0,0 +1,28 @@ +// +// BuildOptions.h +// ownCloud +// +// Created by Felix Schwarz on 15.11.21. +// Copyright © 2021 ownCloud GmbH. All rights reserved. +// + +/* + * Copyright (C) 2021, 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 . + * + */ + +#import +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface BuildOptions : NSObject + +@end + +NS_ASSUME_NONNULL_END diff --git a/ownCloudAppFramework/Building/BuildOptions.m b/ownCloudAppFramework/Building/BuildOptions.m new file mode 100644 index 000000000..1a1b366a0 --- /dev/null +++ b/ownCloudAppFramework/Building/BuildOptions.m @@ -0,0 +1,77 @@ +// +// BuildOptions.m +// ownCloud +// +// Created by Felix Schwarz on 15.11.21. +// Copyright © 2021 ownCloud GmbH. All rights reserved. +// + +/* + * Copyright (C) 2021, 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 . + * + */ + +#import "BuildOptions.h" + +OCClassSettingsIdentifier OCClassSettingsIdentifierBuildOptions = @"build"; + +OCClassSettingsKey OCClassSettingsKeyBuildFlags = @"flags"; +OCClassSettingsKey OCClassSettingsKeyCustomAppScheme = @"custom-app-scheme"; +OCClassSettingsKey OCClassSettingsKeyCustomAuthScheme = @"custom-auth-scheme"; + +@implementation BuildOptions + ++ (void)load +{ + // Make sure the class is loaded + [self classSettingsIdentifier]; +} + ++ (OCClassSettingsIdentifier)classSettingsIdentifier +{ + return (OCClassSettingsIdentifierBuildOptions); +} + ++ (NSDictionary *)defaultSettingsForIdentifier:(OCClassSettingsIdentifier)identifier +{ + return(@{ + OCClassSettingsKeyCustomAppScheme : @"owncloud", + OCClassSettingsKeyCustomAuthScheme : @"oc" + }); +} + ++ (OCClassSettingsMetadataCollection)classSettingsMetadata +{ + return (@{ + // build.flags + OCClassSettingsKeyBuildFlags : @{ + OCClassSettingsMetadataKeyType : OCClassSettingsMetadataTypeString, + OCClassSettingsMetadataKeyDescription : @"A set of space separated flags to customize the build. Must be provided in Branding.plist at build time. For documentation, please see doc/BUILD_CUSTOMIZATION.md.", + OCClassSettingsMetadataKeyStatus : OCClassSettingsKeyStatusSupported, + OCClassSettingsMetadataKeyCategory : @"Build", + }, + + // build.custom-app-scheme + OCClassSettingsKeyCustomAppScheme : @{ + OCClassSettingsMetadataKeyType : OCClassSettingsMetadataTypeString, + OCClassSettingsMetadataKeyDescription : @"Name of the URL scheme to use for private links. Must be provided in Branding.plist at build time. For documentation, please see doc/BUILD_CUSTOMIZATION.md.", + OCClassSettingsMetadataKeyStatus : OCClassSettingsKeyStatusSupported, + OCClassSettingsMetadataKeyCategory : @"Build", + }, + + // build.custom-app-scheme + OCClassSettingsKeyCustomAuthScheme : @{ + OCClassSettingsMetadataKeyType : OCClassSettingsMetadataTypeString, + OCClassSettingsMetadataKeyDescription : @"Name of the URL scheme to use for OAuth2/OIDC authentication. Must be provided in Branding.plist at build time. The authentication redirect URI parameters must also be changed accordingly in Branding.plist and on the server side. For documentation, please see doc/BUILD_CUSTOMIZATION.md.", + OCClassSettingsMetadataKeyStatus : OCClassSettingsKeyStatusSupported, + OCClassSettingsMetadataKeyCategory : @"Build", + }, + }); +} + +@end