mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-15 19:26:42 +08:00
openUrl added
This commit is contained in:
@ -130,4 +130,11 @@ export module ad {
|
||||
|
||||
export function GC() {
|
||||
gc();
|
||||
}
|
||||
|
||||
export function openUrl(url: string): void {
|
||||
var context = ad.getApplicationContext();
|
||||
if (context) {
|
||||
context.startActivity(new android.content.Intent(android.content.Intent.ACTION_VIEW, android.net.Uri.parse(url)));
|
||||
}
|
||||
}
|
6
utils/utils.d.ts
vendored
6
utils/utils.d.ts
vendored
@ -173,4 +173,10 @@
|
||||
* @param source The JSON or JSONP string.
|
||||
*/
|
||||
export function parseJSON(source: string): any
|
||||
|
||||
/**
|
||||
* Opens url.
|
||||
* @param url The url.
|
||||
*/
|
||||
export function openUrl(url: string): void
|
||||
}
|
||||
|
@ -50,7 +50,7 @@ export module ios {
|
||||
var greenRef = new interop.Reference<number>();
|
||||
var blueRef = new interop.Reference<number>();
|
||||
var alphaRef = new interop.Reference<number>();
|
||||
|
||||
|
||||
uiColor.getRedGreenBlueAlpha(redRef, greenRef, blueRef, alphaRef);
|
||||
var red = redRef.value * 255;
|
||||
var green = greenRef.value * 255;
|
||||
@ -142,8 +142,15 @@ export module ios {
|
||||
rootView.measure(widthSpec, heightSpec);
|
||||
rootView.layout(left, top, width, height);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export function GC() {
|
||||
__collect();
|
||||
}
|
||||
|
||||
export function openUrl(url: string): void {
|
||||
var sharedApp = UIApplication.sharedApplication()
|
||||
if (sharedApp) {
|
||||
sharedApp.openURL(NSURL.URLWithString(url));
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user