-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from Twirelab/feature/1
#1 - Update and clean code
- Loading branch information
Showing
20 changed files
with
2,598 additions
and
17,723 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
name: "Test package" | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- "master" | ||
types: | ||
- "opened" | ||
- "synchronize" | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: "Checkout" | ||
uses: actions/checkout@v3 | ||
- name: "Use Node.js" | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 14 | ||
cache: "npm" | ||
- name: "Install npm" | ||
run: npm ci | ||
- name: "Run all tests" | ||
run: npm run test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,4 @@ | ||
{ | ||
"singleQuote": true, | ||
"trailingComma": "all", | ||
"singleQuote": false, | ||
"semi": false | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,56 @@ | ||
nestjs-expo-notifications | ||
# NestJS Expo Notifications [![Tests](https://github.com/Twirelab/nestjs-expo-notifications/actions/workflows/tests.yml/badge.svg)](https://github.com/Twirelab/nestjs-expo-notifications/actions/workflows/tests.yml) | ||
|
||
Injectable Expo Notifications client for Nestjs | ||
|
||
## Install | ||
|
||
```bash | ||
npm i @twirelab/nestjs-expo-notifications expo-server-sdk | ||
``` | ||
|
||
or | ||
|
||
```bash | ||
yarn add @twirelab/nestjs-expo-notifications expo-server-sdk | ||
``` | ||
|
||
## Usage | ||
|
||
Add below code into app.module.js file. | ||
|
||
```typescript | ||
import { ExpoNotificationsModule } from "@twirelab/nestjs-expo-notifications" | ||
|
||
@Module({ | ||
imports: [ | ||
ExpoNotificationsModule.forRoot({ | ||
// optionally providing an access token if you have enabled push security | ||
accessToken: "...", | ||
}), | ||
], | ||
}) | ||
export class AppModule {} | ||
``` | ||
|
||
Now you can inject authentication client into your services, for example: | ||
|
||
```typescript | ||
import { Injectable } from "@nestjs/common" | ||
import { InjectExpoNotifications } from "@twirelab/nestjs-expo-notifications" | ||
import { Expo } from "expo-server-sdk" | ||
|
||
@Injectable() | ||
export class AppService { | ||
constructor(@InjectExpoNotifications() private readonly expo: Expo) {} | ||
|
||
async sendNotifications(): Promise<TokenResponse> { | ||
return await this.expo.sendPushNotificationsAsync([ | ||
{ | ||
to: "ExponentPushToken[**********************]", | ||
title: "Testing notifications", | ||
body: "This is a testing notifications", | ||
}, | ||
]) | ||
} | ||
} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
module.exports = { | ||
preset: "ts-jest", | ||
testEnvironment: "node", | ||
} |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.