From 9d3d0cf318f76a1b5ee9991bf27006f4a10901a7 Mon Sep 17 00:00:00 2001 From: Chris Mercer Date: Thu, 24 Sep 2020 22:37:17 +0100 Subject: [PATCH 01/13] chore: update README.md api's -> APIs (#8895) I'd suggest changing api's to APIs because API is an acronym so should be capitalised, and there shouldn't be an apostrophe as that denotes ownership. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 2a42cd95e..765a067ef 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ NativeScript [![Build Status](https://travis-ci.org/NativeScript/NativeScript.svg?branch=master)](https://travis-ci.org/NativeScript/NativeScript) -[NativeScript](http://www.nativescript.org) empowers you to access native api's from JavaScript directly. The framework currently provides iOS and Android runtimes for rich mobile development and can be utilized in a number of diverse use cases. +[NativeScript](http://www.nativescript.org) empowers you to access native APIs from JavaScript directly. The framework currently provides iOS and Android runtimes for rich mobile development and can be utilized in a number of diverse use cases. ## Getting Started and Installation From 2640a5fd4b5bbd7c9247a34d06d6b5a90937d9cb Mon Sep 17 00:00:00 2001 From: Nathan Walker Date: Fri, 25 Sep 2020 09:55:48 -0700 Subject: [PATCH 02/13] chore(release): @nativescript/webpack@3.0.5 --- packages/webpack/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/webpack/package.json b/packages/webpack/package.json index af66a5281..408d23b13 100644 --- a/packages/webpack/package.json +++ b/packages/webpack/package.json @@ -1,6 +1,6 @@ { "name": "@nativescript/webpack", - "version": "3.0.4", + "version": "3.0.5", "main": "index", "description": "Webpack plugin for NativeScript", "homepage": "https://nativescript.org", From 3437ed7e1483cddf75aeca9bd8ff475e449f110f Mon Sep 17 00:00:00 2001 From: Nathan Walker Date: Fri, 25 Sep 2020 10:42:43 -0700 Subject: [PATCH 03/13] fix(core): global handling with env.production flag (#8903) closes https://github.com/NativeScript/NativeScript/issues/8778 closes https://github.com/NativeScript/NativeScript/issues/8872 --- packages/core/package.json | 2 +- packages/core/ui/styling/css-selector/index.ts | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/core/package.json b/packages/core/package.json index c877bfcc1..e84211160 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -3,7 +3,7 @@ "main": "index", "types": "index.d.ts", "description": "NativeScript Core Modules", - "version": "7.0.5", + "version": "7.0.6", "homepage": "https://nativescript.org", "repository": { "type": "git", diff --git a/packages/core/ui/styling/css-selector/index.ts b/packages/core/ui/styling/css-selector/index.ts index 1ac6846b3..168a1cac7 100644 --- a/packages/core/ui/styling/css-selector/index.ts +++ b/packages/core/ui/styling/css-selector/index.ts @@ -1,3 +1,4 @@ +import '../../../globals'; import { isNullOrUndefined } from '../../../utils/types'; import * as cssParser from '../../../css'; From 95d45e15283c82c8b913179ab0fe23e6335ec423 Mon Sep 17 00:00:00 2001 From: Nathan Walker Date: Fri, 25 Sep 2020 10:45:28 -0700 Subject: [PATCH 04/13] chore(release): @nativescript/core@7.0.6 --- CHANGELOG.md | 10 ++++++++++ package.json | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 26375ca6c..6f7035d84 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,13 @@ +## [7.0.6](https://github.com/NativeScript/NativeScript/compare/7.0.5-core...7.0.6) (2020-09-25) + + +### Bug Fixes + +* **core:** delegate should be set on nativeTextViewProtected ([#8881](https://github.com/NativeScript/NativeScript/issues/8881)) ([021c0bb](https://github.com/NativeScript/NativeScript/commit/021c0bb9a24f15a9adf9d5e25a981ea53901e600)) +* **core:** global handling with env.production flag ([#8903](https://github.com/NativeScript/NativeScript/issues/8903)) ([3437ed7](https://github.com/NativeScript/NativeScript/commit/3437ed7e1483cddf75aeca9bd8ff475e449f110f)) + + + ## [7.0.5](https://github.com/NativeScript/NativeScript/compare/7.0.4-core...7.0.5) (2020-09-23) diff --git a/package.json b/package.json index ae80705d9..27c2ba770 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "nativescript", - "version": "7.0.5", + "version": "7.0.6", "license": "MIT", "scripts": { "setup": "npx rimraf hooks node_modules package-lock.json && npm i && ts-patch install && nx run core:setup", From 03f1f3d5f528d936702b554cf1b7eb2d9b5fd1c2 Mon Sep 17 00:00:00 2001 From: Nathan Walker Date: Fri, 25 Sep 2020 15:58:39 -0700 Subject: [PATCH 05/13] chore: format and fix ci build --- packages/core/__tests__/tsconfig.json | 1 + packages/core/application/index.android.ts | 29 +++++++------- packages/core/application/index.d.ts | 2 +- packages/core/config/config.interface.ts | 3 +- packages/core/config/index.ts | 2 +- packages/core/connectivity/index.android.ts | 2 +- packages/core/globals/index.ts | 4 +- packages/core/index.ts | 16 ++++---- packages/core/inspector_modules.ios.ts | 2 +- .../ui/bottom-navigation/index.android.ts | 2 +- .../core/ui/bottom-navigation/index.ios.ts | 30 ++++++--------- .../ui/builder/component-builder/index.ts | 2 +- packages/core/ui/core/view-base/index.ts | 2 +- .../tab-content-item/index.android.ts | 2 +- packages/core/ui/tab-view/index.android.ts | 4 +- packages/core/ui/tabs/index.android.ts | 2 +- .../core/ui/text-base/text-base-common.ts | 38 +++++++++---------- 17 files changed, 68 insertions(+), 75 deletions(-) diff --git a/packages/core/__tests__/tsconfig.json b/packages/core/__tests__/tsconfig.json index 97e52b876..48350c360 100644 --- a/packages/core/__tests__/tsconfig.json +++ b/packages/core/__tests__/tsconfig.json @@ -30,6 +30,7 @@ } }, "include": [ + "../global-types.d.ts", "./**/*.ts" ], "exclude": [ diff --git a/packages/core/application/index.android.ts b/packages/core/application/index.android.ts index 773108d6d..7587f17af 100644 --- a/packages/core/application/index.android.ts +++ b/packages/core/application/index.android.ts @@ -476,24 +476,23 @@ function ensureBroadCastReceiverClass() { return; } - @NativeClass - class BroadcastReceiver extends android.content.BroadcastReceiver { - private _onReceiveCallback: (context: android.content.Context, intent: android.content.Intent) => void; + @NativeClass + class BroadcastReceiver extends android.content.BroadcastReceiver { + private _onReceiveCallback: (context: android.content.Context, intent: android.content.Intent) => void; - constructor(onReceiveCallback: (context: android.content.Context, intent: android.content.Intent) => void) { - super(); - this._onReceiveCallback = onReceiveCallback; + constructor(onReceiveCallback: (context: android.content.Context, intent: android.content.Intent) => void) { + super(); + this._onReceiveCallback = onReceiveCallback; - return global.__native(this); - } - - public onReceive(context: android.content.Context, intent: android.content.Intent) { - if (this._onReceiveCallback) { - this._onReceiveCallback(context, intent); - } - } - } + return global.__native(this); + } + public onReceive(context: android.content.Context, intent: android.content.Intent) { + if (this._onReceiveCallback) { + this._onReceiveCallback(context, intent); + } + } + } BroadcastReceiverClass = BroadcastReceiver; } diff --git a/packages/core/application/index.d.ts b/packages/core/application/index.d.ts index 909627aa3..fff9e1760 100644 --- a/packages/core/application/index.d.ts +++ b/packages/core/application/index.d.ts @@ -62,7 +62,7 @@ export let autoSystemAppearanceChanged: boolean; /** * enable/disable systemAppearanceChanged */ -export function setAutoSystemAppearanceChanged (value: boolean); +export function setAutoSystemAppearanceChanged(value: boolean); /** * Updates root view classes including those of modals diff --git a/packages/core/config/config.interface.ts b/packages/core/config/config.interface.ts index 57ccf5cc2..e63c30b9a 100644 --- a/packages/core/config/config.interface.ts +++ b/packages/core/config/config.interface.ts @@ -1,4 +1,4 @@ -import type {InstrumentationMode} from '../profiling' +import type { InstrumentationMode } from '../profiling'; interface IConfigPlatform { /** @@ -144,4 +144,3 @@ export interface NativeScriptConfig { */ cssParser?: 'rework' | 'nativescript' | 'css-tree'; } - diff --git a/packages/core/config/index.ts b/packages/core/config/index.ts index 19955812e..e8c38695e 100644 --- a/packages/core/config/index.ts +++ b/packages/core/config/index.ts @@ -1 +1 @@ -export * from './config.interface'; \ No newline at end of file +export * from './config.interface'; diff --git a/packages/core/connectivity/index.android.ts b/packages/core/connectivity/index.android.ts index 13ffbcc9e..0c9b29c56 100644 --- a/packages/core/connectivity/index.android.ts +++ b/packages/core/connectivity/index.android.ts @@ -1,4 +1,4 @@ -import {android as androidApp, getNativeApplication} from '../application'; +import { android as androidApp, getNativeApplication } from '../application'; export enum connectionType { none = 0, diff --git a/packages/core/globals/index.ts b/packages/core/globals/index.ts index a5771d05f..8e419af92 100644 --- a/packages/core/globals/index.ts +++ b/packages/core/globals/index.ts @@ -359,5 +359,5 @@ export function initGlobal() { } } if (!global.NativeScriptHasInitGlobal) { - initGlobal(); -} \ No newline at end of file + initGlobal(); +} diff --git a/packages/core/index.ts b/packages/core/index.ts index 6291561c7..77be3d80a 100644 --- a/packages/core/index.ts +++ b/packages/core/index.ts @@ -29,9 +29,9 @@ export const Application = { loadAppCss, addCss, on, - off, - notify, - hasListeners, + off, + notify, + hasListeners, run, orientation, getNativeApplication, @@ -135,11 +135,11 @@ export const Utils = { android: androidUtils, // legacy (a lot of plugins use the shorthand "ad" Utils.ad instead of Utils.android) ad: androidUtils, - ios: iosUtils, - setTimeout, - setInterval, - clearInterval, - clearTimeout, + ios: iosUtils, + setTimeout, + setInterval, + clearInterval, + clearTimeout, Source, ClassInfo, getClass, diff --git a/packages/core/inspector_modules.ios.ts b/packages/core/inspector_modules.ios.ts index 18deeeebf..b228c93d4 100644 --- a/packages/core/inspector_modules.ios.ts +++ b/packages/core/inspector_modules.ios.ts @@ -1,5 +1,5 @@ console.log('Loading inspector modules...'); -import './globals'; +import './globals'; require('./debugger/webinspector-network'); require('./debugger/webinspector-dom'); require('./debugger/webinspector-css'); diff --git a/packages/core/ui/bottom-navigation/index.android.ts b/packages/core/ui/bottom-navigation/index.android.ts index 5a2fefd91..3334d36a2 100644 --- a/packages/core/ui/bottom-navigation/index.android.ts +++ b/packages/core/ui/bottom-navigation/index.android.ts @@ -456,7 +456,7 @@ export class BottomNavigation extends TabNavigationBase { const fragmentManager = this._getFragmentManager(); const transaction = fragmentManager.beginTransaction(); const fragments = fragmentManager.getFragments().toArray(); - for (let i=0;i>fragmentManager.getFragments().toArray(); - for (let i=0;i>fragmentManager.getFragments().toArray(); - for (let i=0;i Date: Fri, 25 Sep 2020 16:07:33 -0700 Subject: [PATCH 06/13] chore: readme cleanup --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 765a067ef..c210ec5ce 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@

- NativeScript + NativeScript

From dbefc43b9bb9b907883990f8d40c178fc7ecea9c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Sharghi?= Date: Sat, 26 Sep 2020 07:59:47 +0200 Subject: [PATCH 07/13] fix(ios): preferredDatePickerStyle property (#8899) --- packages/core/ui/date-picker/date-picker-common.ts | 8 ++++++++ packages/core/ui/date-picker/index.d.ts | 11 +++++++++++ packages/core/ui/date-picker/index.ios.ts | 7 +++---- packages/core/ui/time-picker/index.d.ts | 12 ++++++++++++ packages/core/ui/time-picker/index.ios.ts | 7 +++---- packages/core/ui/time-picker/time-picker-common.ts | 8 ++++++++ 6 files changed, 45 insertions(+), 8 deletions(-) diff --git a/packages/core/ui/date-picker/date-picker-common.ts b/packages/core/ui/date-picker/date-picker-common.ts index 936ee77cb..de41507b1 100644 --- a/packages/core/ui/date-picker/date-picker-common.ts +++ b/packages/core/ui/date-picker/date-picker-common.ts @@ -13,6 +13,7 @@ export class DatePickerBase extends View implements DatePickerDefinition { public maxDate: Date; public minDate: Date; public date: Date; + public iosPreferredDatePickerStyle: number; } DatePickerBase.prototype.recycleNativeView = 'auto'; @@ -60,3 +61,10 @@ export const dateProperty = new Property({ valueConverter: (v) => new Date(v), }); dateProperty.register(DatePickerBase); + +export const iosPreferredDatePickerStyleProperty = new Property({ + name: 'iosPreferredDatePickerStyle', + defaultValue: 0, + valueConverter: (v) => parseInt(v), +}); +iosPreferredDatePickerStyleProperty.register(DatePickerBase); \ No newline at end of file diff --git a/packages/core/ui/date-picker/index.d.ts b/packages/core/ui/date-picker/index.d.ts index b735de5d8..e255230e4 100644 --- a/packages/core/ui/date-picker/index.d.ts +++ b/packages/core/ui/date-picker/index.d.ts @@ -7,6 +7,7 @@ export const dayProperty: Property; export const dateProperty: Property; export const maxDate: Property; export const minDate: Property; +export const iosPreferredDatePickerStyleProperty: Property; /** * Represents an date picker. @@ -51,4 +52,14 @@ export class DatePicker extends View { * Gets or sets the min date. */ minDate: Date; + + /** + * Gets or set the UIDatePickerStyle of the date picker in iOS 13.4+. Defaults to 0. + * Valid values are numbers: + * - 0: automatic (system picks the concrete style based on the current platform and date picker mode) + * - 1: wheels (the date picker displays as a wheel picker) + * - 2: compact (the date picker displays as a label that when tapped displays a calendar-style editor) + * - 3: inline (the date pickers displays as an inline, editable field) + */ + iosPreferredDatePickerStyle: number; } diff --git a/packages/core/ui/date-picker/index.ios.ts b/packages/core/ui/date-picker/index.ios.ts index f7e1618bb..118124bd0 100644 --- a/packages/core/ui/date-picker/index.ios.ts +++ b/packages/core/ui/date-picker/index.ios.ts @@ -5,9 +5,8 @@ import { Device } from '../../platform'; export * from './date-picker-common'; -const SUPPORT_DATE_PICKER_STYLE = parseFloat(Device.os) >= 14.0; -const SUPPORT_TEXT_COLOR = parseFloat(Device.os) < 14.0; -const DEFAULT_DATE_PICKER_STYLE = 1; +const SUPPORT_DATE_PICKER_STYLE = parseFloat(Device.osVersion) >= 13.4; +const SUPPORT_TEXT_COLOR = parseFloat(Device.osVersion) < 14.0; export class DatePicker extends DatePickerBase { private _changeHandler: NSObject; @@ -17,7 +16,7 @@ export class DatePicker extends DatePickerBase { const picker = UIDatePicker.new(); picker.datePickerMode = UIDatePickerMode.Date; if (SUPPORT_DATE_PICKER_STYLE) { - picker.preferredDatePickerStyle = DEFAULT_DATE_PICKER_STYLE; + picker.preferredDatePickerStyle = this.iosPreferredDatePickerStyle; } return picker; } diff --git a/packages/core/ui/time-picker/index.d.ts b/packages/core/ui/time-picker/index.d.ts index ccab54fb2..4801589d6 100644 --- a/packages/core/ui/time-picker/index.d.ts +++ b/packages/core/ui/time-picker/index.d.ts @@ -54,6 +54,16 @@ export class TimePicker extends View { * Gets or sets the minute interval. */ minuteInterval: number; + + /** + * Gets or set the UIDatePickerStyle of the date picker in iOS 13.4+. Defaults to 0. + * Valid values are numbers: + * - 0: automatic (system picks the concrete style based on the current platform and date picker mode) + * - 1: wheels (the date picker displays as a wheel picker) + * - 2: compact (the date picker displays as a label that when tapped displays a calendar-style editor) + * - 3: inline (the date pickers displays as an inline, editable field) + */ + iosPreferredDatePickerStyle: number; } export const hourProperty: Property; @@ -66,3 +76,5 @@ export const minMinuteProperty: Property; export const timeProperty: Property; export const minuteIntervalProperty: Property; + +export const iosPreferredDatePickerStyleProperty: Property; \ No newline at end of file diff --git a/packages/core/ui/time-picker/index.ios.ts b/packages/core/ui/time-picker/index.ios.ts index f0624e512..12c7ddd7f 100644 --- a/packages/core/ui/time-picker/index.ios.ts +++ b/packages/core/ui/time-picker/index.ios.ts @@ -5,9 +5,8 @@ import { Device } from '../../platform'; export * from './time-picker-common'; -const SUPPORT_DATE_PICKER_STYLE = parseFloat(Device.os) >= 14.0; -const SUPPORT_TEXT_COLOR = parseFloat(Device.os) < 14.0; -const DEFAULT_DATE_PICKER_STYLE = 1; +const SUPPORT_DATE_PICKER_STYLE = parseFloat(Device.osVersion) >= 13.4; +const SUPPORT_TEXT_COLOR = parseFloat(Device.osVersion) < 14.0; function getDate(hour: number, minute: number): Date { let components = NSDateComponents.alloc().init(); @@ -36,7 +35,7 @@ export class TimePicker extends TimePickerBase { const picker = UIDatePicker.new(); picker.datePickerMode = UIDatePickerMode.Time; if (SUPPORT_DATE_PICKER_STYLE) { - picker.preferredDatePickerStyle = DEFAULT_DATE_PICKER_STYLE; + picker.preferredDatePickerStyle = this.iosPreferredDatePickerStyle; } return picker; } diff --git a/packages/core/ui/time-picker/time-picker-common.ts b/packages/core/ui/time-picker/time-picker-common.ts index 077973ab3..39c02cbae 100644 --- a/packages/core/ui/time-picker/time-picker-common.ts +++ b/packages/core/ui/time-picker/time-picker-common.ts @@ -98,6 +98,7 @@ export abstract class TimePickerBase extends View implements TimePickerDefinitio public maxHour: number; public minMinute: number; public maxMinute: number; + public iosPreferredDatePickerStyle: number; } TimePickerBase.prototype.recycleNativeView = 'auto'; @@ -204,3 +205,10 @@ export const timeProperty = new Property({ }, }); timeProperty.register(TimePickerBase); + +export const iosPreferredDatePickerStyleProperty = new Property({ + name: 'iosPreferredDatePickerStyle', + defaultValue: 0, + valueConverter: (v) => parseInt(v), +}); +iosPreferredDatePickerStyleProperty.register(TimePickerBase); From af6336d930259d2d5a62a0ec200d0034f1a25a8e Mon Sep 17 00:00:00 2001 From: Nathan Walker Date: Fri, 25 Sep 2020 23:03:04 -0700 Subject: [PATCH 08/13] chore(release): @nativescript/core@7.0.7 --- CHANGELOG.md | 9 +++++++++ package.json | 2 +- packages/core/package.json | 2 +- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6f7035d84..3769a7c42 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,12 @@ +## [7.0.7](https://github.com/NativeScript/NativeScript/compare/7.0.6-core...7.0.7) (2020-09-26) + + +### Bug Fixes + +* **ios:** preferredDatePickerStyle property ([#8899](https://github.com/NativeScript/NativeScript/issues/8899)) ([dbefc43](https://github.com/NativeScript/NativeScript/commit/dbefc43b9bb9b907883990f8d40c178fc7ecea9c)) + + + ## [7.0.6](https://github.com/NativeScript/NativeScript/compare/7.0.5-core...7.0.6) (2020-09-25) diff --git a/package.json b/package.json index 27c2ba770..84f59f38c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "nativescript", - "version": "7.0.6", + "version": "7.0.7", "license": "MIT", "scripts": { "setup": "npx rimraf hooks node_modules package-lock.json && npm i && ts-patch install && nx run core:setup", diff --git a/packages/core/package.json b/packages/core/package.json index e84211160..b29b9a121 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -3,7 +3,7 @@ "main": "index", "types": "index.d.ts", "description": "NativeScript Core Modules", - "version": "7.0.6", + "version": "7.0.7", "homepage": "https://nativescript.org", "repository": { "type": "git", From 65b1cdbae0a9e873a3d2bc4636038423351b794e Mon Sep 17 00:00:00 2001 From: Martin Guillon Date: Sun, 27 Sep 2020 18:20:52 +0200 Subject: [PATCH 09/13] fix(core): Observable splice index > length (#8900) * fix for splice index > length In javascript you can call splice with an index > length. The result is a push. But when you do that ObservableArray index will be wrong and thus user logic will fail. Example: ```ts // obsarray = [0]; obsarray.splice(2, 0, 1); // this works, the inner array is now [0,1] // however 'change' is called with index = 2 // when the use tries to do obsarray.getItem(eventData.index) -> crash ``` * fix to handle delete too --- packages/core/data/observable-array/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/core/data/observable-array/index.ts b/packages/core/data/observable-array/index.ts index b7f390cc1..cc026e91e 100644 --- a/packages/core/data/observable-array/index.ts +++ b/packages/core/data/observable-array/index.ts @@ -246,7 +246,7 @@ export class ObservableArray extends Observable { eventName: CHANGE, object: this, action: ChangeType.Splice, - index: start, + index: Math.min(start, this._array.length-1), removed: result, addedCount: this._array.length + result.length - length, }); From 647926ee281712a82238d5153522d9a07be5870c Mon Sep 17 00:00:00 2001 From: Nathan Walker Date: Tue, 29 Sep 2020 08:18:04 -0700 Subject: [PATCH 10/13] fix(ios): Utils.openFile (#8914) closes https://github.com/NativeScript/NativeScript/issues/8913 --- packages/core/utils/index.ios.ts | 2 +- packages/core/utils/native-helper.d.ts | 5 ++- packages/core/utils/native-helper.ios.ts | 53 +++++++++++++----------- 3 files changed, 33 insertions(+), 27 deletions(-) diff --git a/packages/core/utils/index.ios.ts b/packages/core/utils/index.ios.ts index 90bc24dc2..1cce1b2a6 100644 --- a/packages/core/utils/index.ios.ts +++ b/packages/core/utils/index.ios.ts @@ -11,7 +11,7 @@ export function openFile(filePath: string): boolean { let path = iOSNativeHelper.isRealDevice() ? filePath.replace('~', appPath) : filePath; const controller = UIDocumentInteractionController.interactionControllerWithURL(NSURL.fileURLWithPath(path)); - controller.delegate = new iOSNativeHelper.UIDocumentInteractionControllerDelegateImpl(); + controller.delegate = iOSNativeHelper.createUIDocumentInteractionControllerDelegate(); return controller.presentPreviewAnimated(true); } catch (e) { diff --git a/packages/core/utils/native-helper.d.ts b/packages/core/utils/native-helper.d.ts index 19986a7cf..d402c33a2 100644 --- a/packages/core/utils/native-helper.d.ts +++ b/packages/core/utils/native-helper.d.ts @@ -168,7 +168,10 @@ export namespace iOSNativeHelper { */ export function applyRotateTransform(transform: any /* CATransform3D*/, x: number, y: number, z: number): any; /* CATransform3D*/ - export class UIDocumentInteractionControllerDelegateImpl {} + /** + * Create a UIDocumentInteractionControllerDelegate implementation for use with UIDocumentInteractionController + */ + export function createUIDocumentInteractionControllerDelegate(): any; /** * Checks whether the application is running on real device and not on simulator. diff --git a/packages/core/utils/native-helper.ios.ts b/packages/core/utils/native-helper.ios.ts index 89d24b29b..b757a33b1 100644 --- a/packages/core/utils/native-helper.ios.ts +++ b/packages/core/utils/native-helper.ios.ts @@ -14,7 +14,7 @@ function openFileAtRootModule(filePath: string): boolean { let path = iOSNativeHelper.isRealDevice() ? filePath.replace('~', appPath) : filePath; const controller = UIDocumentInteractionController.interactionControllerWithURL(NSURL.fileURLWithPath(path)); - controller.delegate = new iOSNativeHelper.UIDocumentInteractionControllerDelegateImpl(); + controller.delegate = iOSNativeHelper.createUIDocumentInteractionControllerDelegate(); return controller.presentPreviewAnimated(true); } catch (e) { @@ -125,30 +125,33 @@ export namespace iOSNativeHelper { } return transform; - } - - @NativeClass - export class UIDocumentInteractionControllerDelegateImpl extends NSObject implements UIDocumentInteractionControllerDelegate { - public static ObjCProtocols = [UIDocumentInteractionControllerDelegate]; - - public getViewController(): UIViewController { - const app = UIApplication.sharedApplication; - - return app.keyWindow.rootViewController; - } - - public documentInteractionControllerViewControllerForPreview(controller: UIDocumentInteractionController) { - return this.getViewController(); - } - - public documentInteractionControllerViewForPreview(controller: UIDocumentInteractionController) { - return this.getViewController().view; - } - - public documentInteractionControllerRectForPreview(controller: UIDocumentInteractionController): CGRect { - return this.getViewController().view.frame; - } - } + } + + export function createUIDocumentInteractionControllerDelegate(): NSObject { + @NativeClass + class UIDocumentInteractionControllerDelegateImpl extends NSObject implements UIDocumentInteractionControllerDelegate { + public static ObjCProtocols = [UIDocumentInteractionControllerDelegate]; + + public getViewController(): UIViewController { + const app = UIApplication.sharedApplication; + + return app.keyWindow.rootViewController; + } + + public documentInteractionControllerViewControllerForPreview(controller: UIDocumentInteractionController) { + return this.getViewController(); + } + + public documentInteractionControllerViewForPreview(controller: UIDocumentInteractionController) { + return this.getViewController().view; + } + + public documentInteractionControllerRectForPreview(controller: UIDocumentInteractionController): CGRect { + return this.getViewController().view.frame; + } + } + return new UIDocumentInteractionControllerDelegateImpl(); + } export function isRealDevice() { try { From 806fc880dd944a8808a0f407ae5d0c0d4be55d5d Mon Sep 17 00:00:00 2001 From: Nathan Walker Date: Tue, 29 Sep 2020 08:18:36 -0700 Subject: [PATCH 11/13] fix(core): global index typing fix for unit testing framework (#8915) --- packages/core/globals/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/core/globals/index.d.ts b/packages/core/globals/index.d.ts index 34b248a72..c934047b4 100644 --- a/packages/core/globals/index.d.ts +++ b/packages/core/globals/index.d.ts @@ -1,6 +1,6 @@ import { Observable } from '../data/observable'; export declare class NativeScriptGlobalState { - events: Observable; + events: Observable; launched: boolean; } export function installPolyfills(moduleName: string, exportNames: string[]): void; From 3a529571027b6d34d161bc78c591ce669e56daf1 Mon Sep 17 00:00:00 2001 From: Nathan Walker Date: Tue, 29 Sep 2020 08:22:50 -0700 Subject: [PATCH 12/13] chore(release): @nativescript/core@7.0.8 --- CHANGELOG.md | 11 +++++++++++ package.json | 2 +- packages/core/package.json | 2 +- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3769a7c42..02522c16e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,14 @@ +## [7.0.8](https://github.com/NativeScript/NativeScript/compare/7.0.7-core...7.0.8) (2020-09-29) + + +### Bug Fixes + +* **core:** global index typing fix for unit testing framework ([#8915](https://github.com/NativeScript/NativeScript/issues/8915)) ([806fc88](https://github.com/NativeScript/NativeScript/commit/806fc880dd944a8808a0f407ae5d0c0d4be55d5d)) +* **core:** Observable splice index > length ([#8900](https://github.com/NativeScript/NativeScript/issues/8900)) ([65b1cdb](https://github.com/NativeScript/NativeScript/commit/65b1cdbae0a9e873a3d2bc4636038423351b794e)) +* **ios:** Utils.openFile ([#8914](https://github.com/NativeScript/NativeScript/issues/8914)) ([647926e](https://github.com/NativeScript/NativeScript/commit/647926ee281712a82238d5153522d9a07be5870c)) + + + ## [7.0.7](https://github.com/NativeScript/NativeScript/compare/7.0.6-core...7.0.7) (2020-09-26) diff --git a/package.json b/package.json index 84f59f38c..133097374 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "nativescript", - "version": "7.0.7", + "version": "7.0.8", "license": "MIT", "scripts": { "setup": "npx rimraf hooks node_modules package-lock.json && npm i && ts-patch install && nx run core:setup", diff --git a/packages/core/package.json b/packages/core/package.json index b29b9a121..6cf44c717 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -3,7 +3,7 @@ "main": "index", "types": "index.d.ts", "description": "NativeScript Core Modules", - "version": "7.0.7", + "version": "7.0.8", "homepage": "https://nativescript.org", "repository": { "type": "git", From a55bcd8561ee229a67a92578ba25a6439b860302 Mon Sep 17 00:00:00 2001 From: Martin Guillon Date: Wed, 30 Sep 2020 16:38:20 +0200 Subject: [PATCH 13/13] fix(android): fragment onPause (#8919) --- packages/core/ui/frame/fragment.android.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/core/ui/frame/fragment.android.ts b/packages/core/ui/frame/fragment.android.ts index a1bea72e9..46477fc61 100644 --- a/packages/core/ui/frame/fragment.android.ts +++ b/packages/core/ui/frame/fragment.android.ts @@ -16,7 +16,7 @@ const FragmentClass = (org.nativescript.widgets.FragmentBase).extend('com.t }, onPause(): void { - this._callbacks.onPause(this, superProto.onStop); + this._callbacks.onPause(this, superProto.onPause); }, onCreate(savedInstanceState: android.os.Bundle) {