From 90b8718138fc6e67e2141d9b77017b3d96e50d51 Mon Sep 17 00:00:00 2001 From: Eduardo Speroni Date: Sat, 18 Sep 2021 17:27:21 -0300 Subject: [PATCH 01/12] fix(android): only attach if activity is CREATED (#9552) --- packages/core/ui/frame/index.android.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/core/ui/frame/index.android.ts b/packages/core/ui/frame/index.android.ts index 200083ea8..177d2b4c5 100644 --- a/packages/core/ui/frame/index.android.ts +++ b/packages/core/ui/frame/index.android.ts @@ -144,8 +144,8 @@ export class Frame extends FrameBase { // _onAttachedToWindow called from OS again after it was detach // still happens with androidx.fragment:1.3.2 - const activity = androidApplication.foregroundActivity || androidApplication.startActivity; - if ((this._manager && this._manager.isDestroyed()) || !activity.getLifecycle?.().getCurrentState().isAtLeast(androidx.lifecycle.Lifecycle.State.STARTED)) { + const lifecycleState = (androidApplication.foregroundActivity?.getLifecycle?.() || androidApplication.startActivity?.getLifecycle?.())?.getCurrentState() || androidx.lifecycle.Lifecycle.State.CREATED; + if ((this._manager && this._manager.isDestroyed()) || !lifecycleState.isAtLeast(androidx.lifecycle.Lifecycle.State.CREATED)) { return; } From ee701db137f7834dc6d8db2324b8356fa286f55d Mon Sep 17 00:00:00 2001 From: Nathan Walker Date: Sat, 18 Sep 2021 13:38:24 -0700 Subject: [PATCH 02/12] chore(release): @nativescript/core@8.1.3 --- CHANGELOG.md | 9 +++++++++ apps/automated/package.json | 4 ++-- package.json | 6 +++--- packages/core/package.json | 2 +- 4 files changed, 15 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 82471abae..88be57ad3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,12 @@ +## [8.1.3](https://github.com/NativeScript/NativeScript/compare/8.1.2-core...8.1.3) (2021-09-18) + + +### Bug Fixes + +* **android:** only attach if activity is CREATED ([#9552](https://github.com/NativeScript/NativeScript/issues/9552)) ([90b8718](https://github.com/NativeScript/NativeScript/commit/90b8718138fc6e67e2141d9b77017b3d96e50d51)) + + + ## [8.1.2](https://github.com/NativeScript/NativeScript/compare/8.1.1-core...8.1.2) (2021-09-15) diff --git a/apps/automated/package.json b/apps/automated/package.json index d9bd699f3..dbec953e9 100644 --- a/apps/automated/package.json +++ b/apps/automated/package.json @@ -10,8 +10,8 @@ "clean": "npx rimraf hooks node_modules platforms package-lock.json && npm i --legacy-peer-deps" }, "dependencies": { - "nativescript-theme-core": "file:../../node_modules/nativescript-theme-core", - "@nativescript/core": "file:../../packages/core" + "@nativescript/core": "file:../../packages/core", + "nativescript-theme-core": "file:../../node_modules/nativescript-theme-core" }, "devDependencies": { "@nativescript/android": "7.0.1", diff --git a/package.json b/package.json index 67d426033..3485b7329 100644 --- a/package.json +++ b/package.json @@ -1,11 +1,11 @@ { "name": "nativescript", - "version": "8.1.2", + "version": "8.1.3", "license": "MIT", "scripts": { "clean": "git clean -f -X -d --exclude=!.idea/ --exclude=!.vscode/*", "setup": "npm run clean && npm install --legacy-peer-deps", - "setup:yarn": "yarn run clean && yarn", + "setup:yarn": "yarn clean && yarn", "setup:pnpm": "pnpm run clean && pnpm install", "postinstall": "ts-patch install && husky install && nx run core:setup", "start": "nps", @@ -53,7 +53,7 @@ "mocha": "^8.0.1", "mocha-typescript": "^1.1.17", "module-alias": "^2.2.2", - "nativescript": "~7.2.0", + "nativescript": "~8.1.2", "nativescript-typedoc-theme": "1.0.0", "parse-css": "git+https://github.com/tabatkins/parse-css.git", "parserlib": "^1.1.1", diff --git a/packages/core/package.json b/packages/core/package.json index 41497a5f0..f6c1ef372 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -3,7 +3,7 @@ "main": "index", "types": "index.d.ts", "description": "A JavaScript library providing an easy to use api for interacting with iOS and Android platform APIs.", - "version": "8.1.2", + "version": "8.1.3", "homepage": "https://nativescript.org", "repository": { "type": "git", From f0ffb216262f8592613420c6ee17805f8c3d4b11 Mon Sep 17 00:00:00 2001 From: Nathan Walker Date: Sun, 19 Sep 2021 12:36:12 -0700 Subject: [PATCH 03/12] feat: task for regenerating api docs (nx run core-api-docs:build) --- nx.json | 3 +++ package.json | 2 +- tools/scripts/build-docs.sh | 6 +++--- tools/scripts/tsconfig.typedoc.json | 2 +- tools/workspace-scripts.js | 7 +++++++ workspace.json | 17 +++++++++++++++++ 6 files changed, 32 insertions(+), 5 deletions(-) diff --git a/nx.json b/nx.json index 20d0fcd77..4de54dd12 100644 --- a/nx.json +++ b/nx.json @@ -28,6 +28,9 @@ "core": { "tags": [] }, + "core-api-docs": { + "tags": [] + }, "types": { "tags": [] }, diff --git a/package.json b/package.json index 3485b7329..e9e65337f 100644 --- a/package.json +++ b/package.json @@ -54,7 +54,7 @@ "mocha-typescript": "^1.1.17", "module-alias": "^2.2.2", "nativescript": "~8.1.2", - "nativescript-typedoc-theme": "1.0.0", + "nativescript-typedoc-theme": "1.1.0", "parse-css": "git+https://github.com/tabatkins/parse-css.git", "parserlib": "^1.1.1", "prettier": "~2.2.1", diff --git a/tools/scripts/build-docs.sh b/tools/scripts/build-docs.sh index f537cb619..7c9d13699 100755 --- a/tools/scripts/build-docs.sh +++ b/tools/scripts/build-docs.sh @@ -2,7 +2,7 @@ set -e ENV="${ENV:-dev}" -DIST_DIR="bin/dist" +DIST_DIR="dist" PACKAGE_VERSION="${PACKAGE_VERSION:-0.0.0}" archive_dist_dir() { @@ -29,8 +29,8 @@ extract_apiref() { # npm_install npx typedoc --tsconfig tools/scripts/tsconfig.typedoc.json - mv "dist/apiref" "$APIREF_DIR" - archive_dist_dir "api-reference" + # mv "dist/apiref" "$APIREF_DIR" + # archive_dist_dir "api-reference" } if [ "${BASH_SOURCE[0]}" == "$0" ] ; then diff --git a/tools/scripts/tsconfig.typedoc.json b/tools/scripts/tsconfig.typedoc.json index b0db2bf83..290e69cf6 100644 --- a/tools/scripts/tsconfig.typedoc.json +++ b/tools/scripts/tsconfig.typedoc.json @@ -23,7 +23,7 @@ ], "typedocOptions": { "entryPoints": ["../../packages/core/index.d.ts", "../../packages/core"], - "out": "dist/apiref", + "out": "dist/api-reference", "name": "NativeScript", "theme": "../../node_modules/nativescript-typedoc-theme", "excludeExternals": true, diff --git a/tools/workspace-scripts.js b/tools/workspace-scripts.js index 2ff7477e7..8847b4f32 100644 --- a/tools/workspace-scripts.js +++ b/tools/workspace-scripts.js @@ -99,6 +99,13 @@ module.exports = { }, }, }, + // @nativescript/core API Reference Docs + 'core-api-docs': { + build: { + script: 'nx run core-api-docs:build', + description: '@nativescript/core: API Reference Docs Build' + } + }, // @nativescript/ui-mobile-base 'ui-mobile-base': { build: { diff --git a/workspace.json b/workspace.json index 92047ea9d..547b38396 100644 --- a/workspace.json +++ b/workspace.json @@ -158,6 +158,23 @@ } } }, + "core-api-docs": { + "root": "tools/scripts", + "sourceRoot": "tools/scripts", + "projectType": "library", + "schematics": {}, + "architect": { + "build": { + "builder": "@nrwl/workspace:run-commands", + "outputs": ["tools/scripts/dist"], + "options": { + "commands": ["./build-docs.sh"], + "cwd": "tools/scripts", + "parallel": false + } + } + } + }, "types": { "root": "packages/types", "sourceRoot": "packages/types", From 183b4d4b10a4ec7f9527e5373c8ce723c3db0c3e Mon Sep 17 00:00:00 2001 From: Jason Cassidy <47318351+jcassidyav@users.noreply.github.com> Date: Mon, 20 Sep 2021 19:12:08 +0100 Subject: [PATCH 04/12] fix(ios): flat property using new appearance api (#9558) --- packages/core/ui/action-bar/index.ios.ts | 35 ++++++++++++++++++++---- 1 file changed, 29 insertions(+), 6 deletions(-) diff --git a/packages/core/ui/action-bar/index.ios.ts b/packages/core/ui/action-bar/index.ios.ts index ce1747e27..c30ff8b2c 100644 --- a/packages/core/ui/action-bar/index.ios.ts +++ b/packages/core/ui/action-bar/index.ios.ts @@ -406,14 +406,37 @@ export class ActionBar extends ActionBarBase { } private updateFlatness(navBar: UINavigationBar) { + if (this.flat) { - navBar.setBackgroundImageForBarMetrics(UIImage.new(), UIBarMetrics.Default); - navBar.shadowImage = UIImage.new(); - navBar.translucent = false; + + if (majorVersion >= 15) { + const appearance = navBar.standardAppearance ?? UINavigationBarAppearance.new(); + appearance.shadowColor = UIColor.clearColor; + + navBar.standardAppearance = appearance; + navBar.compactAppearance = appearance; + navBar.scrollEdgeAppearance = appearance; + } else { + + navBar.setBackgroundImageForBarMetrics(UIImage.new(), UIBarMetrics.Default); + navBar.shadowImage = UIImage.new(); + navBar.translucent = false; + } } else { - navBar.setBackgroundImageForBarMetrics(null, null); - navBar.shadowImage = null; - navBar.translucent = true; + if (majorVersion >= 15) { + if(navBar.standardAppearance){ // Not flat and never been set do nothing. + const appearance = navBar.standardAppearance; + appearance.shadowColor = UINavigationBarAppearance.new().shadowColor; + + navBar.standardAppearance = appearance; + navBar.compactAppearance = appearance; + navBar.scrollEdgeAppearance = appearance; + } + } else { + navBar.setBackgroundImageForBarMetrics(null, null); + navBar.shadowImage = null; + navBar.translucent = true; + } } } From 889f6d73cf8bdc080c54387708562d00c2684e9b Mon Sep 17 00:00:00 2001 From: Janos Hrubos <33330538+janoshrubos@users.noreply.github.com> Date: Tue, 21 Sep 2021 08:07:27 +0200 Subject: [PATCH 05/12] fix: replace autofill string in textfield (#9555) --- packages/core/ui/text-field/index.ios.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/core/ui/text-field/index.ios.ts b/packages/core/ui/text-field/index.ios.ts index 2b188b866..11431ca4e 100644 --- a/packages/core/ui/text-field/index.ios.ts +++ b/packages/core/ui/text-field/index.ios.ts @@ -205,7 +205,8 @@ export class TextField extends TextFieldBase { } if (this.updateTextTrigger === 'textChanged') { - if (textField.secureTextEntry && this.firstEdit) { + const shouldReplaceString = (textField.secureTextEntry && this.firstEdit) || delta > 1; + if (shouldReplaceString) { textProperty.nativeValueChange(this, replacementString); } else { if (range.location <= textField.text.length) { From 3e21748af4dcf76fec3822b4d5e9c844794eda1d Mon Sep 17 00:00:00 2001 From: farfromrefuge Date: Wed, 22 Sep 2021 06:41:34 +0200 Subject: [PATCH 06/12] fix: background parsing color #9559 (#9560) --- packages/core/css/parser.ts | 2 +- packages/core/ui/styling/style-properties.ts | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/packages/core/css/parser.ts b/packages/core/css/parser.ts index 83c1ee1aa..e13411158 100644 --- a/packages/core/css/parser.ts +++ b/packages/core/css/parser.ts @@ -23,7 +23,7 @@ export interface LinearGradient { colors: ColorStop[]; } export interface Background { - readonly color?: number; + readonly color?: number | Color; readonly image?: URL | LinearGradient; readonly repeat?: BackgroundRepeat; readonly position?: BackgroundPosition; diff --git a/packages/core/ui/styling/style-properties.ts b/packages/core/ui/styling/style-properties.ts index c0fb01e4e..e57310201 100644 --- a/packages/core/ui/styling/style-properties.ts +++ b/packages/core/ui/styling/style-properties.ts @@ -838,7 +838,10 @@ backgroundPositionProperty.register(Style); function convertToBackgrounds(this: void, value: string): [CssProperty, any][] { if (typeof value === 'string') { const backgrounds = parser.parseBackground(value).value; - const backgroundColor = backgrounds.color ? new Color(backgrounds.color) : unsetValue; + let backgroundColor = unsetValue; + if (backgrounds.color) { + backgroundColor = backgrounds.color instanceof Color ? backgrounds.color : new Color(backgrounds.color); + } let backgroundImage: string | LinearGradient; if (typeof backgrounds.image === 'object' && backgrounds.image) { From 61980fd4a8573d93ed59348da76e5aca873b2eca Mon Sep 17 00:00:00 2001 From: Janos Hrubos <33330538+janoshrubos@users.noreply.github.com> Date: Thu, 23 Sep 2021 13:02:42 +0200 Subject: [PATCH 07/12] fix: global __DEV__ variable type (#9568) --- packages/core/global-types.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/core/global-types.d.ts b/packages/core/global-types.d.ts index fa03c4782..1272d24e0 100644 --- a/packages/core/global-types.d.ts +++ b/packages/core/global-types.d.ts @@ -128,7 +128,7 @@ declare namespace NodeJS { rootLayout: any; } } -declare const __DEV__: string; +declare const __DEV__: boolean; declare const __CSS_PARSER__: string; declare const __NS_WEBPACK__: boolean; declare const __UI_USE_EXTERNAL_RENDERER__: boolean; From db7b02a4189bdf0471b39579c28deef21ac7899f Mon Sep 17 00:00:00 2001 From: Igor Randjelovic Date: Fri, 24 Sep 2021 17:13:53 +0200 Subject: [PATCH 08/12] chore: fix CI builds --- tools/assets/App_Resources/Android/app.gradle | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tools/assets/App_Resources/Android/app.gradle b/tools/assets/App_Resources/Android/app.gradle index b6218c322..609cf9840 100644 --- a/tools/assets/App_Resources/Android/app.gradle +++ b/tools/assets/App_Resources/Android/app.gradle @@ -7,6 +7,10 @@ android { compileSdkVersion 29 + // added ndkVersion because CI tries to use a higer version and fails + // if having trouble running or building locally, comment this line + // todo: remove once ndk 23+ is supported + ndkVersion "22.1.7171670" defaultConfig { minSdkVersion 17 targetSdkVersion 29 From 8e76bbe2515c5c743d3db30a940ccb8040314bea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20JEAN?= Date: Sat, 25 Sep 2021 09:54:34 +0200 Subject: [PATCH 09/12] fix(android): StringIndexOutOfBoundsException with invalid drawables (#9563) * fix(android/application): org.nativescript.widgets.Utils::getDrawable * chore: fix spacing * fix(android/application): do not load empty path Co-authored-by: Igor Randjelovic * test: Add tests for empty image sources * chore: add a few more test cases These make the app crash without the fix in place Co-authored-by: Igor Randjelovic Co-authored-by: Nathan Walker --- apps/ui/src/css/background-image-page.xml | 32 ++++++++++++++++++- apps/ui/src/image-view/missing-image-page.xml | 2 ++ .../java/org/nativescript/widgets/Utils.java | 10 ++++-- 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/apps/ui/src/css/background-image-page.xml b/apps/ui/src/css/background-image-page.xml index 2b1beaa79..eef80d30e 100644 --- a/apps/ui/src/css/background-image-page.xml +++ b/apps/ui/src/css/background-image-page.xml @@ -1,5 +1,5 @@ - +