diff --git a/tests/app/navigation/transition-tests.ts b/tests/app/navigation/transition-tests.ts index dce7ee3bc..8c7905f4e 100644 --- a/tests/app/navigation/transition-tests.ts +++ b/tests/app/navigation/transition-tests.ts @@ -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 = { diff --git a/tests/app/trace-tests.ts b/tests/app/trace-tests.ts index 721ede745..66c1e435d 100644 --- a/tests/app/trace-tests.ts +++ b/tests/app/trace-tests.ts @@ -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 diff --git a/tns-core-modules/file-system/file-name-resolver.ts b/tns-core-modules/file-system/file-name-resolver.ts index 755de8493..1dc60026c 100644 --- a/tns-core-modules/file-system/file-name-resolver.ts +++ b/tns-core-modules/file-system/file-name-resolver.ts @@ -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 = []; var _eventListeners: Array = []; @@ -14,6 +14,10 @@ export function disable() { enabled = false; } +export function isEnabled() { + return enabled; +} + export function isCategorySet(category: string): boolean { return category in _categories; } diff --git a/tns-core-modules/ui/animation/animation-common.ts b/tns-core-modules/ui/animation/animation-common.ts index 79ddf1407..33d367b88 100644 --- a/tns-core-modules/ui/animation/animation-common.ts +++ b/tns-core-modules/ui/animation/animation-common.ts @@ -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); } diff --git a/tns-core-modules/ui/animation/animation.android.ts b/tns-core-modules/ui/animation/animation.android.ts index fabaf7f4a..f7b59f18f 100644 --- a/tns-core-modules/ui/animation/animation.android.ts +++ b/tns-core-modules/ui/animation/animation.android.ts @@ -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 (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); } } diff --git a/tns-core-modules/ui/animation/animation.ios.ts b/tns-core-modules/ui/animation/animation.ios.ts index 8f428106e..d34ee4d09 100644 --- a/tns-core-modules/ui/animation/animation.ios.ts +++ b/tns-core-modules/ui/animation/animation.ios.ts @@ -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; diff --git a/tns-core-modules/ui/core/bindable.ts b/tns-core-modules/ui/core/bindable.ts index 31abd32d6..75adc1ddd 100644 --- a/tns-core-modules/ui/core/bindable.ts +++ b/tns-core-modules/ui/core/bindable.ts @@ -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)) { diff --git a/tns-core-modules/ui/core/view-base.ts b/tns-core-modules/ui/core/view-base.ts index 13bde5b0c..107f061e8 100644 --- a/tns-core-modules/ui/core/view-base.ts +++ b/tns-core-modules/ui/core/view-base.ts @@ -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) { diff --git a/tns-core-modules/ui/core/view-common.ts b/tns-core-modules/ui/core/view-common.ts index 0c5c5e2da..e78954241 100644 --- a/tns-core-modules/ui/core/view-common.ts +++ b/tns-core-modules/ui/core/view-common.ts @@ -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); } diff --git a/tns-core-modules/ui/core/view.android.ts b/tns-core-modules/ui/core/view.android.ts index 96270dd4a..0fc2fd27f 100644 --- a/tns-core-modules/ui/core/view.android.ts +++ b/tns-core-modules/ui/core/view.android.ts @@ -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"); } diff --git a/tns-core-modules/ui/core/view.ios.ts b/tns-core-modules/ui/core/view.ios.ts index af30b1c05..61d0a9c42 100644 --- a/tns-core-modules/ui/core/view.ios.ts +++ b/tns-core-modules/ui/core/view.ios.ts @@ -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 = (this.nativeView.subviews[0]); diff --git a/tns-core-modules/ui/definitions.d.ts b/tns-core-modules/ui/definitions.d.ts index 824fb1cf2..9d416c3a2 100644 --- a/tns-core-modules/ui/definitions.d.ts +++ b/tns-core-modules/ui/definitions.d.ts @@ -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, diff --git a/tns-core-modules/ui/frame/frame-common.ts b/tns-core-modules/ui/frame/frame-common.ts index 8f960bc84..22f3c5bd0 100644 --- a/tns-core-modules/ui/frame/frame-common.ts +++ b/tns-core-modules/ui/frame/frame-common.ts @@ -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); } } diff --git a/tns-core-modules/ui/frame/frame.android.ts b/tns-core-modules/ui/frame/frame.android.ts index 70cacf6dd..4edc8842e 100644 --- a/tns-core-modules/ui/frame/frame.android.ts +++ b/tns-core-modules/ui/frame/frame.android.ts @@ -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, grantResults: Array, 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); } diff --git a/tns-core-modules/ui/frame/frame.ios.ts b/tns-core-modules/ui/frame/frame.ios.ts index ae7fcad6e..903fb4180 100644 --- a/tns-core-modules/ui/frame/frame.ios.ts +++ b/tns-core-modules/ui/frame/frame.ios.ts @@ -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 = 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 = 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 = 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 { let lastViewController = this.viewControllers.lastObject; let 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; diff --git a/tns-core-modules/ui/image-cache/image-cache.ios.ts b/tns-core-modules/ui/image-cache/image-cache.ios.ts index 95e615d2d..bd10787a6 100644 --- a/tns-core-modules/ui/image-cache/image-cache.ios.ts +++ b/tns-core-modules/ui/image-cache/image-cache.ios.ts @@ -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(); diff --git a/tns-core-modules/ui/image/image.ios.ts b/tns-core-modules/ui/image/image.ios.ts index d67361ab4..781fa102b 100644 --- a/tns-core-modules/ui/image/image.ios.ts +++ b/tns-core-modules/ui/image/image.ios.ts @@ -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); diff --git a/tns-core-modules/ui/layouts/layout.android.ts b/tns-core-modules/ui/layouts/layout.android.ts index 17e50c3a3..f5b41aa55 100644 --- a/tns-core-modules/ui/layouts/layout.android.ts +++ b/tns-core-modules/ui/layouts/layout.android.ts @@ -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); } } diff --git a/tns-core-modules/ui/list-view/list-view-common.ts b/tns-core-modules/ui/list-view/list-view-common.ts index 9a39f5017..e418d89b6 100644 --- a/tns-core-modules/ui/list-view/list-view-common.ts +++ b/tns-core-modules/ui/list-view/list-view-common.ts @@ -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"; diff --git a/tns-core-modules/ui/page/page.ios.ts b/tns-core-modules/ui/page/page.ios.ts index 5973f5363..7cdfa8848 100644 --- a/tns-core-modules/ui/page/page.ios.ts +++ b/tns-core-modules/ui/page/page.ios.ts @@ -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) { diff --git a/tns-core-modules/ui/proxy-view-container/proxy-view-container.ts b/tns-core-modules/ui/proxy-view-container/proxy-view-container.ts index 501bf6239..14a2062aa 100644 --- a/tns-core-modules/ui/proxy-view-container/proxy-view-container.ts +++ b/tns-core-modules/ui/proxy-view-container/proxy-view-container.ts @@ -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); diff --git a/tns-core-modules/ui/styling/font.android.ts b/tns-core-modules/ui/styling/font.android.ts index 0017fdef8..fdc150b37 100644 --- a/tns-core-modules/ui/styling/font.android.ts +++ b/tns-core-modules/ui/styling/font.android.ts @@ -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); } } diff --git a/tns-core-modules/ui/styling/font.ios.ts b/tns-core-modules/ui/styling/font.ios.ts index feb02bbac..be88b1eaa 100644 --- a/tns-core-modules/ui/styling/font.ios.ts +++ b/tns-core-modules/ui/styling/font.ios.ts @@ -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(); if (!CTFontManagerRegisterGraphicsFont(font, error)) { - if (traceEnabled) { + if (traceEnabled()) { traceWrite("Error occur while registering font: " + CFErrorCopyDescription(error.value), traceCategories.Error, traceMessageType.error); } } diff --git a/tns-core-modules/ui/styling/style.ts b/tns-core-modules/ui/styling/style.ts index 225917dde..8db940daf 100644 --- a/tns-core-modules/ui/styling/style.ts +++ b/tns-core-modules/ui/styling/style.ts @@ -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); // } diff --git a/tns-core-modules/ui/tab-view/tab-view.android.ts b/tns-core-modules/ui/tab-view/tab-view.android.ts index 533e30698..dfe69808b 100644 --- a/tns-core-modules/ui/tab-view/tab-view.android.ts +++ b/tns-core-modules/ui/tab-view/tab-view.android.ts @@ -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 = 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); diff --git a/tns-core-modules/ui/tab-view/tab-view.ios.ts b/tns-core-modules/ui/tab-view/tab-view.ios.ts index f1de61226..385186122 100644 --- a/tns-core-modules/ui/tab-view/tab-view.ios.ts +++ b/tns-core-modules/ui/tab-view/tab-view.ios.ts @@ -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); } diff --git a/tns-core-modules/ui/transition/transition.android.ts b/tns-core-modules/ui/transition/transition.android.ts index ae3b5a363..3a39cfd08 100644 --- a/tns-core-modules/ui/transition/transition.android.ts +++ b/tns-core-modules/ui/transition/transition.android.ts @@ -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 = 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 = (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 = (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 = 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 = (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 = (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 = 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 ? (fragment).getReenterTransition() : (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 = 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 ? (fragment).getReturnTransition() : (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(); diff --git a/tns-core-modules/ui/transition/transition.ios.ts b/tns-core-modules/ui/transition/transition.ios.ts index 017cb1894..404d7bd9d 100644 --- a/tns-core-modules/ui/transition/transition.ios.ts +++ b/tns-core-modules/ui/transition/transition.ios.ts @@ -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); } } diff --git a/tns-core-modules/ui/web-view/web-view.android.ts b/tns-core-modules/ui/web-view/web-view.android.ts index d3be67213..1e910b176 100644 --- a/tns-core-modules/ui/web-view/web-view.android.ts +++ b/tns-core-modules/ui/web-view/web-view.android.ts @@ -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(); diff --git a/tns-core-modules/ui/web-view/web-view.ios.ts b/tns-core-modules/ui/web-view/web-view.ios.ts index 6b1ef6bce..e7a2ed4d8 100644 --- a/tns-core-modules/ui/web-view/web-view.ios.ts +++ b/tns-core-modules/ui/web-view/web-view.ios.ts @@ -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); }