Merge pull request #3405 from VladiMihaylenko/dev

[ios] Bookmarks small fixes.
This commit is contained in:
igrechuhin 2016-06-01 17:08:09 +04:00
commit 6d0d8dcc7d
3 changed files with 22 additions and 7 deletions

View file

@ -1,7 +1,8 @@
#import "MapsAppDelegate.h"
#import "MWMPlacePageBookmarkCell.h"
#import "Statistics.h"
#import "UIColor+MapsMeColor.h"
#import "UIFont+MapsMeFonts.h"
namespace
{
@ -12,7 +13,7 @@ CGFloat const kTextViewLeft = 16.;
} // namespace
@interface MWMPlacePageBookmarkCell () <UITextFieldDelegate, UIWebViewDelegate>
@interface MWMPlacePageBookmarkCell () <UITextFieldDelegate, UITextViewDelegate>
@property (weak, nonatomic) IBOutlet UITextView * textView;
@property (weak, nonatomic) IBOutlet UIButton * moreButton;
@ -139,11 +140,15 @@ CGFloat const kTextViewLeft = 16.;
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^
{
self.cachedHtml = text;
self.attributedHtml = [[NSAttributedString alloc]
NSDictionary<NSString *, id> * attr = @{NSForegroundColorAttributeName : [UIColor blackPrimaryText],
NSFontAttributeName : [UIFont regular12]};
NSMutableAttributedString * str = [[NSMutableAttributedString alloc]
initWithData:[text dataUsingEncoding:NSUnicodeStringEncoding]
options:@{NSDocumentTypeDocumentAttribute: NSHTMLTextDocumentType}
options:@{NSDocumentTypeDocumentAttribute : NSHTMLTextDocumentType}
documentAttributes:nil
error:nil];
error:nil];
[str addAttributes:attr range:{0, str.length}];
self.attributedHtml = str;
dispatch_async(dispatch_get_main_queue(), ^
{
[self stopSpinner];
@ -170,4 +175,13 @@ CGFloat const kTextViewLeft = 16.;
self.separator.height + self.editButton.height;
}
#pragma mark - UITextViewDelegate
- (BOOL)textView:(UITextView *)textView shouldInteractWithURL:(NSURL *)URL inRange:(NSRange)characterRange
{
UIViewController * vc = static_cast<UIViewController *>(MapsAppDelegate.theApp.mapViewController);
[vc openUrl:URL];
return NO;
}
@end

View file

@ -115,11 +115,9 @@ typedef NS_ENUM(NSUInteger, MWMiPhonePortraitPlacePageState)
case MWMiPhonePortraitPlacePageStateClosed:
[self.actionBar removeFromSuperview];
[MWMPlacePageNavigationBar remove];
[self.manager.ownerViewController.view endEditing:YES];
break;
case MWMiPhonePortraitPlacePageStatePreview:
[MWMPlacePageNavigationBar remove];
[self.manager.ownerViewController.view endEditing:YES];
break;
case MWMiPhonePortraitPlacePageStateOpen:
case MWMiPhonePortraitPlacePageStateHover:

View file

@ -27,6 +27,9 @@
<userDefinedRuntimeAttribute type="string" keyPath="fontName" value="regular16"/>
<userDefinedRuntimeAttribute type="string" keyPath="colorName" value="blackPrimaryText"/>
</userDefinedRuntimeAttributes>
<connections>
<outlet property="delegate" destination="zRR-Mr-Dr9" id="1JH-0F-Csv"/>
</connections>
</textView>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="gradient_light" translatesAutoresizingMaskIntoConstraints="NO" id="Dhv-uU-KIw">
<rect key="frame" x="16" y="149" width="288" height="24"/>