This commit is contained in:
Niels Andriesse 2019-09-10 13:26:58 +10:00
parent be00f8c6ad
commit 1338fcda21
8 changed files with 15 additions and 20 deletions

View file

@ -1666,7 +1666,6 @@
4C948FF62146EB4800349F0D /* BlockListCache.swift */,
343D3D991E9283F100165CA4 /* BlockListUIUtils.h */,
343D3D9A1E9283F100165CA4 /* BlockListUIUtils.m */,
241C6312231F5F1D00B4198E /* CGFloat+Rounding.swift */,
3466087120E550F300AFFE73 /* ConversationStyle.swift */,
34480B4D1FD0A7A300BC14EF /* DebugLogger.h */,
34480B4E1FD0A7A300BC14EF /* DebugLogger.m */,
@ -1699,7 +1698,6 @@
45360B8C1F9521F800FA666C /* Searcher.swift */,
346129BD1FD2068600532771 /* ThreadUtil.h */,
346129BE1FD2068600532771 /* ThreadUtil.m */,
241C6310231F5C4400B4198E /* UIColor+Helper.swift */,
340872BE22393CF900CB25B0 /* UIGestureRecognizer+OWS.swift */,
4C858A51212DC5E1001B45D3 /* UIImage+OWS.swift */,
B97940251832BD2400BD66CB /* UIUtil.h */,
@ -2651,6 +2649,8 @@
children = (
241C630E231F5AAC00B4198E /* JazzIcon.swift */,
B846365A22B7418B00AF1514 /* Identicon+ObjC.swift */,
241C6312231F5F1D00B4198E /* CGFloat+Rounding.swift */,
241C6310231F5C4400B4198E /* UIColor+Helper.swift */,
);
path = Loki;
sourceTree = "<group>";

View file

@ -50,7 +50,6 @@ public final class LokiGroupChatPoller : NSObject {
let endIndex = senderHexEncodedPublicKey.endIndex
let cutoffIndex = senderHexEncodedPublicKey.index(endIndex, offsetBy: -8)
let senderDisplayName = "\(message.displayName) (...\(senderHexEncodedPublicKey[cutoffIndex..<endIndex]))"
let id = group.id.data(using: String.Encoding.utf8)!
let x1 = SSKProtoGroupContext.builder(id: id, type: .deliver)
x1.setName(group.displayName)
@ -69,10 +68,9 @@ public final class LokiGroupChatPoller : NSObject {
x4.setSource(senderHexEncodedPublicKey)
x4.setSourceDevice(OWSDevicePrimaryDeviceId)
x4.setContent(try! x3.build().serializedData())
let storage = OWSPrimaryStorage.shared()
storage.dbReadWriteConnection.readWrite { transaction in
// Set the display name of the user
transaction.setObject(senderDisplayName, forKey: senderHexEncodedPublicKey, inCollection: group.id)
SSKEnvironment.shared.messageManager.throws_processEnvelope(try! x4.build(), plaintextData: try! x3.build().serializedData(), wasReceivedByUD: false, transaction: transaction)
}

View file

@ -1509,13 +1509,10 @@ static const int kYapDatabaseRangeMaxLength = 25000;
= (![NSObject isNullableObject:previousIncomingSenderId equalTo:incomingSenderId]
|| viewItem.hasCellHeader);
}
if (shouldShowSenderName) {
senderName = [self.contactsManager
attributedContactOrProfileNameForPhoneIdentifier:incomingSenderId
primaryAttributes:[OWSMessageBubbleView
senderNamePrimaryAttributes]
secondaryAttributes:[OWSMessageBubbleView
senderNameSecondaryAttributes]];
senderName = [self.contactsManager attributedContactOrProfileNameForPhoneIdentifier:incomingSenderId primaryAttributes:[OWSMessageBubbleView senderNamePrimaryAttributes]
secondaryAttributes:[OWSMessageBubbleView senderNameSecondaryAttributes]];
if ([self.thread isKindOfClass:[TSGroupThread class]]) {
TSGroupThread *groupThread = (TSGroupThread *)self.thread;

View file

@ -1,5 +1,7 @@
extension CGFloat {
/// Rounds the float to decimal places value
/// Round the number to the given amount of decimal places.
func rounded(toPlaces places:Int) -> CGFloat {
let divisor = pow(10.0, CGFloat(places))
return (self * divisor).rounded() / divisor

View file

@ -1,3 +1,4 @@
@objc(LKIdenticon)
final class Identicon : NSObject {
@ -6,11 +7,7 @@ final class Identicon : NSObject {
let iconLayer = icon.generateLayer(ofSize: size)
let rect = CGRect(origin: CGPoint.zero, size: iconLayer.frame.size)
let renderer = UIGraphicsImageRenderer(size: rect.size)
let image = renderer.image {
context in
return iconLayer.render(in: context.cgContext)
}
let image = renderer.image { iconLayer.render(in: $0.cgContext) }
return image
}
}

View file

@ -1,4 +1,6 @@
extension UIColor {
public func adjust(hueBy degrees: CGFloat) -> UIColor {
var currentHue: CGFloat = 0.0

View file

@ -1,3 +1,4 @@
@objc public extension SSKProtoEnvelope {
@objc public var isGroupChatMessage: Bool {
@ -7,7 +8,5 @@
} catch {
return false
}
return true;
}
}

View file

@ -1387,7 +1387,7 @@ NS_ASSUME_NONNULL_BEGIN
[incomingMessage.attachmentIds addObject:pointer.uniqueId];
}
// Loki: Don't process friend requests in the group chats
// Loki: Don't process friend requests in group chats
if (body.length == 0 && attachmentPointers.count < 1 && !contact) {
OWSLogWarn(@"ignoring empty incoming message from: %@ for group: %@ with timestamp: %lu",