mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-16 03:31:45 +08:00
chore: format and fix ci build
This commit is contained in:
@ -30,6 +30,7 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"include": [
|
"include": [
|
||||||
|
"../global-types.d.ts",
|
||||||
"./**/*.ts"
|
"./**/*.ts"
|
||||||
],
|
],
|
||||||
"exclude": [
|
"exclude": [
|
||||||
|
@ -476,24 +476,23 @@ function ensureBroadCastReceiverClass() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@NativeClass
|
@NativeClass
|
||||||
class BroadcastReceiver extends android.content.BroadcastReceiver {
|
class BroadcastReceiver extends android.content.BroadcastReceiver {
|
||||||
private _onReceiveCallback: (context: android.content.Context, intent: android.content.Intent) => void;
|
private _onReceiveCallback: (context: android.content.Context, intent: android.content.Intent) => void;
|
||||||
|
|
||||||
constructor(onReceiveCallback: (context: android.content.Context, intent: android.content.Intent) => void) {
|
constructor(onReceiveCallback: (context: android.content.Context, intent: android.content.Intent) => void) {
|
||||||
super();
|
super();
|
||||||
this._onReceiveCallback = onReceiveCallback;
|
this._onReceiveCallback = onReceiveCallback;
|
||||||
|
|
||||||
return global.__native(this);
|
return global.__native(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public onReceive(context: android.content.Context, intent: android.content.Intent) {
|
|
||||||
if (this._onReceiveCallback) {
|
|
||||||
this._onReceiveCallback(context, intent);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
public onReceive(context: android.content.Context, intent: android.content.Intent) {
|
||||||
|
if (this._onReceiveCallback) {
|
||||||
|
this._onReceiveCallback(context, intent);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
BroadcastReceiverClass = BroadcastReceiver;
|
BroadcastReceiverClass = BroadcastReceiver;
|
||||||
}
|
}
|
||||||
|
2
packages/core/application/index.d.ts
vendored
2
packages/core/application/index.d.ts
vendored
@ -62,7 +62,7 @@ export let autoSystemAppearanceChanged: boolean;
|
|||||||
/**
|
/**
|
||||||
* enable/disable systemAppearanceChanged
|
* enable/disable systemAppearanceChanged
|
||||||
*/
|
*/
|
||||||
export function setAutoSystemAppearanceChanged (value: boolean);
|
export function setAutoSystemAppearanceChanged(value: boolean);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Updates root view classes including those of modals
|
* Updates root view classes including those of modals
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import type {InstrumentationMode} from '../profiling'
|
import type { InstrumentationMode } from '../profiling';
|
||||||
|
|
||||||
interface IConfigPlatform {
|
interface IConfigPlatform {
|
||||||
/**
|
/**
|
||||||
@ -144,4 +144,3 @@ export interface NativeScriptConfig {
|
|||||||
*/
|
*/
|
||||||
cssParser?: 'rework' | 'nativescript' | 'css-tree';
|
cssParser?: 'rework' | 'nativescript' | 'css-tree';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1 +1 @@
|
|||||||
export * from './config.interface';
|
export * from './config.interface';
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import {android as androidApp, getNativeApplication} from '../application';
|
import { android as androidApp, getNativeApplication } from '../application';
|
||||||
|
|
||||||
export enum connectionType {
|
export enum connectionType {
|
||||||
none = 0,
|
none = 0,
|
||||||
|
@ -359,5 +359,5 @@ export function initGlobal() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!global.NativeScriptHasInitGlobal) {
|
if (!global.NativeScriptHasInitGlobal) {
|
||||||
initGlobal();
|
initGlobal();
|
||||||
}
|
}
|
||||||
|
@ -29,9 +29,9 @@ export const Application = {
|
|||||||
loadAppCss,
|
loadAppCss,
|
||||||
addCss,
|
addCss,
|
||||||
on,
|
on,
|
||||||
off,
|
off,
|
||||||
notify,
|
notify,
|
||||||
hasListeners,
|
hasListeners,
|
||||||
run,
|
run,
|
||||||
orientation,
|
orientation,
|
||||||
getNativeApplication,
|
getNativeApplication,
|
||||||
@ -135,11 +135,11 @@ export const Utils = {
|
|||||||
android: androidUtils,
|
android: androidUtils,
|
||||||
// legacy (a lot of plugins use the shorthand "ad" Utils.ad instead of Utils.android)
|
// legacy (a lot of plugins use the shorthand "ad" Utils.ad instead of Utils.android)
|
||||||
ad: androidUtils,
|
ad: androidUtils,
|
||||||
ios: iosUtils,
|
ios: iosUtils,
|
||||||
setTimeout,
|
setTimeout,
|
||||||
setInterval,
|
setInterval,
|
||||||
clearInterval,
|
clearInterval,
|
||||||
clearTimeout,
|
clearTimeout,
|
||||||
Source,
|
Source,
|
||||||
ClassInfo,
|
ClassInfo,
|
||||||
getClass,
|
getClass,
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
console.log('Loading inspector modules...');
|
console.log('Loading inspector modules...');
|
||||||
import './globals';
|
import './globals';
|
||||||
require('./debugger/webinspector-network');
|
require('./debugger/webinspector-network');
|
||||||
require('./debugger/webinspector-dom');
|
require('./debugger/webinspector-dom');
|
||||||
require('./debugger/webinspector-css');
|
require('./debugger/webinspector-css');
|
||||||
|
@ -456,7 +456,7 @@ export class BottomNavigation extends TabNavigationBase {
|
|||||||
const fragmentManager = this._getFragmentManager();
|
const fragmentManager = this._getFragmentManager();
|
||||||
const transaction = fragmentManager.beginTransaction();
|
const transaction = fragmentManager.beginTransaction();
|
||||||
const fragments = fragmentManager.getFragments().toArray();
|
const fragments = fragmentManager.getFragments().toArray();
|
||||||
for (let i=0;i<fragments.length;i++) {
|
for (let i = 0; i < fragments.length; i++) {
|
||||||
transaction.remove(fragments[i]);
|
transaction.remove(fragments[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,24 +1,18 @@
|
|||||||
// Types
|
// Types
|
||||||
import {TabContentItem} from '../tab-navigation-base/tab-content-item';
|
import { TabContentItem } from '../tab-navigation-base/tab-content-item';
|
||||||
import {TabStrip} from '../tab-navigation-base/tab-strip';
|
import { TabStrip } from '../tab-navigation-base/tab-strip';
|
||||||
import {TabStripItem} from '../tab-navigation-base/tab-strip-item';
|
import { TabStripItem } from '../tab-navigation-base/tab-strip-item';
|
||||||
import {getTransformedText, TextTransform} from '../text-base';
|
import { getTransformedText, TextTransform } from '../text-base';
|
||||||
|
|
||||||
// Requires
|
// Requires
|
||||||
import {Color} from '../../color';
|
import { Color } from '../../color';
|
||||||
import {ImageSource} from '../../image-source';
|
import { ImageSource } from '../../image-source';
|
||||||
import {Device} from '../../platform';
|
import { Device } from '../../platform';
|
||||||
import {iOSNativeHelper, isFontIconURI, layout} from '../../utils';
|
import { iOSNativeHelper, isFontIconURI, layout } from '../../utils';
|
||||||
import {CSSType, IOSHelper, View} from '../core/view';
|
import { CSSType, IOSHelper, View } from '../core/view';
|
||||||
import {Frame} from '../frame';
|
import { Frame } from '../frame';
|
||||||
import {Font} from '../styling/font';
|
import { Font } from '../styling/font';
|
||||||
import {
|
import { getIconSpecSize, itemsProperty, selectedIndexProperty, TabNavigationBase, tabStripProperty } from '../tab-navigation-base/tab-navigation-base';
|
||||||
getIconSpecSize,
|
|
||||||
itemsProperty,
|
|
||||||
selectedIndexProperty,
|
|
||||||
TabNavigationBase,
|
|
||||||
tabStripProperty
|
|
||||||
} from '../tab-navigation-base/tab-navigation-base';
|
|
||||||
|
|
||||||
// TODO:
|
// TODO:
|
||||||
// import { profile } from "../../profiling";
|
// import { profile } from "../../profiling";
|
||||||
|
@ -95,7 +95,7 @@ const createComponentInstance = profile('createComponentInstance', (elementName:
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Get the component type from module.
|
// Get the component type from module.
|
||||||
const instanceType = instanceModule[elementName];
|
const instanceType = instanceModule[elementName];
|
||||||
|
|
||||||
// Create instance of the component.
|
// Create instance of the component.
|
||||||
instance = new instanceType();
|
instance = new instanceType();
|
||||||
|
@ -305,7 +305,7 @@ export abstract class ViewBase extends Observable implements ViewBaseDefinition
|
|||||||
super();
|
super();
|
||||||
this._domId = viewIdCounter++;
|
this._domId = viewIdCounter++;
|
||||||
this._style = new Style(new WeakRef(this));
|
this._style = new Style(new WeakRef(this));
|
||||||
this.notify({eventName: ViewBase.createdEvent, type: this.constructor.name, object: this});
|
this.notify({ eventName: ViewBase.createdEvent, type: this.constructor.name, object: this });
|
||||||
}
|
}
|
||||||
|
|
||||||
// Used in Angular.
|
// Used in Angular.
|
||||||
|
@ -54,7 +54,7 @@ export class TabContentItem extends TabContentItemBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const fragments = fragmentManager.getFragments().toArray();
|
const fragments = fragmentManager.getFragments().toArray();
|
||||||
for (let i=0;i<fragments.length;i++) {
|
for (let i = 0; i < fragments.length; i++) {
|
||||||
if (fragments[i].index === this.index) {
|
if (fragments[i].index === this.index) {
|
||||||
tabFragment = fragments[i];
|
tabFragment = fragments[i];
|
||||||
break;
|
break;
|
||||||
|
@ -366,7 +366,7 @@ export class TabViewItem extends TabViewItemBase {
|
|||||||
let tabFragment = null;
|
let tabFragment = null;
|
||||||
const fragmentManager = tabView._getFragmentManager();
|
const fragmentManager = tabView._getFragmentManager();
|
||||||
const fragments = fragmentManager.getFragments().toArray();
|
const fragments = fragmentManager.getFragments().toArray();
|
||||||
for (let i=0;i<fragments.length;i++) {
|
for (let i = 0; i < fragments.length; i++) {
|
||||||
if (fragments[i].index === this.index) {
|
if (fragments[i].index === this.index) {
|
||||||
tabFragment = fragments[i];
|
tabFragment = fragments[i];
|
||||||
break;
|
break;
|
||||||
@ -624,7 +624,7 @@ export class TabView extends TabViewBase {
|
|||||||
const fragmentManager = this._getFragmentManager();
|
const fragmentManager = this._getFragmentManager();
|
||||||
const transaction = fragmentManager.beginTransaction();
|
const transaction = fragmentManager.beginTransaction();
|
||||||
let fragments = <Array<any>>fragmentManager.getFragments().toArray();
|
let fragments = <Array<any>>fragmentManager.getFragments().toArray();
|
||||||
for (let i=0;i<fragments.length;i++) {
|
for (let i = 0; i < fragments.length; i++) {
|
||||||
transaction.remove(fragments[i]);
|
transaction.remove(fragments[i]);
|
||||||
}
|
}
|
||||||
transaction.commitNowAllowingStateLoss();
|
transaction.commitNowAllowingStateLoss();
|
||||||
|
@ -566,7 +566,7 @@ export class Tabs extends TabsBase {
|
|||||||
const fragmentManager = this._getFragmentManager();
|
const fragmentManager = this._getFragmentManager();
|
||||||
const transaction = fragmentManager.beginTransaction();
|
const transaction = fragmentManager.beginTransaction();
|
||||||
let fragments = <Array<any>>fragmentManager.getFragments().toArray();
|
let fragments = <Array<any>>fragmentManager.getFragments().toArray();
|
||||||
for (let i=0;i<fragments.length;i++ ) {
|
for (let i = 0; i < fragments.length; i++) {
|
||||||
transaction.remove(fragments[i]);
|
transaction.remove(fragments[i]);
|
||||||
}
|
}
|
||||||
transaction.commitNowAllowingStateLoss();
|
transaction.commitNowAllowingStateLoss();
|
||||||
|
@ -27,25 +27,25 @@ export abstract class TextBaseCommon extends View implements TextBaseDefinition
|
|||||||
public formattedText: FormattedString;
|
public formattedText: FormattedString;
|
||||||
|
|
||||||
/***
|
/***
|
||||||
* In the NativeScript Core; by default the nativeTextViewProtected points to the same value as nativeViewProtected.
|
* In the NativeScript Core; by default the nativeTextViewProtected points to the same value as nativeViewProtected.
|
||||||
* At this point no internal NS components need this indirection functionality.
|
* At this point no internal NS components need this indirection functionality.
|
||||||
* This indirection is used to allow support usage by third party components so they don't have to duplicate functionality.
|
* This indirection is used to allow support usage by third party components so they don't have to duplicate functionality.
|
||||||
*
|
*
|
||||||
* A third party component can just override the `nativeTextViewProtected` getter and return a different internal view and that view would be
|
* A third party component can just override the `nativeTextViewProtected` getter and return a different internal view and that view would be
|
||||||
* what all TextView/TextInput class features would be applied to.
|
* what all TextView/TextInput class features would be applied to.
|
||||||
*
|
*
|
||||||
* A example is the Android MaterialDesign TextInput class, it has a wrapper view of a TextInputLayout
|
* A example is the Android MaterialDesign TextInput class, it has a wrapper view of a TextInputLayout
|
||||||
* https://developer.android.com/reference/com/google/android/material/textfield/TextInputLayout
|
* https://developer.android.com/reference/com/google/android/material/textfield/TextInputLayout
|
||||||
* which wraps the actual TextInput. This wrapper layout (TextInputLayout) must be assigned to the nativeViewProtected as the entire
|
* which wraps the actual TextInput. This wrapper layout (TextInputLayout) must be assigned to the nativeViewProtected as the entire
|
||||||
* NS Core uses nativeViewProtected for everything related to layout, so that it can be measured, added to the parent view as a child, ect.
|
* NS Core uses nativeViewProtected for everything related to layout, so that it can be measured, added to the parent view as a child, ect.
|
||||||
*
|
*
|
||||||
* However, its internal view would be the actual TextView/TextInput and to allow that sub-view to have the normal TextView/TextInput
|
* However, its internal view would be the actual TextView/TextInput and to allow that sub-view to have the normal TextView/TextInput
|
||||||
* class features, which we expose and to allow them to work on it, the internal TextView/TextInput is what the needs to have the class values applied to it.
|
* class features, which we expose and to allow them to work on it, the internal TextView/TextInput is what the needs to have the class values applied to it.
|
||||||
*
|
*
|
||||||
* So all code that works on what is expected to be a TextView/TextInput should use `nativeTextViewProtected` so that any third party
|
* So all code that works on what is expected to be a TextView/TextInput should use `nativeTextViewProtected` so that any third party
|
||||||
* components that need to have two separate components can work properly without them having to duplicate all the TextBase (and decendants) functionality
|
* components that need to have two separate components can work properly without them having to duplicate all the TextBase (and decendants) functionality
|
||||||
* by just overriding the nativeTextViewProtected getter.
|
* by just overriding the nativeTextViewProtected getter.
|
||||||
**/
|
**/
|
||||||
get nativeTextViewProtected() {
|
get nativeTextViewProtected() {
|
||||||
return this.nativeViewProtected;
|
return this.nativeViewProtected;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user