Import mobile specific nativescript plugin in NathaWalker angular-seed-advanced - nativescript

I recently started working on Nativescript. I found NathanWalker's angular-seed-advanced quite interesting. I am facing one issue in that. How do I import mobile specific nativescript's plugin in my components as that component is being used for web app too.
If I import directly nativescript plugins in src/client/app/components then Web app will not work as expected. I need to know how to import plugin safely so that both web app and mobile app work as expected

You can import mobile specific items in Root module file which is - native.module.ts.
Code organization section in the same seed project read me file gives good picture of what file is for what, including the above one.
Hope this helps :)

Related

Import projects with links using adobe xd

I recently started using adobe XD and I got a link to a project that I am not a coworker of. But I still would like to import this project to make changes and have all the data available. So now I wonder how I can get the project into my adobe XD app on my pc with only the link?
You will not be able to edit the XD file from a shared link unless the one whom sent it to you makes it a coediting link (invites you to the cloud document itself), or sends you the actual XD file.

Web intent plugin in NativeScript

I building Bookmarks manager app in Nativescript. i am looking for a plugin related to web intent, but i could find any. If any one have any idea to achieve similar functionality like this React native plugin for intent, Please help
Thanks in advance
It's quite straight forward on Android, you would use JavaProxy to create an activity Or simply use your NativeScript activity if you want to open your application itself upon sharing, add the same intent-filter under that activity in AndroidManifest.xml file.
With iOS, there is an option feature request for building app extensions. But still there are some POCs for app extensions available on Github which seems to require some manual steps as mentioned in the Github issue.

Using Angular libraries in Nativescript code sharing project

I'm trying to migrate an Angular app to a shared codebase with Nativescript using the new #nativescript/schematics, however, I'm having problems importing my Angular library when building the mobile version of the app. I used the angular-cli to create the library (ng generate library).
For the web version, all I had to do was build the library separately using ng build library-name which then allowed me to import it into the main application.
How can I build a mobile version of the library that can be imported into the main application when running tns run ios --bundle? I've already migrated the components and module of the library with appropriate *.tns files.
Any help is appreciated
I had the same problem. Nativescript cli do not have this feature where we can build an angular library into npm package and use it in other projects.
I tried a workaround and it worked for me. Write a script to copy all of your project files into another directory and replace all *.tns.ts, *tns.html and *.tns.scss. files with *.ts, *.html and *.scss respectively. Then build these files using regular ng command. You can add a build configuration for the same in angular.json file to build from the copied directory. I hope it helps.
I'm sorry this is just a hyperlink answer but the space required to answer this, in my opinion, is way too large. I just finished finalizing a repo I've been working on to do exactly this. I have a whole slew of angular web libraries that I now want to make available for use on mobile using NativeScript. I have put everything I have learned so far into this repo and I hope it helps you too.
Thanks for the final push/idea #Rohit, a script for doing what he suggests is in the test-lib/gulpfile.js of this repo.

angular2 slow in IE and usage of core-js

I see the angular2 app that I created is much slower (approximately ~5X) in IE11 when compared to other browsers. In IE11, right from the data rendering in a grid, dropdown, pagination are slow whereas the same is super fast and working as expected in other browsers. When I googled, I see using core-js and using enableProdMode() might improve the performance in IE. I have enabled enableProdMode() but I am not clear how to wireup core-js with the angular2 app. I have included core-js as dependency and installed it. So what would be next step to wireup things.?
My issue in angular 6 was an input binding done to a function:
<app-my-component [model]="getMyModel()"></app-my-component>
I changed that to a variable instead
<app-my-component [model]="valueOfGetMyModel"></app-my-component>
This simple change fixed a major performance issue for me. Also, the function was using a polyfilled function in IE, while other browsers had native implementation that didn't show any notable issues.
As a final fix, I also changed the changeDetection strategy to onPush as this component has 15 instances in the page.
please create angular project using angularcli commondline
use ng build --prod to compile your angular project
This will work IE same as Chrome. I have tested and working like charm in my application
Including the following libraries as part of polyfills.ts made my application faster but it never matched the performance to Chrome.
import 'core-js/client/core';
import 'zone.js/dist/zone';
import 'rxjs/bundles/Rx';
import '#angular/core/bundles/core.umd';
import '#angular/common/bundles/common.umd';
import '#angular/compiler/bundles/compiler.umd';
import '#angular/platform-browser/bundles/platform-browser.umd';
import '#angular/platform-browser-dynamic/bundles/platform-browser-dynamic.umd';`
Beware, adding these files increases the size of the bundle drastically.

BraintreePaymentActivity can not be found

I use Braintree as payment processor in a mobile app. In Android I use
import com.braintreepayments.api.dropin.BraintreePaymentActivity;
to import BraintreePaymentActivity
build.gradle has
compile 'com.braintreepayments.api:braintree:1.+'
It worked until today. Now, com.braintreepayments.api.dropin does not have this BraintreePaymentActivity anymore. What is going on?
Try to add braintree project into your workspace.
1) download: http://search.maven.org/remotecontent?filepath=com/braintreepayments/api/braintree/1.2.7/braintree-1.2.7-project.zip
2) import into your workspace.
for more info: https://github.com/braintree/braintree_android/issues/18

Resources