Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TIMOB-16514] Prompt the user before making a call from a webview link #5409

Merged
merged 2 commits into from
Mar 3, 2014
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 10 additions & 0 deletions apidoc/Titanium/UI/WebView.yml
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,16 @@ properties:
default: false
platforms: [iphone, ipad]

- name: handlePlatformUrl
summary: Lets the platform handle the url in a link from the webview
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lets the webView handle platform supported URL's

description: |
Set to `true` to let the platform handle the url automatically. This is necessary, for example, if the url
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Update description to what the property actually does.

links to a telephone number and you wish to promt the user before making a call.
type: Boolean
platforms: [iphone, ipad]
since: "3.3.0"
default: false
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Undefined. Behaves as if false.


- name: hideLoadIndicator
summary: Hides activity indicator when loading remote URL.
type: Boolean
Expand Down
3 changes: 3 additions & 0 deletions iphone/Classes/TiUIWebView.m
Original file line number Diff line number Diff line change
Expand Up @@ -683,6 +683,9 @@ - (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)
return YES;
}

if([TiUtils boolValue: [[self proxy] valueForUndefinedKey:@"handlePlatformUrl"] def:NO]) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Inefficient implementation. Remove this check and save the property in a local variable. Then the following if condition can become
if( ([uiApp canOpenURL:newUrl]) && !handleUrl)

return YES;
}
UIApplication * uiApp = [UIApplication sharedApplication];

if ([uiApp canOpenURL:newUrl])
Expand Down