Explicitly include newlines in numeric fingerprint

More straight forward than fudging / verifying different layout widths.

// FREEBIE
pull/1/head
Michael Kirk 9 years ago
parent e53422f765
commit 1ba082356a

@ -8,7 +8,7 @@
Pod::Spec.new do |s|
s.name = "SignalServiceKit"
s.version = "0.7.0"
s.version = "0.7.1"
s.summary = "An Objective-C library for communicating with the Signal messaging service."
s.description = <<-DESC

@ -155,16 +155,28 @@ static uint32_t const OWSFingerprintDefaultHashIterations = 5200;
}
}
/**
* Formats numeric fingerprint, 3 lines in groups of 5 digits.
*/
- (NSString *)displayableText
{
NSString *input = self.text;
NSMutableArray<NSString *> *chunks = [NSMutableArray new];
for (uint i = 0; i < input.length / 5; i++) {
NSString *nextChunk = [input substringWithRange:NSMakeRange(i * 5, 5)];
[chunks addObject:nextChunk];
NSMutableArray<NSString *> *lines = [NSMutableArray new];
uint lineLength = self.text.length / 3;
for (uint i = 0; i < 3; i++) {
NSString *line = [input substringWithRange:NSMakeRange(i * lineLength, lineLength)];
NSMutableArray<NSString *> *chunks = [NSMutableArray new];
for (uint i = 0; i < line.length / 5; i++) {
NSString *nextChunk = [line substringWithRange:NSMakeRange(i * 5, 5)];
[chunks addObject:nextChunk];
}
[lines addObject:[chunks componentsJoinedByString:@" "]];
}
return [chunks componentsJoinedByString:@" "];
return [lines componentsJoinedByString:@"\n"];
}

Loading…
Cancel
Save