Remove unused ChatColors code
This commit is contained in:
parent
e72176c977
commit
e789cc43fe
@ -171,9 +171,6 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
[items addObject:[OWSTableItem itemWithTitle:@"Log all sticker suggestions"
|
||||
actionBlock:^() { [DebugUIMisc logStickerSuggestions]; }]];
|
||||
|
||||
[items addObject:[OWSTableItem itemWithTitle:@"Create chat colors"
|
||||
actionBlock:^() { [DebugUIMisc createChatColors]; }]];
|
||||
|
||||
[items addObject:[OWSTableItem itemWithTitle:@"Log Local Account"
|
||||
actionBlock:^() { [DebugUIMisc logLocalAccount]; }]];
|
||||
|
||||
@ -413,12 +410,6 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
[[emojiSet.allObjects sortedArrayUsingSelector:@selector(compare:)] componentsJoinedByString:@" "]);
|
||||
}
|
||||
|
||||
+ (void)createChatColors
|
||||
{
|
||||
DatabaseStorageWrite(SDSDatabaseStorage.shared,
|
||||
^(SDSAnyWriteTransaction *transaction) { [ChatColors createFakeChatColorsWithTransaction:transaction]; });
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
||||
@ -150,40 +150,6 @@ public class ChatColors: NSObject, Dependencies {
|
||||
}
|
||||
}
|
||||
|
||||
#if DEBUG
|
||||
@objc
|
||||
public static func createFakeChatColors(transaction: SDSAnyWriteTransaction) {
|
||||
|
||||
func randomOWSColorComponent() -> CGFloat {
|
||||
CGFloat.random(in: 0..<1, choices: 256)
|
||||
}
|
||||
|
||||
func randomOWSColor() -> OWSColor {
|
||||
OWSColor(red: randomOWSColorComponent(),
|
||||
green: randomOWSColorComponent(),
|
||||
blue: randomOWSColorComponent())
|
||||
}
|
||||
|
||||
func randomAngleRadians() -> CGFloat {
|
||||
CGFloat.random(in: 0..<(CGFloat.pi * 2), choices: 256)
|
||||
}
|
||||
|
||||
let count = 256
|
||||
for _ in 0..<count {
|
||||
let setting: ColorOrGradientSetting
|
||||
if Bool.random() {
|
||||
setting = .solidColor(color: randomOWSColor())
|
||||
} else {
|
||||
setting = .gradient(gradientColor1: randomOWSColor(),
|
||||
gradientColor2: randomOWSColor(),
|
||||
angleRadians: randomAngleRadians())
|
||||
}
|
||||
let value = ChatColor(id: ChatColor.randomId, setting: setting)
|
||||
Self.chatColors.upsertCustomValue(value, transaction: transaction)
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
private func fireCustomChatColorsDidChange() {
|
||||
NotificationCenter.default.postNotificationNameAsync(
|
||||
Self.customChatColorsDidChange,
|
||||
@ -319,14 +285,6 @@ public class ChatColors: NSObject, Dependencies {
|
||||
}
|
||||
}
|
||||
|
||||
public static func chatColorForRendering(address: SignalServiceAddress,
|
||||
transaction: SDSAnyReadTransaction) -> ChatColor {
|
||||
guard let thread = TSContactThread.getWithContactAddress(address, transaction: transaction) else {
|
||||
return Self.defaultChatColor
|
||||
}
|
||||
return chatColorForRendering(thread: thread, transaction: transaction)
|
||||
}
|
||||
|
||||
public static func setChatColorSetting(_ value: ChatColor?,
|
||||
thread: TSThread,
|
||||
transaction: SDSAnyWriteTransaction) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user