Skip to content

Commit a24cc04

Browse files
committed
Replace PurchaseStatusCell with ButtonCellViewModel
1 parent 7098fe5 commit a24cc04

13 files changed

+37
-154
lines changed

Cryptomator.xcodeproj/project.pbxproj

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -440,8 +440,6 @@
440440
74F5DC1F26DD036D00AFE989 /* StoreManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74F5DC1E26DD036D00AFE989 /* StoreManager.swift */; };
441441
74FC576125ADED030003ED27 /* VaultCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74FC576025ADED030003ED27 /* VaultCell.swift */; };
442442
988E23D6223540118B002237 /* ShareVaultCoordinator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 988E23D6223540118B002238 /* ShareVaultCoordinator.swift */; };
443-
B32024D32ED0778800E82B07 /* PurchaseStatusCellViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = B32024D22ED0778800E82B07 /* PurchaseStatusCellViewModel.swift */; };
444-
B32024D42ED0778800E82B07 /* PurchaseStatusCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = B32024D12ED0778800E82B07 /* PurchaseStatusCell.swift */; };
445443
B330CB452CB5735300C21E03 /* UnauthorizedErrorViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = B330CB442CB5735000C21E03 /* UnauthorizedErrorViewController.swift */; };
446444
B34C53262D142B1000F30FE9 /* EnterSharePointURLViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = B34C53252D142B0700F30FE9 /* EnterSharePointURLViewController.swift */; };
447445
B34C53282D142B5800F30FE9 /* EnterSharePointURLViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = B34C53272D142B5400F30FE9 /* EnterSharePointURLViewModel.swift */; };
@@ -1065,8 +1063,6 @@
10651063
74F5DC1E26DD036D00AFE989 /* StoreManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StoreManager.swift; sourceTree = "<group>"; };
10661064
74FC576025ADED030003ED27 /* VaultCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = VaultCell.swift; sourceTree = "<group>"; };
10671065
988E23D6223540118B002238 /* ShareVaultCoordinator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ShareVaultCoordinator.swift; sourceTree = "<group>"; };
1068-
B32024D12ED0778800E82B07 /* PurchaseStatusCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PurchaseStatusCell.swift; sourceTree = "<group>"; };
1069-
B32024D22ED0778800E82B07 /* PurchaseStatusCellViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PurchaseStatusCellViewModel.swift; sourceTree = "<group>"; };
10701066
B330CB442CB5735000C21E03 /* UnauthorizedErrorViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UnauthorizedErrorViewController.swift; sourceTree = "<group>"; };
10711067
B34C53252D142B0700F30FE9 /* EnterSharePointURLViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EnterSharePointURLViewController.swift; sourceTree = "<group>"; };
10721068
B34C53272D142B5400F30FE9 /* EnterSharePointURLViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EnterSharePointURLViewModel.swift; sourceTree = "<group>"; };
@@ -2050,8 +2046,6 @@
20502046
740D3683266A1B180058744D /* SettingsCoordinator.swift */,
20512047
740D367D266A18DF0058744D /* SettingsViewController.swift */,
20522048
740D3681266A19150058744D /* SettingsViewModel.swift */,
2053-
B32024D12ED0778800E82B07 /* PurchaseStatusCell.swift */,
2054-
B32024D22ED0778800E82B07 /* PurchaseStatusCellViewModel.swift */,
20552049
7408E6CB26779BC200D7FAEA /* About */,
20562050
);
20572051
path = Settings;
@@ -2811,8 +2805,6 @@
28112805
4AA22C1E261CA94700A17486 /* UsernameFieldCell.swift in Sources */,
28122806
B3C397FE2EB10FC0001280AC /* ShareVaultViewController.swift in Sources */,
28132807
988E23D6223540118B002237 /* ShareVaultCoordinator.swift in Sources */,
2814-
B32024D32ED0778800E82B07 /* PurchaseStatusCellViewModel.swift in Sources */,
2815-
B32024D42ED0778800E82B07 /* PurchaseStatusCell.swift in Sources */,
28162808
4A136132276770BB0077EB7F /* SnapshotVaultListViewModel.swift in Sources */,
28172809
4AED9A79286B4DF500352951 /* S3Authenticating.swift in Sources */,
28182810
747C35172762A3F500E4CA28 /* AttributedTextHeaderFooterViewModel.swift in Sources */,

Cryptomator/AddVault/OpenExistingVault/OpenExistingVaultChooseFolderViewController.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ class OpenExistingVaultChooseFolderViewController: ChooseFolderViewController {
4545

4646
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
4747
if viewModel.foundMasterkey {
48-
let cell = addVaultButtonViewModel.type.init()
48+
let cell = addVaultButtonViewModel.type.init(style: addVaultButtonViewModel.cellStyle, reuseIdentifier: nil)
4949
cell.configure(with: addVaultButtonViewModel)
5050
return cell
5151
} else {

Cryptomator/Common/Cells/BindableTableViewCellViewModel.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,10 @@ class TableViewCellViewModel: Hashable {
3939
fatalError("not implemented")
4040
}
4141

42+
var cellStyle: UITableViewCell.CellStyle {
43+
return .default
44+
}
45+
4246
private let identifier = UUID()
4347

4448
static func == (lhs: TableViewCellViewModel, rhs: TableViewCellViewModel) -> Bool {

Cryptomator/Common/Cells/ButtonCellViewModel.swift

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,16 @@
99
import UIKit
1010

1111
class ButtonCellViewModel<T>: BindableTableViewCellViewModel {
12-
override var type: ConfigurableTableViewCell.Type { ButtonTableViewCell.self }
12+
private let preferredCellStyle: UITableViewCell.CellStyle
13+
override var cellStyle: UITableViewCell.CellStyle { preferredCellStyle }
1314
let action: T
14-
init(action: T, title: String, titleTextColor: UIColor? = .cryptomatorPrimary, detailTitle: String? = nil, isEnabled: Bool = true, selectionStyle: UITableViewCell.SelectionStyle = .default, accessoryType: UITableViewCell.AccessoryType = .none) {
15+
init(action: T, title: String, titleTextColor: UIColor? = .cryptomatorPrimary, detailTitle: String? = nil, image: UIImage? = nil, isEnabled: Bool = true, selectionStyle: UITableViewCell.SelectionStyle = .default, accessoryType: UITableViewCell.AccessoryType = .none, cellStyle: UITableViewCell.CellStyle = .value1) {
1516
self.action = action
16-
super.init(title: title, titleTextColor: titleTextColor, detailTitle: detailTitle, isEnabled: isEnabled, selectionStyle: selectionStyle, accessoryType: accessoryType)
17+
self.preferredCellStyle = cellStyle
18+
super.init(title: title, titleTextColor: titleTextColor, detailTitle: detailTitle, image: image, isEnabled: isEnabled, selectionStyle: selectionStyle, accessoryType: accessoryType)
1719
}
1820

19-
static func createDisclosureButton(action: T, title: String, detailTitle: String? = nil, accessoryType: UITableViewCell.AccessoryType = .disclosureIndicator, isEnabled: Bool = true) -> ButtonCellViewModel<T> {
20-
return ButtonCellViewModel(action: action, title: title, titleTextColor: nil, detailTitle: detailTitle, isEnabled: isEnabled, accessoryType: accessoryType)
21-
}
22-
}
23-
24-
class ButtonTableViewCell: TableViewCell {
25-
override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
26-
super.init(style: .value1, reuseIdentifier: reuseIdentifier)
21+
static func createDisclosureButton(action: T, title: String, detailTitle: String? = nil, image: UIImage? = nil, accessoryType: UITableViewCell.AccessoryType = .disclosureIndicator, isEnabled: Bool = true, cellStyle: UITableViewCell.CellStyle = .value1) -> ButtonCellViewModel<T> {
22+
return ButtonCellViewModel(action: action, title: title, titleTextColor: nil, detailTitle: detailTitle, image: image, isEnabled: isEnabled, accessoryType: accessoryType, cellStyle: cellStyle)
2723
}
2824
}

Cryptomator/Common/Cells/LoadingButtonCell.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
import UIKit
1010

11-
class LoadingButtonCell: ButtonTableViewCell {
11+
class LoadingButtonCell: TableViewCell {
1212
private lazy var loadingIndicator: UIActivityIndicatorView = {
1313
let loadingIndicator = UIActivityIndicatorView(style: .medium)
1414
loadingIndicator.hidesWhenStopped = true

Cryptomator/Common/Cells/SystemSymbolButtonCell.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
import Foundation
1010
import UIKit
1111

12-
class SystemSymbolButtonCell: ButtonTableViewCell {
12+
class SystemSymbolButtonCell: TableViewCell {
1313
override func configure(with viewModel: TableViewCellViewModel) {
1414
super.configure(with: viewModel)
1515
guard let viewModel = viewModel as? SystemSymbolNameProviding else {

Cryptomator/Common/ChooseFolder/CreateNewFolderViewController.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class CreateNewFolderViewController: SingleSectionStaticUITableViewController {
3535

3636
override func configureDataSource() {
3737
dataSource = BaseDiffableDataSource<SingleSection, TableViewCellViewModel>(viewModel: viewModel, tableView: tableView) { _, _, cellViewModel -> UITableViewCell? in
38-
let cell = cellViewModel.type.init()
38+
let cell = cellViewModel.type.init(style: cellViewModel.cellStyle, reuseIdentifier: nil)
3939
cell.configure(with: cellViewModel)
4040
if let textFieldCell = cell as? TextFieldCell {
4141
let imageConfiguration = UIImage.SymbolConfiguration(font: UIFont.preferredFont(forTextStyle: .title2))

Cryptomator/Common/StaticUITableViewController.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ class StaticUITableViewController<SectionType: Hashable>: BaseUITableViewControl
2727

2828
func configureDataSource() {
2929
dataSource = BaseDiffableDataSource<SectionType, TableViewCellViewModel>(viewModel: viewModel, tableView: tableView) { _, _, cellViewModel -> UITableViewCell? in
30-
let cell = cellViewModel.type.init()
30+
let cell = cellViewModel.type.init(style: cellViewModel.cellStyle, reuseIdentifier: nil)
3131
cell.configure(with: cellViewModel)
3232
return cell
3333
}

Cryptomator/Settings/PurchaseStatusCell.swift

Lines changed: 0 additions & 77 deletions
This file was deleted.

Cryptomator/Settings/PurchaseStatusCellViewModel.swift

Lines changed: 0 additions & 24 deletions
This file was deleted.

0 commit comments

Comments
 (0)