npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@leoantares/ns8-batch-notifications

v1.1.1

Published

Add a plugin description

Downloads

4

Readme

@leoantares/ns8-batch-notifications

ns plugin add @leoantares/ns8-batch-notifications

Nativescript Batch plugin

Welcome to Batch's Nativescript Plugin! Batch is a fully fledged mobile engagement platform to execute CRM tactics over iOS, Android & mobile websites. The purpose of this plugin is to manage Push notifications, in-app messages and more.., for Android and IOS. This repository contains the plugin's source code and a demo application.

This plugin is an updated fork from nativescript-batch-notifications

Installation

NPM

yarn ns8-batch-notifications
npm i ns8-batch-notifications

Prerequisites / Requirements

First of all, you must create a batch account; Then a configuration is required for each platform; This process is explained through simple steps in batch official documentation. IOS setup Android setup When you add your Firebase android project, download the google-services.json which you'll add to your NativeScript project at app/App_Resources/Android/google-services.json

For a quick start using the demo app :

  • Override the bundle id in package.json in the demo directory
  • Add the API keys with the ones generated by your batch account in the .env file

Android initialization

We must override the OnCreate method. In order to do so, change the application name value in the AndroidManifest from com.tns.NativeScriptApplication to something like org.myApp.Application. Then, in the root dir, create a typescript file named : 'application.android.ts' and enter the bellow code.

const firebase = require('@nativescript/firebase');
// @ts-ignore
import { BatchNS } from 'nativescript-batch-notifications';

@NativeClass()
@JavaProxy('org.myApp.Application')
class Application extends android.app.Application {
  public onCreate(): void {
    super.onCreate()
    const batch = new BatchNS(process.env.BASH_ANDROID_KEY);
    this.registerActivityLifecycleCallbacks(batch.native.activityLifeCycleHelper());
    firebase.init().catch(console.dir);
  }
}

You also must add the following in your webpack.config.js.

webpack.chainWebpack(config => {
    if (webpack.Utils.platform.getPlatformName() === 'android') {
        // make sure the path to the applicatioon.android.(js|ts)
        // is relative to the webpack.config.js
        // you may need to use `./app/application.android if
        // your app source is located inside the ./app folder.
        config.entry('application').add('./app/application.android')
    }
})

IOS initialization

We must setup a custom delegate; Override the app.ts in the root dir with the bellow code:

import { Application, isIOS } from "@nativescript/core";
// @ts-ignore
import { BatchNS } from "nativescript-batch-notifications";

if (isIOS) {
  @NativeClass
  class MyDelegate extends UIResponder implements UIApplicationDelegate {
    public static ObjCProtocols = [UIApplicationDelegate];

    applicationDidFinishLaunchingWithOptions(application: UIApplication, launchOptions: NSDictionary<any, any>): boolean {
      new BatchNS(process.env.BATCH_IOS_KEY, false);

      return true;
    }
  }

  Application.ios.delegate = MyDelegate;
}

Important notes !!

  • (Android) In this plugin version we assume that the nativescript firebase plugin is installed; This will be fixed in upcoming releases.
  • (IOS) When generating the xcode project, you MUST toggle 'Push Notifications' in the capabilities tab.

License

Apache License Version 2.0