Commit Graph

121 Commits

Author SHA1 Message Date
Manol Donev
a14d2ee720 chore: require relative path within tns-core-modules 2019-06-27 18:29:18 +03:00
Manol Donev
c2656a4be4 chore: update application private apis (#7413) 2019-06-27 13:16:43 +03:00
Manol Donev
4f39fb728b chore: update tslint rules (#7391) 2019-06-26 15:13:48 +03:00
Manol Donev
b20e771552 chore: remove deprecated apis for ns 6.0 (#7382) 2019-06-25 16:52:01 +03:00
Manol Donev
ecd9fc3e9d feat: bundle workflow support (#7337) 2019-06-20 15:58:36 +03:00
Alexander Djenkov
c5db112b8d feat(android): androidX support (#7039)
* feat: migrate support library namespaces to androidX

* feat(tns-platform-declarations): update to androidX typings

* chore(tests): migrate test apps to AndroidX

* chore(tns-platform-declarations): update tsconfig to include androidx dts files

* update package.json to androidx

* chore(androidx): migrate forgotten support library namspaces

* feat(tns-core-modules-widgets): migrate to AndroidX namespaces

* chore(utils): update androidx namspace for getPaletteColor method

* chore(apps): update tns-platform-declarations package

* Update package.json
2019-06-10 09:21:41 +03:00
Vasil Chimev
8a2f592df9 refactor(HMR): Refactor livesync propagaton 2019-05-03 17:48:44 +03:00
Vasil Chimev
d35e14ed0f feat(hmr): preserve navigation history on applying changes (#7146) 2019-04-23 17:47:29 +03:00
Manol Donev
4e56c89f7d fix(ios): application.displayedEvent does not depend on trace to fire (#7141) (#7156) 2019-04-17 13:57:22 +03:00
Eddy Verbruggen
3efc06ed98 feat(android): implement a 'activityNewIntent' event 2019-04-03 11:06:14 +03:00
Martin Yankov
b59d32eb68 Merge branch 'master' into myankov/merge 2019-03-26 12:38:09 +02:00
Manol Donev
b436ecde36 refactor: replace var usage with let/const (#7064) 2019-03-25 18:09:14 +02:00
Manol Donev
761cd47360 chore: fix app.start deprecation (#7067) 2019-03-25 16:04:48 +02:00
Martin Yankov
26679d42ff refactor(): add better err msg for missing main entry (#7063) 2019-03-25 14:07:23 +02:00
Manol Donev
34fe24732d chore: deprecate utils.ios.getter (#7054) 2019-03-22 17:33:21 +02:00
Manol Donev
cf07b2719f chore: update deprecations (#7046) 2019-03-21 14:25:36 +02:00
Vasil Chimev
f9e008fd54 fix(android): throw new Error if no activity callbacks (#7044) 2019-03-20 14:42:50 +02:00
Martin Bektchiev
f34068d59b fix(angular): Re-add references to tns-core-modules.d.ts (#6949)
They were removed in #6927 because we thought they were
unnecessary.
2019-02-21 09:43:38 +02:00
Martin Bektchiev
5449cfa238 fix(docs): Move NativeScriptError declaration to a separate file (#6927)
It is used by `application.d.ts` and needs to be documented. The reason
that it wasn't included in the documentation by now is that `tns-core-modules.d.ts`
(which imports `module.d.ts`) defines types which are part of the internal
modules and runtimes APIs. As such they are excluded from the generation
of API documentation.
2019-02-20 13:58:09 +02:00
Vasil Chimev
44b8acd79c feat(HMR): apply changes in page styles at runtime when app root is a frame (#6857)
* feat(HMR): apply changes in page styles at runtime

* fix: livesync tests

* test: changeCssFile method

* refactor: address comments

Add a comment.
Update `let` to `const`.
Update `changesCssFile` test.

* test: add an assert
2019-02-14 14:03:13 +02:00
Dimitar Tachev
7ced019bbd fix: app launch with app.css hot module update
Fix the application launch when there is an app.css change in a hot module update.
2019-02-08 11:23:24 +02:00
Vasil Chimev
ff476d983d refactor: rename HmrContext to ModuleContext (#6843)
* refactor: rename HmrContext to ModuleContext

* refactor(ModuleContext): rename module to path
2019-01-31 18:32:25 +02:00
Vasil Chimev
8cb726aedf fix-next: avoid circular reference (#6812) 2019-01-22 14:37:29 +02:00
Vasil Trifonov
28db2afbd4 feat: OnDiscardedError typings and event (#6777)
* feat: OnDiscardedError typings and event

* remove ios and android from DiscardedErrorEventData
2019-01-09 18:24:25 +02:00
Manol Donev
46c9de020e fix(android): raise resume event on activity.onPostResume() (#6766) 2019-01-08 15:20:11 +02:00
Vasil Chimev
2b7e7d89e0 fix-next: undefined root view when reapplying styles (#6729)
* fix: undefined root view when reapplying styles

Error:
```
JS ERROR TypeError: undefined is not an object (evaluating
'application_1.getRootView()._onCssStateChange')
```

Steps:
- `tns run <platform> --hmr`
- make a change in application styles
- restart the application
2018-12-27 16:44:24 +02:00
Svetoslav
134b033b77 Merge pull request #6707 from NativeScript/release 2018-12-14 16:40:11 +02:00
SvetoslavTsenov
ea44416734 Merge remote-tracking branch 'origin/master' into release 2018-12-14 14:53:53 +02:00
Vasil Chimev
790bcfb470 refactor(HMR): apply changes in application styles at runtime 2018-12-14 14:34:50 +02:00
Vasil Chimev
42a1491e6e feat(HMR): apply changes in application styles at runtime
Expose `HmrContext` interface.
Apply changes in `app.css` instantly.
Avoid navigation on livesync when changes in `app.css` have been made.
Apply changes in `app.css` on back navigation.
2018-12-14 14:34:47 +02:00
Nathanael Anderson
19895945c2 fix(ios delegate) Eliminate crash on selector looking for "Window" (#6428)
* Add a "window" value so that NS doesn't crash on selectors looking for the delegate.window...

* chore: tslint

* chore: comments to referenced issues added
2018-12-14 13:31:26 +02:00
Martin Bektchiev
1c0218ea15 feat(tns-platform-declarations): Generate iOS typings from iOS 12.1 SDK (#6693)
* feat(tns-platform-declarations): Generate iOS typings from iOS 12.1 SDK

* Instructions for generating iOS typescript definitions
* Refactor `typings-gen.sh` to use {N} CLI and generate fuller
metadata for the system libraries
* Automatically generate `ios.d.ts` wrapper
* Add interop pointers and references as alternatives
to `string` for `char*` args
(implemented in https://github.com/NativeScript/ios-runtime/pull/1022)

BREAKING CHANGE: Several enum values have changed because
    they have been wrongly generated.

    To migrate your app or plugin code use the new names of the
    following:
    *  enum NSUnderlineStyle:
        - `StyleNone` -> `None`
        - `StyleSingle` -> `Single`
        - `StyleThick` -> `Thick`
        - `StyleDouble` -> `Double`
     * enum AVAudioSessionErrorCode:
        - `CodeNone` -> `None`
        - `CodeMediaServicesFailed` -> `MediaServicesFailed`
        - `CodeIsBusy` -> `IsBusy`
        - `CodeIncompatibleCategory` -> `IncompatibleCategory`
        - `CodeCannotInterruptOthers` -> `CannotInterruptOthers`
        - `CodeMissingEntitlement` -> `MissingEntitlement`
        - `CodeSiriIsRecording` -> `SiriIsRecording`
        - `CodeCannotStartPlaying` -> `CannotStartPlaying`
        - `CodeCannotStartRecording` -> `CannotStartRecording`
        - `CodeBadParam` -> `BadParam`
        - `CodeResourceNotAvailable` -> `ResourceNotAvailable`
        - `CodeUnspecified` -> `Unspecified`

* fix(ui/text-base): Update NSUnderlineStyle.StyleSingle constant

After the typings regeneration its and several others' names have
changed to the expected `NSUnderlineStyle.Single`.

* fix(tns-platform-declarations): Restore deprecated enum values

In order to not introduce a breaking change in a patch version, we
are keeping `Style...` and `Code...` values that have been wrongly
generated till now. In the next major/minor release of the package
when the typings are regenerated we can safely remove them.

Revert to using the deprecated one's in `text-base.ios.ts` so that
the introduction of this breaking change doesn't slip in undetected.

* fix(application.ios): Directly call presetnNativeScriptApp

We've been using `performSelectorWithObject` but it's
declaration has been manually added. Moreover it's more
convenient to directly call the method.
2018-12-13 17:04:13 +02:00
Martin Yankov
d91bfd8e11 fix-next: drawer plugin viewcontroller init (#6379) 2018-10-11 15:16:48 +03:00
Martin Guillon
46705ee332 refactor(core-modules): implement createNativeView and initNativeView for all components
refactor(core-modules): implement createNativeView and initNativeView for all components
2018-09-26 13:59:12 +03:00
Manol Donev
cf034dd04d feat(android): migrate to support library apis (#6129)
Switch Activity / Fragment / FragmentManager implementation from native framework to support library APIs

BREAKING CHANGE:


NativeScript core framework now extends support library APIs versus native framework classes as per Google's latest guidelines:
- NativeScript activities now extend `android.support.v7.app.AppCompatActivity` (vs android.app.Activity)
- NativeScript fragments now extend `android.support.v4.app.Fragment` (vs android.app.Fragment)
- NativeScript now works internally with `android.support.v4.app.FragmentManager` (vs android.app.FragmentManager) 

The implications of these changes should be mostly transparent to the developer except for the fact that the support library Fragment / FragmentManager work with Animation APIs versus Animator APIs.

For Android API Levels lower than 28 the new Fragment API uses a different fragment enter animation by default. You can customise the transition per navigation entry or globally via the [navigation transitions API](https://docs.nativescript.org/core-concepts/navigation#navigation-transitions)
Before:
Default fragment enter animation was fade animation

After:
Default fragment enter animation for API levels lower than 28 is now a fast "push fade" animation; default fragment enter animation for API levels equal to or greater than 28 remains fade animation

Before:
AndroidFragmentCallbacks interface exposed the following `onCreateAnimator(...)` method
``` ts
export interface AndroidFragmentCallbacks {
    onCreateAnimator(fragment: any, transit: number, enter: boolean, nextAnim: number, superFunc: Function): any;
    // ...
}
```

After:
AndroidFragmentCallbacks interface now exposes the following `onCreateAnimation(...)` method instead (and `onCreateAnimator(...)` is now removed)
``` ts
export interface AndroidFragmentCallbacks {
    onCreateAnimation(fragment: any, transit: number, enter: boolean, nextAnim: number, superFunc: Function): any;
    // ...
}
```

Before:
Transition class exposed the following abstract `createAndroidAnimator(...)` method
``` ts
export class Transition {
    public createAndroidAnimator(transitionType: string): any;
    // ...
}
```

After:
Transition class now exposes the following abstract `createAndroidAnimation(...)` method instead (and `createAndroidAnimation(...) is now removed)
``` ts
export class Transition {
    public createAndroidAnimation(transitionType: string): any;
    // ...
}
```

To migrate the code of your custom transitions follow the example below:

Before:
``` ts
import * as transition from "tns-core-modules/ui/transition";

export class CustomTransition extends transition.Transition {
    constructor(duration: number, curve: any) {
        super(duration, curve);
    }

    public createAndroidAnimator(transitionType: string): android.animation.Animator {
        var scaleValues = Array.create("float", 2);
        switch (transitionType) {
            case transition.AndroidTransitionType.enter:
            case transition.AndroidTransitionType.popEnter:
                scaleValues[0] = 0;
                scaleValues[1] = 1;
                break;
            case transition.AndroidTransitionType.exit:
            case transition.AndroidTransitionType.popExit:
                scaleValues[0] = 1;
                scaleValues[1] = 0;
                break;
        }
        var objectAnimators = Array.create(android.animation.Animator, 2);
        objectAnimators[0] = android.animation.ObjectAnimator.ofFloat(null, "scaleX", scaleValues);
        objectAnimators[1] = android.animation.ObjectAnimator.ofFloat(null, "scaleY", scaleValues);
        var animatorSet = new android.animation.AnimatorSet();
        animatorSet.playTogether(objectAnimators);

        var duration = this.getDuration();
        if (duration !== undefined) {
            animatorSet.setDuration(duration);
        }
        animatorSet.setInterpolator(this.getCurve());

        return animatorSet;
    }
}
```

After:
``` ts
import * as transition from "tns-core-modules/ui/transition";

export class CustomTransition extends transition.Transition {
    constructor(duration: number, curve: any) {
        super(duration, curve);
    }

    public createAndroidAnimation(transitionType: string): android.view.animation.Animation {
        const scaleValues = [];

        switch (transitionType) {
            case transition.AndroidTransitionType.enter:
            case transition.AndroidTransitionType.popEnter:
                scaleValues[0] = 0;
                scaleValues[1] = 1;
                break;
            case transition.AndroidTransitionType.exit:
            case transition.AndroidTransitionType.popExit:
                scaleValues[0] = 1;
                scaleValues[1] = 0;
                break;
        }
            
        const animationSet = new android.view.animation.AnimationSet(false);
        const duration = this.getDuration();
        if (duration !== undefined) {
            animationSet.setDuration(duration);
        }

        animationSet.setInterpolator(this.getCurve());
        animationSet.addAnimation(
            new android.view.animation.ScaleAnimation(
                scaleValues[0], 
                scaleValues[1], 
                scaleValues[0], 
                scaleValues[1]
            ));

        return animationSet;
    }
}
```
2018-07-31 18:48:34 +03:00
Teodor Dermendjiev
05c2460fc4 feat: Pass NS app to the native app instead of presenting it over the root VC (#5967)
* feat: Pass NS app native controller to the native app instead of presenting it over the rootViewController

When NativeScript embedded app is created from the native one we check for whether the topmost UIViewController has NativeScriptEmbedder protocol (implemented in the iOS Runtime) method 'presentNativeScriptApp:'. If yes, we call it with the NS app viewcontroller as a parameter so the embedder has control over the NS app (where and how to present it etc.) For backwards compatibility we present the NS app on top of the topmost UIViewController as a fallback.

* style: Fix lint errors

* feat: Check for protocol instead of selector in embedding

I

* Check for rootController instead of topViewController to prevent crash if !rootController

* feat: Introduce NativeScriptEmbedder singleton

NativeScriptEmbedder is responsive for communication between the NS and the native iOS app. His delegate will implement methods which we can call from javascript such as "presentNativeScriptApp:".
2018-06-27 16:48:11 +03:00
Vasil Trifonov
bbe25d7ec1 keep some variable from early GC to speed up start time (#5823)
* keep some variable from early GC to speed up start time

* do not clear callbacks, as they shouldn't use much memory
2018-05-17 11:55:15 +03:00
Manol Donev
2fc1d8a8d4 chore(tsc): enable noUnusedLocals compiler option for tns-core-modules (#5755) 2018-05-10 16:12:59 +03:00
Stanimira Vlaeva
9ce08196f8 fix: throw if global css file is not found in webpack context (#5186) 2018-03-01 11:05:12 +02:00
Martin Yankov
4ce45666a5 test: add reset root view tests (#5437) 2018-02-21 11:38:37 +02:00
Martin Yankov
b113b0021a feat: Add methods to get the root view and set a different root view at run time (#5386)
* feat: add option to set a different root view at run time

* feat: expose application getRootView method

* refactor: Introduce ViewEntry interface

* fix: Respect root view rturned from launch event in Android

* refactor: getRootView() code + caching root view per activity.

* refactor: add app-root.xml in apps

* refactor: http test made async
2018-02-09 16:04:20 +02:00
Vasil Chimev
0c8275fa06 refactor: unmark startActivity as deprecated (#5405)
https://github.com/NativeScript/NativeScript/issues/5307
2018-02-08 17:44:53 +02:00
Stanimira Vlaeva
1c78e4784c feat(ios): fire onDisplayed event when first frame is ready to be displayed (#5344)
* feat: add a 'profiling: lifecycle' to track startup times

* feat: log when displayed event fires

* feat(ios): fire onDisplayed event when first frame is ready to be
displayed
2018-01-29 13:47:35 +02:00
Hristo Hristov
016c64fe04 showModal & closeModal can be called on any View
fix livesync implementation to be compatible with 3.4 and to replace mainEntry for 4.0 when root is not Frame
some refactoring of page.ios in order to allow showing multiple modal dialogs
2018-01-18 13:34:25 +02:00
Hristo Hristov
3384112ce8 When application start is called we don't set Frame to be styleScope
Added requestLayout for TextView
Round desiredSize in nativeMeasure
2018-01-09 13:17:50 +02:00
Hristo Hristov
63ab46eb2a Layout improvements 2017-12-15 17:11:51 +02:00
Hristo Hristov
33cd058718 Call loaded/unloaded on the rootView when application is resumed/suspended
Remove dead code from frame.ios
2017-12-15 15:26:23 +02:00
Hristo Hristov
ac04ede97e Implemented showModal on View 2017-12-15 13:08:15 +02:00
Hristo Hristov
2a10b7a220 Remove public iOS types from view.d.ts 2017-12-15 13:06:34 +02:00
Hristo Hristov
199d83c902 Generated platforms declarations for iOS 11
Fixed broken unit-tests
ios layout now run only for the innermost viewcontoller
ios layout for viewcontrollers now implemented with constraints
Added ios11 safeAreas layout support
onMeasure back for frame and tab-view so that they won't throw exception if measure is called on them
Page parents layout updated after page is layout so that inner layout flags are correct
2017-12-15 13:06:34 +02:00