Merge pull request #3496 from NativeScript/trace

Fix tracing
This commit is contained in:
Rossen Hristov
2017-01-16 13:31:01 +02:00
committed by GitHub
32 changed files with 211 additions and 207 deletions

View File

@ -3,13 +3,13 @@ import * as helper from "../ui/helper";
import * as platform from "platform";
import * as trace from "trace";
import {Color} from "color";
import {NavigationEntry, NavigationTransition, topmost as topmostFrame} from "ui/frame";
import {NavigationEntry, NavigationTransition, topmost as topmostFrame, traceEnabled} from "ui/frame";
import {Page} from "ui/page";
import {AnimationCurve} from "ui/enums"
function _testTransition(navigationTransition: NavigationTransition) {
var testId = `Transition[${JSON.stringify(navigationTransition)}]`;
if (trace.enabled) {
if (traceEnabled()) {
trace.write(`Testing ${testId}`, trace.categories.Test);
}
var navigationEntry: NavigationEntry = {

View File

@ -29,7 +29,7 @@ export var test_DummyTestForSnippetOnly2 = function () {
// >> trace-message
trace.setCategories(trace.categories.Debug);
trace.enable();
if (trace.enabled) {
if (trace.isEnabled()) {
trace.write("My Debug Message", trace.categories.Debug);
}
// << trace-message

View File

@ -142,7 +142,7 @@ export class FileNameResolver implements definition.FileNameResolver {
var candidates = this.getFileCandidatesFromFolder(path, ext);
result = _findFileMatch(path, ext, candidates, this._context);
if (trace.enabled) {
if (trace.isEnabled()) {
trace.write("Resolved file name for \"" + path + ext + "\" result: " + (result ? result : "no match found"), trace.categories.Navigation);
}
return result;
@ -166,7 +166,7 @@ export class FileNameResolver implements definition.FileNameResolver {
});
}
else {
if (trace.enabled) {
if (trace.isEnabled()) {
trace.write("Could not find folder " + folderPath + " when loading " + path + ext, trace.categories.Navigation);
}
}
@ -179,7 +179,7 @@ export function _findFileMatch(path: string, ext: string, candidates: Array<stri
var bestValue = -1
var result: string = null;
if (trace.enabled) {
if (trace.isEnabled()) {
trace.write("Candidates for " + path + ext + ": " + candidates.join(", "), trace.categories.Navigation);
}
for (var i = 0; i < candidates.length; i++) {

View File

@ -13,11 +13,11 @@ declare module "trace" {
export function disable(): void;
/**
* A field that indicates if the tracer is enabled and there is a point in writing messages.
* A function that returns whether the tracer is enabled and there is a point in writing messages.
* Check this to avoid writing complex string templates.
* Send error messages should even if tracing is disabled.
* Send error messages even if tracing is disabled.
*/
export var enabled: boolean;
export function isEnabled(): boolean;
/**
* Adds a TraceWriter instance to the trace module.

View File

@ -1,7 +1,7 @@
import * as definition from "trace";
import * as types from "utils/types";
export var enabled = false;
var enabled = false;
var _categories = {};
var _writers: Array<definition.TraceWriter> = [];
var _eventListeners: Array<definition.EventListener> = [];
@ -14,6 +14,10 @@ export function disable() {
enabled = false;
}
export function isEnabled() {
return enabled;
}
export function isCategorySet(category: string): boolean {
return category in _categories;
}

View File

@ -63,7 +63,7 @@ export abstract class AnimationBase implements AnimationBaseDefinition {
throw new Error("No animation definitions specified");
}
if (traceEnabled) {
if (traceEnabled()) {
traceWrite("Analyzing " + animationDefinitions.length + " animation definitions...", traceCategories.Animation);
}
@ -78,7 +78,7 @@ export abstract class AnimationBase implements AnimationBaseDefinition {
if (this._propertyAnimations.length === 0) {
throw new Error("Nothing to animate.");
}
if (traceEnabled) {
if (traceEnabled()) {
traceWrite("Created " + this._propertyAnimations.length + " individual property animations.", traceCategories.Animation);
}

View File

@ -39,34 +39,34 @@ propertyKeys[Properties.translate] = Symbol(keyPrefix + Properties.translate);
export function _resolveAnimationCurve(curve: string | CubicBezierAnimationCurve | android.view.animation.Interpolator): android.view.animation.Interpolator {
switch (curve) {
case "easeIn":
if (traceEnabled) {
if (traceEnabled()) {
traceWrite("Animation curve resolved to android.view.animation.AccelerateInterpolator(1).", traceCategories.Animation);
}
return easeIn();
case "easeOut":
if (traceEnabled) {
if (traceEnabled()) {
traceWrite("Animation curve resolved to android.view.animation.DecelerateInterpolator(1).", traceCategories.Animation);
}
return easeOut();
case "easeInOut":
if (traceEnabled) {
if (traceEnabled()) {
traceWrite("Animation curve resolved to android.view.animation.AccelerateDecelerateInterpolator().", traceCategories.Animation);
}
return easeInOut();
case "linear":
if (traceEnabled) {
if (traceEnabled()) {
traceWrite("Animation curve resolved to android.view.animation.LinearInterpolator().", traceCategories.Animation);
}
return linear();
case "spring":
if (traceEnabled) {
if (traceEnabled()) {
traceWrite("Animation curve resolved to android.view.animation.BounceInterpolator().", traceCategories.Animation);
}
return bounce();
case "ease":
return (<any>android).support.v4.view.animation.PathInterpolatorCompat.create(0.25, 0.1, 0.25, 1.0);
default:
if (traceEnabled) {
if (traceEnabled()) {
traceWrite("Animation curve resolved to original: " + curve, traceCategories.Animation);
}
if (curve instanceof CubicBezierAnimationCurve) {
@ -100,23 +100,23 @@ export class Animation extends AnimationBase {
let that = new WeakRef(this);
this._animatorListener = new android.animation.Animator.AnimatorListener({
onAnimationStart: function (animator: android.animation.Animator): void {
if (traceEnabled) {
if (traceEnabled()) {
traceWrite("MainAnimatorListener.onAndroidAnimationStart(" + animator + ")", traceCategories.Animation);
}
},
onAnimationRepeat: function (animator: android.animation.Animator): void {
if (traceEnabled) {
if (traceEnabled()) {
traceWrite("MainAnimatorListener.onAnimationRepeat(" + animator + ")", traceCategories.Animation);
}
},
onAnimationEnd: function (animator: android.animation.Animator): void {
if (traceEnabled) {
if (traceEnabled()) {
traceWrite("MainAnimatorListener.onAnimationEnd(" + animator + ")", traceCategories.Animation);
}
that.get()._onAndroidAnimationEnd();
},
onAnimationCancel: function (animator: android.animation.Animator): void {
if (traceEnabled) {
if (traceEnabled()) {
traceWrite("MainAnimatorListener.onAnimationCancel(" + animator + ")", traceCategories.Animation);
}
that.get()._onAndroidAnimationCancel();
@ -153,7 +153,7 @@ export class Animation extends AnimationBase {
this._enableHardwareAcceleration();
if (traceEnabled) {
if (traceEnabled()) {
traceWrite("Starting " + this._nativeAnimatorsArray.length + " animations " + (this._playSequentially ? "sequentially." : "together."), traceCategories.Animation);
}
this._animatorSet.setupStartValues();
@ -163,7 +163,7 @@ export class Animation extends AnimationBase {
public cancel(): void {
super.cancel();
if (traceEnabled) {
if (traceEnabled()) {
traceWrite("Cancelling AnimatorSet.", traceCategories.Animation);
}
this._animatorSet.cancel();
@ -203,7 +203,7 @@ export class Animation extends AnimationBase {
return;
}
if (traceEnabled) {
if (traceEnabled()) {
traceWrite("Creating ObjectAnimator(s) for animation: " + Animation._getAnimationInfo(propertyAnimation) + "...", traceCategories.Animation);
}
@ -385,7 +385,7 @@ export class Animation extends AnimationBase {
animators[i].setInterpolator(propertyAnimation.curve);
}
if (traceEnabled) {
if (traceEnabled()) {
traceWrite("Animator created: " + animators[i], traceCategories.Animation);
}
}

View File

@ -157,11 +157,11 @@ export class Animation extends AnimationBase {
}
if (!playSequentially) {
if (traceEnabled) {
if (traceEnabled()) {
traceWrite("Non-merged Property Animations: " + this._propertyAnimations.length, traceCategories.Animation);
}
this._mergedPropertyAnimations = Animation._mergeAffineTransformAnimations(this._propertyAnimations);
if (traceEnabled) {
if (traceEnabled()) {
traceWrite("Merged Property Animations: " + this._mergedPropertyAnimations.length, traceCategories.Animation);
}
}
@ -190,13 +190,13 @@ export class Animation extends AnimationBase {
}
if (that._cancelledAnimations > 0 && (that._cancelledAnimations + that._finishedAnimations) === that._mergedPropertyAnimations.length) {
if (traceEnabled) {
if (traceEnabled()) {
traceWrite(that._cancelledAnimations + " animations cancelled.", traceCategories.Animation);
}
that._rejectAnimationFinishedPromise();
}
else if (that._finishedAnimations === that._mergedPropertyAnimations.length) {
if (traceEnabled) {
if (traceEnabled()) {
traceWrite(that._finishedAnimations + " animations finished.", traceCategories.Animation);
}
that._resolveAnimationFinishedPromise();
@ -237,7 +237,7 @@ export class Animation extends AnimationBase {
return (cancelled?: boolean) => {
if (cancelled && finishedCallback) {
if (traceEnabled) {
if (traceEnabled()) {
traceWrite("Animation " + (index - 1).toString() + " was cancelled. Will skip the rest of animations and call finishedCallback(true).", traceCategories.Animation);
}
finishedCallback(cancelled);
@ -558,11 +558,11 @@ export class Animation extends AnimationBase {
iterations: propertyAnimations[i].iterations,
curve: propertyAnimations[i].curve
};
if (traceEnabled) {
if (traceEnabled()) {
traceWrite("Curve: " + propertyAnimations[i].curve, traceCategories.Animation);
}
newTransformAnimation.value[propertyAnimations[i].property] = propertyAnimations[i].value;
if (traceEnabled) {
if (traceEnabled()) {
traceWrite("Created new transform animation: " + Animation._getAnimationInfo(newTransformAnimation), traceCategories.Animation);
}
@ -571,7 +571,7 @@ export class Animation extends AnimationBase {
if (j < length) {
for (; j < length; j++) {
if (Animation._canBeMerged(propertyAnimations[i], propertyAnimations[j])) {
if (traceEnabled) {
if (traceEnabled()) {
traceWrite("Merging animations: " + Animation._getAnimationInfo(newTransformAnimation) + " + " + Animation._getAnimationInfo(propertyAnimations[j]) + ";", traceCategories.Animation);
}
newTransformAnimation.value[propertyAnimations[j].property] = propertyAnimations[j].value;

View File

@ -76,7 +76,7 @@ export class Bindable extends DependencyObservable implements definition.Bindabl
// }
// public _onPropertyChanged(property: Property, oldValue: any, newValue: any) {
// if (traceEnabled) {
// if (traceEnabled()) {
// traceWrite(`${this}._onPropertyChanged(${property.name}, ${oldValue}, ${newValue})`, traceCategories.Binding);
// }
// super._onPropertyChanged(property, oldValue, newValue);
@ -89,13 +89,13 @@ export class Bindable extends DependencyObservable implements definition.Bindabl
// let binding = this.bindings.get(property.name);
// if (binding && !binding.updating) {
// if (binding.options.twoWay) {
// if (traceEnabled) {
// if (traceEnabled()) {
// traceWrite(`${this}._updateTwoWayBinding(${property.name}, ${newValue});` + property.name, traceCategories.Binding);
// }
// this._updateTwoWayBinding(property.name, newValue);
// }
// else {
// if (traceEnabled) {
// if (traceEnabled()) {
// traceWrite(`${this}.unbind(${property.name});`, traceCategories.Binding);
// }
// this.unbind(property.name);
@ -115,7 +115,7 @@ export class Bindable extends DependencyObservable implements definition.Bindabl
// this.bindings.forEach((binding, index, bindings) => {
// if (!binding.updating && binding.sourceIsBindingContext && binding.options.targetProperty !== "bindingContext") {
// if (traceEnabled) {
// if (traceEnabled()) {
// traceWrite(`Binding ${binding.target.get()}.${binding.options.targetProperty} to new context ${bindingContextSource}`, traceCategories.Binding);
// }
// if (!types.isNullOrUndefined(bindingContextSource)) {

View File

@ -7,7 +7,7 @@ import { fromString as gestureFromString } from "ui/gestures";
import { SelectorCore } from "ui/styling/css-selector";
import { KeyframeAnimation } from "ui/animation/keyframe-animation";
import { enabled as traceEnabled, write as traceWrite, categories as traceCategories, notifyEvent as traceNotifyEvent, isCategorySet } from "trace";
import { isEnabled as traceEnabled, write as traceWrite, categories as traceCategories, notifyEvent as traceNotifyEvent, isCategorySet } from "trace";
// TODO: Remove this import!
import * as types from "utils/types";
@ -426,7 +426,7 @@ export class ViewBase extends Observable implements ViewBaseDefinition {
}
public _addView(view: ViewBase, atIndex?: number) {
if (traceEnabled) {
if (traceEnabled()) {
traceWrite(`${this}._addView(${view}, ${atIndex})`, traceCategories.ViewHierarchy);
}
@ -463,7 +463,7 @@ export class ViewBase extends Observable implements ViewBaseDefinition {
* Core logic for removing a child view from this instance. Used by the framework to handle lifecycle events more centralized. Do not outside the UI Stack implementation.
*/
public _removeView(view: ViewBase) {
if (traceEnabled) {
if (traceEnabled()) {
traceWrite(`${this}._removeView(${view})`, traceCategories.ViewHierarchy);
}
@ -510,7 +510,7 @@ export class ViewBase extends Observable implements ViewBaseDefinition {
public _setupUI(context: android.content.Context, atIndex?: number) {
traceNotifyEvent(this, "_setupUI");
if (traceEnabled) {
if (traceEnabled()) {
traceWrite(`${this}._setupUI(${context})`, traceCategories.VisualTreeEvents);
}
@ -543,7 +543,7 @@ export class ViewBase extends Observable implements ViewBaseDefinition {
}
public _tearDownUI(force?: boolean) {
if (traceEnabled) {
if (traceEnabled()) {
traceWrite(`${this}._tearDownUI(${force})`, traceCategories.VisualTreeEvents);
}
@ -594,7 +594,7 @@ export class ViewBase extends Observable implements ViewBaseDefinition {
}
public _goToVisualState(state: string) {
if (traceEnabled) {
if (traceEnabled()) {
traceWrite(this + " going to state: " + state, traceCategories.Style);
}
if (state === this._visualState) {

View File

@ -550,7 +550,7 @@ export abstract class ViewCommon extends ViewBase implements ViewDefinition {
public setMeasuredDimension(measuredWidth: number, measuredHeight: number): void {
this._measuredWidth = measuredWidth;
this._measuredHeight = measuredHeight;
if (traceEnabled) {
if (traceEnabled()) {
traceWrite(this + " :setMeasuredDimension: " + measuredWidth + ", " + measuredHeight, traceCategories.Layout);
}
}
@ -668,7 +668,7 @@ export abstract class ViewCommon extends ViewBase implements ViewDefinition {
childLeft = Math.round(childLeft);
childTop = Math.round(childTop);
if (traceEnabled) {
if (traceEnabled()) {
traceWrite(child.parent + " :layoutChild: " + child + " " + childLeft + ", " + childTop + ", " + childRight + ", " + childBottom, traceCategories.Layout);
}
@ -695,7 +695,7 @@ export abstract class ViewCommon extends ViewBase implements ViewDefinition {
let childWidthMeasureSpec = ViewCommon.getMeasureSpec(width, widthMode, horizontalMargins, child.effectiveWidth, style.horizontalAlignment === HorizontalAlignment.STRETCH);
let childHeightMeasureSpec = ViewCommon.getMeasureSpec(height, heightMode, verticalMargins, child.effectiveHeight, style.verticalAlignment === VerticalAlignment.STRETCH);
if (traceEnabled) {
if (traceEnabled()) {
traceWrite(child.parent + " :measureChild: " + child + " " + layout.measureSpecToString(childWidthMeasureSpec) + ", " + layout.measureSpecToString(childHeightMeasureSpec), traceCategories.Layout);
}

View File

@ -557,7 +557,7 @@ export class CustomLayoutView extends View implements CustomLayoutViewDefinition
super._addViewToNativeVisualTree(child);
if (this._nativeView && child.nativeView) {
if (traceEnabled) {
if (traceEnabled()) {
traceWrite(`${this}.nativeView.addView(${child}.nativeView, ${atIndex})`, traceCategories.VisualTreeEvents);
}
this._nativeView.addView(child.nativeView, atIndex);
@ -588,7 +588,7 @@ export class CustomLayoutView extends View implements CustomLayoutViewDefinition
if (this._nativeView && child._nativeView) {
this._nativeView.removeView(child._nativeView);
if (traceEnabled) {
if (traceEnabled()) {
traceWrite(`${this}._nativeView.removeView(${child}._nativeView)`, traceCategories.VisualTreeEvents);
traceNotifyEvent(child, "childInLayoutRemovedFromNativeVisualTree");
}

View File

@ -131,7 +131,7 @@ export class View extends ViewCommon {
public _setNativeViewFrame(nativeView: UIView, frame: CGRect) {
if (!CGRectEqualToRect(nativeView.frame, frame)) {
if (traceEnabled) {
if (traceEnabled()) {
traceWrite(this + ", Native setFrame: = " + NSStringFromCGRect(frame), traceCategories.Layout);
}
this._cachedFrame = frame;
@ -161,7 +161,7 @@ export class View extends ViewCommon {
// // in iOS 8 we set frame to subview again otherwise we get clipped.
// let nativeView: UIView;
// if (!this.parent && this.nativeView.subviews.count > 0 && ios.MajorVersion < 8) {
// if (traceEnabled) {
// if (traceEnabled()) {
// traceWrite(this + " has no parent. Setting frame to first child instead.", traceCategories.Layout);
// }
// nativeView = (<UIView>this.nativeView.subviews[0]);

View File

@ -11,7 +11,7 @@ declare module "ui/core/view-base" {
import { isIOS, isAndroid } from "platform";
import { fromString as gestureFromString } from "ui/gestures";
import { KeyframeAnimation } from "ui/animation/keyframe-animation";
import { enabled as traceEnabled, write as traceWrite, categories as traceCategories, notifyEvent as traceNotifyEvent, isCategorySet } from "trace";
import { isEnabled as traceEnabled, write as traceWrite, categories as traceCategories, notifyEvent as traceNotifyEvent, isCategorySet } from "trace";
export {
Observable, EventData, KeyframeAnimation,

View File

@ -67,14 +67,14 @@ export function resolvePageFromEntry(entry: NavigationEntry): Page {
let moduleExports;
if (global.moduleExists(entry.moduleName)) {
if (traceEnabled) {
if (traceEnabled()) {
traceWrite("Loading pre-registered JS module: " + entry.moduleName, traceCategories.Navigation);
}
moduleExports = global.loadModule(entry.moduleName);
} else {
let moduleExportsResolvedPath = resolveFileName(moduleNamePath, "js");
if (moduleExportsResolvedPath) {
if (traceEnabled) {
if (traceEnabled()) {
traceWrite("Loading JS file: " + moduleExportsResolvedPath, traceCategories.Navigation);
}
@ -85,7 +85,7 @@ export function resolvePageFromEntry(entry: NavigationEntry): Page {
}
if (moduleExports && moduleExports.createPage) {
if (traceEnabled) {
if (traceEnabled()) {
traceWrite("Calling createPage()", traceCategories.Navigation);
}
page = moduleExports.createPage();
@ -115,7 +115,7 @@ function pageFromBuilder(moduleNamePath: string, moduleExports: any): Page {
// Possible XML file path.
let fileName = resolveFileName(moduleNamePath, "xml");
if (fileName) {
if (traceEnabled) {
if (traceEnabled()) {
traceWrite("Loading XML file: " + fileName, traceCategories.Navigation);
}
@ -170,7 +170,7 @@ export class FrameBase extends CustomLayoutView implements FrameDefinition {
* @param to The backstack entry to navigate back to.
*/
public goBack(backstackEntry?: BackstackEntry) {
if (traceEnabled) {
if (traceEnabled()) {
traceWrite(`GO BACK`, traceCategories.Navigation);
}
if (!this.canGoBack()) {
@ -199,7 +199,7 @@ export class FrameBase extends CustomLayoutView implements FrameDefinition {
this._processNavigationContext(navigationContext);
}
else {
if (traceEnabled) {
if (traceEnabled()) {
traceWrite(`Going back scheduled`, traceCategories.Navigation);
}
}
@ -227,7 +227,7 @@ export class FrameBase extends CustomLayoutView implements FrameDefinition {
// }
public navigate(param: any) {
if (traceEnabled) {
if (traceEnabled()) {
traceWrite(`NAVIGATE`, traceCategories.Navigation);
}
@ -266,7 +266,7 @@ export class FrameBase extends CustomLayoutView implements FrameDefinition {
this._processNavigationContext(navigationContext);
}
else {
if (traceEnabled) {
if (traceEnabled()) {
traceWrite(`Navigation scheduled`, traceCategories.Navigation);
}
}
@ -346,13 +346,13 @@ export class FrameBase extends CustomLayoutView implements FrameDefinition {
}
public _goBackCore(backstackEntry: BackstackEntry) {
if (traceEnabled) {
if (traceEnabled()) {
traceWrite(`GO BACK CORE(${this._backstackEntryTrace(backstackEntry)}); currentPage: ${this.currentPage}`, traceCategories.Navigation);
}
}
public _navigateCore(backstackEntry: BackstackEntry) {
if (traceEnabled) {
if (traceEnabled()) {
traceWrite(`NAVIGATE CORE(${this._backstackEntryTrace(backstackEntry)}); currentPage: ${this.currentPage}`, traceCategories.Navigation);
}
}

View File

@ -19,7 +19,7 @@ let fragmentId = -1;
let activityInitialized = false;
function onFragmentShown(fragment: android.app.Fragment) {
if (traceEnabled) {
if (traceEnabled()) {
traceWrite(`SHOWN ${fragment}`, traceCategories.NativeLifecycle);
}
@ -27,7 +27,7 @@ function onFragmentShown(fragment: android.app.Fragment) {
if (callbacks.clearHistory) {
// This is the fragment which was at the bottom of the stack (fragment0) when we cleared history and called
// manager.popBackStack(firstEntryName, android.app.FragmentManager.POP_BACK_STACK_INCLUSIVE);
if (traceEnabled) {
if (traceEnabled()) {
traceWrite(`${fragment} has been shown, but it is being cleared from history. Returning.`, traceCategories.NativeLifecycle);
}
return null;
@ -66,7 +66,7 @@ function onFragmentShown(fragment: android.app.Fragment) {
}
function onFragmentHidden(fragment: android.app.Fragment, destroyed: boolean) {
if (traceEnabled) {
if (traceEnabled()) {
traceWrite(`HIDDEN ${fragment}; destroyed: ${destroyed}`, traceCategories.NativeLifecycle);
}
let callbacks: FragmentCallbacksImplementation = fragment[CALLBACKS];
@ -170,7 +170,7 @@ export class Frame extends FrameBase {
backstackEntry.navDepth = navDepth;
let fragmentTransaction = manager.beginTransaction();
if (traceEnabled) {
if (traceEnabled()) {
traceWrite(`BEGIN TRANSACTION ${fragmentTransaction}`, traceCategories.Navigation);
}
@ -201,7 +201,7 @@ export class Frame extends FrameBase {
transitionModule._prepareCurrentFragmentForClearHistory(currentFragment);
}
let firstEntryName = manager.getBackStackEntryAt(0).getName();
if (traceEnabled) {
if (traceEnabled()) {
traceWrite(`POP BACK STACK ${firstEntryName}`, traceCategories.Navigation);
}
manager.popBackStackImmediate(firstEntryName, android.app.FragmentManager.POP_BACK_STACK_INCLUSIVE);
@ -210,13 +210,13 @@ export class Frame extends FrameBase {
// Hide/remove current fragment if it exists and was not popped
if (currentFragment && !emptyNativeBackStack) {
if (this.android.cachePagesOnNavigate && !clearHistory) {
if (traceEnabled) {
if (traceEnabled()) {
traceWrite(`\tHIDE ${currentFragment}`, traceCategories.Navigation);
}
fragmentTransaction.hide(currentFragment);
}
else {
if (traceEnabled) {
if (traceEnabled()) {
traceWrite(`\tREMOVE ${currentFragment}`, traceCategories.Navigation);
}
fragmentTransaction.remove(currentFragment);
@ -224,7 +224,7 @@ export class Frame extends FrameBase {
}
// Add newFragment
if (traceEnabled) {
if (traceEnabled()) {
traceWrite(`\tADD ${newFragmentTag}<${callbacks.entry.resolvedPage}>`, traceCategories.Navigation);
}
fragmentTransaction.add(this.containerViewId, newFragment, newFragmentTag);
@ -232,7 +232,7 @@ export class Frame extends FrameBase {
// addToBackStack
if (this.backStack.length > 0 && currentFragment && !clearHistory) {
// We add each entry in the backstack to avoid the "Stack corrupted" mismatch
if (traceEnabled) {
if (traceEnabled()) {
traceWrite(`\tADD TO BACK STACK ${currentFragment}`, traceCategories.Navigation);
}
fragmentTransaction.addToBackStack(this._currentEntry.fragmentTag);
@ -251,20 +251,20 @@ export class Frame extends FrameBase {
else {
trans = animated ? android.app.FragmentTransaction.TRANSIT_FRAGMENT_OPEN : android.app.FragmentTransaction.TRANSIT_NONE;
}
if (traceEnabled) {
if (traceEnabled()) {
traceWrite(`\tSET TRANSITION ${trans === 0 ? "NONE" : "OPEN"}`, traceCategories.Navigation);
}
fragmentTransaction.setTransition(trans);
}
fragmentTransaction.commit();
if (traceEnabled) {
if (traceEnabled()) {
traceWrite(`END TRANSACTION ${fragmentTransaction}`, traceCategories.Navigation);
}
}
private static _clearHistory(fragment: android.app.Fragment) {
if (traceEnabled) {
if (traceEnabled()) {
traceWrite(`CLEAR HISTORY FOR ${fragment}`, traceCategories.Navigation);
}
let callbacks: FragmentCallbacksImplementation = fragment[CALLBACKS];
@ -374,14 +374,14 @@ export class Frame extends FrameBase {
let weakActivityInstance = weakActivity.get();
let isCurrent = args.activity === weakActivityInstance;
if (!weakActivityInstance) {
if (traceEnabled) {
if (traceEnabled()) {
traceWrite(`Frame _processNavigationContext: Drop For Activity GC-ed`, traceCategories.Navigation);
}
unsubscribe();
return;
}
if (isCurrent) {
if (traceEnabled) {
if (traceEnabled()) {
traceWrite(`Frame _processNavigationContext: Activity.Resumed, Continue`, traceCategories.Navigation);
}
super._processNavigationContext(navigationContext);
@ -389,7 +389,7 @@ export class Frame extends FrameBase {
}
};
let unsubscribe = () => {
if (traceEnabled) {
if (traceEnabled()) {
traceWrite(`Frame _processNavigationContext: Unsubscribe from Activity.Resumed`, traceCategories.Navigation);
}
application.android.off(application.AndroidApplication.activityResumedEvent, resume);
@ -397,7 +397,7 @@ export class Frame extends FrameBase {
application.android.off(application.AndroidApplication.activityDestroyedEvent, unsubscribe);
};
if (traceEnabled) {
if (traceEnabled()) {
traceWrite(`Frame._processNavigationContext: Subscribe for Activity.Resumed`, traceCategories.Navigation);
}
application.android.on(application.AndroidApplication.activityResumedEvent, resume);
@ -542,12 +542,12 @@ function findPageForFragment(fragment: android.app.Fragment, frame: Frame) {
let page: Page;
let entry: BackstackEntry;
if (traceEnabled) {
if (traceEnabled()) {
traceWrite(`Finding page for ${fragmentTag}.`, traceCategories.NativeLifecycle);
}
if (fragmentTag === DIALOG_FRAGMENT_TAG) {
if (traceEnabled) {
if (traceEnabled()) {
traceWrite(`No need to find page for dialog fragment.`, traceCategories.NativeLifecycle);
}
return;
@ -556,7 +556,7 @@ function findPageForFragment(fragment: android.app.Fragment, frame: Frame) {
if (frame._currentEntry && frame._currentEntry.fragmentTag === fragmentTag) {
page = frame.currentPage;
entry = frame._currentEntry;
if (traceEnabled) {
if (traceEnabled()) {
traceWrite(`Current page matches fragment ${fragmentTag}.`, traceCategories.NativeLifecycle);
}
}
@ -570,7 +570,7 @@ function findPageForFragment(fragment: android.app.Fragment, frame: Frame) {
}
if (entry) {
page = entry.resolvedPage;
if (traceEnabled) {
if (traceEnabled()) {
traceWrite(`Found ${page} for ${fragmentTag}`, traceCategories.NativeLifecycle);
}
}
@ -644,7 +644,7 @@ class FragmentCallbacksImplementation implements AndroidFragmentCallbacks {
public clearHistory: boolean;
public onHiddenChanged(fragment: android.app.Fragment, hidden: boolean, superFunc: Function): void {
if (traceEnabled) {
if (traceEnabled()) {
traceWrite(`${fragment}.onHiddenChanged(${hidden})`, traceCategories.NativeLifecycle);
}
superFunc.call(fragment, hidden);
@ -671,14 +671,14 @@ class FragmentCallbacksImplementation implements AndroidFragmentCallbacks {
animator = superFunc.call(fragment, transit, enter, nextAnim);
}
if (traceEnabled) {
if (traceEnabled()) {
traceWrite(`${fragment}.onCreateAnimator(${transit}, ${enter ? "enter" : "exit"}, ${nextAnimString}): ${animator}`, traceCategories.NativeLifecycle);
}
return animator;
}
public onCreate(fragment: android.app.Fragment, savedInstanceState: android.os.Bundle, superFunc: Function): void {
if (traceEnabled) {
if (traceEnabled()) {
traceWrite(`${fragment}.onCreate(${savedInstanceState})`, traceCategories.NativeLifecycle);
}
@ -700,7 +700,7 @@ class FragmentCallbacksImplementation implements AndroidFragmentCallbacks {
}
public onCreateView(fragment: android.app.Fragment, inflater: android.view.LayoutInflater, container: android.view.ViewGroup, savedInstanceState: android.os.Bundle, superFunc: Function): android.view.View {
if (traceEnabled) {
if (traceEnabled()) {
traceWrite(`${fragment}.onCreateView(inflater, container, ${savedInstanceState})`, traceCategories.NativeLifecycle);
}
const entry = this.entry;
@ -717,7 +717,7 @@ class FragmentCallbacksImplementation implements AndroidFragmentCallbacks {
}
public onSaveInstanceState(fragment: android.app.Fragment, outState: android.os.Bundle, superFunc: Function): void {
if (traceEnabled) {
if (traceEnabled()) {
traceWrite(`${fragment}.onSaveInstanceState(${outState})`, traceCategories.NativeLifecycle);
}
superFunc.call(fragment, outState);
@ -727,7 +727,7 @@ class FragmentCallbacksImplementation implements AndroidFragmentCallbacks {
}
public onDestroyView(fragment: android.app.Fragment, superFunc: Function): void {
if (traceEnabled) {
if (traceEnabled()) {
traceWrite(`${fragment}.onDestroyView()`, traceCategories.NativeLifecycle);
}
superFunc.call(fragment);
@ -736,7 +736,7 @@ class FragmentCallbacksImplementation implements AndroidFragmentCallbacks {
}
public onDestroy(fragment: android.app.Fragment, superFunc: Function): void {
if (traceEnabled) {
if (traceEnabled()) {
traceWrite(`${fragment}.onDestroy()`, traceCategories.NativeLifecycle);
}
superFunc.call(fragment);
@ -751,7 +751,7 @@ class ActivityCallbacksImplementation implements AndroidActivityCallbacks {
private _rootView: View;
public onCreate(activity: android.app.Activity, savedInstanceState: android.os.Bundle, superFunc: Function): void {
if (traceEnabled) {
if (traceEnabled()) {
traceWrite(`Activity.onCreate(${savedInstanceState})`, traceCategories.NativeLifecycle);
}
@ -837,7 +837,7 @@ class ActivityCallbacksImplementation implements AndroidActivityCallbacks {
public onStart(activity: any, superFunc: Function): void {
superFunc.call(activity);
if (traceEnabled) {
if (traceEnabled()) {
traceWrite("NativeScriptActivity.onStart();", traceCategories.NativeLifecycle);
}
let rootView = this._rootView;
@ -849,7 +849,7 @@ class ActivityCallbacksImplementation implements AndroidActivityCallbacks {
public onStop(activity: any, superFunc: Function): void {
superFunc.call(activity);
if (traceEnabled) {
if (traceEnabled()) {
traceWrite("NativeScriptActivity.onStop();", traceCategories.NativeLifecycle);
}
let rootView = this._rootView;
@ -866,7 +866,7 @@ class ActivityCallbacksImplementation implements AndroidActivityCallbacks {
superFunc.call(activity);
if (traceEnabled) {
if (traceEnabled()) {
traceWrite("NativeScriptActivity.onDestroy();", traceCategories.NativeLifecycle);
}
@ -878,7 +878,7 @@ class ActivityCallbacksImplementation implements AndroidActivityCallbacks {
}
public onBackPressed(activity: any, superFunc: Function): void {
if (traceEnabled) {
if (traceEnabled()) {
traceWrite("NativeScriptActivity.onBackPressed;", traceCategories.NativeLifecycle);
}
@ -900,7 +900,7 @@ class ActivityCallbacksImplementation implements AndroidActivityCallbacks {
}
public onRequestPermissionsResult(activity: any, requestCode: number, permissions: Array<String>, grantResults: Array<number>, superFunc: Function): void {
if (traceEnabled) {
if (traceEnabled()) {
traceWrite("NativeScriptActivity.onRequestPermissionsResult;", traceCategories.NativeLifecycle);
}
@ -916,7 +916,7 @@ class ActivityCallbacksImplementation implements AndroidActivityCallbacks {
public onActivityResult(activity: any, requestCode: number, resultCode: number, data: android.content.Intent, superFunc: Function): void {
superFunc.call(activity, requestCode, resultCode, data);
if (traceEnabled) {
if (traceEnabled()) {
traceWrite(`NativeScriptActivity.onActivityResult(${requestCode}, ${resultCode}, ${data})`, traceCategories.NativeLifecycle);
}

View File

@ -119,7 +119,7 @@ export class Frame extends FrameBase {
// First navigation.
if (!this._currentEntry) {
this._ios.controller.pushViewControllerAnimated(viewController, animated);
if (traceEnabled) {
if (traceEnabled()) {
traceWrite(`${this}.pushViewControllerAnimated(${viewController}, ${animated}); depth = ${navDepth}`, traceCategories.Navigation);
}
return;
@ -138,7 +138,7 @@ export class Frame extends FrameBase {
}
this._ios.controller.setViewControllersAnimated(newControllers, animated);
if (traceEnabled) {
if (traceEnabled()) {
traceWrite(`${this}.setViewControllersAnimated([${viewController}], ${animated}); depth = ${navDepth}`, traceCategories.Navigation);
}
return;
@ -164,7 +164,7 @@ export class Frame extends FrameBase {
// replace the controllers instead of pushing directly
this._ios.controller.setViewControllersAnimated(newControllers, animated);
if (traceEnabled) {
if (traceEnabled()) {
traceWrite(`${this}.setViewControllersAnimated([originalControllers - lastController + ${viewController}], ${animated}); depth = ${navDepth}`, traceCategories.Navigation);
}
return;
@ -172,7 +172,7 @@ export class Frame extends FrameBase {
// General case.
this._ios.controller.pushViewControllerAnimated(viewController, animated);
if (traceEnabled) {
if (traceEnabled()) {
traceWrite(`${this}.pushViewControllerAnimated(${viewController}, ${animated}); depth = ${navDepth}`, traceCategories.Navigation);
}
}
@ -187,7 +187,7 @@ export class Frame extends FrameBase {
let animated = this._currentEntry ? this._getIsAnimatedNavigation(this._currentEntry.entry) : false;
this._updateActionBar(backstackEntry.resolvedPage);
if (traceEnabled) {
if (traceEnabled()) {
traceWrite(`${this}.popToViewControllerAnimated(${controller}, ${animated}); depth = ${navDepth}`, traceCategories.Navigation);
}
this._ios.controller.popToViewControllerAnimated(controller, animated);
@ -366,7 +366,7 @@ export class Frame extends FrameBase {
return;
}
if (traceEnabled) {
if (traceEnabled()) {
traceWrite(`Forcing navigationBar.frame.origin.y to ${statusBarHeight} due to a higher in-call status-bar`, traceCategories.Layout);
}
@ -394,19 +394,19 @@ class TransitionDelegate extends NSObject {
}
public animationWillStart(animationID: string, context: any): void {
if (traceEnabled) {
if (traceEnabled()) {
traceWrite(`START ${this._id}`, traceCategories.Transition);
}
}
public animationDidStop(animationID: string, finished: boolean, context: any): void {
if (finished) {
if (traceEnabled) {
if (traceEnabled()) {
traceWrite(`END ${this._id}`, traceCategories.Transition);
}
}
else {
if (traceEnabled) {
if (traceEnabled()) {
traceWrite(`CANCEL ${this._id}`, traceCategories.Transition);
}
}
@ -453,7 +453,7 @@ class UINavigationControllerAnimatedDelegate extends NSObject implements UINavig
return null;
}
if (traceEnabled) {
if (traceEnabled()) {
traceWrite(`UINavigationControllerImpl.navigationControllerAnimationControllerForOperationFromViewControllerToViewController(${operation}, ${fromVC}, ${toVC}), transition: ${JSON.stringify(navigationTransition)}`, traceCategories.NativeLifecycle);
}
@ -487,7 +487,7 @@ class UINavigationControllerImpl extends UINavigationController {
public viewDidLayoutSubviews(): void {
let owner = this._owner.get();
if (owner) {
if (traceEnabled) {
if (traceEnabled()) {
traceWrite(this._owner + " viewDidLayoutSubviews, isLoaded = " + owner.isLoaded, traceCategories.ViewHierarchy);
}
@ -525,7 +525,7 @@ class UINavigationControllerImpl extends UINavigationController {
public pushViewControllerAnimated(viewController: UIViewController, animated: boolean): void {
let navigationTransition = <NavigationTransition>viewController[TRANSITION];
if (traceEnabled) {
if (traceEnabled()) {
traceWrite(`UINavigationControllerImpl.pushViewControllerAnimated(${viewController}, ${animated}); transition: ${JSON.stringify(navigationTransition)}`, traceCategories.NativeLifecycle);
}
@ -544,7 +544,7 @@ class UINavigationControllerImpl extends UINavigationController {
let viewController = viewControllers.lastObject;
let navigationTransition = <NavigationTransition>viewController[TRANSITION];
if (traceEnabled) {
if (traceEnabled()) {
traceWrite(`UINavigationControllerImpl.setViewControllersAnimated(${viewControllers}, ${animated}); transition: ${JSON.stringify(navigationTransition)}`, traceCategories.NativeLifecycle);
}
@ -562,7 +562,7 @@ class UINavigationControllerImpl extends UINavigationController {
public popViewControllerAnimated(animated: boolean): UIViewController {
let lastViewController = this.viewControllers.lastObject;
let navigationTransition = <NavigationTransition>lastViewController[TRANSITION];
if (traceEnabled) {
if (traceEnabled()) {
traceWrite(`UINavigationControllerImpl.popViewControllerAnimated(${animated}); transition: ${JSON.stringify(navigationTransition)}`, traceCategories.NativeLifecycle);
}
@ -586,7 +586,7 @@ class UINavigationControllerImpl extends UINavigationController {
public popToViewControllerAnimated(viewController: UIViewController, animated: boolean): NSArray<UIViewController> {
let lastViewController = this.viewControllers.lastObject;
let navigationTransition = <NavigationTransition>lastViewController[TRANSITION];
if (traceEnabled) {
if (traceEnabled()) {
traceWrite(`UINavigationControllerImpl.popToViewControllerAnimated(${viewController}, ${animated}); transition: ${JSON.stringify(navigationTransition)}`, traceCategories.NativeLifecycle);
}
@ -644,31 +644,31 @@ export function _getNativeCurve(transition: NavigationTransition): UIViewAnimati
if (transition.curve) {
switch (transition.curve) {
case "easeIn":
if (traceEnabled) {
if (traceEnabled()) {
traceWrite("Transition curve resolved to UIViewAnimationCurve.EaseIn.", traceCategories.Transition);
}
return UIViewAnimationCurve.EaseIn;
case "easeOut":
if (traceEnabled) {
if (traceEnabled()) {
traceWrite("Transition curve resolved to UIViewAnimationCurve.EaseOut.", traceCategories.Transition);
}
return UIViewAnimationCurve.EaseOut;
case "easeInOut":
if (traceEnabled) {
if (traceEnabled()) {
traceWrite("Transition curve resolved to UIViewAnimationCurve.EaseInOut.", traceCategories.Transition);
}
return UIViewAnimationCurve.EaseInOut;
case "linear":
if (traceEnabled) {
if (traceEnabled()) {
traceWrite("Transition curve resolved to UIViewAnimationCurve.Linear.", traceCategories.Transition);
}
return UIViewAnimationCurve.Linear;
default:
if (traceEnabled) {
if (traceEnabled()) {
traceWrite("Transition curve resolved to original: " + transition.curve, traceCategories.Transition);
}
return transition.curve;

View File

@ -35,7 +35,7 @@ class MemmoryWarningHandler extends NSObject {
this._cache = cache;
getter(NSNotificationCenter, NSNotificationCenter.defaultCenter).addObserverSelectorNameObject(this, "clearCache", "UIApplicationDidReceiveMemoryWarningNotification", null);
if (trace.enabled) {
if (trace.isEnabled()) {
trace.write("[MemmoryWarningHandler] Added low memory observer.", trace.categories.Debug);
}
@ -44,14 +44,14 @@ class MemmoryWarningHandler extends NSObject {
public dealloc(): void {
getter(NSNotificationCenter, NSNotificationCenter.defaultCenter).removeObserverNameObject(this, "UIApplicationDidReceiveMemoryWarningNotification", null);
if (trace.enabled) {
if (trace.isEnabled()) {
trace.write("[MemmoryWarningHandler] Removed low memory observer.", trace.categories.Debug);
}
super.dealloc();
}
public clearCache(): void {
if (trace.enabled) {
if (trace.isEnabled()) {
trace.write("[MemmoryWarningHandler] Clearing Image Cache.", trace.categories.Debug);
}
this._cache.removeAllObjects();

View File

@ -69,7 +69,7 @@ export class Image extends ImageBase {
measureWidth = finiteWidth ? Math.min(resultW, width) : resultW;
measureHeight = finiteHeight ? Math.min(resultH, height) : resultH;
if (traceEnabled) {
if (traceEnabled()) {
traceWrite("Image stretch: " + this.stretch +
", nativeWidth: " + nativeWidth +
", nativeHeight: " + nativeHeight, traceCategories.Layout);

View File

@ -51,7 +51,7 @@ export class Layout extends LayoutBase implements LayoutDefinition {
const view = this._nativeView;
if (view) {
if (traceEnabled) {
if (traceEnabled()) {
traceWrite(`${this} :measure: ${layout.measureSpecToString(widthMeasureSpec)}, ${layout.measureSpecToString(heightMeasureSpec)}`, traceCategories.Layout);
}
view.measure(widthMeasureSpec, heightMeasureSpec);
@ -64,7 +64,7 @@ export class Layout extends LayoutBase implements LayoutDefinition {
var view = this._nativeView;
if (view) {
this.layoutNativeView(left, top, right, bottom);
if (traceEnabled) {
if (traceEnabled()) {
traceWrite(`${this} :layout: ${left}, ${top}, ${right - left}, ${bottom - top}`, traceCategories.Layout);
}
}

View File

@ -1,5 +1,5 @@
import { ListView as ListViewDefinition, ItemsSource } from "ui/list-view";
import { CoercibleProperty, CssProperty, Style, Bindable, View, Template, KeyedTemplate, Length, Property, Color, lengthComparer } from "ui/core/view";
import { CoercibleProperty, CssProperty, Style, View, Template, KeyedTemplate, Length, Property, Color, lengthComparer } from "ui/core/view";
import { parse, parseMultipleTemplates } from "ui/builder";
import { Label } from "ui/label";
import { ObservableArray, ChangedData } from "data/observable-array";

View File

@ -75,7 +75,7 @@ class UIViewControllerImpl extends UIViewController {
return;
}
if (traceEnabled) {
if (traceEnabled()) {
traceWrite(owner + " viewDidLayoutSubviews, isLoaded = " + owner.isLoaded, traceCategories.ViewHierarchy);
}
@ -130,7 +130,7 @@ class UIViewControllerImpl extends UIViewController {
}
}
if (traceEnabled) {
if (traceEnabled()) {
traceWrite(owner + ", native frame = " + NSStringFromCGRect(this.view.frame), traceCategories.Layout);
}
}
@ -146,8 +146,8 @@ class UIViewControllerImpl extends UIViewController {
super.viewWillAppear(animated);
this.shown = false;
let page = this._owner.get();
if (traceEnabled) {
if (traceEnabled) {
if (traceEnabled()) {
if (traceEnabled()) {
traceWrite(page + " viewWillAppear", traceCategories.Navigation);
}
}
@ -198,7 +198,7 @@ class UIViewControllerImpl extends UIViewController {
super.viewDidAppear(animated);
this.shown = true;
let page = this._owner.get();
if (traceEnabled) {
if (traceEnabled()) {
traceWrite(page + " viewDidAppear", traceCategories.Navigation);
}
if (!page) {
@ -249,7 +249,7 @@ class UIViewControllerImpl extends UIViewController {
public viewWillDisappear(animated: boolean): void {
let page = this._owner.get();
if (traceEnabled) {
if (traceEnabled()) {
traceWrite(page + " viewWillDisappear", traceCategories.Navigation);
}
if (!page) {
@ -275,7 +275,7 @@ class UIViewControllerImpl extends UIViewController {
public viewDidDisappear(animated: boolean): void {
let page = this._owner.get();
if (traceEnabled) {
if (traceEnabled()) {
traceWrite(page + " viewDidDisappear", traceCategories.Navigation);
}
// Exit if no page or page is hiding because it shows another page modally.
@ -374,7 +374,7 @@ export class Page extends PageBase {
private _addNativeView(view: View) {
if (view) {
if (traceEnabled) {
if (traceEnabled()) {
traceWrite("Native: Adding " + view + " to " + this, traceCategories.ViewHierarchy);
}
if (view.ios instanceof UIView) {
@ -388,7 +388,7 @@ export class Page extends PageBase {
private _removeNativeView(view: View) {
if (view) {
if (traceEnabled) {
if (traceEnabled()) {
traceWrite("Native: Removing " + view + " from " + this, traceCategories.ViewHierarchy);
}
if (view.ios instanceof UIView) {

View File

@ -52,7 +52,7 @@ export class ProxyViewContainer extends LayoutBase implements ProxyViewContainer
}
public _addViewToNativeVisualTree(child: View, atIndex?: number): boolean {
if (traceEnabled) {
if (traceEnabled()) {
traceWrite("ViewContainer._addViewToNativeVisualTree for a child " + child + " ViewContainer.parent: " + this.parent, traceCategories.ViewHierarchy);
}
super._addViewToNativeVisualTree(child);
@ -72,7 +72,7 @@ export class ProxyViewContainer extends LayoutBase implements ProxyViewContainer
// Add last;
insideIndex = this._getNativeViewsCount();
}
if (traceEnabled) {
if (traceEnabled()) {
traceWrite("ProxyViewContainer._addViewToNativeVisualTree at: " + atIndex + " base: " + baseIndex + " additional: " + insideIndex, traceCategories.ViewHierarchy);
}
return parent._addViewToNativeVisualTree(child, baseIndex + insideIndex);
@ -82,7 +82,7 @@ export class ProxyViewContainer extends LayoutBase implements ProxyViewContainer
}
public _removeViewFromNativeVisualTree(child: View): void {
if (traceEnabled) {
if (traceEnabled()) {
traceWrite("ProxyViewContainer._removeViewFromNativeVisualTree for a child " + child + " ViewContainer.parent: " + this.parent, traceCategories.ViewHierarchy);
}
super._removeViewFromNativeVisualTree(child);

View File

@ -1,5 +1,5 @@
import { FontBase, parseFontFamily, genericFontFamilies, FontWeight } from "./font-common";
import { enabled as traceEnabled, write as traceWrite, categories as traceCategories, messageType as traceMessageType } from "trace";
import { isEnabled as traceEnabled, write as traceWrite, categories as traceCategories, messageType as traceMessageType } from "trace";
import * as application from "application";
import * as fs from "file-system";
@ -75,7 +75,7 @@ function loadFontFromFile(fontFamily: string): android.graphics.Typeface {
fontAssetPath = FONTS_BASE_PATH + fontFamily + ".otf";
}
else {
if (traceEnabled) {
if (traceEnabled()) {
traceWrite("Could not find font file for " + fontFamily, traceCategories.Error, traceMessageType.error);
}
}
@ -85,7 +85,7 @@ function loadFontFromFile(fontFamily: string): android.graphics.Typeface {
fontAssetPath = fs.path.join(fs.knownFolders.currentApp().path, fontAssetPath);
result = android.graphics.Typeface.createFromFile(fontAssetPath);
} catch (e) {
if (traceEnabled) {
if (traceEnabled()) {
traceWrite("Error loading font asset: " + fontAssetPath, traceCategories.Error, traceMessageType.error);
}
}

View File

@ -1,5 +1,5 @@
import { FontBase, parseFontFamily, genericFontFamilies, FontStyle, FontWeight } from "./font-common";
import { enabled as traceEnabled, write as traceWrite, categories as traceCategories, messageType as traceMessageType } from "trace";
import { isEnabled as traceEnabled, write as traceWrite, categories as traceCategories, messageType as traceMessageType } from "trace";
import * as fs from "file-system";
import * as utils from "utils/utils";
@ -310,7 +310,7 @@ export module ios {
const error = new interop.Reference<NSError>();
if (!CTFontManagerRegisterGraphicsFont(font, error)) {
if (traceEnabled) {
if (traceEnabled()) {
traceWrite("Error occur while registering font: " + CFErrorCopyDescription(<NSError>error.value), traceCategories.Error, traceMessageType.error);
}
}

View File

@ -180,7 +180,7 @@ export class Style extends Observable implements StyleDefinition {
// }
// public _onPropertyChanged(property: Property, oldValue: any, newValue: any) {
// if (traceEnabled) {
// if (traceEnabled()) {
// traceWrite(
// "Style._onPropertyChanged view:" + this._view +
// ", property: " + property.name +
@ -239,12 +239,12 @@ export class Style extends Observable implements StyleDefinition {
// let handler: definition.StylePropertyChangedHandler = getHandler(property, this._view);
// if (!handler) {
// if (traceEnabled) {
// if (traceEnabled()) {
// traceWrite("No handler for property: " + property.name + " with id: " + property.id + ", view:" + this._view, traceCategories.Style);
// }
// }
// else {
// if (traceEnabled) {
// if (traceEnabled()) {
// traceWrite("Found handler for property: " + property.name + ", view:" + this._view, traceCategories.Style);
// }

View File

@ -121,7 +121,7 @@ function ensurePagerAdapterClass() {
}
instantiateItem(container: android.view.ViewGroup, index: number) {
if (traceEnabled) {
if (traceEnabled()) {
traceWrite("TabView.PagerAdapter.instantiateItem; container: " + container + "; index: " + index, traceCategory);
}
@ -131,7 +131,7 @@ function ensurePagerAdapterClass() {
// }
if (this[VIEWS_STATES]) {
if (traceEnabled) {
if (traceEnabled()) {
traceWrite("TabView.PagerAdapter.instantiateItem; restoreHierarchyState: " + item.view, traceCategory);
}
item.view._nativeView.restoreHierarchyState(this[VIEWS_STATES]);
@ -144,7 +144,7 @@ function ensurePagerAdapterClass() {
}
destroyItem(container: android.view.ViewGroup, index: number, _object: any) {
if (traceEnabled) {
if (traceEnabled()) {
traceWrite("TabView.PagerAdapter.destroyItem; container: " + container + "; index: " + index + "; _object: " + _object, traceCategory);
}
let item = this.items[index];
@ -172,7 +172,7 @@ function ensurePagerAdapterClass() {
}
saveState(): android.os.Parcelable {
if (traceEnabled) {
if (traceEnabled()) {
traceWrite("TabView.PagerAdapter.saveState", traceCategory);
}
@ -201,7 +201,7 @@ function ensurePagerAdapterClass() {
}
restoreState(state: android.os.Parcelable, loader: java.lang.ClassLoader) {
if (traceEnabled) {
if (traceEnabled()) {
traceWrite("TabView.PagerAdapter.restoreState", traceCategory);
}
let bundle: android.os.Bundle = <android.os.Bundle>state;
@ -280,7 +280,7 @@ export class TabView extends TabViewBase {
}
public _createNativeView() {
if (traceEnabled) {
if (traceEnabled()) {
traceWrite("TabView._createUI(" + this + ");", traceCategory);
}
@ -371,7 +371,7 @@ export class TabView extends TabViewBase {
return -1;
}
set [selectedIndexProperty.native](value: number) {
if (traceEnabled) {
if (traceEnabled()) {
traceWrite("TabView this._viewPager.setCurrentItem(" + value + ", true);", traceCategory);
}
this._viewPager.setCurrentItem(value, true);

View File

@ -21,7 +21,7 @@ class UITabBarControllerImpl extends UITabBarController {
}
public viewDidLayoutSubviews(): void {
if (traceEnabled) {
if (traceEnabled()) {
traceWrite("TabView.UITabBarControllerClass.viewDidLayoutSubviews();", traceCategories.Debug);
}
super.viewDidLayoutSubviews();
@ -44,7 +44,7 @@ class UITabBarControllerDelegateImpl extends NSObject implements UITabBarControl
}
public tabBarControllerShouldSelectViewController(tabBarController: UITabBarController, viewController: UIViewController): boolean {
if (traceEnabled) {
if (traceEnabled()) {
traceWrite("TabView.delegate.SHOULD_select(" + tabBarController + ", " + viewController + ");", traceCategories.Debug);
}
@ -59,7 +59,7 @@ class UITabBarControllerDelegateImpl extends NSObject implements UITabBarControl
}
public tabBarControllerDidSelectViewController(tabBarController: UITabBarController, viewController: UIViewController): void {
if (traceEnabled) {
if (traceEnabled()) {
traceWrite("TabView.delegate.DID_select(" + tabBarController + ", " + viewController + ");", traceCategories.Debug);
}
@ -82,7 +82,7 @@ class UINavigationControllerDelegateImpl extends NSObject implements UINavigatio
}
navigationControllerWillShowViewControllerAnimated(navigationController: UINavigationController, viewController: UIViewController, animated: boolean): void {
if (traceEnabled) {
if (traceEnabled()) {
traceWrite("TabView.moreNavigationController.WILL_show(" + navigationController + ", " + viewController + ", " + animated + ");", traceCategories.Debug);
}
@ -96,7 +96,7 @@ class UINavigationControllerDelegateImpl extends NSObject implements UINavigatio
}
navigationControllerDidShowViewControllerAnimated(navigationController: UINavigationController, viewController: UIViewController, animated: boolean): void {
if (traceEnabled) {
if (traceEnabled()) {
traceWrite("TabView.moreNavigationController.DID_show(" + navigationController + ", " + viewController + ", " + animated + ");", traceCategories.Debug);
}
// We don't need Edit button in More screen.
@ -182,14 +182,14 @@ export class TabView extends TabViewBase {
public _onViewControllerShown(viewController: UIViewController) {
// This method could be called with the moreNavigationController or its list controller, so we have to check.
if (traceEnabled) {
if (traceEnabled()) {
traceWrite("TabView._onViewControllerShown(" + viewController + ");", traceCategories.Debug);
}
if (this._ios.viewControllers && this._ios.viewControllers.containsObject(viewController)) {
this.selectedIndex = this._ios.viewControllers.indexOfObject(viewController);
}
else {
if (traceEnabled) {
if (traceEnabled()) {
traceWrite("TabView._onViewControllerShown: viewController is not one of our viewControllers", traceCategories.Debug);
}
}
@ -197,7 +197,7 @@ export class TabView extends TabViewBase {
private _actionBarHiddenByTabView: boolean;
public _handleTwoNavigationBars(backToMoreWillBeVisible: boolean) {
if (traceEnabled) {
if (traceEnabled()) {
traceWrite(`TabView._handleTwoNavigationBars(backToMoreWillBeVisible: ${backToMoreWillBeVisible})`, traceCategories.Debug);
}
@ -210,7 +210,7 @@ export class TabView extends TabViewBase {
page.actionBarHidden = true;
page.frame.ios._disableNavBarAnimation = false;
this._actionBarHiddenByTabView = true;
if (traceEnabled) {
if (traceEnabled()) {
traceWrite(`TabView hid action bar`, traceCategories.Debug);
}
return;
@ -221,7 +221,7 @@ export class TabView extends TabViewBase {
page.actionBarHidden = false;
page.frame.ios._disableNavBarAnimation = false;
this._actionBarHiddenByTabView = undefined;
if (traceEnabled) {
if (traceEnabled()) {
traceWrite(`TabView restored action bar`, traceCategories.Debug);
}
return;
@ -382,7 +382,7 @@ export class TabView extends TabViewBase {
return -1;
}
set [selectedIndexProperty.native](value: number) {
if (traceEnabled) {
if (traceEnabled()) {
traceWrite("TabView._onSelectedIndexPropertyChangedSetNativeValue(" + value + ")", traceCategories.Debug);
}

View File

@ -6,7 +6,7 @@ import { device } from "platform";
import { _resolveAnimationCurve } from "ui/animation";
import lazy from "utils/lazy";
import { enabled as traceEnabled, write as traceWrite, categories as traceCategories } from "trace";
import { isEnabled as traceEnabled, write as traceWrite, categories as traceCategories } from "trace";
let slideTransition: any;
function ensureSlideTransition() {
@ -60,7 +60,7 @@ export module AndroidTransitionType {
export function _clearBackwardTransitions(fragment: any): void {
let expandedFragment = <ExpandedFragment>fragment;
if (expandedFragment.enterPopExitTransition) {
if (traceEnabled) {
if (traceEnabled()) {
traceWrite(`Cleared enterPopExitTransition ${expandedFragment.enterPopExitTransition} for ${fragment}`, traceCategories.Transition);
}
if (expandedFragment.enterPopExitTransitionListener) {
@ -72,7 +72,7 @@ export function _clearBackwardTransitions(fragment: any): void {
if (_sdkVersion() >= 21) {
let enterTransition = (<any>fragment).getEnterTransition();
if (enterTransition) {
if (traceEnabled) {
if (traceEnabled()) {
traceWrite(`Cleared Enter ${enterTransition.getClass().getSimpleName()} transition for ${fragment}`, traceCategories.Transition);
}
if (enterTransition.transitionListener) {
@ -82,7 +82,7 @@ export function _clearBackwardTransitions(fragment: any): void {
}
let returnTransition = (<any>fragment).getReturnTransition();
if (returnTransition) {
if (traceEnabled) {
if (traceEnabled()) {
traceWrite(`Cleared Pop Exit ${returnTransition.getClass().getSimpleName()} transition for ${fragment}`, traceCategories.Transition);
}
if (returnTransition.transitionListener) {
@ -96,7 +96,7 @@ export function _clearBackwardTransitions(fragment: any): void {
export function _clearForwardTransitions(fragment: any): void {
let expandedFragment = <ExpandedFragment>fragment;
if (expandedFragment.exitPopEnterTransition) {
if (traceEnabled) {
if (traceEnabled()) {
traceWrite(`Cleared exitPopEnterTransition ${expandedFragment.exitPopEnterTransition} for ${fragment}`, traceCategories.Transition);
}
if (expandedFragment.exitPopEnterTransitionListener) {
@ -108,7 +108,7 @@ export function _clearForwardTransitions(fragment: any): void {
if (_sdkVersion() >= 21) {
let exitTransition = (<any>fragment).getExitTransition();
if (exitTransition) {
if (traceEnabled) {
if (traceEnabled()) {
traceWrite(`Cleared Exit ${exitTransition.getClass().getSimpleName()} transition for ${fragment}`, traceCategories.Transition);
}
if (exitTransition.transitionListener) {
@ -118,7 +118,7 @@ export function _clearForwardTransitions(fragment: any): void {
}
let reenterTransition = (<any>fragment).getReenterTransition();
if (reenterTransition) {
if (traceEnabled) {
if (traceEnabled()) {
traceWrite(`Cleared Pop Enter ${reenterTransition.getClass().getSimpleName()} transition for ${fragment}`, traceCategories.Transition);
}
if (reenterTransition.transitionListener) {
@ -297,14 +297,14 @@ function _setUpNativeTransition(navigationTransition: NavigationTransition, nati
}
export function _onFragmentShown(fragment: any, isBack: boolean): void {
if (traceEnabled) {
if (traceEnabled()) {
traceWrite(`_onFragmentShown(${fragment}, isBack: ${isBack})`, traceCategories.Transition);
}
let expandedFragment = <ExpandedFragment>fragment;
let transitionType = isBack ? "Pop Enter" : "Enter";
let relevantTransition = isBack ? expandedFragment.exitPopEnterTransition : expandedFragment.enterPopExitTransition;
if (relevantTransition) {
if (traceEnabled) {
if (traceEnabled()) {
traceWrite(`${fragment} has been shown when going ${isBack ? "back" : "forward"}, but there is ${transitionType} ${relevantTransition}. Will complete page addition when transition ends.`, traceCategories.Transition);
}
expandedFragment.completePageAdditionWhenTransitionEnds = { isBack: isBack };
@ -312,7 +312,7 @@ export function _onFragmentShown(fragment: any, isBack: boolean): void {
else if (_sdkVersion() >= 21) {
let nativeTransition = isBack ? (<any>fragment).getReenterTransition() : (<any>fragment).getEnterTransition();
if (nativeTransition) {
if (traceEnabled) {
if (traceEnabled()) {
traceWrite(`${fragment} has been shown when going ${isBack ? "back" : "forward"}, but there is ${transitionType} ${nativeTransition.getClass().getSimpleName()} transition. Will complete page addition when transition ends.`, traceCategories.Transition);
}
expandedFragment.completePageAdditionWhenTransitionEnds = { isBack: isBack };
@ -325,14 +325,14 @@ export function _onFragmentShown(fragment: any, isBack: boolean): void {
}
export function _onFragmentHidden(fragment: any, isBack: boolean, destroyed: boolean) {
if (traceEnabled) {
if (traceEnabled()) {
traceWrite(`_onFragmentHidden(${fragment}, isBack: ${isBack}, destroyed: ${destroyed})`, traceCategories.Transition);
}
let expandedFragment = <ExpandedFragment>fragment;
let transitionType = isBack ? "Pop Exit" : "Exit";
let relevantTransition = isBack ? expandedFragment.enterPopExitTransition : expandedFragment.exitPopEnterTransition;
if (relevantTransition) {
if (traceEnabled) {
if (traceEnabled()) {
traceWrite(`${fragment} has been hidden when going ${isBack ? "back" : "forward"}, but there is ${transitionType} ${relevantTransition}. Will complete page removal when transition ends.`, traceCategories.Transition);
}
expandedFragment.completePageRemovalWhenTransitionEnds = { isBack: isBack };
@ -340,7 +340,7 @@ export function _onFragmentHidden(fragment: any, isBack: boolean, destroyed: boo
else if (_sdkVersion() >= 21) {
let nativeTransition = isBack ? (<any>fragment).getReturnTransition() : (<any>fragment).getExitTransition();
if (nativeTransition) {
if (traceEnabled) {
if (traceEnabled()) {
traceWrite(`${fragment} has been hidden when going ${isBack ? "back" : "forward"}, but there is ${transitionType} ${nativeTransition.getClass().getSimpleName()} transition. Will complete page removal when transition ends.`, traceCategories.Transition);
}
expandedFragment.completePageRemovalWhenTransitionEnds = { isBack: isBack };
@ -361,7 +361,7 @@ function _completePageAddition(fragment: any, isBack: boolean) {
let frame = fragment._callbacks.frame;
let entry: BackstackEntry = fragment._callbacks.entry;
let page: Page = entry.resolvedPage;
if (traceEnabled) {
if (traceEnabled()) {
traceWrite(`STARTING ADDITION of ${page}...`, traceCategories.Transition);
}
// The original code that was once in Frame onFragmentShown
@ -369,7 +369,7 @@ function _completePageAddition(fragment: any, isBack: boolean) {
page.onNavigatedTo(isBack);
frame._processNavigationQueue(page);
entry.isNavigation = undefined;
if (traceEnabled) {
if (traceEnabled()) {
traceWrite(`ADDITION of ${page} completed`, traceCategories.Transition);
}
}
@ -380,7 +380,7 @@ function _completePageRemoval(fragment: any, isBack: boolean) {
let frame = fragment._callbacks.frame;
let entry: BackstackEntry = fragment._callbacks.entry;
let page: Page = entry.resolvedPage;
if (traceEnabled) {
if (traceEnabled()) {
traceWrite(`STARTING REMOVAL of ${page}...`, traceCategories.Transition);
}
if (page.frame) {
@ -389,12 +389,12 @@ function _completePageRemoval(fragment: any, isBack: boolean) {
if (entry.isNavigation) {
page.onNavigatedFrom(isBack);
}
if (traceEnabled) {
if (traceEnabled()) {
traceWrite(`REMOVAL of ${page} completed`, traceCategories.Transition);
}
}
else {
if (traceEnabled) {
if (traceEnabled()) {
traceWrite(`REMOVAL of ${page} has already been done`, traceCategories.Transition);
}
}
@ -403,12 +403,12 @@ function _completePageRemoval(fragment: any, isBack: boolean) {
expandedFragment.isDestroyed = undefined;
if (page._context) {
page._tearDownUI(true);
if (traceEnabled) {
if (traceEnabled()) {
traceWrite(`DETACHMENT of ${page} completed`, traceCategories.Transition);
}
}
else {
if (traceEnabled) {
if (traceEnabled()) {
traceWrite(`DETACHMENT of ${page} has already been done`, traceCategories.Transition);
}
_removePageNativeViewFromAndroidParent(page);
@ -422,7 +422,7 @@ export function _removePageNativeViewFromAndroidParent(page: Page): void {
if (page._nativeView && page._nativeView.getParent) {
let androidParent = page._nativeView.getParent();
if (androidParent && androidParent.removeView) {
if (traceEnabled) {
if (traceEnabled()) {
traceWrite(`REMOVED ${page}._nativeView from its Android parent`, traceCategories.Transition);
}
page._tearDownUI(true);
@ -442,7 +442,7 @@ function _addNativeTransitionListener(fragment: any, nativeTransition: any/*andr
if (!expandedFragment) {
return;
}
if (traceEnabled) {
if (traceEnabled()) {
traceWrite(`CANCEL ${_toShortString(transition)} transition for ${expandedFragment}`, traceCategories.Transition);
}
if (expandedFragment.completePageRemovalWhenTransitionEnds) {
@ -458,7 +458,7 @@ function _addNativeTransitionListener(fragment: any, nativeTransition: any/*andr
if (!expandedFragment) {
return;
}
if (traceEnabled) {
if (traceEnabled()) {
traceWrite(`END ${_toShortString(transition)} transition for ${expandedFragment}`, traceCategories.Transition);
}
if (expandedFragment.completePageRemovalWhenTransitionEnds) {
@ -471,19 +471,19 @@ function _addNativeTransitionListener(fragment: any, nativeTransition: any/*andr
},
onTransitionPause: function (transition: any): void {
let expandedFragment = this.fragment;
if (traceEnabled) {
if (traceEnabled()) {
traceWrite(`PAUSE ${_toShortString(transition)} transition for ${expandedFragment}`, traceCategories.Transition);
}
},
onTransitionResume: function (transition: any): void {
let expandedFragment = this.fragment;
if (traceEnabled) {
if (traceEnabled()) {
traceWrite(`RESUME ${_toShortString(transition)} transition for ${expandedFragment}`, traceCategories.Transition);
}
},
onTransitionStart: function (transition: any): void {
let expandedFragment = this.fragment;
if (traceEnabled) {
if (traceEnabled()) {
traceWrite(`START ${_toShortString(transition)} transition for ${expandedFragment}`, traceCategories.Transition);
}
}
@ -551,17 +551,17 @@ export function _onFragmentCreateAnimator(fragment: ExpandedFragment, nextAnim:
let transitionListener: any = new android.animation.Animator.AnimatorListener({
onAnimationStart: function (animator: android.animation.Animator): void {
if (traceEnabled) {
if (traceEnabled()) {
traceWrite(`START ${transitionType} ${this.transition} for ${this.fragment}`, traceCategories.Transition);
}
},
onAnimationRepeat: function (animator: android.animation.Animator): void {
if (traceEnabled) {
if (traceEnabled()) {
traceWrite(`REPEAT ${transitionType} ${this.transition} for ${this.fragment}`, traceCategories.Transition);
}
},
onAnimationEnd: function (animator: android.animation.Animator): void {
if (traceEnabled) {
if (traceEnabled()) {
traceWrite(`END ${transitionType} ${this.transition} for ${this.fragment}`, traceCategories.Transition);
}
@ -576,7 +576,7 @@ export function _onFragmentCreateAnimator(fragment: ExpandedFragment, nextAnim:
this.checkedRemove();
},
onAnimationCancel: function (animator: android.animation.Animator): void {
if (traceEnabled) {
if (traceEnabled()) {
traceWrite(`CANCEL ${transitionType} ${this.transition} for ${this.fragment}`, traceCategories.Transition);
}
@ -668,7 +668,7 @@ function ensureIntEvaluator() {
}
function _createDummyZeroDurationAnimator(): android.animation.Animator {
if (traceEnabled) {
if (traceEnabled()) {
traceWrite(`_createDummyZeroDurationAnimator()`, traceCategories.Transition);
}
ensureIntEvaluator();

View File

@ -1,7 +1,7 @@
import { Transition as TransitionDefinition } from "ui/transition";
import { NavigationTransition } from "ui/frame";
import {
enabled as traceEnabled,
isEnabled as traceEnabled,
write as traceWrite,
categories as traceCategories
} from "trace";
@ -50,7 +50,7 @@ class AnimatedTransitioning extends NSObject implements UIViewControllerAnimated
case UINavigationControllerOperation.None: this._transitionType = "none"; break;
}
if (traceEnabled) {
if (traceEnabled()) {
traceWrite(`START ${this._transition} ${this._transitionType}`, traceCategories.Transition);
}
this._transition.animateIOSTransition(containerView, this._fromVC.view, this._toVC.view, this._operation, completion);
@ -62,12 +62,12 @@ class AnimatedTransitioning extends NSObject implements UIViewControllerAnimated
public animationEnded(transitionCompleted: boolean): void {
if (transitionCompleted) {
if (traceEnabled) {
if (traceEnabled()) {
traceWrite(`END ${this._transition} ${this._transitionType}`, traceCategories.Transition);
}
}
else {
if (traceEnabled) {
if (traceEnabled()) {
traceWrite(`CANCEL ${this._transition} ${this._transitionType}`, traceCategories.Transition);
}
}

View File

@ -19,7 +19,7 @@ function ensureWebViewClientClass() {
}
public shouldOverrideUrlLoading(view: android.webkit.WebView, url: string) {
if (traceEnabled) {
if (traceEnabled()) {
traceWrite("WebViewClientClass.shouldOverrideUrlLoading(" + url + ")", traceCategories.Debug);
}
return false;
@ -29,7 +29,7 @@ function ensureWebViewClientClass() {
super.onPageStarted(view, url, favicon);
if (this._view) {
if (traceEnabled) {
if (traceEnabled()) {
traceWrite("WebViewClientClass.onPageStarted(" + url + ", " + favicon + ")", traceCategories.Debug);
}
this._view._onLoadStarted(url, WebViewBase.navigationTypes[WebViewBase.navigationTypes.indexOf("linkClicked")]);
@ -40,7 +40,7 @@ function ensureWebViewClientClass() {
super.onPageFinished(view, url);
if (this._view) {
if (traceEnabled) {
if (traceEnabled()) {
traceWrite("WebViewClientClass.onPageFinished(" + url + ")", traceCategories.Debug);
}
this._view._onLoadFinished(url, undefined);
@ -58,7 +58,7 @@ function ensureWebViewClientClass() {
super.onReceivedError(view, errorCode, description, failingUrl);
if (this._view) {
if (traceEnabled) {
if (traceEnabled()) {
traceWrite("WebViewClientClass.onReceivedError(" + errorCode + ", " + description + ", " + failingUrl + ")", traceCategories.Debug);
}
this._view._onLoadFinished(failingUrl, description + "(" + errorCode + ")");
@ -70,7 +70,7 @@ function ensureWebViewClientClass() {
super.onReceivedError(view, request, error);
if (this._view) {
if (traceEnabled) {
if (traceEnabled()) {
traceWrite("WebViewClientClass.onReceivedError(" + error.getErrorCode() + ", " + error.getDescription() + ", " + (error.getUrl && error.getUrl()) + ")", traceCategories.Debug);
}
this._view._onLoadFinished(error.getUrl && error.getUrl(), error.getDescription() + "(" + error.getErrorCode() + ")");
@ -116,7 +116,7 @@ export class WebView extends WebViewBase {
return;
}
if (traceEnabled) {
if (traceEnabled()) {
traceWrite("WebView._loadUrl(" + url + ")", traceCategories.Debug);
}
this._android.stopLoading();

View File

@ -37,7 +37,7 @@ class UIWebViewDelegateImpl extends NSObject implements UIWebViewDelegate {
break;
}
if (traceEnabled) {
if (traceEnabled()) {
traceWrite("UIWebViewDelegateClass.webViewShouldStartLoadWithRequestNavigationType(" + request.URL.absoluteString + ", " + navigationType + ")", traceCategories.Debug);
}
owner._onLoadStarted(request.URL.absoluteString, WebViewBase.navigationTypes[navTypeIndex]);
@ -47,13 +47,13 @@ class UIWebViewDelegateImpl extends NSObject implements UIWebViewDelegate {
}
public webViewDidStartLoad(webView: UIWebView) {
if (traceEnabled) {
if (traceEnabled()) {
traceWrite("UIWebViewDelegateClass.webViewDidStartLoad(" + webView.request.URL + ")", traceCategories.Debug);
}
}
public webViewDidFinishLoad(webView: UIWebView) {
if (traceEnabled) {
if (traceEnabled()) {
traceWrite("UIWebViewDelegateClass.webViewDidFinishLoad(" + webView.request.URL + ")", traceCategories.Debug);
}
let owner = this._owner.get();
@ -70,7 +70,7 @@ class UIWebViewDelegateImpl extends NSObject implements UIWebViewDelegate {
src = webView.request.URL.absoluteString;
}
if (traceEnabled) {
if (traceEnabled()) {
traceWrite("UIWebViewDelegateClass.webViewDidFailLoadWithError(" + error.localizedDescription + ")", traceCategories.Debug);
}
if (owner) {
@ -110,7 +110,7 @@ export class WebView extends WebViewBase {
}
public _loadUrl(url: string) {
if (traceEnabled) {
if (traceEnabled()) {
traceWrite("WebView._loadUrl(" + url + ")", traceCategories.Debug);
}