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
4 changes: 4 additions & 0 deletions .swiftlint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,10 @@ only_rules:
# Prefer `last(where:)` over `filter { }.last`.
- last_where

# Trailing closing brackets/parens of literal expressions (arrays, dicts)
# should match the indentation of the line that introduced them.
- literal_expression_end_indentation

# MARK comment should be in valid format.
- mark

Expand Down
2 changes: 1 addition & 1 deletion Modules/Sources/Support/InternalDataProvider.swift
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ extension SupportDataProvider {
userWantsToTalkToHuman: true,
isWrittenByUser: false
)
])
])
}

static let supportConversationSummaries: [ConversationSummary] = [
Expand Down
10 changes: 5 additions & 5 deletions Modules/Sources/WordPressKit/PluginServiceRemote.swift
Original file line number Diff line number Diff line change
Expand Up @@ -84,36 +84,36 @@ public class PluginServiceRemote: ServiceRemoteWordPressComREST {
public func activatePlugin(pluginID: String, siteID: Int, success: @escaping () -> Void, failure: @escaping (Error) -> Void) {
let parameters = [
"active": "true"
] as [String: AnyObject]
] as [String: AnyObject]
modifyPlugin(parameters: parameters, pluginID: pluginID, siteID: siteID, success: success, failure: failure)
}

public func deactivatePlugin(pluginID: String, siteID: Int, success: @escaping () -> Void, failure: @escaping (Error) -> Void) {
let parameters = [
"active": "false"
] as [String: AnyObject]
] as [String: AnyObject]
modifyPlugin(parameters: parameters, pluginID: pluginID, siteID: siteID, success: success, failure: failure)
}

public func enableAutoupdates(pluginID: String, siteID: Int, success: @escaping () -> Void, failure: @escaping (Error) -> Void) {
let parameters = [
"autoupdate": "true"
] as [String: AnyObject]
] as [String: AnyObject]
modifyPlugin(parameters: parameters, pluginID: pluginID, siteID: siteID, success: success, failure: failure)
}

public func disableAutoupdates(pluginID: String, siteID: Int, success: @escaping () -> Void, failure: @escaping (Error) -> Void) {
let parameters = [
"autoupdate": "false"
] as [String: AnyObject]
] as [String: AnyObject]
modifyPlugin(parameters: parameters, pluginID: pluginID, siteID: siteID, success: success, failure: failure)
}

public func activateAndEnableAutoupdates(pluginID: String, siteID: Int, success: @escaping () -> Void, failure: @escaping (Error) -> Void) {
let parameters = [
"active": "true",
"autoupdate": "true"
] as [String: AnyObject]
] as [String: AnyObject]
modifyPlugin(parameters: parameters, pluginID: pluginID, siteID: siteID, success: success, failure: failure)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public extension FileManager {
URLResourceKey.isRegularFileKey,
URLResourceKey.fileAllocatedSizeKey,
URLResourceKey.totalFileAllocatedSizeKey,
]
]

// The error handler simply signals errors to outside code.
var errorDidOccur: Error?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ extension UIView {
layoutMarginsGuide.trailingAnchor.constraint(equalTo: subview.trailingAnchor),
layoutMarginsGuide.topAnchor.constraint(equalTo: subview.topAnchor),
layoutMarginsGuide.bottomAnchor.constraint(equalTo: subview.bottomAnchor)
])
])
}

/// Adds constraints that pin a subview to self's safe area with padding insets.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ open class LoginEmailViewController: LoginViewController, NUXKeyboardResponder {
stackView.addConstraints([
button.leadingAnchor.constraint(equalTo: instructionLabel.leadingAnchor),
button.trailingAnchor.constraint(equalTo: instructionLabel.trailingAnchor)
])
])

googleLoginButton = button
}
Expand All @@ -167,7 +167,7 @@ open class LoginEmailViewController: LoginViewController, NUXKeyboardResponder {
stackView.addConstraints([
button.leadingAnchor.constraint(equalTo: instructionLabel.leadingAnchor),
button.trailingAnchor.constraint(equalTo: instructionLabel.trailingAnchor)
])
])

selfHostedLoginButton = button
}
Expand Down Expand Up @@ -235,7 +235,7 @@ open class LoginEmailViewController: LoginViewController, NUXKeyboardResponder {
stackView.addConstraints([
button.leadingAnchor.constraint(equalTo: instructionLabel.leadingAnchor),
button.trailingAnchor.constraint(equalTo: instructionLabel.trailingAnchor)
])
])

wpcomSignupButton = button
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ open class LoginSocialErrorCell: UITableViewCell {
contentView.bottomAnchor.constraint(equalTo: labelStack.bottomAnchor, constant: Constants.labelVerticalMargin),
contentView.layoutMarginsGuide.leadingAnchor.constraint(equalTo: labelStack.leadingAnchor),
contentView.layoutMarginsGuide.trailingAnchor.constraint(equalTo: labelStack.trailingAnchor)
])
])

titleLabel.text = errorTitle.localizedUppercase
if let styledDescription = errorDescriptionStyled {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class SiteAssemblyServiceTests: XCTestCase {
"domain_name": "domainName.com" as AnyObject,
"product_id": 42 as AnyObject,
"supports_privacy": true as AnyObject,
]
]
siteCreator.address = try DomainSuggestion(json: domainSuggestionPayload)

creationRequest = siteCreator.build()
Expand Down
2 changes: 1 addition & 1 deletion Tests/KeystoneTests/Tests/Models/BasePostTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class BasePostTests: CoreDataTestCase {
[
try! MediaFileManager.cache.directoryURL().appendingPathComponent("thumbnail-p16-1792x1792.jpeg"),
try! MediaFileManager().directoryURL().appendingPathComponent("p16-1792x1792.jpeg")
].forEach {
].forEach {
try? "".write(to: $0, atomically: true, encoding: .utf8)
}
}
Expand Down
8 changes: 4 additions & 4 deletions WordPress/Classes/Extensions/UIView+Borders.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ extension UIView {
borderView.topAnchor.constraint(equalTo: topAnchor),
borderView.centerXAnchor.constraint(equalTo: centerXAnchor),
borderView.widthAnchor.constraint(equalTo: widthAnchor)
])
])
return borderView
}

Expand All @@ -23,7 +23,7 @@ extension UIView {
borderView.bottomAnchor.constraint(equalTo: bottomAnchor),
borderView.centerXAnchor.constraint(equalTo: centerXAnchor),
borderView.widthAnchor.constraint(equalTo: widthAnchor)
])
])
return borderView
}

Expand All @@ -36,7 +36,7 @@ extension UIView {
borderView.bottomAnchor.constraint(equalTo: bottomAnchor),
borderView.leadingAnchor.constraint(equalTo: leadingAnchor, constant: leadingMargin),
borderView.trailingAnchor.constraint(equalTo: trailingAnchor)
])
])
return borderView
}

Expand All @@ -49,7 +49,7 @@ extension UIView {
borderView.bottomAnchor.constraint(equalTo: bottomAnchor),
borderView.leadingAnchor.constraint(equalTo: leadingAnchor, constant: leadingMargin),
borderView.trailingAnchor.constraint(equalTo: trailingAnchor, constant: trailingMargin)
])
])
return borderView
}

Expand Down
2 changes: 1 addition & 1 deletion WordPress/Classes/Services/MediaCoordinator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,7 @@ class MediaCoordinator: NSObject {
"width": media.width ?? "",
"localURL": media.localURL ?? "",
"remoteURL": media.remoteURL ?? "",
])
])

self.coordinator(for: media).attach(error: nserror, toMediaID: media.uploadID)
self.fail(nserror, media: media)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ class AztecAttachmentViewController: UITableViewController {
captionRow
],
footerText: nil)
])
])
}

// MARK: - Actions
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -667,7 +667,7 @@ class AztecPostViewController: UIViewController, PostEditor {
titleTextField.trailingAnchor.constraint(equalTo: view.readableContentGuide.trailingAnchor),
titleTopConstraint,
titleHeightConstraint
])
])

let insets = titleTextField.textContainerInset

Expand All @@ -676,35 +676,35 @@ class AztecPostViewController: UIViewController, PostEditor {
titlePlaceholderLabel.rightAnchor.constraint(equalTo: titleTextField.rightAnchor, constant: -insets.right - titleTextField.textContainer.lineFragmentPadding),
titlePlaceholderLabel.topAnchor.constraint(equalTo: titleTextField.topAnchor, constant: insets.top),
titlePlaceholderLabel.heightAnchor.constraint(equalToConstant: titleTextField.font!.lineHeight)
])
])

NSLayoutConstraint.activate([
separatorView.leadingAnchor.constraint(equalTo: view.readableContentGuide.leadingAnchor),
separatorView.trailingAnchor.constraint(equalTo: view.readableContentGuide.trailingAnchor),
separatorView.topAnchor.constraint(equalTo: titleTextField.bottomAnchor),
separatorView.heightAnchor.constraint(equalToConstant: separatorView.frame.height)
])
])

NSLayoutConstraint.activate([
richTextView.leadingAnchor.constraint(equalTo: view.readableContentGuide.leadingAnchor),
richTextView.trailingAnchor.constraint(equalTo: view.readableContentGuide.trailingAnchor),
richTextView.topAnchor.constraint(equalTo: view.topAnchor),
richTextView.bottomAnchor.constraint(equalTo: view.bottomAnchor)
])
])

NSLayoutConstraint.activate([
htmlTextView.leftAnchor.constraint(equalTo: richTextView.leftAnchor),
htmlTextView.rightAnchor.constraint(equalTo: richTextView.rightAnchor),
htmlTextView.topAnchor.constraint(equalTo: richTextView.topAnchor),
htmlTextView.bottomAnchor.constraint(equalTo: richTextView.bottomAnchor)
])
])

NSLayoutConstraint.activate([
placeholderLabel.leftAnchor.constraint(equalTo: richTextView.leftAnchor, constant: insets.left + richTextView.textContainer.lineFragmentPadding),
placeholderLabel.rightAnchor.constraint(equalTo: richTextView.rightAnchor, constant: -insets.right - richTextView.textContainer.lineFragmentPadding),
textPlaceholderTopConstraint,
placeholderLabel.bottomAnchor.constraint(lessThanOrEqualTo: richTextView.bottomAnchor, constant: Constants.placeholderPadding.bottom)
])
])
}

private func configureDefaultProperties(for textView: UITextView, accessibilityLabel: String) {
Expand Down Expand Up @@ -745,7 +745,7 @@ class AztecPostViewController: UIViewController, PostEditor {
mediaProgressView.leadingAnchor.constraint(equalTo: navigationBar.leadingAnchor),
mediaProgressView.widthAnchor.constraint(equalTo: navigationBar.widthAnchor),
mediaProgressView.topAnchor.constraint(equalTo: navigationBar.bottomAnchor, constant: -mediaProgressView.frame.height)
])
])
}

func registerAttachmentImageProviders() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public class BlogDetailsSectionFooterView: UITableViewHeaderFooterView {
stackView.bottomAnchor.constraint(equalTo: contentView.readableContentGuide.bottomAnchor),
// Spacer view.
spacerView.heightAnchor.constraint(equalToConstant: 20),
])
])
updateUI(title: nil, shouldShowExtraSpacing: false)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ open class TableViewHeaderDetailView: UITableViewHeaderFooterView {
stackView.trailingAnchor.constraint(equalTo: contentView.readableContentGuide.trailingAnchor),
stackView.topAnchor.constraint(equalTo: contentView.readableContentGuide.topAnchor),
stackView.bottomAnchor.constraint(equalTo: contentView.readableContentGuide.bottomAnchor),
])
])
}

// MARK: - View Lifecycle
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ class LanguageSelectorViewController: UITableViewController, UISearchResultsUpda
}
return ImmuTable(sections: [
ImmuTableSection(rows: filtered.map(model(language:)))
])
])
}

private func modelForBrowsing() -> ImmuTable {
Expand All @@ -92,7 +92,7 @@ class LanguageSelectorViewController: UITableViewController, UISearchResultsUpda
ImmuTableSection(
headerText: NSLocalizedString("All languages", comment: "Section title for All Languages"),
rows: database.all.map(model(language:)))
])
])
}

private func model(language: Language) -> ImmuTableRow {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,8 @@ extension RegisterDomainDetailsViewModel {
editingStyle: .multipleChoice,
validationRules: [nonEmptyRule,
serverSideRule(with: Localized.ContactInformation.country)]
))]
))
]
}

static var phoneNumberRows: [RowType] {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class JetpackConnectionWebViewController: UIViewController {
let stackView = UIStackView(arrangedSubviews: [
progressView,
webView
])
])
stackView.axis = .vertical
view = stackView
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,8 @@ open class JetpackConnectionViewController: UITableViewController {
rows: [disconnectRow],
footerText: NSLocalizedString("Your site will no longer send data to WordPress.com and Jetpack features will stop working. You will lose access to the site on the app and you will have to re-add it with the site credentials.",
comment: "Explanatory text bellow the Disconnect from WordPress.com button")
)])
)
])
}

// MARK: - Row Handler
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ open class JetpackSettingsViewController: UITableViewController {
comment: "Jetpack Settings: WordPress.com Login settings"),
rows: wordPressLoginRows,
footerText: nil)
])
])
}

// MARK: Learn More footer
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class MediaCacheSettingsViewController: UITableViewController {
ImmuTable.registerRows([
TextRow.self,
BrandedNavigationRow.self
], tableView: self.tableView)
], tableView: self.tableView)

reloadViewModel()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ class PrivacySettingsViewController: UITableViewController {
ccpaLink,
otherTracking,
otherTrackingLink
]),
]),
ImmuTableSection(rows: [
reportCrashes,
reportCrashesInfoText
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ class CircularProgressView: UIView {
NSLayoutConstraint.activate([
progressIndicator.centerXAnchor.constraint(equalTo: centerXAnchor),
progressIndicator.centerYAnchor.constraint(equalTo: centerYAnchor)
])
])
}

private func configureErrorView() {
Expand All @@ -198,7 +198,7 @@ class CircularProgressView: UIView {
view.bottomAnchor.constraint(equalTo: bottomAnchor),
view.leadingAnchor.constraint(equalTo: leadingAnchor),
view.trailingAnchor.constraint(equalTo: trailingAnchor)
])
])

view.isHidden = true
}
Expand Down Expand Up @@ -272,7 +272,7 @@ final class AccessoryView: UIView {
NSLayoutConstraint.activate([
container.centerXAnchor.constraint(equalTo: centerXAnchor),
container.centerYAnchor.constraint(equalTo: centerYAnchor)
])
])
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -226,8 +226,8 @@ class PluginDirectoryViewModel: Observable {
featuredRow(presenter: presenter),
popularRow(presenter: presenter),
newRow(presenter: presenter),
]),
])
]),
])
}

public func refresh() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ class PluginListViewModel: Observable {

return ImmuTable(sections: [
ImmuTableSection(rows: rows)
])
])
}
}

Expand Down
Loading