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/more #106

Merged
merged 13 commits into from
Sep 3, 2018
Merged
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
2 changes: 1 addition & 1 deletion ios-sdk
Submodule ios-sdk updated 71 files
+0 −11 Example/Ocean/ViewController.m
+84 −4 ownCloudSDK.xcodeproj/project.pbxproj
+1 −1 ownCloudSDK/Authentication/OCAuthenticationMethod.h
+14 −6 ownCloudSDK/Connection/OCConnection.h
+313 −17 ownCloudSDK/Connection/OCConnection.m
+10 −0 ownCloudSDK/Connection/OCConnectionDAVRequest.h
+22 −2 ownCloudSDK/Connection/OCConnectionDAVRequest.m
+2 −0 ownCloudSDK/Connection/OCConnectionQueue.h
+52 −3 ownCloudSDK/Connection/OCConnectionQueue.m
+19 −0 ownCloudSDK/Connection/OCConnectionRequest.h
+10 −0 ownCloudSDK/Connection/OCConnectionRequest.m
+1 −1 ownCloudSDK/Core/Commands/OCCore+CommandCopyMove.m
+1 −1 ownCloudSDK/Core/Commands/OCCore+CommandCreateFolder.m
+38 −2 ownCloudSDK/Core/Commands/OCCore+CommandDelete.m
+204 −0 ownCloudSDK/Core/Commands/OCCore+CommandDownload.m
+36 −0 ownCloudSDK/Core/Commands/OCCore+CommandLocalCreation.m
+35 −0 ownCloudSDK/Core/Commands/OCCore+CommandLocalModification.m
+38 −0 ownCloudSDK/Core/Files/OCCore+Download.m
+33 −0 ownCloudSDK/Core/ItemList/OCCore+ItemList.h
+701 −0 ownCloudSDK/Core/ItemList/OCCore+ItemList.m
+4 −16 ownCloudSDK/Core/ItemList/OCCoreItemListTask.m
+7 −0 ownCloudSDK/Core/OCCore+FileProvider.h
+181 −0 ownCloudSDK/Core/OCCore+FileProvider.m
+3 −7 ownCloudSDK/Core/OCCore+Internal.h
+2 −0 ownCloudSDK/Core/OCCore+SyncEngine.h
+368 −245 ownCloudSDK/Core/OCCore+SyncEngine.m
+26 −12 ownCloudSDK/Core/OCCore.h
+31 −540 ownCloudSDK/Core/OCCore.m
+8 −2 ownCloudSDK/Core/Sync/OCCoreSyncContext.h
+28 −10 ownCloudSDK/Core/Sync/OCCoreSyncContext.m
+3 −0 ownCloudSDK/Core/Sync/OCCoreSyncRoute.h
+8 −1 ownCloudSDK/Core/Sync/OCCoreSyncRoute.m
+5 −0 ownCloudSDK/Core/Sync/OCSyncRecord.h
+38 −0 ownCloudSDK/Core/Sync/OCSyncRecord.m
+8 −0 ownCloudSDK/Events/OCEvent.h
+3 −0 ownCloudSDK/Events/OCEvent.m
+39 −0 ownCloudSDK/Extensions/OCExtension.h
+33 −0 ownCloudSDK/Extensions/OCExtension.m
+28 −0 ownCloudSDK/Extensions/OCExtensionContext.h
+23 −0 ownCloudSDK/Extensions/OCExtensionContext.m
+28 −0 ownCloudSDK/Extensions/OCExtensionLocation.h
+23 −0 ownCloudSDK/Extensions/OCExtensionLocation.m
+35 −0 ownCloudSDK/Extensions/OCExtensionManager.h
+47 −0 ownCloudSDK/Extensions/OCExtensionManager.m
+30 −0 ownCloudSDK/Extensions/OCExtensionTypes.h
+29 −0 ownCloudSDK/Item/Images/OCItem+OCThumbnail.h
+37 −0 ownCloudSDK/Item/Images/OCItem+OCThumbnail.m
+4 −0 ownCloudSDK/Item/Images/OCItemThumbnail.h
+2 −0 ownCloudSDK/Item/Images/OCItemThumbnail.m
+19 −4 ownCloudSDK/Item/OCItem.h
+64 −0 ownCloudSDK/Item/OCItem.m
+4 −0 ownCloudSDK/Resource Management/OCCoreManager.h
+7 −0 ownCloudSDK/Resource Management/OCCoreManager.m
+17 −0 ownCloudSDK/Resources/en.lproj/Localizable.strings
+ ownCloudSDK/Resources/eu.lproj/Localizable.strings
+24 −5 ownCloudSDK/Toolkit/OCReachabilityMonitor.m
+37 −28 ownCloudSDK/Vaults/Database/OCDatabase+Schemas.m
+4 −2 ownCloudSDK/Vaults/Database/OCDatabase.h
+44 −4 ownCloudSDK/Vaults/Database/OCDatabase.m
+6 −0 ownCloudSDK/Vaults/OCVault.h
+33 −1 ownCloudSDK/Vaults/OCVault.m
+1 −0 ownCloudSDK/ownCloudSDK.h
+9 −7 ownCloudSDKTests/AuthenticationTests.m
+261 −6 ownCloudSDKTests/ConnectionTests.m
+16 −15 ownCloudSDKTests/CoreSyncTests.m
+13 −11 ownCloudSDKTests/CoreTests.m
+4 −3 ownCloudSDKTests/HostSimulatorTests.m
+22 −0 ownCloudSDKTests/OCTestTarget.h
+43 −0 ownCloudSDKTests/OCTestTarget.m
+ ownCloudSDKTests/rainbow.png
+ ownCloudUI/Resources/ru.lproj/Localizable.strings
52 changes: 41 additions & 11 deletions ownCloud.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
objects = {

/* Begin PBXBuildFile section */
232B01F42126B0CE00366FA0 /* MoreViewHeader.swift in Sources */ = {isa = PBXBuildFile; fileRef = 232B01F32126B0CE00366FA0 /* MoreViewHeader.swift */; };
232B01F62126B10900366FA0 /* MoreStaticTableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 232B01F52126B10900366FA0 /* MoreStaticTableViewController.swift */; };
232F7CAD2097140300EE22E4 /* UploadsSettingsSection.swift in Sources */ = {isa = PBXBuildFile; fileRef = 232F7CAC2097140300EE22E4 /* UploadsSettingsSection.swift */; };
232F7CAF2097260400EE22E4 /* SettingsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 232F7CAE2097260400EE22E4 /* SettingsViewController.swift */; };
233BDEA0204FEFE500C06732 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 233BDE9F204FEFE500C06732 /* AppDelegate.swift */; };
Expand All @@ -15,12 +17,16 @@
233BDEB5204FEFE500C06732 /* OwnCloudTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 233BDEB4204FEFE500C06732 /* OwnCloudTests.swift */; };
233E0FD82099F11D00C3D8D5 /* SecuritySettingsSection.swift in Sources */ = {isa = PBXBuildFile; fileRef = 233E0FD72099F11D00C3D8D5 /* SecuritySettingsSection.swift */; };
2347446A20761BB700859C93 /* String+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2347446920761BB700859C93 /* String+Extension.swift */; };
236735A621217C3500E5834A /* MoreViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 236735A521217C3500E5834A /* MoreViewController.swift */; };
23957A6D209AFFE8003C8537 /* MoreSettingsSection.swift in Sources */ = {isa = PBXBuildFile; fileRef = 23957A6C209AFFE8003C8537 /* MoreSettingsSection.swift */; };
239F1319205A693A0029F186 /* UIColor+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 239F1318205A693A0029F186 /* UIColor+Extension.swift */; };
239F437E20D0EE6300B1276D /* icon-search.tvg in Resources */ = {isa = PBXBuildFile; fileRef = 239F437D20D0EE6300B1276D /* icon-search.tvg */; };
23BEF1182076667F00DD2E6F /* IssuesViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 23BEF1172076667F00DD2E6F /* IssuesViewController.swift */; };
23C56537212167BE00BD4B47 /* CardPresentationController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 23C5652F212167BD00BD4B47 /* CardPresentationController.swift */; };
23C56538212167BE00BD4B47 /* CardTransitionDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 23C56536212167BE00BD4B47 /* CardTransitionDelegate.swift */; };
23D0E09E205BCF8D002D7C80 /* ownCloudUI.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 230B84F020597F6E00C9F828 /* ownCloudUI.framework */; };
23D0E09F205BCF8D002D7C80 /* ownCloudUI.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = 230B84F020597F6E00C9F828 /* ownCloudUI.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
23D77FCD212BFBD100DE76F1 /* NamingViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 23D77FC6212BFBD100DE76F1 /* NamingViewController.swift */; };
23E22BB720C6A5C40024D11E /* UIDevice+UIUserInterfaceIdiom.swift in Sources */ = {isa = PBXBuildFile; fileRef = 23E22BB220C6A5C40024D11E /* UIDevice+UIUserInterfaceIdiom.swift */; };
23F6238120B587EF004FDE8B /* SortMethod.swift in Sources */ = {isa = PBXBuildFile; fileRef = 23F6238020B587EF004FDE8B /* SortMethod.swift */; };
23FA23E620BFD3D8009A6D73 /* SortBar.swift in Sources */ = {isa = PBXBuildFile; fileRef = 23FA23E520BFD3D8009A6D73 /* SortBar.swift */; };
Expand All @@ -33,7 +39,6 @@
597A404920AD59EF00B028B2 /* AppLockWindow.swift in Sources */ = {isa = PBXBuildFile; fileRef = 597A404820AD59EF00B028B2 /* AppLockWindow.swift */; };
59D4895220C83F2E00369C2E /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 59D4895420C83F2E00369C2E /* InfoPlist.strings */; };
6D107AA0B21417432C72755A /* EarlGrey.swift in Sources */ = {isa = PBXBuildFile; fileRef = D7F3B3E74D4B04F9CAF95C09 /* EarlGrey.swift */; };
6E216A642112F58700ED21BD /* NamingViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6E216A632112F58700ED21BD /* NamingViewController.swift */; };
6E83C77E20A32C1B0066EC23 /* SettingsSection.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6E83C77D20A32C1B0066EC23 /* SettingsSection.swift */; };
6E83C78420A33C180066EC23 /* LAContext+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6E83C78320A33C180066EC23 /* LAContext+Extension.swift */; };
6EB8EDC52114358400C2BF44 /* folder-create.tvg in Resources */ = {isa = PBXBuildFile; fileRef = 6EB8EDBE2114358300C2BF44 /* folder-create.tvg */; };
Expand Down Expand Up @@ -278,6 +283,8 @@

/* Begin PBXFileReference section */
05D694726A3BC5C5FE8AECB9 /* Pods-ownCloudTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-ownCloudTests.debug.xcconfig"; path = "Pods/Target Support Files/Pods-ownCloudTests/Pods-ownCloudTests.debug.xcconfig"; sourceTree = "<group>"; };
232B01F32126B0CE00366FA0 /* MoreViewHeader.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MoreViewHeader.swift; sourceTree = "<group>"; };
232B01F52126B10900366FA0 /* MoreStaticTableViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MoreStaticTableViewController.swift; sourceTree = "<group>"; };
232F7CAC2097140300EE22E4 /* UploadsSettingsSection.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UploadsSettingsSection.swift; sourceTree = "<group>"; };
232F7CAE2097260400EE22E4 /* SettingsViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingsViewController.swift; sourceTree = "<group>"; };
233BDE9C204FEFE500C06732 /* ownCloud.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = ownCloud.app; sourceTree = BUILT_PRODUCTS_DIR; };
Expand All @@ -291,10 +298,14 @@
233BDEBF204FEFF300C06732 /* ownCloudSDK.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = ownCloudSDK.xcodeproj; path = "ios-sdk/ownCloudSDK.xcodeproj"; sourceTree = "<group>"; };
233E0FD72099F11D00C3D8D5 /* SecuritySettingsSection.swift */ = {isa = PBXFileReference; indentWidth = 8; lastKnownFileType = sourcecode.swift; path = SecuritySettingsSection.swift; sourceTree = "<group>"; tabWidth = 8; usesTabs = 1; };
2347446920761BB700859C93 /* String+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "String+Extension.swift"; sourceTree = "<group>"; };
236735A521217C3500E5834A /* MoreViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MoreViewController.swift; sourceTree = "<group>"; };
23957A6C209AFFE8003C8537 /* MoreSettingsSection.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MoreSettingsSection.swift; sourceTree = "<group>"; };
239F1318205A693A0029F186 /* UIColor+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIColor+Extension.swift"; sourceTree = "<group>"; };
239F437D20D0EE6300B1276D /* icon-search.tvg */ = {isa = PBXFileReference; lastKnownFileType = text; path = "icon-search.tvg"; sourceTree = "<group>"; };
23BEF1172076667F00DD2E6F /* IssuesViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = IssuesViewController.swift; sourceTree = "<group>"; };
23C5652F212167BD00BD4B47 /* CardPresentationController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CardPresentationController.swift; sourceTree = "<group>"; };
23C56536212167BE00BD4B47 /* CardTransitionDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CardTransitionDelegate.swift; sourceTree = "<group>"; };
23D77FC6212BFBD100DE76F1 /* NamingViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NamingViewController.swift; sourceTree = "<group>"; };
23E22BB220C6A5C40024D11E /* UIDevice+UIUserInterfaceIdiom.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UIDevice+UIUserInterfaceIdiom.swift"; sourceTree = "<group>"; };
23F6238020B587EF004FDE8B /* SortMethod.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SortMethod.swift; sourceTree = "<group>"; };
23FA23E520BFD3D8009A6D73 /* SortBar.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SortBar.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -498,10 +509,31 @@
name = Products;
sourceTree = "<group>";
};
2366821521144DCD0045EF72 /* Card Presentation Controller */ = {
isa = PBXGroup;
children = (
23C5652F212167BD00BD4B47 /* CardPresentationController.swift */,
23C56536212167BE00BD4B47 /* CardTransitionDelegate.swift */,
);
path = "Card Presentation Controller";
sourceTree = "<group>";
};
236735A421217C2300E5834A /* Actions */ = {
isa = PBXGroup;
children = (
236735A521217C3500E5834A /* MoreViewController.swift */,
232B01F32126B0CE00366FA0 /* MoreViewHeader.swift */,
232B01F52126B10900366FA0 /* MoreStaticTableViewController.swift */,
23D77FC6212BFBD100DE76F1 /* NamingViewController.swift */,
);
path = Actions;
sourceTree = "<group>";
};
2393696F207610F700BCE21A /* Recovered References */ = {
isa = PBXGroup;
children = (
230B84F020597F6E00C9F828 /* ownCloudUI.framework */,
6E216A632112F58700ED21BD /* NamingViewController.swift */,
);
name = "Recovered References";
sourceTree = "<group>";
Expand Down Expand Up @@ -561,14 +593,6 @@
name = Pods;
sourceTree = "<group>";
};
6E216A5C2112F55E00ED21BD /* Actions */ = {
isa = PBXGroup;
children = (
6E216A632112F58700ED21BD /* NamingViewController.swift */,
);
path = Actions;
sourceTree = "<group>";
};
DC1B26FD209CF0D2004715E1 /* Issues Animators */ = {
isa = PBXGroup;
children = (
Expand All @@ -590,7 +614,7 @@
DC3BE0DB2077CC13002A0AC0 /* Client */ = {
isa = PBXGroup;
children = (
6E216A5C2112F55E00ED21BD /* Actions */,
236735A421217C2300E5834A /* Actions */,
DCFED971208095E200A2D984 /* ClientItemCell.swift */,
DC3BE0DC2077CC13002A0AC0 /* ClientQueryViewController.swift */,
DC3BE0DD2077CC13002A0AC0 /* ClientRootViewController.swift */,
Expand Down Expand Up @@ -778,6 +802,7 @@
DCF4F1622051927200189B9A /* UI Elements */ = {
isa = PBXGroup;
children = (
2366821521144DCD0045EF72 /* Card Presentation Controller */,
DCF4F17820519F8C00189B9A /* StaticTableViewController.swift */,
DCF4F17A20519F9D00189B9A /* StaticTableViewSection.swift */,
DCF4F17E2051A0D000189B9A /* StaticTableViewRow.swift */,
Expand Down Expand Up @@ -1161,6 +1186,7 @@
DC3BE0DF2077CC14002A0AC0 /* ClientRootViewController.swift in Sources */,
DC1B2709209CF0D3004715E1 /* CertificateViewController.swift in Sources */,
DC136582208223F000FC0F60 /* OCBookmark+Extension.swift in Sources */,
23D77FCD212BFBD100DE76F1 /* NamingViewController.swift in Sources */,
23FA23E620BFD3D8009A6D73 /* SortBar.swift in Sources */,
6E83C78420A33C180066EC23 /* LAContext+Extension.swift in Sources */,
593BAB46209AE1BC00023634 /* PasscodeViewController.swift in Sources */,
Expand All @@ -1174,12 +1200,13 @@
232F7CAF2097260400EE22E4 /* SettingsViewController.swift in Sources */,
DC85572C20513B8C00189B9A /* ServerListTableViewController.swift in Sources */,
233BDEA0204FEFE500C06732 /* AppDelegate.swift in Sources */,
236735A621217C3500E5834A /* MoreViewController.swift in Sources */,
23957A6D209AFFE8003C8537 /* MoreSettingsSection.swift in Sources */,
DCF4F1822051A94200189B9A /* GlobalSettingsViewController.swift in Sources */,
232B01F62126B10900366FA0 /* MoreStaticTableViewController.swift in Sources */,
593BAB97209F8A0500023634 /* AppLockManager.swift in Sources */,
DCFED972208095E200A2D984 /* ClientItemCell.swift in Sources */,
23E22BB720C6A5C40024D11E /* UIDevice+UIUserInterfaceIdiom.swift in Sources */,
6E216A642112F58700ED21BD /* NamingViewController.swift in Sources */,
23F6238120B587EF004FDE8B /* SortMethod.swift in Sources */,
239F1319205A693A0029F186 /* UIColor+Extension.swift in Sources */,
DC3BE0E12077CD4B002A0AC0 /* Synchronized.swift in Sources */,
Expand All @@ -1189,14 +1216,17 @@
DC42244C207CAFBB0006A2A6 /* ThemeCollection.swift in Sources */,
DCFED9BA20809B8900A2D984 /* ThemeTVGResource.swift in Sources */,
DC3BE0DE2077CC14002A0AC0 /* ClientQueryViewController.swift in Sources */,
23C56538212167BE00BD4B47 /* CardTransitionDelegate.swift in Sources */,
DC1B270A209CF0D3004715E1 /* ConnectionIssueViewController.swift in Sources */,
DC0B37972051681600189B9A /* ThemeButton.swift in Sources */,
DCF4F17B20519F9D00189B9A /* StaticTableViewSection.swift in Sources */,
23C56537212167BE00BD4B47 /* CardPresentationController.swift in Sources */,
DC7DBA2B207F71E400E7337D /* VectorImageView.swift in Sources */,
DCE974BC207EACA60069FC2B /* UIImage+Extension.swift in Sources */,
DC1B2707209CF0D3004715E1 /* IssuesDismissalAnimator.swift in Sources */,
23BEF1182076667F00DD2E6F /* IssuesViewController.swift in Sources */,
DC85980620D85EE600A433C6 /* AsyncSequentialQueue.swift in Sources */,
232B01F42126B0CE00366FA0 /* MoreViewHeader.swift in Sources */,
DCF4F17F2051A0D000189B9A /* StaticTableViewRow.swift in Sources */,
DC321261207EB01B00DB171D /* ThemeImage.swift in Sources */,
DC7DBA54207FA80C00E7337D /* TVGImage.swift in Sources */,
Expand Down
4 changes: 2 additions & 2 deletions ownCloud/Bookmarks/BookmarkViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -497,7 +497,7 @@ class BookmarkViewController: StaticTableViewController {
removeRows.append(tokenInfoRow!)
}

if !authenticationMethodClass.usesUserName() {
if !authenticationMethodClass.usesUserName {
removeRows.append(usernameRow!)
}

Expand Down Expand Up @@ -530,7 +530,7 @@ class BookmarkViewController: StaticTableViewController {
credentialsSection?.insert(row: passwordRow!, at: 0, animated: animated)
}

if authenticationMethodClass.usesUserName() {
if authenticationMethodClass.usesUserName {
if usernameRow?.attached == false {
credentialsSection?.insert(row: usernameRow!, at: 0, animated: animated)
}
Expand Down
87 changes: 87 additions & 0 deletions ownCloud/Client/Actions/MoreStaticTableViewController.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
//
// MoreStaticTableViewController.swift
// ownCloud
//
// Created by Pablo Carrascal on 17/08/2018.
// Copyright © 2018 ownCloud GmbH. All rights reserved.
//

/*
* Copyright (C) 2018, 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 <http://www.gnu.org/licenses/gpl-3.0.en.html>.
*
*/

import UIKit

class MoreStaticTableViewController: StaticTableViewController {

private var themeApplierTokens: [ThemeApplierToken]

override init(style: UITableViewStyle) {
themeApplierTokens = []
super.init(style: style)
}

deinit {
themeApplierTokens.forEach({
Theme.shared.remove(applierForToken: $0)
})
}

required init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}

override func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
if let title = (sections[section] as? MoreStaticTableViewSection)?.headerAttributedTitle {
let containerView = UIView()
let label = UILabel()
label.translatesAutoresizingMaskIntoConstraints = false
containerView.addSubview(label)
NSLayoutConstraint.activate([
label.leftAnchor.constraint(equalTo: containerView.safeAreaLayoutGuide.leftAnchor, constant: 20),
label.topAnchor.constraint(equalTo: containerView.topAnchor, constant: 10),
label.bottomAnchor.constraint(equalTo: containerView.bottomAnchor, constant: -10),
label.rightAnchor.constraint(equalTo: containerView.safeAreaLayoutGuide.rightAnchor, constant: -20)
])

label.attributedText = title

let messageApplierToken = Theme.shared.add(applier: { (_, collection, _) in
label.applyThemeCollection(collection)
})

themeApplierTokens.append(messageApplierToken)

return containerView
}

return nil
}

override func applyThemeCollection(theme: Theme, collection: ThemeCollection, event: ThemeEvent) {
super.applyThemeCollection(theme: theme, collection: collection, event: event)
self.tableView.separatorColor = self.tableView.backgroundColor
}
}

class MoreStaticTableViewSection : StaticTableViewSection {
public var headerAttributedTitle : NSAttributedString?
public var footerAttributedTitle : NSAttributedString?

convenience init(headerAttributedTitle theHeaderTitle: NSAttributedString, footerAttributedTitle theFooterTitle: NSAttributedString? = nil, identifier : String? = nil, rows rowsToAdd: [StaticTableViewRow] = Array()) {
self.init()

self.headerAttributedTitle = theHeaderTitle
self.footerAttributedTitle = theFooterTitle

self.identifier = identifier

self.add(rows: rowsToAdd)
}
}
Loading