refactor: circular deps part 13

This commit is contained in:
Nathan Walker
2025-07-09 20:07:56 -07:00
parent ee03774ec0
commit 579a25d583
31 changed files with 552 additions and 387 deletions

View File

@ -1,12 +1,9 @@
// Definitions.
import { ImageSource as ImageSourceDefinition, iosSymbolScaleType } from '.';
import { ImageAsset } from '../image-asset';
import * as http from '../http';
// Types.
import { path as fsPath, knownFolders } from '../file-system';
import { isFileOrResourcePath, RESOURCE_PREFIX, layout } from '../utils';
import { Application } from '../application';
import { getNativeApp } from '../application/helpers-common';
import { Font } from '../ui/styling/font';
import { Color } from '../color';
@ -14,23 +11,8 @@ import { getScaledDimensions } from './image-source-common';
export { isFileOrResourcePath };
let application: android.app.Application;
let resources: android.content.res.Resources;
function getApplication() {
if (!application) {
application = Application.android.getNativeApplication();
}
return application;
}
function getResources() {
if (!resources) {
resources = getApplication().getResources();
}
return resources;
return getNativeApp() as android.app.Application;
}
export class ImageSource implements ImageSourceDefinition {
@ -85,7 +67,7 @@ export class ImageSource implements ImageSourceDefinition {
}
static fromResourceSync(name: string): ImageSource {
const res = getResources();
const res = getApplication().getResources();
if (res) {
const identifier: number = res.getIdentifier(name, 'drawable', getApplication().getPackageName());
if (0 < identifier) {