forked from organicmaps/organicmaps
[ios] add wikipedia source in full place description
This commit is contained in:
parent
cc7c37a2d7
commit
621b1f2857
3 changed files with 16 additions and 4 deletions
iphone/Maps
|
@ -23,6 +23,7 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
- (BOOL)shouldAddAccessToken;
|
||||
- (void)forward;
|
||||
- (void)back;
|
||||
- (NSString *)configuredHtmlWithText:(NSString *)htmlText;
|
||||
|
||||
@end
|
||||
|
||||
|
|
|
@ -31,10 +31,7 @@
|
|||
self = [super initWithNibName:nil bundle:nil];
|
||||
if (self)
|
||||
{
|
||||
auto html = [htmlText stringByReplacingOccurrencesOfString:@"<body>"
|
||||
withString:@"<body><font face=\"helvetica\" size=\"14pt\">"];
|
||||
html = [html stringByReplacingOccurrencesOfString:@"</body>" withString:@"</font></body>"];
|
||||
_m_htmlText = html;
|
||||
_m_htmlText = [self configuredHtmlWithText:htmlText];
|
||||
_m_url = url;
|
||||
if (title)
|
||||
self.navigationItem.title = title;
|
||||
|
@ -42,6 +39,14 @@
|
|||
return self;
|
||||
}
|
||||
|
||||
- (NSString *)configuredHtmlWithText:(NSString *)htmlText
|
||||
{
|
||||
auto html = [htmlText stringByReplacingOccurrencesOfString:@"<body>"
|
||||
withString:@"<body><font face=\"helvetica\" size=\"14pt\">"];
|
||||
html = [htmlText stringByReplacingOccurrencesOfString:@"</body>" withString:@"</font></body>"];
|
||||
return html;
|
||||
}
|
||||
|
||||
- (instancetype)initWithAuthURL:(NSURL *)url onSuccessAuth:(MWMStringBlock)success
|
||||
onFailure:(MWMVoidBlock)failure
|
||||
{
|
||||
|
|
|
@ -10,6 +10,12 @@ final class PlacePageDescriptionViewController: WebViewController {
|
|||
Statistics.logEvent(kStatPlacePageDescriptionViewAll)
|
||||
}
|
||||
}
|
||||
|
||||
override func configuredHtml(withText htmlText: String) -> String {
|
||||
var html = htmlText.replacingOccurrences(of: "<body>", with: "<body><font face=\"helvetica\" size=\"14pt\">")
|
||||
html = html.replacingOccurrences(of: "</body>", with: "<p><b>wikipedia.org</b></p></font></body>")
|
||||
return html
|
||||
}
|
||||
|
||||
override func webView(_ webView: WKWebView,
|
||||
decidePolicyFor navigationAction: WKNavigationAction,
|
||||
|
|
Loading…
Add table
Reference in a new issue