Improve displaying release notes in sparkle-cli (safer & less code)

This commit is contained in:
Zorg committed 2016-08-11 20:58:53 -04:00
1 parent a51edf3dad
commit 1a0e169e7f
1 file changed
+10 -4
+10 -4
View File
@@ -120,18 +120,24 @@
});
}
- (void)displayReleaseNotes:(const char * _Nullable)releaseNotes
{
if (releaseNotes != NULL) {
fprintf(stderr, "Release notes:\n");
fprintf(stderr, "%s\n", releaseNotes);
}
}
- (void)displayHTMLReleaseNotes:(NSData *)releaseNotes
{
NSAttributedString *attributedString = [[NSAttributedString alloc] initWithHTML:releaseNotes documentAttributes:NULL];
fprintf(stderr, "Release notes:\n");
fprintf(stderr, "%s\n", attributedString.string.UTF8String);
[self displayReleaseNotes:attributedString.string.UTF8String];
}
- (void)displayPlainTextReleaseNotes:(NSData *)releaseNotes encoding:(NSStringEncoding)encoding
{
NSString *string = [[NSString alloc] initWithData:releaseNotes encoding:encoding];
fprintf(stderr, "Release notes:\n");
fprintf(stderr, "%s\n", string.UTF8String);
[self displayReleaseNotes:string.UTF8String];
}
- (void)showUpdateWithAppcastItem:(SUAppcastItem *)appcastItem updateAdjective:(NSString *)updateAdjective