Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #606 from facebook/development

Release Three20 v1.0.6.1
  • Loading branch information...
commit b1766f796564b5db928e7618f921607be626ef76 2 parents 4aed866 + b16f136
@jwang jwang authored
View
4 src/Three20Core/Headers/NSDataAdditions.h
@@ -35,10 +35,10 @@
/**
* Create an NSData from a base64 encoded representation
- *
+ * Padding '=' characters are optional. Whitespace is ignored.
* @return the NSData object
*/
-+ (id)dataWithBase64EncodedString:(NSString *)string; // Padding '=' characters are optional. Whitespace is ignored.
++ (id)dataWithBase64EncodedString:(NSString *)string;
/**
* Marshal the data into a base64 encoded representation
View
18 src/Three20Core/Sources/NSDataAdditions.m
@@ -63,10 +63,11 @@ - (NSString*)sha1Hash {
// base64 code found on http://www.cocoadev.com/index.pl?BaseSixtyFour
// where the poster released it to public domain
// style not exactly congruous with normal three20 style, but kept mostly intact with the original
-static const char encodingTable[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
+static const char encodingTable[] =
+ "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
-+ (NSData*)dataWithBase64EncodedString:(NSString *)string;
-{
+///////////////////////////////////////////////////////////////////////////////////////////////////
++ (NSData*)dataWithBase64EncodedString:(NSString *)string {
if ([string length] == 0)
return [NSData data];
@@ -129,8 +130,8 @@ + (NSData*)dataWithBase64EncodedString:(NSString *)string;
return [NSData dataWithBytesNoCopy:bytes length:length];
}
-- (NSString *)base64Encoding;
-{
+///////////////////////////////////////////////////////////////////////////////////////////////////
+- (NSString *)base64Encoding {
if ([self length] == 0)
return @"";
@@ -147,7 +148,8 @@ - (NSString *)base64Encoding;
while (bufferLength < 3 && i < [self length])
buffer[bufferLength++] = ((char *)[self bytes])[i++];
- // Encode the bytes in the buffer to four characters, including padding "=" characters if necessary.
+ // Encode the bytes in the buffer to four characters,
+ // including padding "=" characters if necessary.
characters[length++] = encodingTable[(buffer[0] & 0xFC) >> 2];
characters[length++] = encodingTable[((buffer[0] & 0x03) << 4) | ((buffer[1] & 0xF0) >> 4)];
if (bufferLength > 1)
@@ -158,7 +160,9 @@ - (NSString *)base64Encoding;
else characters[length++] = '=';
}
- return [[[NSString alloc] initWithBytesNoCopy:characters length:length encoding:NSASCIIStringEncoding freeWhenDone:YES] autorelease];
+ return [[[NSString alloc] initWithBytesNoCopy:characters length:length
+ encoding:NSASCIIStringEncoding freeWhenDone:YES]
+ autorelease];
}
// end recycled base64 code
///////////////////////////////////////////////////////////////////////////////////////////////////
View
36 src/Three20Core/Sources/NSDateAdditions.m
@@ -53,7 +53,9 @@ + (NSDate*)dateWithToday {
///////////////////////////////////////////////////////////////////////////////////////////////////
- (NSDate*)dateAtMidnight {
NSCalendar *gregorian = [[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar];
- NSDateComponents *comps = [gregorian components:(NSYearCalendarUnit|NSMonthCalendarUnit|NSDayCalendarUnit) fromDate:[NSDate date]];
+ NSDateComponents *comps = [gregorian components:
+ (NSYearCalendarUnit|NSMonthCalendarUnit|NSDayCalendarUnit)
+ fromDate:[NSDate date]];
NSDate *midnight = [gregorian dateFromComponents:comps];
[gregorian release];
return midnight;
@@ -146,31 +148,33 @@ - (NSString*)formatRelativeTime {
if (elapsed > 0) {
if (elapsed <= 1) {
return TTLocalizedString(@"in just a moment", @"");
-
- } else if (elapsed < TT_MINUTE) {
+ }
+ else if (elapsed < TT_MINUTE) {
int seconds = (int)(elapsed);
return [NSString stringWithFormat:TTLocalizedString(@"in %d seconds", @""), seconds];
-
- } else if (elapsed < 2*TT_MINUTE) {
+
+ }
+ else if (elapsed < 2*TT_MINUTE) {
return TTLocalizedString(@"in about a minute", @"");
-
- } else if (elapsed < TT_HOUR) {
+ }
+ else if (elapsed < TT_HOUR) {
int mins = (int)(elapsed/TT_MINUTE);
return [NSString stringWithFormat:TTLocalizedString(@"in %d minutes", @""), mins];
-
- } else if (elapsed < TT_HOUR*1.5) {
+ }
+ else if (elapsed < TT_HOUR*1.5) {
return TTLocalizedString(@"in about an hour", @"");
-
- } else if (elapsed < TT_DAY) {
+ }
+ else if (elapsed < TT_DAY) {
int hours = (int)((elapsed+TT_HOUR/2)/TT_HOUR);
return [NSString stringWithFormat:TTLocalizedString(@"in %d hours", @""), hours];
-
- } else {
+ }
+ else {
return [self formatDateTime];
- }
- } else {
+ }
+ }
+ else {
elapsed = -elapsed;
-
+
if (elapsed <= 1) {
return TTLocalizedString(@"just a moment ago", @"");
View
7 src/Three20Core/Sources/NSStringAdditions.m
@@ -144,9 +144,10 @@ - (NSString*)stringByAddingQueryDictionary:(NSDictionary*)query {
///////////////////////////////////////////////////////////////////////////////////////////////////
- (id)urlEncoded {
CFStringRef cfUrlEncodedString = CFURLCreateStringByAddingPercentEscapes(NULL,
- (CFStringRef)self,
- NULL, (CFStringRef)@"!*’();:@&=$,/?%#[]",
- kCFStringEncodingUTF8);
+ (CFStringRef)self,NULL,
+ (CFStringRef)@"!*’();:@&=$,/?%#[]",
+ kCFStringEncodingUTF8);
+
NSString *urlEncoded = [NSString stringWithString:(NSString *)cfUrlEncodedString];
CFRelease(cfUrlEncodedString);
return urlEncoded;
View
3  src/Three20Style/Sources/TTStyledLayout.m
@@ -377,7 +377,8 @@ - (void)breakLine {
// XXXjoe Support top, bottom, and center alignment also
if (frame.height < _lineHeight) {
UIFont* font = frame.font ? frame.font : _font;
- [self offsetFrame:frame by:(_lineHeight - (frame.height - (lowestDescender - font.descender)))];
+ [self offsetFrame:frame by:(_lineHeight - (frame.height -
+ (lowestDescender - font.descender)))];
}
frame = frame.nextFrame;
}
View
19 src/Three20Style/Sources/TTStyledTextParser.m
@@ -274,7 +274,8 @@ - (NSData *) parser:(NSXMLParser *)parser
- (void)parseText:(NSString*)string URLs:(BOOL)shouldParseURLs {
if (shouldParseURLs) {
[self parseURLs:string];
- } else {
+ }
+ else {
TTStyledTextNode* node = [[[TTStyledTextNode alloc] initWithText:string] autorelease];
[self addNode:node];
}
@@ -303,7 +304,7 @@ - (void)parseText:(NSString*)string {
NSCharacterSet* newLines = [NSCharacterSet newlineCharacterSet];
NSInteger stringIndex = 0;
NSInteger length = string.length;
-
+
while (1) {
NSRange searchRange = NSMakeRange(stringIndex, length - stringIndex);
NSRange range = [string rangeOfCharacterFromSet:newLines options:0 range:searchRange];
@@ -312,22 +313,24 @@ - (void)parseText:(NSString*)string {
NSRange textRange = NSMakeRange(stringIndex, range.location - stringIndex);
NSString* substr = [string substringWithRange:textRange];
[self parseText:substr URLs:_parseURLs];
-
+
// Add a line break node after the text
TTStyledLineBreakNode* br = [[[TTStyledLineBreakNode alloc] init] autorelease];
[self addNode:br];
-
+
stringIndex = stringIndex + substr.length + 1;
-
- } else {
+
+ }
+ else {
// Find all text until the end of hte string and parse it
NSString* substr = [string substringFromIndex:stringIndex];
[self parseText:substr URLs:_parseURLs];
break;
}
}
-
- } else {
+
+ }
+ else {
[self parseText:string URLs:_parseURLs];
}
}
View
2  src/Three20UI/Headers/TTTableViewController.h
@@ -93,7 +93,7 @@
* A Boolean value indicating if the controller clears the selection when the table appears.
* Default is YES.
*/
-@property(nonatomic) BOOL clearsSelectionOnViewWillAppear;
+@property (nonatomic) BOOL clearsSelectionOnViewWillAppear;
/**
* Initializes and returns a controller having the given style.
View
1  src/Three20UI/Sources/TTPhotoViewController.m
@@ -30,6 +30,7 @@
#import "Three20UI/UIToolbarAdditions.h"
// UINavigator
+#import "Three20UINavigator/TTGlobalNavigatorMetrics.h"
#import "Three20UINavigator/TTURLObject.h"
#import "Three20UINavigator/TTURLMap.h"
#import "Three20UINavigator/TTBaseNavigationController.h"
View
5 src/Three20UI/Sources/TTStyledTextTableItemCell.m
@@ -79,12 +79,13 @@ + (CGFloat)tableView:(UITableView*)tableView rowHeightForObject:(id)object {
if (item.URL) {
padding += kDisclosureIndicatorWidth;
}
-
+
CGFloat margin = item.margin.left + item.margin.right;
item.text.width = tableView.width - padding - margin;
- return item.text.height + item.padding.top + item.padding.bottom + item.margin.top + item.margin.bottom;
+ return item.text.height + item.padding.top + item.padding.bottom
+ + item.margin.top + item.margin.bottom;
}
View
6 src/Three20UI/Sources/TTTableViewController.m
@@ -641,18 +641,18 @@ - (UITableView*)tableView {
_tableView = [[TTTableView alloc] initWithFrame:self.view.bounds style:_tableViewStyle];
_tableView.autoresizingMask = UIViewAutoresizingFlexibleWidth
| UIViewAutoresizingFlexibleHeight;
-
+
UIColor* separatorColor = _tableViewStyle == UITableViewStyleGrouped
? TTSTYLEVAR(tableGroupedCellSeparatorColor)
: TTSTYLEVAR(tablePlainCellSeparatorColor);
if (separatorColor) {
_tableView.separatorColor = separatorColor;
}
-
+
_tableView.separatorStyle = _tableViewStyle == UITableViewStyleGrouped
? TTSTYLEVAR(tableGroupedCellSeparatorStyle)
: TTSTYLEVAR(tablePlainCellSeparatorStyle);
-
+
UIColor* backgroundColor = _tableViewStyle == UITableViewStyleGrouped
? TTSTYLEVAR(tableGroupedBackgroundColor)
: TTSTYLEVAR(tablePlainBackgroundColor);
View
10 src/Three20UI/Sources/TTWebController.m
@@ -321,8 +321,10 @@ - (void)restoreView:(NSDictionary*)state {
///////////////////////////////////////////////////////////////////////////////////////////////////
- (BOOL)webView:(UIWebView*)webView shouldStartLoadWithRequest:(NSURLRequest*)request
navigationType:(UIWebViewNavigationType)navigationType {
- if ([_delegate respondsToSelector:@selector(webController:webView:shouldStartLoadWithRequest:navigationType:)] &&
- ![_delegate webController:self webView:webView shouldStartLoadWithRequest:request navigationType:navigationType]) {
+ if ([_delegate respondsToSelector:
+ @selector(webController:webView:shouldStartLoadWithRequest:navigationType:)] &&
+ ![_delegate webController:self webView:webView
+ shouldStartLoadWithRequest:request navigationType:navigationType]) {
return NO;
}
@@ -417,7 +419,7 @@ - (void)setHeaderView:(UIView*)headerView {
_headerView = [headerView retain];
_headerView.frame = CGRectMake(0, 0, _webView.width, _headerView.height);
- self.view;
+ //self.view;
UIView* scroller = [_webView descendantOrSelfWithClass:NSClassFromString(@"UIScroller")];
UIView* docView = [scroller descendantOrSelfWithClass:NSClassFromString(@"UIWebDocumentView")];
[scroller addSubview:_headerView];
@@ -443,7 +445,7 @@ - (void)openURL:(NSURL*)URL {
///////////////////////////////////////////////////////////////////////////////////////////////////
- (void)openRequest:(NSURLRequest*)request {
- self.view;
+ //self.view;
[_webView loadRequest:request];
}
Please sign in to comment.
Something went wrong with that request. Please try again.