Giter Club home page Giter Club logo

ngx-onesignal's Introduction

NgxOnesignal

Angular OneSignal

angular nrwl/nx one signal

https://nodei.co/npm/ngx-onesignal.png?downloads=true&downloadRank=true&stars=true

npm version Build Status Maintainability MIT License Node version Conventional Commits dependencies Status HitCount

used

1. Sign Up OneSignal

make Custom Code APP and get appId.

2. run Angular cli + add

npx @angular/cli will be replaced by the ng command if the angular cli is installed

# generate angular project
npx @angular/cli new [project name]

# cahnge directory
cd [project name]

# add pwa
npx @angular/cli add @angular/pwa

# add onesignal
npx @angular/cli add ngx-onesignal --appId=[your onesignal appId]

3. custmize Angular app

see sample code

4. build and run

# build production
npx ng build --prod

# npm run server
npx http-server ./dist/client -p 4000 -S -K tools/ssh/server.key -C tools/ssh/server.crt

# open onesignal https webpage
/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --ignore-certificate-errors --user-data-dir=dist/chromeTemp

5. add Universal

# add universal
npx @angular/cli add @nguniversal/express-engine --clientProject [project name]

# build universal
npm run build:ssr

# run server ( http://localhost:4000 )
npm run serve:ssr

Supported

Angular version ngx-onestop version support
10 10.x
9 10.x
8 8.x -
7 8.x -

Development environment support

  • OSX 10.x
  • node v12

Tasks

  • format (prettier)
  • npm publish
  • ng_add
    • add NgxOneSignalModule to root module
    • add OneSignalSDKWorkers file
    • add OneSignalSDKWorkers to angular.json
    • replace ServiceWorkerModule.register file
  • sandbox test
  • unit testing
  • e2e testing
    • cypress
  • universal
  • nrwl/nx workspace support
  • ci/cd

ngx-onesignal's People

Contributors

msakamaki avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

ngx-onesignal's Issues

How to get userID and pushToken?

I am submitting a

  • Feature Request

What is the expected behavior?

Get userId and pushToken

What is the current behavior?

What are the steps to reproduce?

What is the use-case or motivation for changing an existing behavior?

Which versions are you using for the following packages?

Angular: 9.1.2
Angular CDK:
Angular CLI: latest
Nx (option):
ngx-onesignal: latest

Is there anything else we should know?

Not compatible with Angular Ivy

I am submitting a

  • Bug Report

What is the expected behavior?

I have installed as per instructions
Should work properly.

What is the current behavior?

When I import NgxOneSignalModule I get this error related to not compatible with Angular Ivy

image

What are the steps to reproduce?

Try to install it with Angular 10+

Which versions are you using for the following packages?

Angular: 10.1.2
Angular CDK: 10.1.2
Angular CLI: 10.1.2
Nx (option):
ngx-onesignal: 0.0.7

Is there anything else we should know?

Support for Safari

I am submitting a

  • Bug Report

What is the expected behavior?

Be able to get the user id through await OneSignal.getUserId()

What is the current behavior?

It returns a bug when subscribing as shown:

Screen Shot 2020-10-31 at 4 38 19 PM
Screen Shot 2020-10-31 at 4 37 57 PM

What are the steps to reproduce?

As far as I can see just creating the project as the example in the docs.

What is the use-case or motivation for changing an existing behavior?

Which versions are you using for the following packages?

Angular: 10.2.0
Angular CDK: 10.2.6
Angular CLI: 10.2.0
Nx (option):
ngx-onesignal: 10.0.0

Is there anything else we should know?

This is my app.module:

NgxOneSignalModule.forRoot({
      appId: 'my-app-id,
      autoRegister: false,
      allowLocalhostAsSecureOrigin: true,
      notifyButton: {
        enable: true,
      },
    }),

And my app.component:

import { Component, OnInit } from '@angular/core';
import { OneSignalService } from 'ngx-onesignal';

@Component({
  selector: 'app-root',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.scss']
})
export class AppComponent implements OnInit {

  constructor(public readonly onesignal: OneSignalService) {
    (window as any).ngxOnesignal = this.onesignal;
  }

  ngOnInit(): void {
    setTimeout(() => {
      this.onesignal.subscribe();
      console.log(`Initiated`);
    }, 2000);
  }
}

Also, I couldn't see anything about the safari_web_id property as described in https://documentation.onesignal.com/docs/safari-web-push-setup, so, does this wrapper supports it?

My Safari version is 14.0 (15610.1.28.1.9, 15610) and I'm on a Mac OS Catalina 10.15.7.

You can access my example here https://onesignal-testing.surge.sh and also its repository on Github https://github.com/nncl/ngx-onesignal-test

I really appreciate your help :)

How to send tags?

Hi,

I need to send tags using this module. I've found the method this.onesignal.send(method: OneSignalStubFuncionList, value: undefined) but I don't know how to send a tag using this method.

Can you post an example using the .push(...) method?

node version 12

npm install ngx-onesignal

node: 14.15.4
Wanted node version 12 (>=12.0.0 <13.0.0)

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] preinstall: `npx check-node-version --node 12`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] preinstall script.

Is it really need restrict node version to 12?

add an Observable that knows that global oneSignal has enabled.

I am submitting a

  • Feature Request

What is the expected behavior?

What is the current behavior?

What are the steps to reproduce?

What is the use-case or motivation for changing an existing behavior?

Which versions are you using for the following packages?

Angular:
Angular CDK:
Angular CLI:
Nx (option):
ngx-onesignal:

Is there anything else we should know?

Compile fails after adding package with angular@^8.0.0

I am submitting a

  • Bug Report

What is the expected behavior?

The module can be added without any problems

What is the current behavior?

As soon as the module is added to the imports of AppModule the build fails with the following error:

ERROR in Error during template compile of 'NgModule'
  Function calls are not supported in decorators but 'ɵmakeDecorator' was called.
Unexpected value '[object Object]' imported by the module 'AppModule in [...]/src/app/app.module.ts'. Please add a @NgModule annotation.
Error during template compile of 'Injectable'
  Function calls are not supported in decorators but 'ɵmakeDecorator' was called.
Error during template compile of 'Injectable'
  Function calls are not supported in decorators but 'ɵmakeDecorator' was called.
Error during template compile of 'Injectable'
  Function calls are not supported in decorators but 'ɵmakeDecorator' was called.
Error during template compile of 'Injectable'
  Function calls are not supported in decorators but 'ɵmakeDecorator' was called.
Error during template compile of 'Injectable'
  Function calls are not supported in decorators but 'ɵmakeDecorator' was called.
Error during template compile of 'Injectable'
  Function calls are not supported in decorators but 'ɵmakeDecorator' was called.
Error during template compile of 'Injectable'
  Function calls are not supported in decorators but 'ɵmakeDecorator' was called.
Error during template compile of 'Injectable'
  Function calls are not supported in decorators but 'ɵmakeDecorator' was called.
Error during template compile of 'NgModule'
  Function calls are not supported in decorators but 'ɵmakeDecorator' was called.
Error during template compile of 'Injectable'
  Function calls are not supported in decorators but 'ɵmakeDecorator' was called.

As soon as I remove the import then the app compiles normally again

What are the steps to reproduce?

Create a Angular v8 app following the documented steps and try to compile in production mode.

Which versions are you using for the following packages?

Angular: 8.2.3
Angular CLI: 8.3.0
ngx-onesignal: 0.0.7

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.