Skip to content

Commit

Permalink
Fix SwiftLint 0.53.0 errors
Browse files Browse the repository at this point in the history
  • Loading branch information
mvasilak committed Oct 4, 2023
1 parent 2a2eebd commit ced3371
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ class AttachmentDownloadOperation: AsynchronousOperation {
try? self.fileStorage.remove(zipFile)
// Rename unzipped file if zip contained only 1 file and the names don't match
let unzippedFiles: [File] = try self.fileStorage.contentsOfDirectory(at: file.directory)
if unzippedFiles.count == 1, let unzipped = unzippedFiles.first, (unzipped.name != file.name || unzipped.ext != file.ext) {
if unzippedFiles.count == 1, let unzipped = unzippedFiles.first, (unzipped.name != file.name) || (unzipped.ext != file.ext) {
try? self.fileStorage.move(from: unzipped, to: file)
}

Expand Down
4 changes: 2 additions & 2 deletions Zotero/Controllers/AttachmentCreator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,9 @@ struct AttachmentCreator {
var data: [(Int, String, LinkMode, Bool, Date)] = []

for (idx, child) in item.children.enumerated() {
guard (child.rawType == ItemTypes.attachment && child.syncState != .dirty && !child.trash),
guard (child.rawType == ItemTypes.attachment) && (child.syncState != .dirty) && !child.trash,
let linkMode = child.fields.first(where: { $0.key == FieldKeys.Item.Attachment.linkMode }).flatMap({ LinkMode(rawValue: $0.value) }),
(linkMode == .importedUrl || linkMode == .importedFile),
(linkMode == .importedUrl) || (linkMode == .importedFile),
let contentType = self.contentType(for: child),
AttachmentCreator.mainAttachmentContentTypes.contains(contentType) else { continue }

Expand Down
2 changes: 1 addition & 1 deletion Zotero/Controllers/SessionController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ final class SessionController: ObservableObject {
var apiToken = self.secureStorage.apiToken
var userId = self.defaults.userId

if (apiToken == nil || userId == 0),
if (apiToken == nil) || (userId == 0),
let debugUserId = DebugSessionConstants.userId,
let debugApiToken = DebugSessionConstants.apiToken {
apiToken = debugApiToken
Expand Down
2 changes: 1 addition & 1 deletion Zotero/Controllers/Sync/SyncController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -750,7 +750,7 @@ final class SyncController: SynchronizationController {
groupDefault: response.defaultGroup,
groups: response.groups)

if let group = permissions.groupDefault, (!group.library || !group.write) {
if let group = permissions.groupDefault, !group.library || !group.write {
return Single.error(SyncError.Fatal.missingGroupPermissions)
}
return Single.just((permissions, response.username, response.displayName))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1014,7 +1014,7 @@ extension ItemDetailCollectionViewHandler: UICollectionViewDelegate {

case .field(let fieldId, _):
// Tappable fields should be only tappable when not in editing mode, in case of attachment, URL is not editable, so keep it tappable even while editing.
guard (!self.viewModel.state.isEditing || self.viewModel.state.data.type == ItemTypes.attachment), let field = self.viewModel.state.data.fields[fieldId], field.isTappable else { return }
guard !self.viewModel.state.isEditing || (self.viewModel.state.data.type == ItemTypes.attachment), let field = self.viewModel.state.data.fields[fieldId], field.isTappable else { return }
switch field.key {
case FieldKeys.Item.Attachment.url:
self.observer.on(.next(.openUrl(field.value)))
Expand Down

0 comments on commit ced3371

Please sign in to comment.