refactor(core): zero circulars + esm ready (#10770)

This commit is contained in:
Nathan Walker
2025-09-18 17:03:23 -07:00
committed by GitHub
parent 1e54baf198
commit c2ff8c1ae7
306 changed files with 9136 additions and 9889 deletions

View File

@@ -1,6 +1,6 @@
import { IFileSystemAccess, FileSystemAccess, FileSystemAccess29 } from './file-system-access';
import { SDK_VERSION } from '../utils';
import { Application } from '../application';
import { SDK_VERSION } from '../utils/constants';
import { getNativeApp } from '../application/helpers-common';
// The FileSystemAccess implementation, used through all the APIs.
let fileAccess: IFileSystemAccess;
@@ -182,15 +182,6 @@ export class FileSystemEntity {
}
}
let applicationContext;
function getApplicationContext() {
if (!applicationContext) {
applicationContext = Application.android.getNativeApplication().getApplicationContext();
}
return applicationContext;
}
export enum AndroidDirectory {
ALARMS = 'alarms',
AUDIOBOOKS = 'audiobooks',
@@ -279,7 +270,7 @@ class Android {
throw new Error(`createFile is available on Android only!`);
}
const context = getApplicationContext() as android.content.Context;
const context = getNativeApp<android.app.Application>().getApplicationContext() as android.content.Context;
const meta = new android.content.ContentValues();
meta.put(android.provider.MediaStore.MediaColumns.DISPLAY_NAME, options.name);
@@ -332,7 +323,7 @@ export class File extends FileSystemEntity {
// falls back to creating a temp file without a known extension.
if (!fileInfo) {
const tempFile = `${knownFolders.temp().path}/${java.util.UUID.randomUUID().toString()}`;
org.nativescript.widgets.Async.File.copySync(path, tempFile, getApplicationContext());
org.nativescript.widgets.Async.File.copySync(path, tempFile, getNativeApp<android.app.Application>().getApplicationContext());
path = tempFile;
} else {
const ext = fileInfo.extension;