Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
121 changes: 67 additions & 54 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,55 +6,59 @@
# -------------------------

aliases:
# -------------------------
# CACHE
# -------------------------
- &restore-yarn-cache
keys:
- yarn-cache-{{ arch }}-{{ checksum "package.json" }}-{{ checksum "yarn.lock" }}
- yarn-cache-{{ arch }}
# -------------------------
# CACHE
# -------------------------
- &restore-yarn-cache
keys:
- yarn-cache-{{ arch }}-{{ checksum "package.json" }}-{{ checksum "yarn.lock" }}
- yarn-cache-{{ arch }}

- &save-yarn-cache
paths:
- ~/.cache/yarn
- ~/Library/Detox/ios
key: yarn-cache-{{ arch }}-{{ checksum "package.json" }}-{{ checksum "yarn.lock" }}
- &save-yarn-cache
paths:
- ~/.cache/yarn
- ~/Library/Detox/ios
key: yarn-cache-{{ arch }}-{{ checksum "package.json" }}-{{ checksum "yarn.lock" }}

# -------------------------
# INSTALLATION
# -------------------------
- &yarn
name: Yarn Install
command: |
yarn install --network-concurrency 1 --non-interactive --cache-folder ~/.cache/yarn & wait
# -------------------------
# INSTALLATION
# -------------------------
- &yarn
name: Yarn Install
command: |
yarn install --network-concurrency 1 --non-interactive --cache-folder ~/.cache/yarn & wait

# -------------------------
# ANALYSE
# -------------------------
# -------------------------
# ANALYSE
# -------------------------

- &flow
name: Flow Checks
command: yarn test:flow

- &flow
name: Flow Checks
command: yarn test:flow
- &javascript
name: Javascript Tests
command: yarn test:js

- &javascript
name: Javascript Tests
command: yarn test:js
- &eslint
name: Lint
command: yarn lint

# -------------------------
# DEFAULTS
# -------------------------
defaults: &defaults
working_directory: ~/react-native-push-notification-ios
environment:
- GIT_COMMIT_DESC: git log --format=oneline -n 1 $CIRCLE_SHA1
- GIT_COMMIT_DESC: git log --format=oneline -n 1 $CIRCLE_SHA1

# JAVASCRIPT
js_defaults: &js_defaults
<<: *defaults
docker:
- image: circleci/node:8
- image: circleci/node:8
environment:
- PATH: "/opt/yarn/yarn-v1.5.1/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
- PATH: "/opt/yarn/yarn-v1.5.1/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"

# -------------------------
# JOBS
Expand All @@ -65,30 +69,36 @@ jobs:
checkout-code:
<<: *js_defaults
steps:
- checkout
- restore-cache: *restore-yarn-cache
- run: rm -rf node_modules
- run: yarn cache clean
- run: *yarn
- save-cache: *save-yarn-cache
- persist_to_workspace:
root: .
paths: .
- checkout
- restore-cache: *restore-yarn-cache
- run: rm -rf node_modules
- run: yarn cache clean
- run: *yarn
- save-cache: *save-yarn-cache
- persist_to_workspace:
root: .
paths: .

flow:
<<: *js_defaults
steps:
- attach_workspace:
at: ~/react-native-push-notification-ios
- run: *flow
- attach_workspace:
at: ~/react-native-push-notification-ios
- run: *flow

javascript:
<<: *js_defaults
steps:
- attach_workspace:
at: ~/react-native-push-notification-ios
- run: *javascript
- attach_workspace:
at: ~/react-native-push-notification-ios
- run: *javascript

lint:
<<: *js_defaults
steps:
- attach_workspace:
at: ~/react-native-push-notification-ios
- run: *eslint

# -------------------------
# WORK FLOWS
Expand All @@ -97,10 +107,13 @@ workflows:
version: 2
Test:
jobs:
- checkout-code
- flow:
requires:
- checkout-code
- javascript:
requires:
- checkout-code
- checkout-code
- flow:
requires:
- checkout-code
- javascript:
requires:
- checkout-code
- lint:
requires:
- checkout-code
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
4 changes: 4 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
module.exports = {
root: true,
extends: ["@react-native-community"]
};
6 changes: 6 additions & 0 deletions .prettierrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
module.exports = {
bracketSpacing: false,
jsxBracketSameLine: true,
singleQuote: true,
trailingComma: "all"
};
16 changes: 8 additions & 8 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
module.exports = {
presets: ["module:metro-react-native-babel-preset"],
presets: ['module:metro-react-native-babel-preset'],
plugins: [
[
"module-resolver",
'module-resolver',
{
alias: {
"@react-native-community/push-notification-ios": "./js"
'@react-native-community/push-notification-ios': './js',
},
cwd: "babelrc"
}
]
]
};
cwd: 'babelrc',
},
],
],
};
19 changes: 8 additions & 11 deletions example/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,15 +86,13 @@ export default class App extends Component<Props, State> {
label="Send fake local notification"
/>
<Button
onPress={() =>
PushNotificationIOS.setApplicationIconBadgeNumber(42)
}
label="Set app's icon badge to 42"
/>
<Button
onPress={() => PushNotificationIOS.setApplicationIconBadgeNumber(0)}
label="Clear app's icon badge"
/>
onPress={() => PushNotificationIOS.setApplicationIconBadgeNumber(42)}
label="Set app's icon badge to 42"
/>
<Button
onPress={() => PushNotificationIOS.setApplicationIconBadgeNumber(0)}
label="Clear app's icon badge"
/>
<View>
<Button
onPress={this._showPermissions.bind(this)}
Expand Down Expand Up @@ -122,7 +120,7 @@ export default class App extends Component<Props, State> {
_sendLocalNotification() {
PushNotificationIOS.presentLocalNotification({
alertBody: 'Sample local notification',
applicationIconBadgeNumber: 1
applicationIconBadgeNumber: 1,
});
}

Expand Down Expand Up @@ -187,7 +185,6 @@ export default class App extends Component<Props, State> {
}
}


const styles = StyleSheet.create({
container: {
flex: 1,
Expand Down
4 changes: 2 additions & 2 deletions js/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@

'use strict';

import { NativeEventEmitter, NativeModules, Platform } from 'react-native';
import {NativeEventEmitter, NativeModules} from 'react-native';
import invariant from 'invariant';

const { RNCPushNotificationIOS } = NativeModules;
const {RNCPushNotificationIOS} = NativeModules;

const PushNotificationEmitter = new NativeEventEmitter(RNCPushNotificationIOS);

Expand Down
7 changes: 6 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
"start": "node node_modules/react-native/local-cli/cli.js start",
"test": "yarn test:flow && yarn test:js",
"test:flow": "flow check",
"test:js": "echo 0"
"test:js": "echo 0",
"lint": "eslint ."
},
"keywords": [
"react-native",
Expand All @@ -30,12 +31,16 @@
},
"devDependencies": {
"@babel/core": "^7.0.0",
"@react-native-community/eslint-config": "^0.0.5",
"babel-core": "^7.0.0-bridge.0",
"babel-jest": "24.1.0",
"babel-plugin-module-resolver": "^3.1.3",
"eslint": "^6.8.0",
"eslint-plugin-prettier": "^3.1.2",
"flow-bin": "^0.86.0",
"jest": "24.1.0",
"metro-react-native-babel-preset": "0.51.1",
"prettier": "^1.19.1",
"react": "16.6.3",
"react-native": "0.58.4"
},
Expand Down
Loading