From acdf277c367cc0f35f013d6e0beb490204913235 Mon Sep 17 00:00:00 2001 From: kkostiuk <kateryna.kostiuk@savoirfairelinux.com> Date: Sun, 18 Apr 2021 09:59:40 -0400 Subject: [PATCH] cleanup warnings Change-Id: I5e3613be43ed547310195dc488498c38f22e6206 --- Ring/Ring/Calls/CallViewController.swift | 2 +- .../Conference/ContactPickerViewController.swift | 2 +- Ring/Ring/Constants/Generated/Images.swift | 9 +++++++-- Ring/Ring/Constants/Generated/Strings.swift | 16 ++++++++++------ Ring/Ring/Dialpad/DialpadViewController.swift | 2 +- .../Conversation/MessageViewModel.swift | 2 +- .../SmartList/SmartlistViewController.swift | 2 +- .../views/JamiSearchView/JamiSearchView.swift | 2 +- Ring/Ring/Features/Me/Me/MeViewController.swift | 2 +- Ring/Ring/Features/Me/Me/MeViewModel.swift | 2 +- .../GeneralSettingsViewController.swift | 4 ++-- Ring/Ring/Models/AccountCredentialsModel.swift | 6 +++--- Ring/Ring/Services/ConversationsManager.swift | 2 +- 13 files changed, 31 insertions(+), 22 deletions(-) diff --git a/Ring/Ring/Calls/CallViewController.swift b/Ring/Ring/Calls/CallViewController.swift index 019ea5f91..2943e042a 100644 --- a/Ring/Ring/Calls/CallViewController.swift +++ b/Ring/Ring/Calls/CallViewController.swift @@ -553,7 +553,7 @@ class CallViewController: UIViewController, StoryboardBased, ViewModelBased, Con } if self.viewModel.isAudioOnly { let device = UIDevice.modelName - if device == "iPhone 5" || device == "iPhone 5c" || device == "iPhone 5s" || device == "iPhone SE" { + if device == "iPhone 5" || device == "iPhone 5c" || device == "iPhone 5s" || device == "iPhone SE" { self.durationLabel.isHidden = true self.buttonsContainerBottomConstraint.constant = -10 } diff --git a/Ring/Ring/Calls/Conference/ContactPickerViewController.swift b/Ring/Ring/Calls/Conference/ContactPickerViewController.swift index 13cc51dac..8c85ad965 100644 --- a/Ring/Ring/Calls/Conference/ContactPickerViewController.swift +++ b/Ring/Ring/Calls/Conference/ContactPickerViewController.swift @@ -107,7 +107,7 @@ class ContactPickerViewController: UIViewController, StoryboardBased, ViewModelB private func setupDataSources() { let configureCell: (TableViewSectionedDataSource, UITableView, IndexPath, ContactPickerSection.Item) -> UITableViewCell = { - ( dataSource: TableViewSectionedDataSource<ContactPickerSection>, + ( _: TableViewSectionedDataSource<ContactPickerSection>, tableView: UITableView, indexPath: IndexPath, contactItem: ContactPickerSection.Item) in diff --git a/Ring/Ring/Constants/Generated/Images.swift b/Ring/Ring/Constants/Generated/Images.swift index 9676ff147..f346b3137 100644 --- a/Ring/Ring/Constants/Generated/Images.swift +++ b/Ring/Ring/Constants/Generated/Images.swift @@ -135,7 +135,8 @@ internal struct ImageAsset { #if os(iOS) || os(tvOS) let image = Image(named: name, in: bundle, compatibleWith: nil) #elseif os(macOS) - let image = bundle.image(forResource: NSImage.Name(name)) + let name = NSImage.Name(self.name) + let image = (bundle == .main) ? NSImage(named: name) : bundle.image(forResource: name) #elseif os(watchOS) let image = Image(named: name) #endif @@ -164,7 +165,11 @@ internal extension ImageAsset.Image { // swiftlint:disable convenience_type private final class BundleToken { static let bundle: Bundle = { - Bundle(for: BundleToken.self) + #if SWIFT_PACKAGE + return Bundle.module + #else + return Bundle(for: BundleToken.self) + #endif }() } // swiftlint:enable convenience_type diff --git a/Ring/Ring/Constants/Generated/Strings.swift b/Ring/Ring/Constants/Generated/Strings.swift index 6a4f8f14c..32308c53d 100644 --- a/Ring/Ring/Constants/Generated/Strings.swift +++ b/Ring/Ring/Constants/Generated/Strings.swift @@ -8,7 +8,7 @@ import Foundation // MARK: - Strings // swiftlint:disable explicit_type_interface function_parameter_count identifier_name line_length -// swiftlint:disable nesting type_body_length type_name +// swiftlint:disable nesting type_body_length type_name vertical_whitespace_opening_braces internal enum L10n { internal enum Account { @@ -499,9 +499,9 @@ internal enum L10n { } internal enum LinkToAccountManager { - /// Enter account manager URI + /// Enter JAMS URL internal static let accountManagerLabel = L10n.tr("Localizable", "linkToAccountManager.accountManagerLabel") - /// Account manager + /// JAMS URL internal static let accountManagerPlaceholder = L10n.tr("Localizable", "linkToAccountManager.accountManagerPlaceholder") /// Enter Password internal static let passwordLabel = L10n.tr("Localizable", "linkToAccountManager.passwordLabel") @@ -592,7 +592,7 @@ internal enum L10n { } internal enum Welcome { - /// Connect to account manager + /// Connect to a JAMS server internal static let connectToManager = L10n.tr("Localizable", "welcome.connectToManager") /// Create a Jami account internal static let createAccount = L10n.tr("Localizable", "welcome.createAccount") @@ -605,7 +605,7 @@ internal enum L10n { } } // swiftlint:enable explicit_type_interface function_parameter_count identifier_name line_length -// swiftlint:enable nesting type_body_length type_name +// swiftlint:enable nesting type_body_length type_name vertical_whitespace_opening_braces // MARK: - Implementation Details @@ -619,7 +619,11 @@ extension L10n { // swiftlint:disable convenience_type private final class BundleToken { static let bundle: Bundle = { - Bundle(for: BundleToken.self) + #if SWIFT_PACKAGE + return Bundle.module + #else + return Bundle(for: BundleToken.self) + #endif }() } // swiftlint:enable convenience_type diff --git a/Ring/Ring/Dialpad/DialpadViewController.swift b/Ring/Ring/Dialpad/DialpadViewController.swift index 091781db2..7d6051f04 100644 --- a/Ring/Ring/Dialpad/DialpadViewController.swift +++ b/Ring/Ring/Dialpad/DialpadViewController.swift @@ -44,7 +44,7 @@ class DialpadViewController: UIViewController, StoryboardBased, ViewModelBased { collectionView.backgroundColor = UIColor.jamiBackgroundColor self.applyL10n() let device = UIDevice.modelName - if device == "iPhone 5" || device == "iPhone 5c" || device == "iPhone 5s" || device == "iPhone SE" { + if device == "iPhone 5" || device == "iPhone 5c" || device == "iPhone 5s" || device == "iPhone SE" { labelTopConstraint.constant = 15 labelBottomConstraint.constant = 15 } diff --git a/Ring/Ring/Features/Conversations/Conversation/MessageViewModel.swift b/Ring/Ring/Features/Conversations/Conversation/MessageViewModel.swift index caf2e1656..c401b65f9 100644 --- a/Ring/Ring/Features/Conversations/Conversation/MessageViewModel.swift +++ b/Ring/Ring/Features/Conversations/Conversation/MessageViewModel.swift @@ -42,7 +42,7 @@ enum MessageSequencing { enum GeneratedMessageType: String { case receivedContactRequest = "Contact request received" - case contactAdded = "Contact added" + case contactAdded = "Contact added" case missedIncomingCall = "Missed incoming call" case missedOutgoingCall = "Missed outgoing call" case incomingCall = "Incoming call" diff --git a/Ring/Ring/Features/Conversations/SmartList/SmartlistViewController.swift b/Ring/Ring/Features/Conversations/SmartList/SmartlistViewController.swift index dc7459940..b8f711818 100644 --- a/Ring/Ring/Features/Conversations/SmartList/SmartlistViewController.swift +++ b/Ring/Ring/Features/Conversations/SmartList/SmartlistViewController.swift @@ -351,7 +351,7 @@ class SmartlistViewController: UIViewController, StoryboardBased, ViewModelBased //Configure cells closure for the datasources let configureCell: (TableViewSectionedDataSource, UITableView, IndexPath, ConversationSection.Item) -> UITableViewCell = { - ( dataSource: TableViewSectionedDataSource<ConversationSection>, + ( _: TableViewSectionedDataSource<ConversationSection>, tableView: UITableView, indexPath: IndexPath, conversationItem: ConversationSection.Item) in diff --git a/Ring/Ring/Features/Conversations/views/JamiSearchView/JamiSearchView.swift b/Ring/Ring/Features/Conversations/views/JamiSearchView/JamiSearchView.swift index 11f4d469c..f22fcb349 100644 --- a/Ring/Ring/Features/Conversations/views/JamiSearchView/JamiSearchView.swift +++ b/Ring/Ring/Features/Conversations/views/JamiSearchView/JamiSearchView.swift @@ -70,7 +70,7 @@ class JamiSearchView: NSObject { self.searchResultsTableView.rx.setDelegate(self).disposed(by: disposeBag) let configureCell: (TableViewSectionedDataSource, UITableView, IndexPath, ConversationSection.Item) -> UITableViewCell = { - (dataSource: TableViewSectionedDataSource<ConversationSection>, + (_: TableViewSectionedDataSource<ConversationSection>, tableView: UITableView, indexPath: IndexPath, conversationItem: ConversationSection.Item) in diff --git a/Ring/Ring/Features/Me/Me/MeViewController.swift b/Ring/Ring/Features/Me/Me/MeViewController.swift index ba9649e27..a236c2c61 100644 --- a/Ring/Ring/Features/Me/Me/MeViewController.swift +++ b/Ring/Ring/Features/Me/Me/MeViewController.swift @@ -300,7 +300,7 @@ class MeViewController: EditProfileViewController, StoryboardBased, ViewModelBas ( dataSource: TableViewSectionedDataSource<SettingsSection>, tableView: UITableView, indexPath: IndexPath, - item: SettingsSection.Item) in + _: SettingsSection.Item) in switch dataSource[indexPath] { case .autoRegistration: diff --git a/Ring/Ring/Features/Me/Me/MeViewModel.swift b/Ring/Ring/Features/Me/Me/MeViewModel.swift index 2d0c25c27..45de8c5a9 100644 --- a/Ring/Ring/Features/Me/Me/MeViewModel.swift +++ b/Ring/Ring/Features/Me/Me/MeViewModel.swift @@ -127,7 +127,7 @@ class MeViewModel: ViewModel, Stateable { lazy var accountCredentials: Observable<SettingsSection> = { return Observable .combineLatest(userName.startWith(""), ringId.startWith("")) { (name, ringID) in - var items: [SettingsSection.SectionRow] = [.sectionHeader(title: L10n.AccountPage.credentialsHeader), + var items: [SettingsSection.SectionRow] = [.sectionHeader(title: L10n.AccountPage.credentialsHeader), .jamiID(label: ringID)] items.append(.jamiUserName(label: name)) items.append(.shareAccountDetails) diff --git a/Ring/Ring/GeneralSettings/GeneralSettingsViewController.swift b/Ring/Ring/GeneralSettings/GeneralSettingsViewController.swift index 2e19ae5e8..83a79fbf9 100644 --- a/Ring/Ring/GeneralSettings/GeneralSettingsViewController.swift +++ b/Ring/Ring/GeneralSettings/GeneralSettingsViewController.swift @@ -61,9 +61,9 @@ class GeneralSettingsViewController: UIViewController, StoryboardBased, ViewMode let configureCell: (TableViewSectionedDataSource, UITableView, IndexPath, GeneralSettingsSection.Item) -> UITableViewCell = { ( dataSource: TableViewSectionedDataSource<GeneralSettingsSection>, - tableView: UITableView, + _: UITableView, indexPath: IndexPath, - item: GeneralSettingsSection.Item) in + _: GeneralSettingsSection.Item) in switch dataSource[indexPath] { case .hardwareAcceleration: diff --git a/Ring/Ring/Models/AccountCredentialsModel.swift b/Ring/Ring/Models/AccountCredentialsModel.swift index e916ae371..6142afdd2 100644 --- a/Ring/Ring/Models/AccountCredentialsModel.swift +++ b/Ring/Ring/Models/AccountCredentialsModel.swift @@ -80,9 +80,9 @@ class AccountCredentialsModel: Object { func toDictionary() -> [String: String] { var dictionary = [String: String]() - dictionary[ConfigKey.accountUsername.rawValue] = self.username - dictionary[ConfigKey.accountPassword.rawValue] = self.password - dictionary[ConfigKey.accountRealm.rawValue] = self.accountRealm + dictionary[ConfigKey.accountUsername.rawValue] = self.username + dictionary[ConfigKey.accountPassword.rawValue] = self.password + dictionary[ConfigKey.accountRealm.rawValue] = self.accountRealm return dictionary } } diff --git a/Ring/Ring/Services/ConversationsManager.swift b/Ring/Ring/Services/ConversationsManager.swift index 8225bb61d..dfcf2e962 100644 --- a/Ring/Ring/Services/ConversationsManager.swift +++ b/Ring/Ring/Services/ConversationsManager.swift @@ -66,7 +66,7 @@ class ConversationsManager: MessagesAdapterDelegate { var data = [String: String]() data[NotificationUserInfoKeys.messageContent.rawValue] = event.getEventInput(ServiceEventInput.content) data[NotificationUserInfoKeys.participantID.rawValue] = event.getEventInput(ServiceEventInput.peerUri) - data[NotificationUserInfoKeys.accountID.rawValue] = event.getEventInput(ServiceEventInput.accountId) + data[NotificationUserInfoKeys.accountID.rawValue] = event.getEventInput(ServiceEventInput.accountId) guard let contactUri = data[NotificationUserInfoKeys.participantID.rawValue], let hash = JamiURI(schema: URIType.ring, infoHach: contactUri).hash else { return } -- GitLab