#pragma mark - Internal
+- (NSURL *)publicLinkURL {
+ if ([self.object.publicURI hasPrefix:@"https://"]) {
+ return [NSURL URLWithString:[NSString stringWithFormat:@"https://%@",
+ [NSString encodeToPercentEscape:[self.object.publicURI substringFromIndex:8]
+ charactersToEncode:@"!*'();:@&=+$,?%#[]"]]];
+ } else if ([self.object.publicURI hasPrefix:@"http://"]) {
+ return [NSURL URLWithString:[NSString stringWithFormat:@"http://%@",
+ [NSString encodeToPercentEscape:[self.object.publicURI substringFromIndex:7]
+ charactersToEncode:@"!*'();:@&=+$,?%#[]"]]];
+ } else {
+ return [account.provider.publicLinkURLPrefix URLByAppendingPathComponent:
+ [NSString encodeToPercentEscape:[self.object.publicURI substringFromIndex:1]
+ charactersToEncode:@"!*'();:@&=+$,?%#[]"]];
+ }
+}
+
- (void)objectIsPublicSwitchChanged:(id)sender {
NSString *activityMessage = [NSString stringWithFormat:@"Enabling public link.."];
self.oldPublicURI = object.publicURI;
CGSizeMake(221.0, 9000.0))
lineBreakMode:UILineBreakModeCharacterWrap].height;
} else if ((indexPath.section == publicLinkSection) && (indexPath.row == 1)) {
- NSURL *publicLinkURL = [account.provider.publicLinkURLPrefix URLByAppendingPathComponent:
- [NSString encodeToPercentEscape:[self.object.publicURI substringFromIndex:1]
- charactersToEncode:@"!*'();:@&=+$,?%#[]"]];
- result = 30.0 + [[publicLinkURL description] sizeWithFont:[UIFont systemFontOfSize:18.0]
- constrainedToSize:(([UIDevice currentDevice].userInterfaceIdiom == UIUserInterfaceIdiomPad) ?
- CGSizeMake(596.0, 9000.0) :
- CGSizeMake(280.0, 9000.0))
- lineBreakMode:UILineBreakModeCharacterWrap].height;
+ result = 30.0 + [[[self publicLinkURL] description] sizeWithFont:[UIFont systemFontOfSize:18.0]
+ constrainedToSize:(([UIDevice currentDevice].userInterfaceIdiom == UIUserInterfaceIdiomPad) ?
+ CGSizeMake(596.0, 9000.0) :
+ CGSizeMake(280.0, 9000.0))
+ lineBreakMode:UILineBreakModeCharacterWrap].height;
}
return MAX(aTableView.rowHeight, result);
}
cell.textView.backgroundColor = [UIColor clearColor];
cell.textView.font = [UIFont systemFontOfSize:15.0];
cell.textView.dataDetectorTypes = UIDataDetectorTypeLink;
- cell.textView.text = [[account.provider.publicLinkURLPrefix URLByAppendingPathComponent:
- [NSString encodeToPercentEscape:[self.object.publicURI substringFromIndex:1]
- charactersToEncode:@"!*'();:@&=+$,?%#[]"]] description];
+ cell.textView.text = [[self publicLinkURL] description];
cell.selectionStyle = UITableViewCellSelectionStyleNone;
cell.accessoryView = UITableViewCellAccessoryNone;
return cell;