From 999e3780ec199f061ef6f9ecca08a4e7337e75de Mon Sep 17 00:00:00 2001 From: Manol Donev Date: Fri, 2 Nov 2018 17:31:52 +0200 Subject: [PATCH 1/5] fix(android): back navigation on app suspend/resume (#6489) --- tns-core-modules/ui/frame/frame.android.ts | 31 +++++++++++++++------- 1 file changed, 21 insertions(+), 10 deletions(-) diff --git a/tns-core-modules/ui/frame/frame.android.ts b/tns-core-modules/ui/frame/frame.android.ts index bfb911d2cb..3f98a8ef0b 100644 --- a/tns-core-modules/ui/frame/frame.android.ts +++ b/tns-core-modules/ui/frame/frame.android.ts @@ -25,10 +25,10 @@ import { createViewFromEntry } from "../builder"; export * from "./frame-common"; interface AnimatorState { - enterAnimator: android.animation.Animator; - exitAnimator: android.animation.Animator; - popEnterAnimator: android.animation.Animator; - popExitAnimator: android.animation.Animator; + enterAnimator: any; + exitAnimator: any; + popEnterAnimator: any; + popExitAnimator: any; transitionName: string; } @@ -306,10 +306,8 @@ export class Frame extends FrameBase { // restore cached animation settings if we just completed simulated first navigation (no animation) if (this._cachedAnimatorState) { restoreAnimatorState(this._currentEntry, this._cachedAnimatorState); - this._cachedAnimatorState = null; } - } public onBackPressed(): boolean { @@ -503,13 +501,26 @@ export class Frame extends FrameBase { } } +function cloneExpandedAnimator(expandedAnimator: any) { + if (!expandedAnimator) { + return null; + } + + const clone = expandedAnimator.clone(); + clone.entry = expandedAnimator.entry; + clone.transitionType = expandedAnimator.transitionType; + + return clone; +} + function getAnimatorState(entry: BackstackEntry): AnimatorState { const expandedEntry = entry; const animatorState = {}; - animatorState.enterAnimator = expandedEntry.enterAnimator; - animatorState.exitAnimator = expandedEntry.exitAnimator; - animatorState.popEnterAnimator = expandedEntry.popEnterAnimator; - animatorState.popExitAnimator = expandedEntry.popExitAnimator; + + animatorState.enterAnimator = cloneExpandedAnimator(expandedEntry.enterAnimator); + animatorState.exitAnimator = cloneExpandedAnimator(expandedEntry.exitAnimator); + animatorState.popEnterAnimator = cloneExpandedAnimator(expandedEntry.popEnterAnimator); + animatorState.popExitAnimator = cloneExpandedAnimator(expandedEntry.popExitAnimator); animatorState.transitionName = expandedEntry.transitionName; return animatorState; From b6a5df18fcd792b094319aaa53540867936f92e7 Mon Sep 17 00:00:00 2001 From: Vasil Chimev Date: Mon, 5 Nov 2018 15:52:34 +0200 Subject: [PATCH 2/5] docs: add 5.0.0 changelog (#6485) * docs: add 5.0.0 changelog * docs: merge 5.0.0 RC and 5.0.0 changelogs --- CHANGELOG.md | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fc93ce4975..76d4473eaf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,17 +1,20 @@ Cross Platform Modules Changelog ============================== - -## [5.0.0 - RC](https://github.com/NativeScript/NativeScript/compare/4.2.1...5.0.0-rc) (2018-10-17) + +# [5.0.0](https://github.com/NativeScript/NativeScript/compare/4.2.1...5.0.0) (2018-11-01) ### Bug Fixes * don't crash on missing resources in tab-view and action-bar ([#6388](https://github.com/NativeScript/NativeScript/issues/6388)) ([56a1b12](https://github.com/NativeScript/NativeScript/commit/56a1b12)) * nested fragments interact through child fragment manager ([#6293](https://github.com/NativeScript/NativeScript/issues/6293)) ([3071720](https://github.com/NativeScript/NativeScript/commit/3071720)) * Page and Frame isLoaded undefined checks ([#6255](https://github.com/NativeScript/NativeScript/issues/6255)) ([12fade7](https://github.com/NativeScript/NativeScript/commit/12fade7)) +* **connectivity:** making startMonitoring() behave on iOS as on Android ([#6373](https://github.com/NativeScript/NativeScript/issues/6373)) ([a58fc52](https://github.com/NativeScript/NativeScript/commit/a58fc52)) +* **observable-array:** reduce no longer ignores zero as initial value ([#6402](https://github.com/NativeScript/NativeScript/issues/6402)) ([c0438df](https://github.com/NativeScript/NativeScript/commit/c0438df)) * **modals:** application activityBackPressed event not fired for modals ([#6261](https://github.com/NativeScript/NativeScript/issues/6261)) ([8575c60](https://github.com/NativeScript/NativeScript/commit/8575c60)) * **list-view:** Layout list-view items on request ([#6159](https://github.com/NativeScript/NativeScript/issues/6159)) ([ec24c5a](https://github.com/NativeScript/NativeScript/commit/ec24c5a)) * **tab-view:** Title and icon positioning ([#6362](https://github.com/NativeScript/NativeScript/issues/6362)) ([e3d5f0d](https://github.com/NativeScript/NativeScript/commit/e3d5f0d)) +* **tab-view:** change androidOffscreenTabLimit to 1 when using bottom tabs for android([#6476](https://github.com/NativeScript/NativeScript/issues/6476)) ([371fc9b](https://github.com/NativeScript/NativeScript/commit/371fc9b)) * **android:** HEAD request should return statusCode ([7e89f94](https://github.com/NativeScript/NativeScript/commit/7e89f94)) * **android:** nested frames on app suspend/resume ([#6339](https://github.com/NativeScript/NativeScript/issues/6339)) ([0bf6dc2](https://github.com/NativeScript/NativeScript/commit/0bf6dc2)) * **android:** parallel navigations should not be triggered ([#6275](https://github.com/NativeScript/NativeScript/issues/6275)) ([6c9fa16](https://github.com/NativeScript/NativeScript/commit/6c9fa16)) @@ -26,6 +29,9 @@ Cross Platform Modules Changelog * add ability to pass touch event through parent view ([#6204](https://github.com/NativeScript/NativeScript/issues/6204)) ([2625683](https://github.com/NativeScript/NativeScript/commit/2625683)) * implement capitalization type option for prompt dialogs ([#6325](https://github.com/NativeScript/NativeScript/issues/6325)) ([ae6a661](https://github.com/NativeScript/NativeScript/commit/ae6a661)) * **application-settings:** implemented allKeys method ([#6371](https://github.com/NativeScript/NativeScript/issues/6371)) ([829d18b](https://github.com/NativeScript/NativeScript/commit/829d18b)) +* **frame:** add new actionBarVisibility property ([#6449](https://github.com/NativeScript/NativeScript/issues/6449)) ([0002624](https://github.com/NativeScript/NativeScript/commit/0002624)) +* **frame:** hardware back in parent frame when back states available ([#6446](https://github.com/NativeScript/NativeScript/issues/6446)) ([af651d6](https://github.com/NativeScript/NativeScript/commit/af651d6)) +* **grid:** implement addChildAtCell ([#6411](https://github.com/NativeScript/NativeScript/issues/6411)) ([a3f1493](https://github.com/NativeScript/NativeScript/commit/a3f1493)) * **image-asset-ios:** add autoScaleFactor option to switch auto scaling ([#6127](https://github.com/NativeScript/NativeScript/issues/6127)) ([81e63ee](https://github.com/NativeScript/NativeScript/commit/81e63ee)) * **styling:** Add two functions to control applicationAdditionalSelectors ([#6124](https://github.com/NativeScript/NativeScript/issues/6124)) ([85b8c01](https://github.com/NativeScript/NativeScript/commit/85b8c01)) * **tslib:** add tslib helpers to global ([#6351](https://github.com/NativeScript/NativeScript/issues/6351)) ([1232d1e](https://github.com/NativeScript/NativeScript/commit/1232d1e)) @@ -87,6 +93,8 @@ export function pageLoaded(args: EventData) { wrapLayout = page.getViewById("wrapLayout"); // or wrapLayout = page.getViewById("wrapLayout"); } ``` +* **android:** change androidOffscreenTabLimit to 1 when using bottom tabs of tab-view([#6476](https://github.com/NativeScript/NativeScript/issues/6476)) ([371fc9b](https://github.com/NativeScript/NativeScript/commit/371fc9b)) + * **ios:** widgets native view lifecycle refactoring - native view is now created right before they are added to visual tree ([#6102](https://github.com/NativeScript/NativeScript/issues/6102)) ([46705ee](https://github.com/NativeScript/NativeScript/commit/46705ee)): The iOS widgets native view lifecycle now matches the Android widgets. Before, the iOS native view was created in the widget constructor and you could manipulate the native view right after the widget is instantiated. After the refactoring, the widget's native view will be created when it's added to the visual tree. The most correct way to manipulate the native view is in the `loaded` event handler. From 7d21b5c9ab1372e5a689c92fde337184b02876dd Mon Sep 17 00:00:00 2001 From: Manol Donev Date: Mon, 5 Nov 2018 16:17:51 +0200 Subject: [PATCH 3/5] fix(android): IllegalStateException with tabview&nested frames (#6495) --- tns-core-modules/ui/frame/frame.android.ts | 31 ++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/tns-core-modules/ui/frame/frame.android.ts b/tns-core-modules/ui/frame/frame.android.ts index 3f98a8ef0b..81d6cf7fca 100644 --- a/tns-core-modules/ui/frame/frame.android.ts +++ b/tns-core-modules/ui/frame/frame.android.ts @@ -859,7 +859,38 @@ class FragmentCallbacksImplementation implements AndroidFragmentCallbacks { if (traceEnabled()) { traceWrite(`${fragment}.onDestroy()`, traceCategories.NativeLifecycle); } + superFunc.call(fragment); + + const entry = this.entry; + if (!entry) { + traceError(`${fragment}.onDestroy: entry is null or undefined`); + return null; + } + + const page = entry.resolvedPage; + if (!page) { + traceError(`${fragment}.onDestroy: entry has no resolvedPage`); + return null; + } + + // fixes 'java.lang.IllegalStateException: The specified child already has a parent. You must call removeView() on the child's parent first'. + // on app resume in nested frame scenarios with support library version greater than 26.0.0 + // HACK: this whole code block shouldn't be necessary as the native view is supposedly removed from its parent + // right after onDestroyView(...) is called but for some reason the fragment view (page) still thinks it has a + // parent while its supposed parent believes it properly removed its children; in order to "force" the child to + // lose its parent we temporarily add it to the parent, and then remove it (addViewInLayout doesn't trigger layout pass) + const nativeView = page.nativeViewProtected; + if (nativeView != null) { + const parentView = nativeView.getParent(); + if (parentView instanceof android.view.ViewGroup) { + if (parentView.getChildCount() === 0) { + parentView.addViewInLayout(nativeView, -1, new org.nativescript.widgets.CommonLayoutParams()); + } + + parentView.removeView(nativeView); + } + } } @profile From af5eb7321b6d26ce96a124f6d2a993b854d3512d Mon Sep 17 00:00:00 2001 From: Vladimir Amiorkov Date: Fri, 2 Nov 2018 15:33:17 +0200 Subject: [PATCH 4/5] fix: Resolve incorrect name of listener when unsubscribing (#6487) --- tns-core-modules/ui/styling/style-scope.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tns-core-modules/ui/styling/style-scope.ts b/tns-core-modules/ui/styling/style-scope.ts index 8e0df7dd14..8f3cf607c9 100644 --- a/tns-core-modules/ui/styling/style-scope.ts +++ b/tns-core-modules/ui/styling/style-scope.ts @@ -506,7 +506,7 @@ export class CssState { this._appliedChangeMap.forEach((changes, view) => { if (changes.attributes) { changes.attributes.forEach(attribute => { - view.removeEventListener("onPropertyChanged:" + attribute, this._onDynamicStateChangeHandler); + view.removeEventListener(attribute + "Change", this._onDynamicStateChangeHandler); }); } if (changes.pseudoClasses) { From 5728e9d15102a4c7338eb172af59c5d78e299196 Mon Sep 17 00:00:00 2001 From: SvetoslavTsenov Date: Wed, 7 Nov 2018 16:10:39 +0200 Subject: [PATCH 5/5] release: cut the 5.0.2 release --- CHANGELOG.md | 12 ++++++++++++ tns-core-modules/package.json | 2 +- tns-platform-declarations/package.json | 2 +- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 76d4473eaf..0ca6e47a52 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,18 @@ Cross Platform Modules Changelog ============================== + +## [5.0.2](https://github.com/NativeScript/NativeScript/compare/5.0.0-rc...5.0.2) (2018-11-07) + + +### Bug Fixes + +* **android:** back navigation on app suspend/resume ([#6489](https://github.com/NativeScript/NativeScript/issues/6489)) ([999e378](https://github.com/NativeScript/NativeScript/commit/999e378)) +* **android:** IllegalStateException with tabview and nested frames ([#6495](https://github.com/NativeScript/NativeScript/issues/6495)) ([7d21b5c](https://github.com/NativeScript/NativeScript/commit/7d21b5c)) +* Resolve incorrect name of listener when unsubscribing ([#6487](https://github.com/NativeScript/NativeScript/issues/6487)) ([af5eb73](https://github.com/NativeScript/NativeScript/commit/af5eb73)) + + + # [5.0.0](https://github.com/NativeScript/NativeScript/compare/4.2.1...5.0.0) (2018-11-01) diff --git a/tns-core-modules/package.json b/tns-core-modules/package.json index 1797a80ea6..12a93bfefa 100644 --- a/tns-core-modules/package.json +++ b/tns-core-modules/package.json @@ -1,7 +1,7 @@ { "name": "tns-core-modules", "description": "Telerik NativeScript Core Modules", - "version": "5.0.1", + "version": "5.0.2", "homepage": "https://www.nativescript.org", "repository": { "type": "git", diff --git a/tns-platform-declarations/package.json b/tns-platform-declarations/package.json index 2485da6475..3751ce17da 100644 --- a/tns-platform-declarations/package.json +++ b/tns-platform-declarations/package.json @@ -1,6 +1,6 @@ { "name": "tns-platform-declarations", - "version": "5.0.0", + "version": "5.0.2", "description": "Platform-specific TypeScript declarations for NativeScript for accessing native objects", "main": "", "scripts": {