| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -8,24 +8,6 @@ else { | |||
| 8 | 8 | ||
| 9 | 9 | import * as application from "tns-core-modules/application"; | |
| 10 | 10 | ||
| 11 | - // Specify custom UIApplicationDelegate. | ||
| 12 | - /* | ||
| 13 | - class MyDelegate extends UIResponder implements UIApplicationDelegate { | ||
| 14 | - public static ObjCProtocols = [UIApplicationDelegate]; | ||
| 15 | - | ||
| 16 | - applicationDidFinishLaunchingWithOptions(application: UIApplication, launchOptions: NSDictionary): boolean { | ||
| 17 | - console.log("applicationWillFinishLaunchingWithOptions: " + launchOptions) | ||
| 18 | - return true; | ||
| 19 | - } | ||
| 20 | - | ||
| 21 | - applicationDidBecomeActive(application: UIApplication): void { | ||
| 22 | - console.log("applicationDidBecomeActive: " + application) | ||
| 23 | - } | ||
| 24 | - } | ||
| 25 | - | ||
| 26 | - application.ios.delegate = MyDelegate; | ||
| 27 | - */ | ||
| 28 | - | ||
| 29 | 11 | if (application.ios) { | |
| 30 | 12 | // Observe application notifications. | |
| 31 | 13 | application.ios.addNotificationObserver(UIApplicationDidFinishLaunchingNotification, (notification: NSNotification) => { | |
@@ -34,6 +16,18 @@ if (application.ios) { | |||
| 34 | 16 | } | |
| 35 | 17 | ||
| 36 | 18 | // Common events for both Android and iOS. | |
| 19 | + application.on(application.displayedEvent, function (args: application.ApplicationEventData) { | ||
| 20 | + (<any>global).isDisplayedEventFired = true; | ||
| 21 | + | ||
| 22 | + if (args.android) { | ||
| 23 | + // For Android applications, args.android is an android activity class. | ||
| 24 | + console.log("Activity: " + args.android); | ||
| 25 | + } else if (args.ios) { | ||
| 26 | + // For iOS applications, args.ios is UIApplication. | ||
| 27 | + console.log("UIApplication: " + args.ios); | ||
| 28 | + } | ||
| 29 | + }); | ||
| 30 | + | ||
| 37 | 31 | application.on(application.launchEvent, function (args: application.ApplicationEventData) { | |
| 38 | 32 | if (args.android) { | |
| 39 | 33 | // For Android applications, args.android is an android.content.Intent class. | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -13,11 +13,16 @@ if (app.android) { | |||
| 13 | 13 | ||
| 14 | 14 | import * as TKUnit from "../TKUnit"; | |
| 15 | 15 | ||
| 16 | - export var testInitialized = function () { | ||
| 16 | + export function testInitialized() { | ||
| 17 | 17 | if (platform.device.os === platform.platformNames.android) { | |
| 18 | 18 | // we have the android defined | |
| 19 | 19 | TKUnit.assert(app.android, "Application module not properly intialized"); | |
| 20 | 20 | } else if (platform.device.os === platform.platformNames.ios) { | |
| 21 | 21 | TKUnit.assert(app.ios, "Application module not properly intialized"); | |
| 22 | 22 | } | |
| 23 | - } | ||
| 23 | + } | ||
| 24 | + | ||
| 25 | + export function testDisplayedEvent() { | ||
| 26 | + // global.isDisplayedEventFired flag is set in app.ts application.displayedEvent handler | ||
| 27 | + TKUnit.assert((<any>global).isDisplayedEventFired, "application.displayedEvent not fired"); | ||
| 28 | + } | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -19,7 +19,7 @@ import { createViewFromEntry } from "../ui/builder"; | |||
| 19 | 19 | import { ios as iosView, View } from "../ui/core/view"; | |
| 20 | 20 | import { Frame, NavigationEntry } from "../ui/frame"; | |
| 21 | 21 | import * as utils from "../utils/utils"; | |
| 22 | - import { profile, level as profilingLevel, Level } from "../profiling"; | ||
| 22 | + import { profile } from "../profiling"; | ||
| 23 | 23 | ||
| 24 | 24 | // NOTE: UIResponder with implementation of window - related to https://github.com/NativeScript/ios-runtime/issues/430 | |
| 25 | 25 | // TODO: Refactor the UIResponder to use Typescript extends when this issue is resolved: | |
@@ -131,7 +131,7 @@ class IOSApplication implements IOSApplicationDefinition { | |||
| 131 | 131 | ||
| 132 | 132 | @profile | |
| 133 | 133 | private didFinishLaunchingWithOptions(notification: NSNotification) { | |
| 134 | - if (!displayedOnce && profilingLevel() >= Level.lifecycle) { | ||
| 134 | + if (!displayedOnce) { | ||
| 135 | 135 | displayedLinkTarget = CADisplayLinkTarget.new(); | |
| 136 | 136 | displayedLink = CADisplayLink.displayLinkWithTargetSelector(displayedLinkTarget, "onDisplayed"); | |
| 137 | 137 | displayedLink.addToRunLoopForMode(NSRunLoop.mainRunLoop, NSDefaultRunLoopMode); | |
| Back | FazBrowse Home | New Git URL |
0 commit comments