Skip to content

Commit f1d8c95

Browse files
Simone ManganelliSimone Manganelli
Simone Manganelli
authored and
Simone Manganelli
committed
badge text now includes an ellipsis if it's still checking for H.264 variants; extra contextual items now appear if H.264 is confirmed but HD H.264 is still being checked
1 parent 57930e9 commit f1d8c95

File tree

2 files changed

+24
-11
lines changed

2 files changed

+24
-11
lines changed

Plugin/Plugin.h

+1
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ THE SOFTWARE.
5454
NSString *_launchedAppBundleIdentifier;
5555

5656
BOOL _contextMenuIsVisible;
57+
BOOL _receivedAllResponses;
5758
NSURLConnection *connections[2];
5859
unsigned expectedResponses;
5960
NSTimer *_delayingTimer;

Plugin/Plugin.m

+23-11
Original file line numberDiff line numberDiff line change
@@ -751,21 +751,30 @@ - (void) _loadInvisibleContentForWindow: (NSNotification*) notification
751751

752752
- (NSString*) badgeLabelText
753753
{
754-
if( [ self _useHDH264Version ] && [self _hasHDH264Version])
754+
if( [ self _useHDH264Version ] && [self _hasHDH264Version]) {
755755
return NSLocalizedString( @"HD H.264", @"HD H.264 badge text" );
756-
if( [ self _useH264Version ] && [self _hasH264Version])
757-
return NSLocalizedString( @"H.264", @"H.264 badge text" );
758-
else if( _fromYouTube && _videoId)
756+
} else if( [ self _useH264Version ] && [self _hasH264Version]) {
757+
if (_receivedAllResponses) {
758+
return NSLocalizedString( @"H.264", @"H.264 badge text" );
759+
} else {
760+
return NSLocalizedString( @"H.264…", @"H.264 badge waiting text" );
761+
}
762+
} else if( _fromYouTube && _videoId) {
759763
// we check the video ID too because if it's a flash ad on YouTube.com,
760764
// we don't want to identify it as an actual YouTube video -- but if
761765
// the flash object actually has a video ID parameter, it means its
762766
// a bona fide YouTube video
763767

764-
return NSLocalizedString( @"YouTube", @"YouTube badge text" );
765-
else if( _badgeText )
768+
if (_receivedAllResponses) {
769+
return NSLocalizedString( @"YouTube", @"YouTube badge text" );
770+
} else {
771+
return NSLocalizedString( @"YouTube…", @"YouTube badge waiting text" );
772+
}
773+
} else if( _badgeText ) {
766774
return _badgeText;
767-
else
775+
} else {
768776
return NSLocalizedString( @"Flash", @"Flash badge text" );
777+
}
769778
}
770779

771780
- (void) _drawBadgeWithPressed: (BOOL) pressed
@@ -1158,24 +1167,27 @@ - (void)_checkForH264VideoVariants
11581167
}
11591168

11601169
expectedResponses = 2;
1170+
_receivedAllResponses = NO;
11611171
}
11621172
}
11631173

11641174
- (void)finishedWithConnection:(NSURLConnection *)connection
11651175
{
1166-
BOOL receivedAllResponses = YES;
1176+
BOOL didReceiveAllResponses = YES;
11671177

11681178
for (int i = 0; i < 2; ++i) {
11691179
if (connection == connections[i]) {
11701180
[connection cancel];
11711181
[connection release];
11721182
connections[i] = nil;
11731183
} else if (connections[i])
1174-
receivedAllResponses = NO;
1184+
didReceiveAllResponses = NO;
11751185
}
11761186

1177-
if (receivedAllResponses)
1178-
[self setUpExtraMenuItems];
1187+
if (didReceiveAllResponses) _receivedAllResponses = YES;
1188+
1189+
[self setUpExtraMenuItems];
1190+
[self setNeedsDisplay:YES];
11791191
}
11801192

11811193
- (void)connection:(NSURLConnection *)connection

0 commit comments

Comments
 (0)