Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Remove legacy ChatTableViewCell #1971

Merged
merged 1 commit into from
Feb 12, 2025
Merged
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
chore: Remove legacy ChatTableViewCell
Signed-off-by: Marcel Müller <marcel-mueller@gmx.de>
SystemKeeper committed Feb 5, 2025
commit d4a8b5eec8180133b0d4401931f4ec34c12ab3df
6 changes: 0 additions & 6 deletions NextcloudTalk.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
@@ -585,7 +585,6 @@
2CC32E9A27F5DADB00BB8C39 /* NCChatReaction.m in Sources */ = {isa = PBXBuildFile; fileRef = 2CC32E9727F5D9BD00BB8C39 /* NCChatReaction.m */; };
2CC7158920B837140045C789 /* PlaceholderView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 2CC7158820B837140045C789 /* PlaceholderView.xib */; };
2CC7158C20B8394A0045C789 /* PlaceholderView.m in Sources */ = {isa = PBXBuildFile; fileRef = 2CC7158B20B8394A0045C789 /* PlaceholderView.m */; };
2CC7159420C54D080045C789 /* ChatTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 2CC7159320C54D080045C789 /* ChatTableViewCell.m */; };
2CCCD21D2835088F00F076CE /* OpenSSL in Frameworks */ = {isa = PBXBuildFile; productRef = 2CCCD21C2835088F00F076CE /* OpenSSL */; };
2CD4F6B72C11C80600ED594F /* ContactsSearchResultTableViewContoller.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2CD4F6B62C11C80600ED594F /* ContactsSearchResultTableViewContoller.swift */; };
2CD5F3242142781A006B71BF /* NCExternalSignalingController.m in Sources */ = {isa = PBXBuildFile; fileRef = 2CD5F3232142781A006B71BF /* NCExternalSignalingController.m */; };
@@ -1167,8 +1166,6 @@
2CC7158820B837140045C789 /* PlaceholderView.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = PlaceholderView.xib; sourceTree = "<group>"; };
2CC7158A20B8394A0045C789 /* PlaceholderView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PlaceholderView.h; sourceTree = "<group>"; };
2CC7158B20B8394A0045C789 /* PlaceholderView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = PlaceholderView.m; sourceTree = "<group>"; };
2CC7159220C54D080045C789 /* ChatTableViewCell.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ChatTableViewCell.h; sourceTree = "<group>"; };
2CC7159320C54D080045C789 /* ChatTableViewCell.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ChatTableViewCell.m; sourceTree = "<group>"; };
2CD4F6B62C11C80600ED594F /* ContactsSearchResultTableViewContoller.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContactsSearchResultTableViewContoller.swift; sourceTree = "<group>"; };
2CD5F3222142781A006B71BF /* NCExternalSignalingController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = NCExternalSignalingController.h; sourceTree = "<group>"; };
2CD5F3232142781A006B71BF /* NCExternalSignalingController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = NCExternalSignalingController.m; sourceTree = "<group>"; };
@@ -1946,8 +1943,6 @@
2C04248F2CA32D45004772F6 /* BaseChatTableViewCell+Audio.swift */,
2C4747E52CB6710F002828F2 /* BaseChatTableViewCell+Poll.swift */,
1FE029B92CE289A200C0C633 /* MessageSeparatorTableViewCell.swift */,
2CC7159220C54D080045C789 /* ChatTableViewCell.h */,
2CC7159320C54D080045C789 /* ChatTableViewCell.m */,
1F35F9022AEEDEE800044BDA /* AutoCompletionTableViewCell.h */,
1F35F9032AEEDF0E00044BDA /* AutoCompletionTableViewCell.m */,
2C604BD7211988A700D34DCD /* SystemMessageTableViewCell.h */,
@@ -2955,7 +2950,6 @@
2CC32E9227F45AE000BB8C39 /* ReactionsViewCell.swift in Sources */,
1F1B0F452BE047CE003FD766 /* ModalPresentationController.swift in Sources */,
2CBF82AE1FC888FC00636459 /* NCPushNotification.m in Sources */,
2CC7159420C54D080045C789 /* ChatTableViewCell.m in Sources */,
1F8AAC322C518759004DA20A /* SignalingSettings.swift in Sources */,
1F1B0F272BDA61C5003FD766 /* AllocationTracker.swift in Sources */,
2CA1CCAA1F02D1A4002FE6A2 /* NCAPIController.m in Sources */,
3 changes: 3 additions & 0 deletions NextcloudTalk/AutoCompletionTableViewCell.h
Original file line number Diff line number Diff line change
@@ -5,7 +5,10 @@

#import <UIKit/UIKit.h>

#import "SystemMessageTableViewCell.h"

static CGFloat kAutoCompletionCellHeight = 50.0;

static NSString *AutoCompletionCellIdentifier = @"AutoCompletionCellIdentifier";

@class AvatarButton;
1 change: 0 additions & 1 deletion NextcloudTalk/AutoCompletionTableViewCell.m
Original file line number Diff line number Diff line change
@@ -4,7 +4,6 @@
*/

#import "AutoCompletionTableViewCell.h"
#import "ChatTableViewCell.h"

#import "SLKUIConstants.h"

11 changes: 0 additions & 11 deletions NextcloudTalk/BaseChatViewController.swift
Original file line number Diff line number Diff line change
@@ -3040,17 +3040,6 @@ import SwiftUI

let cell = tableView.cellForRow(at: indexPath)

// Show reactionSummary for legacy cells
if let cell = cell as? ChatTableViewCell {
let pointInCell = tableView.convert(point, to: cell)
let reactionView = cell.contentView.subviews.first(where: { $0 is ReactionsView && $0.frame.contains(pointInCell) })

if reactionView != nil {
self.showReactionsSummary(of: cell.message)
return nil
}
}

if let cell = cell as? BaseChatTableViewCell {
let pointInCell = tableView.convert(point, to: cell)
let pointInReactionPart = cell.convert(pointInCell, to: cell.reactionPart)
39 changes: 0 additions & 39 deletions NextcloudTalk/ChatTableViewCell.h

This file was deleted.

158 changes: 0 additions & 158 deletions NextcloudTalk/ChatTableViewCell.m

This file was deleted.

11 changes: 0 additions & 11 deletions NextcloudTalk/ChatViewController.swift
Original file line number Diff line number Diff line change
@@ -1742,17 +1742,6 @@ import SwiftyAttributes

let cell = tableView.cellForRow(at: indexPath)

// Show reactionSummary for legacy cells
if let cell = cell as? ChatTableViewCell {
let pointInCell = tableView.convert(point, to: cell)
let reactionView = cell.contentView.subviews.first(where: { $0 is ReactionsView && $0.frame.contains(pointInCell) })

if reactionView != nil {
self.showReactionsSummary(of: cell.message)
return nil
}
}

if let cell = cell as? BaseChatTableViewCell {
let pointInCell = tableView.convert(point, to: cell)
let pointInReactionPart = cell.convert(pointInCell, to: cell.reactionPart)
4 changes: 3 additions & 1 deletion NextcloudTalk/MessageSeparatorTableViewCell.swift
Original file line number Diff line number Diff line change
@@ -7,10 +7,12 @@ protocol MessageSeparatorTableViewCellDelegate: AnyObject {
func generateSummaryButtonPressed()
}

class MessageSeparatorTableViewCell: ChatTableViewCell {
class MessageSeparatorTableViewCell: UITableViewCell {

public weak var delegate: MessageSeparatorTableViewCellDelegate?

public var messageId: Int = 0

public static let identifier = "MessageSeparatorCellIdentifier"

public static let unreadMessagesSeparatorId = -99
9 changes: 9 additions & 0 deletions NextcloudTalk/NCChatMessage.h
Original file line number Diff line number Diff line change
@@ -32,6 +32,15 @@ extern NSString * const kSharedItemTypeVoice;
extern NSString * const kSharedItemTypePoll;
extern NSString * const kSharedItemTypeRecording;

typedef NS_ENUM(NSInteger, ChatMessageDeliveryState) {
ChatMessageDeliveryStateSent = 0,
ChatMessageDeliveryStateRead,
ChatMessageDeliveryStateSending,
ChatMessageDeliveryStateDeleting,
ChatMessageDeliveryStateFailed,
ChatMessageDeliveryStateSilent
};

@class NCChatMessage;

typedef void (^GetReferenceDataCompletionBlock)(NCChatMessage *message, NSDictionary *referenceData, NSString *url);
2 changes: 2 additions & 0 deletions NextcloudTalk/NextcloudTalk-Bridging-Header.h
Original file line number Diff line number Diff line change
@@ -85,4 +85,6 @@
#import "AvatarBackgroundImageView.h"
#import "NCUser.h"

#import "DRCellSlideGestureRecognizer.h"

#endif /* NextcloudTalk_Bridging_Header_h */
8 changes: 5 additions & 3 deletions NextcloudTalk/SystemMessageTableViewCell.h
Original file line number Diff line number Diff line change
@@ -5,24 +5,26 @@

#import <UIKit/UIKit.h>

#import "ChatTableViewCell.h"
#import "MessageBodyTextView.h"
#import "NCChatMessage.h"

static CGFloat kChatCellAvatarHeight = 30.0;
static CGFloat kSystemMessageCellMinimumHeight = 30.0;

static NSString *SystemMessageCellIdentifier = @"SystemMessageCellIdentifier";

@protocol SystemMessageTableViewCellDelegate <ChatTableViewCellDelegate>
@protocol SystemMessageTableViewCellDelegate <NSObject>

- (void)cellWantsToCollapseMessagesWithMessage:(NCChatMessage *)message;

@end

@interface SystemMessageTableViewCell : ChatTableViewCell
@interface SystemMessageTableViewCell : UITableViewCell

@property (nonatomic, weak) id<SystemMessageTableViewCellDelegate> delegate;

@property (nonatomic, assign) NSInteger messageId;
@property (nonatomic, strong) NCChatMessage *message;
@property (nonatomic, strong) UILabel *dateLabel;
@property (nonatomic, strong) MessageBodyTextView *bodyTextView;
@property (nonatomic, strong) UIButton *collapseButton;
2 changes: 2 additions & 0 deletions NextcloudTalk/SystemMessageTableViewCell.m
Original file line number Diff line number Diff line change
@@ -9,6 +9,8 @@

#import "NextcloudTalk-Swift.h"

static CGFloat kChatCellDateLabelWidth = 40.0;

@interface SystemMessageTableViewCell () <UITextFieldDelegate>
@property (nonatomic, assign) BOOL didCreateSubviews;
@end

Unchanged files with check annotations Beta

extension XCTestCase {
// TODO: This should probably be part of APIController

Check warning on line 12 in NextcloudTalkTests/Integration/Helpers.swift

GitHub Actions / SwiftLint

Todo Violation: TODOs should be resolved (This should probably be part o...) (todo)
func getRoomDict(from rawRoomDict: [Any], for account: TalkAccount) -> [NCRoom] {
var rooms: [NCRoom] = []
for roomDict in rawRoomDict {
passwordTextField.typeText(TestConstants.password + "\n")
let accountAccess = webViewsQuery.staticTexts["Account access"]
XCTAssert(accountAccess.waitForExistence(timeout: TestConstants.timeoutLong))

Check failure on line 90 in NextcloudTalkTests/UI/Helpers.swift

GitHub Actions / Test (stable23, stable23, 8.0)

test_Login, XCTAssertTrue failed

Check failure on line 90 in NextcloudTalkTests/UI/Helpers.swift

GitHub Actions / Test (stable31, stable31, 8.3)

test_Login, XCTAssertTrue failed

Check failure on line 90 in NextcloudTalkTests/UI/Helpers.swift

GitHub Actions / Test (main, master, 8.3)

test_Login, XCTAssertTrue failed
let grantAccessButton = webViewsQuery.buttons["Grant access"]
XCTAssert(grantAccessButton.waitForExistence(timeout: TestConstants.timeoutLong))
waitForEnabled(object: grantAccessButton)
waitForHittable(object: grantAccessButton)
// TODO: Find a better way to reliable detect if the grant access button is tappable

Check warning on line 97 in NextcloudTalkTests/UI/Helpers.swift

GitHub Actions / SwiftLint

Todo Violation: TODOs should be resolved (Find a better way to reliable ...) (todo)
sleep(5)
grantAccessButton.tap()
app.navigationBars["Nextcloud Talk"].buttons["Create or join a conversation"].tap()
let createNewConversationCell = app.tables.cells.staticTexts["Create a new conversation"]
XCTAssert(createNewConversationCell.waitForExistence(timeout: TestConstants.timeoutShort))

Check failure on line 113 in NextcloudTalkTests/UI/Helpers.swift

GitHub Actions / Test (stable23, stable23, 8.0)

testDeallocation, XCTAssertTrue failed
createNewConversationCell.tap()
let newConversationNavBar = app.navigationBars["New conversation"]
List(options, id: \.self) { option in
Button(action: {
setActiveUserStatus(userStatus: option.identifier)
}) {

Check warning on line 23 in NextcloudTalk/UserStatusOptionsSwiftUI.swift

GitHub Actions / SwiftLint

Multiple Closures with Trailing Closure Violation: Trailing closure syntax should not be used when passing more than one closure argument (multiple_closures_with_trailing_closure)
HStack(spacing: 15) {
AnyView(NCUserStatus.getUserStatusIcon(userStatus: option.identifier))
.frame(width: 20)
self.adaptInterfaceForAppState(appState: NCConnectionController.sharedInstance().appState)
}
override func didReceiveMemoryWarning() {

Check warning on line 129 in NextcloudTalk/SettingsTableViewController.swift

GitHub Actions / SwiftLint

Unneeded Overridden Functions Violation: Remove overridden functions that don't do anything except call their super (unneeded_override)
super.didReceiveMemoryWarning()
}
return nil
}
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {

Check warning on line 682 in NextcloudTalk/SettingsTableViewController.swift

GitHub Actions / SwiftLint

Cyclomatic Complexity Violation: Function should have complexity 10 or less; currently complexity is 11 (cyclomatic_complexity)
let sections = getSettingsSections()
let settingsSection = sections[indexPath.section]
func searchForContactsWithSearchParameter(_ searchParameter: String) {
searchRequest?.cancel()
searchRequest = NCAPIController.sharedInstance().getContactsFor(account, forRoom: "new", groupRoom: false, withSearchParam: searchParameter) { indexes, contacts, contactList, error in

Check warning on line 147 in NextcloudTalk/NewRoomTableViewController.swift

GitHub Actions / SwiftLint

Unused Closure Parameter Violation: Unused parameter in a closure should be replaced with _ (unused_closure_parameter)

Check warning on line 147 in NextcloudTalk/NewRoomTableViewController.swift

GitHub Actions / SwiftLint

Unused Closure Parameter Violation: Unused parameter in a closure should be replaced with _ (unused_closure_parameter)
if error == nil, let contactList = contactList as? [NCUser] {
let storedContacts = NCContact.contacts(forAccountId: self.account.accountId, contains: searchParameter)
let combinedContactList = NCUser.combineUsersArray(storedContacts, withUsersArray: contactList)
return dict
}
// TODO: Should probably be an optional?

Check warning on line 134 in NextcloudTalk/NCChatMessage.swift

GitHub Actions / SwiftLint

Todo Violation: TODOs should be resolved (Should probably be an optional...) (todo)
public var systemMessageFormat: NSMutableAttributedString {
guard let message = self.parsedMessage() else { return NSMutableAttributedString(string: "") }
return message.withTextColor(.tertiaryLabel)
}
// TODO: Should probably be an optional?

Check warning on line 141 in NextcloudTalk/NCChatMessage.swift

GitHub Actions / SwiftLint

Todo Violation: TODOs should be resolved (Should probably be an optional...) (todo)
public var sendingMessage: String {
guard var resultMessage = self.message else { return "" }
import UIKit
protocol PollDraftsViewControllerDelegate: AnyObject {
func didSelectPollDraft(draft:NCPoll, forEditing: Bool)

Check warning on line 9 in NextcloudTalk/PollDraftsViewController.swift

GitHub Actions / SwiftLint

Colon Spacing Violation: Colons should be next to the identifier when specifying a type and next to the key in dictionary literals (colon)
}
class PollDraftsViewController: UITableViewController {