Fix iOS 13 depraction, fix Swiftlint and Danger on PRs by Kaspik · Pull Request #1715 · MessageKit/MessageKit · GitHub
Skip to content
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
23 changes: 8 additions & 15 deletions .github/workflows/danger.yml
67 changes: 67 additions & 0 deletions .swiftlint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
disabled_rules:
- trailing_whitespace
- file_length
- line_length
- type_body_length
- identifier_name
- function_parameter_count
- switch_case_alignment
- orphaned_doc_comment
- inclusive_language
- multiple_closures_with_trailing_closure

opt_in_rules:
- force_unwrapping
- implicitly_unwrapped_optional
- conditional_returns_on_newline
- empty_count
- empty_string
- extension_access_modifier
- closure_spacing
- fatal_error_message
- first_where
- toggle_bool
- unused_declaration
- modifier_order
- contains_over_first_not_nil
- convenience_type
- fallthrough
- unused_import
- unavailable_function
- strict_fileprivate
- explicit_init
- anyobject_protocol
- switch_case_on_newline
- contains_over_range_nil_comparison
- contains_over_filter_count
- contains_over_filter_is_empty
- empty_collection_literal
- flatmap_over_map_reduce
- no_space_in_method_call

excluded:
- Tests
- Vendor
- Scripts
- fastlane
- "DerivedData/**/*"
- "**/.build"
- "**/Package.swift"

function_body_length: 120
type_name:
min_length: 3
max_length: 60
identifier_name:
min_length: 3
max_length: 60
cyclomatic_complexity: 30
large_tuple:
warning: 4
error: 5
implicitly_unwrapped_optional:
mode: all_except_iboutlets

colon:
flexible_right_spacing: false
apply_to_dictionaries: true
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ See [MIGRATION_GUIDE.md](https://github.com/MessageKit/MessageKit/blob/main/Docu

### Fixed

- Fixed iOS 13 deprecation warnings [#1715](https://github.com/MessageKit/MessageKit/pull/1715) by [@kaspik](https://github.com/Kaspik)

### Removed

- NSConstraintLayoutSet.swift [#1700](https://github.com/MessageKit/MessageKit/pull/1700) by [@martinpucik](https://github.com/martinpucik)
Expand Down
11 changes: 8 additions & 3 deletions Dangerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#
# MIT License
#
# Copyright (c) 2017-2020 MessageKit
# Copyright (c) 2017-2022 MessageKit
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
Expand Down Expand Up @@ -29,6 +29,11 @@ if mergeable_state == "draft"
warn("PR is marked as Draft")
end

# Make it more obvious that a PR is a work in progress and shouldn't be merged yet
if github.pr_title.include? "[WIP]"
warn("PR is marked as Work in Progress")
end

# Mainly to encourage writing up some reasoning about the PR, rather than just leaving a title
if github.pr_body.length < 5
fail("Please provide a summary in the Pull Request description")
Expand All @@ -42,9 +47,9 @@ end

# Warn when there is a big PR
if git.lines_of_code > 1000
warn("Big Pull Request - Please consider splitting up your changes into smaller Pull Requests.")
warn("Big Pull Request - Please consider splitting up your changes into smaller Pull Requests.")
end

swiftlint.config_file = '.swiftlint.yml'
swiftlint.binary_path = 'Example/Pods/SwiftLint/swiftlint'
swiftlint.binary_path = 'bin/swiftlint'
swiftlint.lint_files inline_mode:true, fail_on_error:true
9 changes: 5 additions & 4 deletions Sources/Controllers/MessagesViewController+Menu.swift
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,11 @@ internal extension MessagesViewController {
selectedIndexPathForMenu = nil
}

currentMenuController.setMenuVisible(false, animated: false)
currentMenuController.hideMenu()

guard let selectedCell = messagesCollectionView.cellForItem(at: selectedIndexPath) as? MessageContentCell else { return }
guard let selectedCell = messagesCollectionView.cellForItem(at: selectedIndexPath) as? MessageContentCell else {
return
}
let selectedCellMessageBubbleFrame = selectedCell.convert(selectedCell.messageContainerView.frame, to: view)

var messageInputBarFrame: CGRect = .zero
Expand Down Expand Up @@ -85,8 +87,7 @@ internal extension MessagesViewController {
currentMenuController.arrowDirection = .up
}

currentMenuController.setTargetRect(targetRect, in: view)
currentMenuController.setMenuVisible(true, animated: true)
currentMenuController.showMenu(from: view, rect: targetRect)
}

// MARK: - Helpers
Expand Down
Binary file added bin/swiftlint
Binary file not shown.
1 change: 1 addition & 0 deletions bin/swiftlint.version.txt