Skip to content

Commit

Permalink
Merge branch 'main' into android-background-improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
NathanWalker committed Nov 30, 2023
2 parents 959ddfb + 82e9c67 commit 9f34d01
Show file tree
Hide file tree
Showing 67 changed files with 460 additions and 354 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,5 @@ Thumbs.db

# types
ios-typings-prj

.nx/cache
2 changes: 2 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,5 @@ package.json
*.scss
*.sh
!packages/webpack/templates/*.js

/.nx/cache
4 changes: 2 additions & 2 deletions apps/automated/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
"nativescript-theme-core": "file:../../node_modules/nativescript-theme-core"
},
"devDependencies": {
"@nativescript/android": "~8.5.0",
"@nativescript/ios": "~8.5.0",
"@nativescript/android": "~8.6.0",
"@nativescript/ios": "~8.6.0",
"@nativescript/webpack": "file:../../dist/packages/nativescript-webpack.tgz",
"circular-dependency-plugin": "^5.2.2",
"typescript": "~5.2.0"
Expand Down
6 changes: 3 additions & 3 deletions apps/toolbox/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@
"dependencies": {
"@nativescript/core": "file:../../packages/core",
"nativescript-theme-core": "file:../../node_modules/nativescript-theme-core",
"@nativescript/imagepicker": "^1.0.6"
"@nativescript/imagepicker": "^3.0.0"
},
"devDependencies": {
"@nativescript/android": "~8.5.0",
"@nativescript/ios": "~8.5.0",
"@nativescript/android": "~8.6.0",
"@nativescript/ios": "~8.6.0",
"@nativescript/webpack": "file:../../dist/packages/nativescript-webpack.tgz",
"typescript": "~5.2.0"
}
Expand Down
4 changes: 4 additions & 0 deletions apps/toolbox/src/app.css
Original file line number Diff line number Diff line change
Expand Up @@ -221,4 +221,8 @@ Button {
.switch-demo-page Switch.custom-switch:disabled:checked {
color: #ddd;
background-color: #777;
}

.no-shadow {
box-shadow: none;
}
6 changes: 4 additions & 2 deletions apps/toolbox/src/pages/box-shadow.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<!-- layouts -->
<ScrollView height="100%" visibility="{{ selectedComponentType === 'layouts' ? 'visible' : 'collapsed' }}">
<StackLayout padding="20">
<StackLayout width="300" height="100" class="demo-component" boxShadow="{{ appliedBoxShadow }}" borderColor="{{ borderColor }}" borderWidth="{{ borderWidth }}" borderRadius="{{ borderRadius }}" background="{{ background }}" tap="{{ toggleAnimation }}">
<StackLayout width="300" height="100" class="demo-component" boxShadow="{{ appliedBoxShadow }}" borderColor="{{ borderColor }}" borderWidth="{{ borderWidth }}" borderRadius="{{ borderRadius }}" background="{{ background }}" tap="{{ toggleAnimation }}">
<Label text="StackLayout" />
</StackLayout>

Expand Down Expand Up @@ -40,10 +40,12 @@
</GridLayout>

<!-- buttons -->
<GridLayout rows="*" height="100%" visibility="{{ selectedComponentType === 'buttons' ? 'visible' : 'collapsed' }}">
<GridLayout rows="*,*" height="100%" visibility="{{ selectedComponentType === 'buttons' ? 'visible' : 'collapsed' }}">

<Button horizontalAlignment="center" verticalAlignment="center" class="demo-component" boxShadow="{{ appliedBoxShadow }}" borderColor="{{ borderColor }}" borderWidth="{{ borderWidth }}" borderRadius="{{ borderRadius }}" background="{{ background }}" tap="{{ toggleAnimation }}" text="button" />

<Button row="1" horizontalAlignment="center" verticalAlignment="center" class="demo-component no-shadow" text="button no shadow" />

</GridLayout>

<!-- images -->
Expand Down
7 changes: 4 additions & 3 deletions apps/toolbox/src/pages/image-handling.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,11 @@ export class DemoModel extends Observable {
.then(() => {
return context.present();
})
.then((selection) => {
const imageAsset = selection.length > 0 ? selection[0] : null;
if (imageAsset) {
.then((selections) => {
const selection = selections.length > 0 ? selections[0] : null;
if (selection) {
this.addingPhoto = true;
const imageAsset = selection.asset;

ImageSource.fromAsset(imageAsset).then(
(savedImage) => {
Expand Down
4 changes: 2 additions & 2 deletions apps/ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
"@nativescript/core": "file:../../packages/core"
},
"devDependencies": {
"@nativescript/android": "~8.5.0",
"@nativescript/ios": "~8.5.0",
"@nativescript/android": "~8.6.0",
"@nativescript/ios": "~8.6.0",
"@nativescript/webpack": "file:../../dist/packages/nativescript-webpack.tgz",
"typescript": "~5.2.0"
},
Expand Down
44 changes: 34 additions & 10 deletions nx.json
Original file line number Diff line number Diff line change
@@ -1,19 +1,13 @@
{
"npmScope": "nativescript",
"workspaceLayout": {
"appsDir": "apps",
"libsDir": "packages"
},
"tasksRunnerOptions": {
"default": {
"runner": "nx-cloud",
"options": {
"useDaemonProcess": false,
"cacheableOperations": ["build", "lint", "test", "ios", "android", "e2e"],
"canTrackAnalytics": false,
"showUsageWarnings": true,
"parallel": 1,
"accessToken": "NzRmNDM3NDgtZjlmNy00MTUwLWIxZDktYjJlZTRhMWM5ODY3fHJlYWQtd3JpdGU="
"showUsageWarnings": true
}
}
},
Expand Down Expand Up @@ -84,10 +78,40 @@
},
"targetDefaults": {
"build": {
"inputs": ["production", "^production"]
"inputs": ["production", "^production"],
"cache": true
},
"test": {
"inputs": ["default", "^production", "{workspaceRoot}/jest.preset.js"]
"inputs": ["default", "^production", "{workspaceRoot}/jest.preset.js"],
"cache": true
},
"lint": {
"cache": true
},
"ios": {
"cache": true
},
"android": {
"cache": true
},
"e2e": {
"cache": true
},
"@nx/jest:jest": {
"inputs": ["default", "^production", "{workspaceRoot}/jest.preset.js"],
"cache": true,
"options": {
"passWithNoTests": true
},
"configurations": {
"ci": {
"ci": true,
"codeCoverage": true
}
}
}
}
},
"useDaemonProcess": false,
"nxCloudAccessToken": "NzRmNDM3NDgtZjlmNy00MTUwLWIxZDktYjJlZTRhMWM5ODY3fHJlYWQtd3JpdGU=",
"parallel": 1
}
38 changes: 18 additions & 20 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,26 +18,25 @@
"url": "https://github.com/NativeScript/NativeScript.git"
},
"dependencies": {
"@nx/devkit": "16.9.1",
"@swc/helpers": "0.5.2",
"nativescript-theme-core": "^1.0.4",
"nx-cloud": "16.4.0"
"@nx/devkit": "17.1.3",
"@swc/helpers": "0.5.3",
"nativescript-theme-core": "^1.0.4"
},
"devDependencies": {
"@nativescript/hook": "^2.0.0",
"@nativescript/nx": "^16.5.0",
"@nstudio/focus": "^16.5.0",
"@nativescript/nx": "^17.0.1",
"@nstudio/focus": "^17.0.1",
"@nstudio/nps-i": "~2.0.0",
"@nx/eslint-plugin": "16.9.1",
"@nx/jest": "16.9.1",
"@nx/js": "16.9.1",
"@nx/node": "16.9.1",
"@nx/plugin": "16.9.1",
"@nx/workspace": "16.9.1",
"@nx/eslint-plugin": "17.1.3",
"@nx/jest": "17.1.3",
"@nx/js": "17.1.3",
"@nx/node": "17.1.3",
"@nx/plugin": "17.1.3",
"@nx/workspace": "17.1.3",
"@prettier/plugin-xml": "^2.2.0",
"@swc-node/register": "~1.4.2",
"@swc-node/register": "1.6.8",
"@swc/cli": "~0.1.62",
"@swc/core": "1.3.90",
"@swc/core": "~1.3.99",
"@types/jest": "~29.5.0",
"@types/node": "^18.7.1",
"@typescript-eslint/eslint-plugin": "^6.6.0",
Expand All @@ -47,18 +46,18 @@
"css": "^3.0.0",
"css-tree": "^1.1.2",
"dotenv": "~16.3.1",
"emoji-regex": "^10.2.1",
"emoji-regex": "^10.3.0",
"eslint": "~8.43.0",
"eslint-config-prettier": "~8.8.0",
"gonzales": "^1.0.7",
"husky": "^8.0.1",
"jest": "~29.6.0",
"jest-environment-jsdom": "~29.6.0",
"lint-staged": "^14.0.0",
"lint-staged": "^15.1.0",
"module-alias": "^2.2.2",
"nativescript": "~8.6.0",
"nativescript-typedoc-theme": "1.1.0",
"nx": "16.9.1",
"nx": "17.1.3",
"parse-css": "git+https://github.com/tabatkins/parse-css.git",
"parserlib": "^1.1.1",
"prettier": "^2.6.2",
Expand All @@ -72,12 +71,11 @@
"tslib": "^2.6.0",
"typedoc": "^0.24.8",
"typescript": "~5.2.0",
"zx": "^7.0.5"
"zx": "^7.2.0"
},
"lint-staged": {
"**/*.{js,ts,css,scss,json,html}": [
"npx prettier --write"
]
}
}

}
2 changes: 1 addition & 1 deletion packages/core/accessibility/accessibility-properties.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export const iosAccessibilityMaxFontScaleProperty = new InheritedCssProperty<Sty
});
iosAccessibilityMaxFontScaleProperty.register(Style);

export const accessibilityHiddenProperty = new (global.isIOS ? InheritedCssProperty : CssProperty)({
export const accessibilityHiddenProperty = new (__IOS__ ? InheritedCssProperty : CssProperty)({
name: 'accessibilityHidden',
cssName: 'a11y-hidden',
valueConverter: booleanConverter,
Expand Down
2 changes: 1 addition & 1 deletion packages/core/accessibility/font-scale-common.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export const VALID_FONT_SCALES = global.isIOS // iOS supports a wider number of font scales than Android does.
export const VALID_FONT_SCALES = __IOS__ // iOS supports a wider number of font scales than Android does.
? [0.5, 0.7, 0.85, 1, 1.15, 1.3, 1.5, 2, 2.5, 3, 3.5, 4]
: [0.85, 1, 1.15, 1.3];

Expand Down
4 changes: 3 additions & 1 deletion packages/core/application/application-common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import type { Frame } from '../ui/frame';
import type { NavigationEntry } from '../ui/frame/frame-interfaces';
import type { StyleScope } from '../ui/styling/style-scope';
import type { AndroidApplication as IAndroidApplication, iOSApplication as IiOSApplication } from './';
import type { ApplicationEventData, CssChangedEventData, DiscardedErrorEventData, FontScaleChangedEventData, LaunchEventData, LoadAppCSSEventData, NativeScriptError, OrientationChangedEventData, SystemAppearanceChangedEventData, UnhandledErrorEventData } from './application-interfaces';
import type { ApplicationEventData, CssChangedEventData, DiscardedErrorEventData, FontScaleChangedEventData, InitRootViewEventData, LaunchEventData, LoadAppCSSEventData, NativeScriptError, OrientationChangedEventData, SystemAppearanceChangedEventData, UnhandledErrorEventData } from './application-interfaces';

// prettier-ignore
const ORIENTATION_CSS_CLASSES = [
Expand Down Expand Up @@ -125,6 +125,7 @@ export class ApplicationCommon {
readonly livesyncEvent = 'livesync';
readonly loadAppCssEvent = 'loadAppCss';
readonly cssChangedEvent = 'cssChanged';
readonly initRootViewEvent = 'initRootView';

// Expose statically for backwards compat on AndroidApplication.on etc.
/**
Expand Down Expand Up @@ -368,6 +369,7 @@ export class ApplicationCommon {
this.setRootViewCSSClasses(rootView);
initAccessibilityCssHelper();
initAccessibilityFontScale();
this.notify(<InitRootViewEventData>{ eventName: this.initRootViewEvent, rootView });
}

/**
Expand Down
7 changes: 7 additions & 0 deletions packages/core/application/application-interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,13 @@ export interface CssChangedEventData extends ApplicationEventData {
cssText?: string;
}

/**
* Event data containing information about application css change.
*/
export interface InitRootViewEventData extends ApplicationEventData {
rootView: View;
}

/**
* Data for the Android activity events.
*/
Expand Down
8 changes: 4 additions & 4 deletions packages/core/file-system/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ let fileAccess: IFileSystemAccess;
*/
export function getFileAccess(): IFileSystemAccess {
if (!fileAccess) {
if (global.isAndroid && SDK_VERSION >= 29) {
if (__ANDROID__ && SDK_VERSION >= 29) {
fileAccess = new FileSystemAccess29();
} else {
fileAccess = new FileSystemAccess();
Expand Down Expand Up @@ -275,7 +275,7 @@ function getAndroidDirectory(value: AndroidDirectory): { path: string; column: a

class Android {
createFile(options: { relativePath?: string; name: string; mime: string; directory: AndroidDirectory }): File {
if (!global.isAndroid) {
if (!__ANDROID__) {
throw new Error(`createFile is available on Android only!`);
}

Expand Down Expand Up @@ -326,7 +326,7 @@ export class File extends FileSystemEntity {
throw error;
};

if (global.isAndroid && copy) {
if (__ANDROID__ && copy) {
if (path.startsWith('content:')) {
const fileInfo = getFileAccess().getFile(path, onError);
// falls back to creating a temp file without a known extension.
Expand Down Expand Up @@ -897,7 +897,7 @@ export namespace knownFolders {

export namespace ios {
function _checkPlatform(knownFolderName: string) {
if (!global.isIOS) {
if (!__IOS__) {
throw new Error(`The "${knownFolderName}" known folder is available on iOS only!`);
}
}
Expand Down
2 changes: 1 addition & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@nativescript/core",
"version": "8.6.1",
"version": "8.6.2",
"description": "A JavaScript library providing an easy to use api for interacting with iOS and Android platform APIs.",
"main": "index",
"types": "index.d.ts",
Expand Down
Binary file modified packages/core/platforms/android/core.aar
Binary file not shown.
6 changes: 0 additions & 6 deletions packages/core/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,7 @@
"outputs": ["{workspaceRoot}/dist/out-tsc"],
"options": {
"jestConfig": "packages/core/jest.config.ts",
"passWithNoTests": true,
"verbose": true
},
"configurations": {
"ci": {
"ci": true
}
}
},
"build": {
Expand Down
2 changes: 1 addition & 1 deletion packages/core/ui/content-view/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export class ContentView extends CustomLayoutView implements AddChildFromBuilder
}

this._onContentChanged(oldView, value);
if (global.isIOS && oldView !== value) {
if (__IOS__ && oldView !== value) {
this.requestLayout();
}
}
Expand Down

0 comments on commit 9f34d01

Please sign in to comment.