Skip to content

Commit

Permalink
Merge pull request #7600 from hansemannn/TIMOB-20178
Browse files Browse the repository at this point in the history
[TIMOB-20178] Support Peek and Pop in Ti.UI.WebView
  • Loading branch information
pec1985 committed Dec 28, 2015
2 parents 9aaa978 + b608bc0 commit 1b32bbe
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 0 deletions.
18 changes: 18 additions & 0 deletions apidoc/Titanium/UI/WebView.yml
Original file line number Diff line number Diff line change
Expand Up @@ -393,6 +393,24 @@ events:

properties:

- name: allowsLinkPreview
summary: |
A Boolean value that determines whether pressing on a link displays a preview of the
destination for the link.
description: |
This property is available on devices that support 3D Touch. Default value is `false`.
If you set this value to `true` for a web view, users (with devices that support 3D Touch)
can preview link destinations, and can preview detected data such as addresses, by pressing on links.
Such previews are known to users as peeks. If a user presses deeper, the preview navigates (or pops,
in user terminology) to the destination. Because pop navigation switches the user from your app to
Safari, it is opt-in, by way of this property, rather default behavior for this class.
type: Boolean
default: false
since: "6.0.0"
osver: {ios: {min: "9.0"}}
platforms: [iphone]

- name: data
summary: Web content to load.
description: |
Expand Down
1 change: 1 addition & 0 deletions iphone/Classes/TiUIWebView.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
-(void)reload;

-(void)setHtml_:(NSString*)content withObject:(id)property;
-(void)setAllowsLinkPreview_:(id)value;

@end

Expand Down
11 changes: 11 additions & 0 deletions iphone/Classes/TiUIWebView.m
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,17 @@ -(id)url
return url;
}

-(void)setAllowsLinkPreview_:(id)value
{
#if IS_XCODE_7
if ([TiUtils isIOS9OrGreater] == NO) {
return;
}
ENSURE_TYPE(value, NSNumber);
[webview setAllowsLinkPreview:[TiUtils boolValue:value]];
#endif
}

- (void)reload
{
RELEASE_TO_NIL(lastValidLoad);
Expand Down

0 comments on commit 1b32bbe

Please sign in to comment.