From 1338fcda21a96cee094478d8a7d2695d8d7b9b31 Mon Sep 17 00:00:00 2001 From: Niels Andriesse Date: Tue, 10 Sep 2019 13:26:58 +1000 Subject: [PATCH] Clean --- Signal.xcodeproj/project.pbxproj | 4 ++-- Signal/src/Loki/LokiGroupChatPoller.swift | 4 +--- .../ConversationView/ConversationViewModel.m | 9 +++------ SignalMessaging/{utils => Loki}/CGFloat+Rounding.swift | 4 +++- SignalMessaging/Loki/Identicon+ObjC.swift | 7 ++----- SignalMessaging/{utils => Loki}/UIColor+Helper.swift | 2 ++ .../src/Loki/Messaging/SSKProtoEnvelope+Loki.swift | 3 +-- SignalServiceKit/src/Messages/OWSMessageManager.m | 2 +- 8 files changed, 15 insertions(+), 20 deletions(-) rename SignalMessaging/{utils => Loki}/CGFloat+Rounding.swift (72%) rename SignalMessaging/{utils => Loki}/UIColor+Helper.swift (99%) diff --git a/Signal.xcodeproj/project.pbxproj b/Signal.xcodeproj/project.pbxproj index 0bea20fe8..c35ea15de 100644 --- a/Signal.xcodeproj/project.pbxproj +++ b/Signal.xcodeproj/project.pbxproj @@ -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 = ""; diff --git a/Signal/src/Loki/LokiGroupChatPoller.swift b/Signal/src/Loki/LokiGroupChatPoller.swift index 4473e82a2..029fe95cc 100644 --- a/Signal/src/Loki/LokiGroupChatPoller.swift +++ b/Signal/src/Loki/LokiGroupChatPoller.swift @@ -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.. CGFloat { let divisor = pow(10.0, CGFloat(places)) return (self * divisor).rounded() / divisor diff --git a/SignalMessaging/Loki/Identicon+ObjC.swift b/SignalMessaging/Loki/Identicon+ObjC.swift index bbdd1370c..9b8c81bfd 100644 --- a/SignalMessaging/Loki/Identicon+ObjC.swift +++ b/SignalMessaging/Loki/Identicon+ObjC.swift @@ -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 } } diff --git a/SignalMessaging/utils/UIColor+Helper.swift b/SignalMessaging/Loki/UIColor+Helper.swift similarity index 99% rename from SignalMessaging/utils/UIColor+Helper.swift rename to SignalMessaging/Loki/UIColor+Helper.swift index e90badac4..47cec7330 100644 --- a/SignalMessaging/utils/UIColor+Helper.swift +++ b/SignalMessaging/Loki/UIColor+Helper.swift @@ -1,4 +1,6 @@ + extension UIColor { + public func adjust(hueBy degrees: CGFloat) -> UIColor { var currentHue: CGFloat = 0.0 diff --git a/SignalServiceKit/src/Loki/Messaging/SSKProtoEnvelope+Loki.swift b/SignalServiceKit/src/Loki/Messaging/SSKProtoEnvelope+Loki.swift index 218e5a3f5..97e8a9f44 100644 --- a/SignalServiceKit/src/Loki/Messaging/SSKProtoEnvelope+Loki.swift +++ b/SignalServiceKit/src/Loki/Messaging/SSKProtoEnvelope+Loki.swift @@ -1,3 +1,4 @@ + @objc public extension SSKProtoEnvelope { @objc public var isGroupChatMessage: Bool { @@ -7,7 +8,5 @@ } catch { return false } - - return true; } } diff --git a/SignalServiceKit/src/Messages/OWSMessageManager.m b/SignalServiceKit/src/Messages/OWSMessageManager.m index 6dea2528b..e7f5a667d 100644 --- a/SignalServiceKit/src/Messages/OWSMessageManager.m +++ b/SignalServiceKit/src/Messages/OWSMessageManager.m @@ -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",