Skip to content
Snippets Groups Projects
Commit b4826e2d authored by Bruno Muniz's avatar Bruno Muniz :apple:
Browse files

Fixing mr comments

parent da5cf239
No related branches found
No related tags found
2 merge requests!40v1.1.2b166,!38Using new database structure
......@@ -160,9 +160,11 @@ public final class SingleChatController: UIViewController {
private func setupNavigationBar(contact: Contact) {
screenView.set(name: contact.nickname ?? contact.username!)
avatarView.snp.makeConstraints { $0.width.height.equalTo(35) }
avatarView.setupProfile(title: contact.nickname ?? contact.username!, image: contact.photo, size: .small)
nameLabel.text = contact.nickname ?? contact.username
let title = (contact.nickname ?? contact.username) ?? ""
avatarView.setupProfile(title: title, image: contact.photo, size: .small)
nameLabel.text = title
nameLabel.textColor = Asset.neutralActive.color
nameLabel.font = Fonts.Mulish.semiBold.font(size: 18.0)
......
......@@ -197,7 +197,7 @@ extension CellFactory {
return false
}
return transfer(item.fileTransferId!).type == "png"
return transfer(item.fileTransferId!).type == "jpeg"
}, build: { item, collectionView, indexPath in
let ft = transfer(item.fileTransferId!)
......@@ -227,7 +227,7 @@ extension CellFactory {
return false
}
return transfer(item.fileTransferId!).type == "png"
return transfer(item.fileTransferId!).type == "jpeg"
}, build: { item, collectionView, indexPath in
let ft = transfer(item.fileTransferId!)
......
......@@ -93,17 +93,14 @@ final class GroupChatViewModel {
return ("[DELETED]", "[DELETED]")
}
guard let contact = try? session.dbManager.fetchContacts(.init(id: [message.senderId])).first else {
return ("You", message.text)
}
let contactTitle = (contact.nickname ?? contact.username) ?? "Fetching username..."
return (contactTitle, message.text)
return (getName(from: message.senderId), message.text)
}
func getName(from senderId: Data) -> String {
guard senderId != session.myId else { return "You" }
guard let contact = try? session.dbManager.fetchContacts(.init(id: [senderId])).first else {
return "You"
return "[DELETED]"
}
return (contact.nickname ?? contact.username) ?? "Fetching username..."
......@@ -111,20 +108,7 @@ final class GroupChatViewModel {
func didRequestReply(_ message: Message) {
guard let networkId = message.networkId else { return }
let senderTitle: String = {
if message.senderId == session.myId {
return "You"
} else {
guard let contact = try? session.dbManager.fetchContacts(.init(id: [message.senderId])).first else {
return "Error"
}
return (contact.nickname ?? contact.username) ?? "Fetching username..."
}
}()
stagedReply = Reply(messageId: networkId, senderId: message.senderId)
replySubject.send((senderTitle, message.text))
replySubject.send(getReplyContent(for: message.id))
}
}
......@@ -7,12 +7,6 @@ import XXModels
import MenuFeature
import DependencyInjection
extension Contact: Hashable {
public func hash(into hasher: inout Hasher) {
hasher.combine(id)
}
}
public final class ChatListController: UIViewController {
@Dependency private var coordinator: ChatListCoordinating
@Dependency private var statusBarController: StatusBarStyleControlling
......@@ -122,7 +116,8 @@ public final class ChatListController: UIViewController {
collectionView: screenView.listContainerView.collectionView
) { collectionView, indexPath, contact in
let cell: ChatListRecentContactCell = collectionView.dequeueReusableCell(forIndexPath: indexPath)
cell.setup(title: contact.nickname ?? contact.username!, image: contact.photo)
let title = (contact.nickname ?? contact.username) ?? ""
cell.setup(title: title, image: contact.photo)
return cell
}
......
......@@ -18,7 +18,7 @@ extension Session {
let url = try FileManager.store(
data: compressedImage,
name: "image_\(Date.asTimestamp)",
type: "png"
type: "jpeg"
)
self.sendFile(url: url, to: contact)
......
......@@ -184,7 +184,7 @@ public final class Session: SessionType {
guard self.hasRunningTasks == false else { throw NSError.create("") }
}.finalCatch { _ in fatalError("Couldn't delete account because network is not stopping") }
try? dbManager.drop()
try! dbManager.drop()
FileManager.xxCleanup()
email = nil
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment