Skip to content

Commit

Permalink
- add BookmarkComposer
Browse files Browse the repository at this point in the history
- add BookmarkSetupViewController UI for BookmarkComposer
- other improvements
  • Loading branch information
felix-schwarz committed Sep 6, 2023
1 parent 14b7ccc commit 4cf015e
Show file tree
Hide file tree
Showing 21 changed files with 1,607 additions and 48 deletions.
2 changes: 1 addition & 1 deletion ios-sdk
64 changes: 64 additions & 0 deletions ownCloud.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,11 @@
DC20DE6B21C01B210096000B /* ownCloudUI.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2393697C2076110900BCE21A /* ownCloudUI.framework */; };
DC2218C62822C5B900808BCE /* OCVFSNode+FileProviderItem.m in Sources */ = {isa = PBXBuildFile; fileRef = DC2218C52822C5B900808BCE /* OCVFSNode+FileProviderItem.m */; };
DC2218CC2823329100808BCE /* FileProviderContentEnumerator.m in Sources */ = {isa = PBXBuildFile; fileRef = DC2218CB2823329100808BCE /* FileProviderContentEnumerator.m */; };
DC2323DC2AA7B5D600BFF393 /* BookmarkComposer.swift in Sources */ = {isa = PBXBuildFile; fileRef = DC2323DB2AA7B5D600BFF393 /* BookmarkComposer.swift */; };
DC2323DE2AA7B6BB00BFF393 /* BookmarkComposerConfiguration.swift in Sources */ = {isa = PBXBuildFile; fileRef = DC2323DD2AA7B6BB00BFF393 /* BookmarkComposerConfiguration.swift */; };
DC2323E02AA7C59400BFF393 /* BookmarkSetupViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = DC2323DF2AA7C59400BFF393 /* BookmarkSetupViewController.swift */; };
DC2323E32AA85D0300BFF393 /* BookmarkSetupStepViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = DC2323E22AA85D0300BFF393 /* BookmarkSetupStepViewController.swift */; };
DC2323E62AA865A700BFF393 /* BookmarkSetupStepEnterURLViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = DC2323E52AA865A700BFF393 /* BookmarkSetupStepEnterURLViewController.swift */; };
DC23D1D9238F390A00423F62 /* OCLicenseAppStoreReceipt.m in Sources */ = {isa = PBXBuildFile; fileRef = DC23D1D7238F390200423F62 /* OCLicenseAppStoreReceipt.m */; };
DC23D1DA238F391200423F62 /* OCLicenseAppStoreReceipt.h in Headers */ = {isa = PBXBuildFile; fileRef = DC23D1D6238F390200423F62 /* OCLicenseAppStoreReceipt.h */; settings = {ATTRIBUTES = (Public, ); }; };
DC24B28725BA2A2E005783E2 /* Branding.h in Headers */ = {isa = PBXBuildFile; fileRef = DC24B27125B9DF31005783E2 /* Branding.h */; settings = {ATTRIBUTES = (Public, ); }; };
Expand Down Expand Up @@ -305,6 +310,11 @@
DC4C575D233958B70098BAE9 /* FixedHeightImageView.swift in Sources */ = {isa = PBXBuildFile; fileRef = DC4C575C233958B70098BAE9 /* FixedHeightImageView.swift */; };
DC51FD922475715F0069AB79 /* CellularSettingsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = DC51FD912475715F0069AB79 /* CellularSettingsViewController.swift */; };
DC576EC022647A070087316D /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = DC576EC222647A070087316D /* Localizable.strings */; };
DC5908752AA87A1700BFF393 /* BookmarkSetupStepEnterUsernameViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = DC5908742AA87A1700BFF393 /* BookmarkSetupStepEnterUsernameViewController.swift */; };
DC5908772AA87ABF00BFF393 /* BookmarkSetupStepAuthenticateViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = DC5908762AA87ABF00BFF393 /* BookmarkSetupStepAuthenticateViewController.swift */; };
DC59087A2AA87F6B00BFF393 /* BookmarkSetupStepFinishedViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = DC5908792AA87F6B00BFF393 /* BookmarkSetupStepFinishedViewController.swift */; };
DC59087D2AA8B82200BFF393 /* BookmarkSetupStepPrepopulateViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = DC59087C2AA8B82200BFF393 /* BookmarkSetupStepPrepopulateViewController.swift */; };
DC59087F2AA8D25400BFF393 /* CertificateSummaryView.swift in Sources */ = {isa = PBXBuildFile; fileRef = DC59087E2AA8D25400BFF393 /* CertificateSummaryView.swift */; };
DC5C48A32918FB7400EBC053 /* CollectionSidebarViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = DC5C48A22918FB7400EBC053 /* CollectionSidebarViewController.swift */; };
DC5D58FF2A7166A300BFF393 /* ThemeCSS+SystemColors.swift in Sources */ = {isa = PBXBuildFile; fileRef = DC5D58FE2A7166A300BFF393 /* ThemeCSS+SystemColors.swift */; };
DC60F2A629802ABE00905EC8 /* UINavigationItem+NavigationContent.swift in Sources */ = {isa = PBXBuildFile; fileRef = DC60F2A529802ABE00905EC8 /* UINavigationItem+NavigationContent.swift */; };
Expand Down Expand Up @@ -1219,6 +1229,11 @@
DC2218C52822C5B900808BCE /* OCVFSNode+FileProviderItem.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "OCVFSNode+FileProviderItem.m"; sourceTree = "<group>"; };
DC2218CA2823329100808BCE /* FileProviderContentEnumerator.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = FileProviderContentEnumerator.h; sourceTree = "<group>"; };
DC2218CB2823329100808BCE /* FileProviderContentEnumerator.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = FileProviderContentEnumerator.m; sourceTree = "<group>"; };
DC2323DB2AA7B5D600BFF393 /* BookmarkComposer.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BookmarkComposer.swift; sourceTree = "<group>"; };
DC2323DD2AA7B6BB00BFF393 /* BookmarkComposerConfiguration.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BookmarkComposerConfiguration.swift; sourceTree = "<group>"; };
DC2323DF2AA7C59400BFF393 /* BookmarkSetupViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BookmarkSetupViewController.swift; sourceTree = "<group>"; };
DC2323E22AA85D0300BFF393 /* BookmarkSetupStepViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BookmarkSetupStepViewController.swift; sourceTree = "<group>"; };
DC2323E52AA865A700BFF393 /* BookmarkSetupStepEnterURLViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BookmarkSetupStepEnterURLViewController.swift; sourceTree = "<group>"; };
DC23D1D6238F390200423F62 /* OCLicenseAppStoreReceipt.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = OCLicenseAppStoreReceipt.h; sourceTree = "<group>"; };
DC23D1D7238F390200423F62 /* OCLicenseAppStoreReceipt.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = OCLicenseAppStoreReceipt.m; sourceTree = "<group>"; };
DC243BF92317B446004FBB5C /* ThemeWindow.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ThemeWindow.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -1310,6 +1325,11 @@
DC4FEAE9209E48E800D4476B /* DispatchQueueTools.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DispatchQueueTools.swift; sourceTree = "<group>"; };
DC51FD912475715F0069AB79 /* CellularSettingsViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CellularSettingsViewController.swift; sourceTree = "<group>"; };
DC576EC122647A070087316D /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/Localizable.strings; sourceTree = "<group>"; };
DC5908742AA87A1700BFF393 /* BookmarkSetupStepEnterUsernameViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BookmarkSetupStepEnterUsernameViewController.swift; sourceTree = "<group>"; };
DC5908762AA87ABF00BFF393 /* BookmarkSetupStepAuthenticateViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BookmarkSetupStepAuthenticateViewController.swift; sourceTree = "<group>"; };
DC5908792AA87F6B00BFF393 /* BookmarkSetupStepFinishedViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BookmarkSetupStepFinishedViewController.swift; sourceTree = "<group>"; };
DC59087C2AA8B82200BFF393 /* BookmarkSetupStepPrepopulateViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BookmarkSetupStepPrepopulateViewController.swift; sourceTree = "<group>"; };
DC59087E2AA8D25400BFF393 /* CertificateSummaryView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CertificateSummaryView.swift; sourceTree = "<group>"; };
DC5C48A22918FB7400EBC053 /* CollectionSidebarViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CollectionSidebarViewController.swift; sourceTree = "<group>"; };
DC5D58FE2A7166A300BFF393 /* ThemeCSS+SystemColors.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "ThemeCSS+SystemColors.swift"; sourceTree = "<group>"; };
DC5D9E742496512400BFFE8E /* MessageQueueExample.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MessageQueueExample.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -2294,6 +2314,38 @@
path = "Cursor Support";
sourceTree = "<group>";
};
DC2323DA2AA7B5A100BFF393 /* Composer */ = {
isa = PBXGroup;
children = (
DC2323DB2AA7B5D600BFF393 /* BookmarkComposer.swift */,
DC2323DD2AA7B6BB00BFF393 /* BookmarkComposerConfiguration.swift */,
);
path = Composer;
sourceTree = "<group>";
};
DC2323E12AA7C59900BFF393 /* Setup */ = {
isa = PBXGroup;
children = (
DC2323DF2AA7C59400BFF393 /* BookmarkSetupViewController.swift */,
DC2323E22AA85D0300BFF393 /* BookmarkSetupStepViewController.swift */,
DC2323E72AA865DD00BFF393 /* Steps */,
);
path = Setup;
sourceTree = "<group>";
};
DC2323E72AA865DD00BFF393 /* Steps */ = {
isa = PBXGroup;
children = (
DC2323E52AA865A700BFF393 /* BookmarkSetupStepEnterURLViewController.swift */,
DC5908742AA87A1700BFF393 /* BookmarkSetupStepEnterUsernameViewController.swift */,
DC5908762AA87ABF00BFF393 /* BookmarkSetupStepAuthenticateViewController.swift */,
DC59087C2AA8B82200BFF393 /* BookmarkSetupStepPrepopulateViewController.swift */,
DC5908792AA87F6B00BFF393 /* BookmarkSetupStepFinishedViewController.swift */,
DC59087E2AA8D25400BFF393 /* CertificateSummaryView.swift */,
);
path = Steps;
sourceTree = "<group>";
};
DC23D1D0238F38DF00423F62 /* Receipt */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -3423,6 +3475,8 @@
DCF4F1612051925A00189B9A /* Bookmarks */ = {
isa = PBXGroup;
children = (
DC2323DA2AA7B5A100BFF393 /* Composer */,
DC2323E12AA7C59900BFF393 /* Setup */,
DC1B270B209CF34B004715E1 /* BookmarkViewController.swift */,
4CC46D202284C677009E938F /* BookmarkInfoViewController.swift */,
394B0CFB29F958200005CBFE /* AccountSettingsProvider.swift */,
Expand Down Expand Up @@ -4312,18 +4366,23 @@
6E4F1734217749910049A71B /* ImageDisplayViewController.swift in Sources */,
DC8EB271239308E5009148F9 /* LicenseOffersViewController.swift in Sources */,
025FC742247D5004009307A7 /* MediaUploadOperation.swift in Sources */,
DC59087A2AA87F6B00BFF393 /* BookmarkSetupStepFinishedViewController.swift in Sources */,
4C11EE5B22E88D4200B84869 /* InstantMediaUploadTaskExtension.swift in Sources */,
DC6CF7FB219446050013B9F9 /* LogSettingsViewController.swift in Sources */,
39878B7421FB1DE800DBF693 /* UINavigationController+Extension.swift in Sources */,
DC2323DC2AA7B5D600BFF393 /* BookmarkComposer.swift in Sources */,
DC82D6FA23171339001551C5 /* ScanAction.swift in Sources */,
DCC3700724D466D2008B0DEB /* DiagnosticManager.swift in Sources */,
23EC775D2137FB6B0032D4E6 /* WebViewDisplayViewController.swift in Sources */,
4C464BF12187AF1500D30602 /* PDFTocTableViewCell.swift in Sources */,
DCE4E43E24C19C3E0051722F /* Action+UserInterface.swift in Sources */,
DC2323DE2AA7B6BB00BFF393 /* BookmarkComposerConfiguration.swift in Sources */,
DC1B270C209CF34B004715E1 /* BookmarkViewController.swift in Sources */,
025FC745247EF0F1009307A7 /* BackgroundUploadsSettingsSection.swift in Sources */,
DC63208321FCAC1E007EC0A8 /* ClientActivityViewController.swift in Sources */,
DC9C1AEC247C76470067895A /* MessageGroupCell.swift in Sources */,
DC2323E32AA85D0300BFF393 /* BookmarkSetupStepViewController.swift in Sources */,
DC5908772AA87ABF00BFF393 /* BookmarkSetupStepAuthenticateViewController.swift in Sources */,
4C464BF62187AF1500D30602 /* PDFTocItem.swift in Sources */,
6E3A103E219D5BBA00F90C96 /* RenameAction.swift in Sources */,
DCDC208F23994DFB003CFF5B /* LicenseTransactionsViewController.swift in Sources */,
Expand All @@ -4340,9 +4399,11 @@
DC0030CB2350B75000BB8570 /* ScanViewController.swift in Sources */,
4C464BF42187AF1500D30602 /* PDFSearchTableViewCell.swift in Sources */,
DCD1300A23A191C000255779 /* LicenseOfferButton.swift in Sources */,
DC2323E02AA7C59400BFF393 /* BookmarkSetupViewController.swift in Sources */,
DCFEF90926EFA45A001DC7A4 /* VendorServices+App.swift in Sources */,
4C9BFA2323158C3F0059CA3E /* PreviewViewController.swift in Sources */,
399698ED260A3CEE00E5AEBA /* ImportPasteboardAction.swift in Sources */,
DC59087F2AA8D25400BFF393 /* CertificateSummaryView.swift in Sources */,
4C3E17DB234DBF9A000D7BA8 /* PendingMediaUploadTaskExtension.swift in Sources */,
DCC832DE242C0C3700153F8C /* DisplaySleepPreventer.swift in Sources */,
6E586CFC2199A72600F680C4 /* OpenInAction.swift in Sources */,
Expand All @@ -4351,6 +4412,7 @@
4C1561E8222321E0009C4EF3 /* PhotoSelectionViewController.swift in Sources */,
39CC8AE6228C12100020253B /* Array+Extension.swift in Sources */,
DCE28F602433683700879DEC /* ClientSessionManager.swift in Sources */,
DC5908752AA87A1700BFF393 /* BookmarkSetupStepEnterUsernameViewController.swift in Sources */,
3968C881239C54AC00AC28AC /* ReleaseNotesHostViewController.swift in Sources */,
394B0CFC29F958200005CBFE /* AccountSettingsProvider.swift in Sources */,
DC6428D02081406800493A01 /* CollapsibleProgressBar.swift in Sources */,
Expand Down Expand Up @@ -4419,10 +4481,12 @@
DC6C0A4929239E560045FF2A /* AppRootViewController.swift in Sources */,
02DC7C9024CB354800DCB2C6 /* ProPhotoUploadSettingsSection.swift in Sources */,
DCC832F6242CC5F700153F8C /* CardIssueMessagePresenter.swift in Sources */,
DC59087D2AA8B82200BFF393 /* BookmarkSetupStepPrepopulateViewController.swift in Sources */,
DCD1301123A23F4E00255779 /* OCLicenseManager+AppStore.swift in Sources */,
DC62514C225D254500736874 /* UploadBaseAction.swift in Sources */,
4C6B78102226B83300C5F3DB /* PhotoAlbumTableViewController.swift in Sources */,
DCDA83852A9CE6C300BFF393 /* InitialSetupViewController.swift in Sources */,
DC2323E62AA865A700BFF393 /* BookmarkSetupStepEnterURLViewController.swift in Sources */,
23EC77592137F3DD0032D4E6 /* DisplayExtension.swift in Sources */,
DCDF58B323CE82E100080BEB /* LicenseInAppPurchaseFeatureView.swift in Sources */,
DC33939622E0747400DD3DA4 /* MakeAvailableOfflineAction.swift in Sources */,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@
<EnvironmentVariable
key = "oc:log.enabled-components"
value = "[writer.stderr,writer.file,option.log-requests-and-responses]"
isEnabled = "NO">
isEnabled = "YES">
</EnvironmentVariable>
<EnvironmentVariable
key = "oc:log.colored"
Expand Down
3 changes: 2 additions & 1 deletion ownCloud/App Controllers/AppRootViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,8 @@ open class AppRootViewController: EmbeddingViewController, BrowserNavigationView
noBookmarkCondition = DataSourceCondition(.empty, with: OCBookmarkManager.shared.bookmarksDatasource, initial: true, action: { [weak self] condition in
if condition.fulfilled == true {
// No account available
self?.contentViewController = InitialSetupViewController()
self?.contentViewController = BookmarkSetupViewController(configuration: .newBookmarkConfiguration, headerTitle: "Account setup".localized)
// self?.contentViewController = InitialSetupViewController()
} else {
// Account already available
self?.contentViewController = self?.contentBrowserController
Expand Down
61 changes: 37 additions & 24 deletions ownCloud/Bookmarks/BookmarkViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1108,39 +1108,52 @@ class BookmarkViewController: StaticTableViewController {
// MARK: - Convenience for presentation
extension BookmarkViewController {
static func showBookmarkUI(on hostViewController: UIViewController, edit bookmark: OCBookmark? = nil, performContinue: Bool = false, attemptLoginOnSuccess: Bool = false, autosolveErrorOnSuccess: NSError? = nil, removeAuthDataFromCopy: Bool = true) {
var editBookmark = bookmark
if bookmark != nil {
var editBookmark = bookmark

if let bookmark {
// Retrieve latest version of bookmark from OCBookmarkManager
if let latestStoredBookmarkVersion = OCBookmarkManager.shared.bookmark(forUUIDString: bookmark.uuid.uuidString) {
editBookmark = latestStoredBookmarkVersion
if let bookmark {
// Retrieve latest version of bookmark from OCBookmarkManager
if let latestStoredBookmarkVersion = OCBookmarkManager.shared.bookmark(forUUIDString: bookmark.uuid.uuidString) {
editBookmark = latestStoredBookmarkVersion
}
}
}

let bookmarkViewController : BookmarkViewController = BookmarkViewController(editBookmark, removeAuthDataFromCopy: removeAuthDataFromCopy)
bookmarkViewController.userActionCompletionHandler = { (bookmark, success) in
if success, let bookmark = bookmark {
if let error = autosolveErrorOnSuccess as Error? {
OCMessageQueue.global.resolveIssues(forError: error, forBookmarkUUID: bookmark.uuid)
}
let bookmarkViewController : BookmarkViewController = BookmarkViewController(editBookmark, removeAuthDataFromCopy: removeAuthDataFromCopy)
bookmarkViewController.userActionCompletionHandler = { (bookmark, success) in
if success, let bookmark = bookmark {
if let error = autosolveErrorOnSuccess as Error? {
OCMessageQueue.global.resolveIssues(forError: error, forBookmarkUUID: bookmark.uuid)
}

if attemptLoginOnSuccess {
AccountConnectionPool.shared.connection(for: bookmark)?.connect()
if attemptLoginOnSuccess {
AccountConnectionPool.shared.connection(for: bookmark)?.connect()
}
}
}
}

let navigationController : ThemeNavigationController = ThemeNavigationController(rootViewController: bookmarkViewController)
navigationController.isModalInPresentation = true
let navigationController : ThemeNavigationController = ThemeNavigationController(rootViewController: bookmarkViewController)
navigationController.isModalInPresentation = true

hostViewController.present(navigationController, animated: true, completion: {
OnMainThread {
if performContinue {
bookmarkViewController.showedOAuthInfoHeader = true // needed for HTTP+OAuth2 connections to really continue on .handleContinue() call
bookmarkViewController.handleContinue()
hostViewController.present(navigationController, animated: true, completion: {
OnMainThread {
if performContinue {
bookmarkViewController.showedOAuthInfoHeader = true // needed for HTTP+OAuth2 connections to really continue on .handleContinue() call
bookmarkViewController.handleContinue()
}
}
}
})
})
} else {
let setupViewController = BookmarkSetupViewController(configuration: .newBookmarkConfiguration, headerTitle: "Add account".localized, cancelHandler: {
hostViewController.dismiss(animated: true)
}, doneHandler: { bookmark in
hostViewController.dismiss(animated: true)
if attemptLoginOnSuccess, let bookmark {
AccountConnectionPool.shared.connection(for: bookmark)?.connect()
}
})

hostViewController.present(setupViewController, animated: true, completion: nil)
}
}
}

Expand Down
Loading

0 comments on commit 4cf015e

Please sign in to comment.