Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
[submodule "ios-sdk"]
path = ios-sdk
#url = https://github.com/opencloud-eu/ios-sdk.git
url = ../ios-sdk.git
url = https://github.com/gpongelli/opencloud-ios-sdk.git
#url = ../ios-sdk.git
branch = custom-claim
3 changes: 3 additions & 0 deletions OpenCloud/Bookmarks/Composer/BookmarkComposer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,9 @@ class BookmarkComposer: NSObject {
}

func instantiateConnection(for bmark: OCBookmark) -> OCConnection {
let customScopes = (OCAppIdentity.shared.userDefaults! as UserDefaults).object(forKey:"oidc-custom-scopes")
bmark.customOIDCScopes = customScopes as? String

let connection = OCConnection(bookmark: bmark)

connection.hostSimulator = OCHostSimulatorManager.shared.hostSimulator(forLocation: .accountSetup, for: self)
Expand Down
9 changes: 9 additions & 0 deletions OpenCloud/Resources/Localizable.xcstrings
Original file line number Diff line number Diff line change
Expand Up @@ -510,6 +510,9 @@
},
"Credentials" : {

},
"Custom OIDC scopes to be appended to fixed ones." : {

},
"Cut" : {

Expand Down Expand Up @@ -1240,6 +1243,12 @@
},
"Offline files use" : {

},
"OIDC Scopes" : {

},
"OIDC settings" : {

},
"OK" : {

Expand Down
39 changes: 39 additions & 0 deletions OpenCloud/Settings/OIDCSettingsSection.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
//
// OIDCSettingsSection.swift
// OpenCloud
//
// Created by Gabriele Pongelli on 26.12.2025.
//
//

/*
* Copyright (C) 2025, Gabriele Pongelli.
*
* This code is covered by the GNU Public License Version 3.
*
* For distribution utilizing Apple mechanisms please see https://opencloud.eu/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 OpenCloudSDK
import OpenCloudApp
import OpenCloudAppShared

class OIDCSettingsSection: SettingsSection {
override init(userDefaults: UserDefaults) {
super.init(userDefaults: userDefaults)

self.headerTitle = OCLocalizedString("OIDC settings", nil)

self.add(row: StaticTableViewRow(rowWithAction: { (_, _) in
}, title: OCLocalizedString("OIDC Scopes", nil), subtitle: OCLocalizedString("Custom OIDC scopes to be appended to fixed ones.", nil)))

self.add(row: StaticTableViewRow(textFieldWithAction: { (row, _, _) in
if let oidcScopes = row.value as? String {
DisplaySettings.shared.oidcCustomScopes = oidcScopes as NSString
}
}, placeholder: "Custom OIDC scopes", value: DisplaySettings.shared.oidcCustomScopes as String, autocorrectionType: UITextAutocorrectionType.no, identifier: "oidc-string"))
}
}
1 change: 1 addition & 0 deletions OpenCloud/Settings/SettingsViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ class SettingsViewController: StaticTableViewController {
self.addSection(UserInterfaceSettingsSection(userDefaults: userDefaults))
self.addSection(DataSettingsSection(userDefaults: userDefaults))
self.addSection(DisplaySettingsSection(userDefaults: userDefaults))
self.addSection(OIDCSettingsSection(userDefaults: userDefaults))
self.addSection(MediaFilesSettingsSection(userDefaults: userDefaults))

#if !DISABLE_APPSTORE_LICENSING
Expand Down
5 changes: 5 additions & 0 deletions OpenCloudAppFramework/Display Settings/DisplaySettings.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ NS_ASSUME_NONNULL_BEGIN
#pragma mark - Drag files
@property(assign,nonatomic) BOOL preventDraggingFiles;

#pragma mark - OIDC Scopes
@property(assign,nonatomic) NSString *oidcCustomScopes;

#pragma mark - Query condition
@property(nonatomic,readonly,nullable) OCQueryCondition *queryConditionForDisplaySettings;

Expand All @@ -46,6 +49,7 @@ NS_ASSUME_NONNULL_BEGIN
extern NSString *DisplaySettingsShowHiddenFilesPrefsKey; //!< The UserDefaults Key containing the BOOL value for .showHiddenFiles
extern NSString *DisplaySettingsSortFoldersFirstPrefsKey; //!< The UserDefaults Key containing the BOOL value for .sortFoldersFirst
extern NSString *DisplaySettingsPreventDraggingFilesPrefsKey; //!< The UserDefaults Key containing the BOOL value for .preventDraggingFiles
extern NSString *DisplaySettingsOIDCCustomScopesPrefsKey; //!< The UserDefaults Key containing the BOOL value for .oidcCustomScopes

extern OCIPCNotificationName OCIPCNotificationNameDisplaySettingsChanged; //!< Posted when display settings changed (internal use only)
extern NSNotificationName DisplaySettingsChanged; //!< Posted when display settings changed (for use by app + File Provider)
Expand All @@ -54,5 +58,6 @@ extern OCClassSettingsIdentifier OCClassSettingsIdentifierDisplay; //!< The cl
extern OCClassSettingsKey OCClassSettingsKeyDisplayShowHiddenFiles; //!< The class settings key for Show Hidden Files
extern OCClassSettingsKey OCClassSettingsKeyDisplaySortFoldersFirst; //!< The class settings key for sorting folders first
extern OCClassSettingsKey OCClassSettingsKeyDisplayPreventDraggingFiles; //!< The class settings key if Drag Files is enabled
extern OCClassSettingsKey OCClassSettingsKeyCustomOidcScopes; //!< The class settings key for custom OIDC scopes

NS_ASSUME_NONNULL_END
30 changes: 30 additions & 0 deletions OpenCloudAppFramework/Display Settings/DisplaySettings.m
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ - (instancetype)init
_showHiddenFiles = [self _showHiddenFilesValue];
_sortFoldersFirst = [self _sortFoldersFirst];
_preventDraggingFiles = [self _preventDraggingFilesValue];
_oidcCustomScopes = [self _oidcCustomScopesValue];
}

return (self);
Expand All @@ -114,6 +115,10 @@ - (void)_handleDisplaySettingsChanged
_preventDraggingFiles = [self _preventDraggingFilesValue];
[self didChangeValueForKey:@"preventDraggingFiles"];

[self willChangeValueForKey:@"oidcCustomScopes"];
_oidcCustomScopes = [self _oidcCustomScopesValue];
[self didChangeValueForKey:@"oidcCustomScopes"];

[[NSNotificationCenter defaultCenter] postNotificationName:DisplaySettingsChanged object:self];
}

Expand Down Expand Up @@ -189,6 +194,29 @@ - (void)setPreventDraggingFiles:(BOOL)preventDraggingFiles
[self postChangeNotifications];
}


#pragma mark - OIDC Custom Scopes
- (NSString*)_oidcCustomScopesValue
{
NSString *oidcScopes;

if ((oidcScopes = [OCAppIdentity.sharedAppIdentity.userDefaults objectForKey:DisplaySettingsOIDCCustomScopesPrefsKey]) != nil)
{
return oidcScopes;
}

return ([self classSettingForOCClassSettingsKey:OCClassSettingsKeyCustomOidcScopes]);
}

- (void)setOidcCustomScopes:(NSString*)oidcCustomScopes
{
_oidcCustomScopes = oidcCustomScopes;

[OCAppIdentity.sharedAppIdentity.userDefaults setValue:oidcCustomScopes forKey:DisplaySettingsOIDCCustomScopesPrefsKey];

[self postChangeNotifications];
}

#pragma mark - Query updating
- (void)updateQueryWithDisplaySettings:(OCQuery *)query
{
Expand Down Expand Up @@ -243,6 +271,7 @@ - (BOOL)query:(OCQuery *)query shouldIncludeItem:(OCItem *)item
NSString *DisplaySettingsShowHiddenFilesPrefsKey = @"display-show-hidden-files";
NSString *DisplaySettingsSortFoldersFirstPrefsKey = @"display-sort-folders-first";
NSString *DisplaySettingsPreventDraggingFilesPrefsKey = @"display-prevent-dragging-files";
NSString *DisplaySettingsOIDCCustomScopesPrefsKey = @"oidc-custom-scopes";

OCIPCNotificationName OCIPCNotificationNameDisplaySettingsChanged = @"org.opencloud.display-settings-changed";

Expand All @@ -252,3 +281,4 @@ - (BOOL)query:(OCQuery *)query shouldIncludeItem:(OCItem *)item
OCClassSettingsKey OCClassSettingsKeyDisplayShowHiddenFiles = @"show-hidden-files";
OCClassSettingsKey OCClassSettingsKeyDisplaySortFoldersFirst = @"sort-folders-first";
OCClassSettingsKey OCClassSettingsKeyDisplayPreventDraggingFiles = @"prevent-dragging-files";
OCClassSettingsKey OCClassSettingsKeyCustomOidcScopes = @"custom-scopes";