From b79801af5fd9862158ffcd8af5e8541cea870d8f Mon Sep 17 00:00:00 2001 From: Nathan Walker Date: Tue, 22 Jul 2025 22:46:15 -0700 Subject: [PATCH] chore: cleanup --- apps/automated/src/main-page.ts | 1 - apps/automated/src/test-runner.ts | 1 - apps/automated/src/tk-unit.ts | 1 - apps/automated/src/ui-helper.ts | 2 -- apps/toolbox/src/main-page.ts | 1 - .../file-system/file-system-access.ios.ts | 20 ++----------------- packages/core/globals/index.ts | 6 +----- packages/core/module-name-resolver/index.ts | 1 - .../qualifier-matcher/index.ts | 2 -- packages/core/ui/builder/index.ts | 4 ---- packages/core/ui/frame/frame-common.ts | 1 - packages/core/ui/page/page-common.ts | 1 - 12 files changed, 3 insertions(+), 38 deletions(-) diff --git a/apps/automated/src/main-page.ts b/apps/automated/src/main-page.ts index a1ec47324..5a62b4412 100644 --- a/apps/automated/src/main-page.ts +++ b/apps/automated/src/main-page.ts @@ -23,7 +23,6 @@ function runTests() { export function onNavigatedTo(args) { args.object.off(Page.loadedEvent, onNavigatedTo); - console.log('onNavigatedTo called', executeTests); if (executeTests) { executeTests = false; runTests(); diff --git a/apps/automated/src/test-runner.ts b/apps/automated/src/test-runner.ts index 39ea7a935..bd507b717 100644 --- a/apps/automated/src/test-runner.ts +++ b/apps/automated/src/test-runner.ts @@ -455,7 +455,6 @@ function getAllProperties(obj: any) { let testsSelector: string; export function runAll(testSelector?: string) { testsSelector = testSelector; - console.log('runAll called with:', testSelector); if (running) { // TODO: We may schedule pending run requests return; diff --git a/apps/automated/src/tk-unit.ts b/apps/automated/src/tk-unit.ts index 1f7c8451f..3c79c6dff 100644 --- a/apps/automated/src/tk-unit.ts +++ b/apps/automated/src/tk-unit.ts @@ -359,7 +359,6 @@ export function waitUntilReady(isReady: () => boolean, timeoutSec: number = 5, s const currentRunLoop = NSRunLoop.currentRunLoop; currentRunLoop.limitDateForMode(currentRunLoop.currentMode); if (isReady()) { - console.log('waitUntilReady: isReady() returned true'); break; } diff --git a/apps/automated/src/ui-helper.ts b/apps/automated/src/ui-helper.ts index 69c075d2a..3e1879dbe 100644 --- a/apps/automated/src/ui-helper.ts +++ b/apps/automated/src/ui-helper.ts @@ -203,13 +203,11 @@ export function waitUntilNavigatedFrom(action: Function, topFrame?: Frame) { const currentPage = topFrame ? topFrame.currentPage : Frame.topmost().currentPage; let completed = false; function navigatedFrom(args) { - console.log('navigatedFrom called'); args.object.page.off('navigatedFrom', navigatedFrom); completed = true; } currentPage.on('navigatedFrom', navigatedFrom); - console.log('calling action!'); action(); TKUnit.waitUntilReady(() => completed); } diff --git a/apps/toolbox/src/main-page.ts b/apps/toolbox/src/main-page.ts index 39b5b1efd..83f8dc9b0 100644 --- a/apps/toolbox/src/main-page.ts +++ b/apps/toolbox/src/main-page.ts @@ -2,7 +2,6 @@ import { EventData, Page, Utils } from '@nativescript/core'; import { HelloWorldModel } from './main-view-model'; export function navigatingTo(args: EventData) { - console.log('toolbox navigatingTo called'); const page = args.object; page.bindingContext = new HelloWorldModel(); diff --git a/packages/core/file-system/file-system-access.ios.ts b/packages/core/file-system/file-system-access.ios.ts index 05925eb8b..e879bc851 100644 --- a/packages/core/file-system/file-system-access.ios.ts +++ b/packages/core/file-system/file-system-access.ios.ts @@ -1,5 +1,5 @@ import { encoding as textEncoding } from '../text'; -import { iOSNativeHelper } from '../utils'; +import { getFileExtension, iOSNativeHelper } from '../utils'; // TODO: Implement all the APIs receiving callback using async blocks // TODO: Check whether we need try/catch blocks for the iOS implementation @@ -611,24 +611,8 @@ export class FileSystemAccess { return url.path; } - // TODO: This method is the same as in the iOS implementation. - // Make it in a separate file / module so it can be reused from both implementations. public getFileExtension(path: string): string { - // TODO [For Panata]: The definitions currently specify "any" as a return value of this method - //const nsString = Foundation.NSString.stringWithString(path); - //const extension = nsString.pathExtension(); - - //if (extension && extension.length > 0) { - // extension = extension.concat(".", extension); - //} - - //return extension; - const dotIndex = path.lastIndexOf('.'); - if (dotIndex && dotIndex >= 0 && dotIndex < path.length) { - return path.substring(dotIndex); - } - - return ''; + return getFileExtension(path); } private deleteEntity(path: string, onError?: (error: any) => any) { diff --git a/packages/core/globals/index.ts b/packages/core/globals/index.ts index c7a2addeb..9f6175e36 100644 --- a/packages/core/globals/index.ts +++ b/packages/core/globals/index.ts @@ -104,7 +104,6 @@ global._unregisterModule = function _unregisterModule(name: string): void { global.registerBundlerModules = function registerBundlerModules(context: Context, extensionMap: ExtensionMap = {}) { const registerWithName = (nickName: string, moduleId: string) => { - console.log(`Registering module '${nickName}' with id '${moduleId}'`); modules.set(nickName, { moduleId, loader: () => { @@ -114,7 +113,6 @@ global.registerBundlerModules = function registerBundlerModules(context: Context }; const registerModuleById = (moduleId: string) => { - console.log(`registerModuleById: ${moduleId}`); const extDotIndex = moduleId.lastIndexOf('.'); const base = moduleId.substring(0, extDotIndex); const originalExt = moduleId.substring(extDotIndex); @@ -129,7 +127,7 @@ global.registerBundlerModules = function registerBundlerModules(context: Context if (registerName.startsWith('./') && registerName.endsWith('.js')) { const jsNickNames = [ // This is extremely short version like "main-page" that was promoted to be used with global.registerModule("module-name", loaderFunc); - registerName.substring(2, registerName.length - 5), + registerName.substring(2, registerName.length - 3), // This is for supporting module names like "./main/main-page" registerName.substring(0, registerName.length - 3), // This is for supporting module names like "main/main-page.js" @@ -398,7 +396,5 @@ function isTestingEnv() { return typeof jest !== 'undefined' || global.__UNIT_TEST__; } -console.log('isTestingEnv():', isTestingEnv()); - // ensure the Application instance is initialized before any other module imports it. import '../application'; diff --git a/packages/core/module-name-resolver/index.ts b/packages/core/module-name-resolver/index.ts index 15419d25e..fd0c2e95c 100644 --- a/packages/core/module-name-resolver/index.ts +++ b/packages/core/module-name-resolver/index.ts @@ -20,7 +20,6 @@ export class ModuleNameResolver implements ModuleNameResolverType { let result: string = this._cache[key]; if (result === undefined) { result = this.resolveModuleNameImpl(path, ext); - console.log('resolveModuleName result:', result); this._cache[key] = result; } diff --git a/packages/core/module-name-resolver/qualifier-matcher/index.ts b/packages/core/module-name-resolver/qualifier-matcher/index.ts index 178c333c9..dfdd60a01 100644 --- a/packages/core/module-name-resolver/qualifier-matcher/index.ts +++ b/packages/core/module-name-resolver/qualifier-matcher/index.ts @@ -176,8 +176,6 @@ export function findMatch(path: string, ext: string, candidates: Array, result = candidates[i]; } } - console.log(' > findMatch called with path:', path, 'and ext:', ext, 'candidates:', candidates, 'context:', context, '--- MATCH? result:', result); - console.log('. '); return result; } diff --git a/packages/core/ui/builder/index.ts b/packages/core/ui/builder/index.ts index f8b23435f..764d10919 100644 --- a/packages/core/ui/builder/index.ts +++ b/packages/core/ui/builder/index.ts @@ -73,11 +73,8 @@ export class Builder { return view; } else if (entry.moduleName) { const moduleName = sanitizeModuleName(entry.moduleName); - console.log('.'); - console.log('moduleName:', moduleName); const resolvedCodeModuleName = resolveModuleName(moduleName, ''); //`${moduleName}.xml`; const moduleExports = resolvedCodeModuleName ? global.loadModule(resolvedCodeModuleName) : null; - console.log('createViewFromEntry called with entry:', entry, 'moduleName:', entry.moduleName, 'resolvedCodeModuleName:', resolvedCodeModuleName, 'moduleExports:', moduleExports); if (moduleExports && moduleExports.createPage) { // Exports has a createPage() method const view = moduleExports.createPage(); @@ -143,7 +140,6 @@ export class Builder { */ static parseMultipleTemplates(value: string, context: any): Array { const dummyComponent = `${value}`; - console.log('parseMultipleTemplates called with value:', value, 'context:', context); return parseInternal(dummyComponent, context).component['itemTemplates']; } } diff --git a/packages/core/ui/frame/frame-common.ts b/packages/core/ui/frame/frame-common.ts index 08ea7d7a9..793611850 100644 --- a/packages/core/ui/frame/frame-common.ts +++ b/packages/core/ui/frame/frame-common.ts @@ -226,7 +226,6 @@ export class FrameBase extends CustomLayoutView { } public navigate(param: any) { - console.log('framebase navigate() called with:', param); if (Trace.isEnabled()) { Trace.write(`NAVIGATE`, Trace.categories.Navigation); } diff --git a/packages/core/ui/page/page-common.ts b/packages/core/ui/page/page-common.ts index 660f885d3..a1e3657b3 100644 --- a/packages/core/ui/page/page-common.ts +++ b/packages/core/ui/page/page-common.ts @@ -135,7 +135,6 @@ export class PageBase extends ContentView { @profile public onNavigatedTo(isBackNavigation: boolean): void { - console.log('onNavigatedTo called with isBackNavigation:', isBackNavigation); this.notify(this.createNavigatedData(PageBase.navigatedToEvent, isBackNavigation)); if (this.accessibilityAnnouncePageEnabled) {