openUrl added

This commit is contained in:
Vladimir Enchev
2015-09-09 10:34:21 +03:00
parent 0e61d1a120
commit cd313eb6d2
3 changed files with 22 additions and 2 deletions

View File

@ -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
View File

@ -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
}

View File

@ -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));
}
}