Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
R
react-native-notifications
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Jira
Jira
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
冷佳娟
react-native-notifications
Commits
4e661458
Commit
4e661458
authored
Sep 09, 2019
by
yogevbd
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Split Notification.ts, Fix android example module
parent
36a833fc
Changes
21
Show whitespace changes
Inline
Side-by-side
Showing
21 changed files
with
117 additions
and
111 deletions
+117
-111
example/android/myapplication/build.gradle
example/android/myapplication/build.gradle
+1
-2
example/android/myapplication/src/main/java/com/wix/reactnativenotifications/app/MainActivity.java
...va/com/wix/reactnativenotifications/app/MainActivity.java
+3
-25
example/android/myapplication/src/main/java/com/wix/reactnativenotifications/app/MainApplication.java
...com/wix/reactnativenotifications/app/MainApplication.java
+6
-1
example/index.js
example/index.js
+17
-14
lib/android/app/build.gradle
lib/android/app/build.gradle
+1
-1
lib/android/app/src/main/java/com/wix/reactnativenotifications/core/notification/PushNotificationProps.java
...otifications/core/notification/PushNotificationProps.java
+0
-10
lib/src/Notifications.ts
lib/src/Notifications.ts
+2
-1
lib/src/adapters/CompletionCallbackWrapper.ts
lib/src/adapters/CompletionCallbackWrapper.ts
+3
-1
lib/src/adapters/NativeCommandsSender.ts
lib/src/adapters/NativeCommandsSender.ts
+4
-1
lib/src/adapters/NativeEventsReceiver.ts
lib/src/adapters/NativeEventsReceiver.ts
+6
-2
lib/src/commands/Commands.test.ts
lib/src/commands/Commands.test.ts
+7
-5
lib/src/commands/Commands.ts
lib/src/commands/Commands.ts
+3
-1
lib/src/events/EventsRegistry.test.ts
lib/src/events/EventsRegistry.test.ts
+10
-9
lib/src/events/EventsRegistry.ts
lib/src/events/EventsRegistry.ts
+2
-1
lib/src/interfaces/Notification.ts
lib/src/interfaces/Notification.ts
+16
-35
lib/src/interfaces/NotificationActionResponse.ts
lib/src/interfaces/NotificationActionResponse.ts
+4
-0
lib/src/interfaces/NotificationCategory.ts
lib/src/interfaces/NotificationCategory.ts
+18
-0
lib/src/interfaces/NotificationCompletion.ts
lib/src/interfaces/NotificationCompletion.ts
+5
-0
lib/src/interfaces/NotificationEvents.ts
lib/src/interfaces/NotificationEvents.ts
+2
-1
lib/src/interfaces/NotificationPermissions.ts
lib/src/interfaces/NotificationPermissions.ts
+5
-0
package.json
package.json
+2
-1
No files found.
example/android/myapplication/build.gradle
View file @
4e661458
...
...
@@ -13,10 +13,9 @@ apply from: "../../../node_modules/react-native/react.gradle"
android
{
compileSdkVersion
28
buildToolsVersion
"28.0.3"
defaultConfig
{
applicationId
"com.wix.reactnativenotifications.app"
minSdkVersion
1
9
minSdkVersion
1
6
targetSdkVersion
28
versionCode
1
versionName
"1.0"
...
...
example/android/myapplication/src/main/java/com/wix/reactnativenotifications/app/MainActivity.java
View file @
4e661458
package
com.wix.reactnativenotifications.app
;
import
android.os.Build
;
import
android.os.Bundle
;
import
android.view.ViewGroup
;
import
android.widget.Toolbar
;
import
com.facebook.react.ReactActivity
;
import
com.facebook.react.ReactRootView
;
import
static
android
.
os
.
Build
.
VERSION
.
SDK_INT
;
public
class
MainActivity
extends
ReactActivity
{
private
ReactRootView
mReactRootView
;
@Override
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
ViewGroup
layout
;
if
(
SDK_INT
>=
Build
.
VERSION_CODES
.
LOLLIPOP
)
{
layout
=
(
ViewGroup
)
getLayoutInflater
().
inflate
(
R
.
layout
.
activity_main
,
null
);
Toolbar
toolbar
=
layout
.
findViewById
(
R
.
id
.
toolbar
);
setActionBar
(
toolbar
);
}
else
{
layout
=
(
ViewGroup
)
getLayoutInflater
().
inflate
(
R
.
layout
.
activity_main_prelollipop
,
null
);
}
mReactRootView
=
new
ReactRootView
(
this
);
layout
.
addView
(
mReactRootView
);
setContentView
(
layout
);
startReactApplication
();
}
private
void
startReactApplication
()
{
mReactRootView
.
startReactApplication
(
getReactInstanceManager
(),
"NotificationsExampleApp"
,
null
);
@Override
protected
String
getMainComponentName
()
{
return
"NotificationsExampleApp"
;
}
}
example/android/myapplication/src/main/java/com/wix/reactnativenotifications/app/MainApplication.java
View file @
4e661458
...
...
@@ -26,6 +26,11 @@ public class MainApplication extends Application implements ReactApplication {
new
RNNotificationsPackage
(
MainApplication
.
this
)
);
}
@Override
protected
String
getJSMainModuleName
()
{
return
"index"
;
}
};
@Override
...
...
example/index.js
View file @
4e661458
...
...
@@ -6,7 +6,7 @@ import {
Button
}
from
'
react-native
'
;
import
React
,
{
Component
}
from
'
react
'
;
import
{
Notifications
}
from
'
react-native-notifications
'
;
import
{
Notifications
}
from
'
react-native-notifications
'
;
class
NotificationsExampleApp
extends
Component
{
constructor
()
{
...
...
@@ -22,7 +22,7 @@ class NotificationsExampleApp extends Component {
registerNotificationEvents
()
{
Notifications
.
events
().
registerNotificationReceived
((
notification
,
completion
)
=>
{
this
.
setState
({
notifications
:
[...
this
.
state
.
notifications
,
notification
.
link
]
notifications
:
[...
this
.
state
.
notifications
,
notification
]
});
completion
({
alert
:
true
,
sound
:
false
,
badge
:
false
});
...
...
@@ -30,7 +30,7 @@ class NotificationsExampleApp extends Component {
Notifications
.
events
().
registerRemoteNotificationOpened
((
notification
,
completion
)
=>
{
this
.
setState
({
notifications
:
[...
this
.
state
.
notifications
,
`Notification Clicked:
${
notification
.
link
}
`
]
notifications
:
[...
this
.
state
.
notifications
,
notification
]
});
completion
();
...
...
@@ -38,7 +38,13 @@ class NotificationsExampleApp extends Component {
}
renderNotification
(
notification
)
{
return
<
Text
>
{
`
${
notification
}
`
}
<
/Text>
;
return
(
<
View
style
=
{{
backgroundColor
:
'
lightgray
'
,
margin
:
10
}}
>
<
Text
>
{
`Title:
${
notification
.
title
}
`
}
<
/Text
>
<
Text
>
{
`Body:
${
notification
.
body
}
`
}
<
/Text
>
<
Text
>
{
`Extra Link Param:
${
notification
.
data
.
link
}
`
}
<
/Text
>
<
/View
>
);
}
requestPermissions
()
{
...
...
@@ -88,13 +94,10 @@ class NotificationsExampleApp extends Component {
async
componentDidMount
()
{
const
initialNotification
=
await
Notifications
.
getInitialNotification
();
if
(
initialNotification
)
{
this
.
setState
({
notifications
:
[
initialNotification
.
link
,
...
this
.
state
.
notifications
]});
this
.
setState
({
notifications
:
[
initialNotification
,
...
this
.
state
.
notifications
]});
}
}
componentWillUnmount
()
{
}
render
()
{
const
notifications
=
this
.
state
.
notifications
.
map
((
notification
,
idx
)
=>
(
...
...
@@ -105,9 +108,9 @@ class NotificationsExampleApp extends Component {
return
(
<
View
style
=
{
styles
.
container
}
>
<
Button
title
=
{
'
Request permissions
'
}
onPress
=
{
this
.
requestPermissions
}
testID
=
{
'
requestPermissions
'
}
/
>
<
Button
title
=
{
'
Send local notification
'
}
onPress
=
{
this
.
sendLocalNotification
}
testID
=
{
'
sendLocalNotification
'
}
/
>
<
Button
title
=
{
'
Remove all delivered notifications
'
}
onPress
=
{
this
.
removeAllDeliveredNotifications
}
/
>
<
Button
title
=
{
'
Request permissions
'
}
onPress
=
{
this
.
requestPermissions
}
testID
=
{
'
requestPermissions
'
}
/
>
<
Button
title
=
{
'
Send local notification
'
}
onPress
=
{
this
.
sendLocalNotification
}
testID
=
{
'
sendLocalNotification
'
}
/
>
<
Button
title
=
{
'
Remove all delivered notifications
'
}
onPress
=
{
this
.
removeAllDeliveredNotifications
}
/
>
{
notifications
}
<
/View
>
);
...
...
lib/android/app/build.gradle
View file @
4e661458
...
...
@@ -6,7 +6,7 @@ android {
buildToolsVersion
'28.0.3'
defaultConfig
{
minSdkVersion
1
9
minSdkVersion
1
6
targetSdkVersion
27
versionCode
1
versionName
"1.0"
...
...
lib/android/app/src/main/java/com/wix/reactnativenotifications/core/notification/PushNotificationProps.java
View file @
4e661458
...
...
@@ -6,16 +6,6 @@ public class PushNotificationProps {
protected
Bundle
mBundle
;
public
PushNotificationProps
()
{
mBundle
=
new
Bundle
();
}
public
PushNotificationProps
(
String
title
,
String
body
)
{
mBundle
=
new
Bundle
();
mBundle
.
putString
(
"title"
,
title
);
mBundle
.
putString
(
"body"
,
body
);
}
public
PushNotificationProps
(
Bundle
bundle
)
{
mBundle
=
bundle
;
}
...
...
lib/src/Notifications.ts
View file @
4e661458
...
...
@@ -2,9 +2,10 @@ import { NativeCommandsSender } from './adapters/NativeCommandsSender';
import
{
NativeEventsReceiver
}
from
'
./adapters/NativeEventsReceiver
'
;
import
{
Commands
}
from
'
./commands/Commands
'
;
import
{
EventsRegistry
}
from
'
./events/EventsRegistry
'
;
import
{
Notification
,
NotificationCategory
}
from
'
./interfaces/Notification
'
;
import
{
Notification
}
from
'
./interfaces/Notification
'
;
import
{
UniqueIdProvider
}
from
'
./adapters/UniqueIdProvider
'
;
import
{
CompletionCallbackWrapper
}
from
'
./adapters/CompletionCallbackWrapper
'
;
import
{
NotificationCategory
}
from
'
./interfaces/NotificationCategory
'
;
export
class
NotificationsRoot
{
private
readonly
nativeEventsReceiver
:
NativeEventsReceiver
;
...
...
lib/src/adapters/CompletionCallbackWrapper.ts
View file @
4e661458
import
{
NativeCommandsSender
}
from
'
./NativeCommandsSender
'
;
import
{
NotificationCompletion
,
Notification
}
from
'
../interfaces/Notification
'
;
import
{
Notification
}
from
'
../interfaces/Notification
'
;
import
{
NotificationCompletion
}
from
'
../interfaces/NotificationCompletion
'
;
import
{
Platform
}
from
'
react-native
'
;
export
class
CompletionCallbackWrapper
{
constructor
(
...
...
lib/src/adapters/NativeCommandsSender.ts
View file @
4e661458
import
{
NativeModules
}
from
'
react-native
'
;
import
{
Notification
,
NotificationCategory
,
NotificationPermissions
,
NotificationCompletion
}
from
'
../interfaces/Notification
'
;
import
{
Notification
}
from
'
../interfaces/Notification
'
;
import
{
NotificationCompletion
}
from
'
../interfaces/NotificationCompletion
'
;
import
{
NotificationPermissions
}
from
'
../interfaces/NotificationPermissions
'
;
import
{
NotificationCategory
}
from
'
../interfaces/NotificationCategory
'
;
interface
NativeCommandsModule
{
getInitialNotification
():
Promise
<
Notification
>
;
...
...
lib/src/adapters/NativeEventsReceiver.ts
View file @
4e661458
...
...
@@ -19,7 +19,9 @@ export class NativeEventsReceiver {
}
public
registerRemoteNotificationReceived
(
callback
:
(
notification
:
Notification
)
=>
void
):
EmitterSubscription
{
return
this
.
emitter
.
addListener
(
'
notificationReceived
'
,
callback
);
return
this
.
emitter
.
addListener
(
'
notificationReceived
'
,
(
payload
)
=>
{
callback
(
new
Notification
(
payload
));
});
}
public
registerPushKitNotificationReceived
(
callback
:
(
event
:
object
)
=>
void
):
EmitterSubscription
{
...
...
@@ -27,7 +29,9 @@ export class NativeEventsReceiver {
}
public
registerRemoteNotificationOpened
(
callback
:
(
response
:
Notification
,
completion
:
()
=>
void
)
=>
void
):
EmitterSubscription
{
return
this
.
emitter
.
addListener
(
'
notificationOpened
'
,
callback
);
return
this
.
emitter
.
addListener
(
'
notificationOpened
'
,
(
payload
,
completion
)
=>
{
callback
(
new
Notification
(
payload
),
completion
);
});
}
public
registerRemoteNotificationsRegistrationFailed
(
callback
:
(
event
:
RegistrationError
)
=>
void
):
EmitterSubscription
{
...
...
lib/src/commands/Commands.test.ts
View file @
4e661458
...
...
@@ -3,8 +3,10 @@ import { mock, verify, instance, when, anyNumber } from 'ts-mockito';
import
{
Commands
}
from
'
./Commands
'
;
import
{
NativeCommandsSender
}
from
'
../adapters/NativeCommandsSender
'
;
import
{
Notification
,
NotificationCategory
,
NotificationPermissions
}
from
'
../interfaces/Notification
'
;
import
{
Notification
}
from
'
../interfaces/Notification
'
;
import
{
UniqueIdProvider
}
from
'
../adapters/UniqueIdProvider
'
;
import
{
NotificationCategory
}
from
'
../interfaces/NotificationCategory
'
;
import
{
NotificationPermissions
}
from
'
../interfaces/NotificationPermissions
'
;
describe
(
'
Commands
'
,
()
=>
{
let
uut
:
Commands
;
...
...
@@ -28,7 +30,7 @@ describe('Commands', () => {
});
it
(
'
returns a promise with the initial notification
'
,
async
()
=>
{
const
expectedNotification
:
Notification
=
{
identifier
:
'
id
'
,
data
:
{},
alert
:
'
alert
'
}
;
const
expectedNotification
:
Notification
=
new
Notification
({
identifier
:
'
id
'
})
;
when
(
mockedNativeCommandsSender
.
getInitialNotification
()).
thenResolve
(
expectedNotification
);
...
...
@@ -75,19 +77,19 @@ describe('Commands', () => {
describe
(
'
postLocalNotification
'
,
()
=>
{
it
(
'
sends to native
'
,
()
=>
{
const
notification
:
Notification
=
{
identifier
:
'
id
'
,
alert
:
'
alert
'
,
data
:
{}}
;
const
notification
:
Notification
=
new
Notification
({
identifier
:
'
id
'
})
;
uut
.
postLocalNotification
(
notification
);
verify
(
mockedNativeCommandsSender
.
postLocalNotification
(
notification
,
anyNumber
())).
called
();
});
it
(
'
generates unique identifier
'
,
()
=>
{
const
notification
:
Notification
=
{
identifier
:
'
id
'
,
data
:
{},
alert
:
'
alert
'
}
;
const
notification
:
Notification
=
new
Notification
({
identifier
:
'
id
'
})
;
uut
.
postLocalNotification
(
notification
);
verify
(
mockedNativeCommandsSender
.
postLocalNotification
(
notification
,
anyNumber
())).
called
();
});
it
(
'
use passed notification id
'
,
()
=>
{
const
notification
:
Notification
=
{
identifier
:
'
id
'
,
data
:
{},
alert
:
'
alert
'
}
;
const
notification
:
Notification
=
new
Notification
({
identifier
:
'
id
'
})
;
const
passedId
:
number
=
2
;
uut
.
postLocalNotification
(
notification
,
passedId
);
verify
(
mockedNativeCommandsSender
.
postLocalNotification
(
notification
,
passedId
)).
called
();
...
...
lib/src/commands/Commands.ts
View file @
4e661458
import
*
as
_
from
'
lodash
'
;
import
{
NativeCommandsSender
}
from
'
../adapters/NativeCommandsSender
'
;
import
{
Notification
,
NotificationCategory
,
NotificationPermissions
}
from
'
../interfaces/Notification
'
;
import
{
Notification
}
from
'
../interfaces/Notification
'
;
import
{
NotificationCategory
}
from
'
../interfaces/NotificationCategory
'
;
import
{
NotificationPermissions
}
from
'
../interfaces/NotificationPermissions
'
;
import
{
UniqueIdProvider
}
from
'
../adapters/UniqueIdProvider
'
;
export
class
Commands
{
...
...
lib/src/events/EventsRegistry.test.ts
View file @
4e661458
import
{
EventsRegistry
}
from
'
./EventsRegistry
'
;
import
{
NativeEventsReceiver
}
from
'
../adapters/NativeEventsReceiver.mock
'
;
import
{
Notification
Completion
,
Notification
}
from
'
../interfaces/Notification
'
;
import
{
Notification
}
from
'
../interfaces/Notification
'
;
import
{
CompletionCallbackWrapper
}
from
'
../adapters/CompletionCallbackWrapper
'
;
import
{
NativeCommandsSender
}
from
'
../adapters/NativeCommandsSender.mock
'
;
import
{
NotificationResponse
}
from
'
../interfaces/NotificationEvents
'
;
import
{
Platform
}
from
'
react-native
'
;
import
{
NotificationCompletion
}
from
'
../interfaces/NotificationCompletion
'
;
describe
(
'
EventsRegistry
'
,
()
=>
{
let
uut
:
EventsRegistry
;
...
...
@@ -28,7 +29,7 @@ describe('EventsRegistry', () => {
it
(
'
should wrap callback with completion block
'
,
()
=>
{
const
wrappedCallback
=
jest
.
fn
();
const
notification
:
Notification
=
{
identifier
:
'
identifier
'
,
data
:
{},
alert
:
'
alert
'
}
const
notification
:
Notification
=
new
Notification
({
identifier
:
'
identifier
'
});
uut
.
registerNotificationReceived
(
wrappedCallback
);
const
call
=
mockNativeEventsReceiver
.
registerRemoteNotificationReceived
.
mock
.
calls
[
0
][
0
];
...
...
@@ -39,7 +40,7 @@ describe('EventsRegistry', () => {
});
it
(
'
should wrap callback with completion block
'
,
()
=>
{
const
expectedNotification
:
Notification
=
{
identifier
:
'
identifier
'
,
data
:
{},
alert
:
'
alert
'
}
const
expectedNotification
:
Notification
=
new
Notification
({
identifier
:
'
identifier
'
});
uut
.
registerNotificationReceived
((
notification
)
=>
{
expect
(
notification
).
toEqual
(
expectedNotification
);
...
...
@@ -49,7 +50,7 @@ describe('EventsRegistry', () => {
});
it
(
'
should invoke finishPresentingNotification
'
,
()
=>
{
const
notification
:
Notification
=
{
identifier
:
'
notificationId
'
,
data
:
{},
alert
:
'
alert
'
}
const
notification
:
Notification
=
new
Notification
({
identifier
:
'
notificationId
'
});
const
response
:
NotificationCompletion
=
{
alert
:
true
}
uut
.
registerNotificationReceived
((
notification
,
completion
)
=>
{
...
...
@@ -63,7 +64,7 @@ describe('EventsRegistry', () => {
it
(
'
should not invoke finishPresentingNotification on Android
'
,
()
=>
{
Platform
.
OS
=
'
android
'
;
const
expectedNotification
:
Notification
=
{
identifier
:
'
notificationId
'
,
data
:
{},
alert
:
'
alert
'
}
const
expectedNotification
:
Notification
=
new
Notification
({
identifier
:
'
notificationId
'
});
const
response
:
NotificationCompletion
=
{
alert
:
true
}
uut
.
registerNotificationReceived
((
notification
,
completion
)
=>
{
...
...
@@ -88,7 +89,7 @@ describe('EventsRegistry', () => {
it
(
'
should wrap callback with completion block
'
,
()
=>
{
const
wrappedCallback
=
jest
.
fn
();
const
notification
:
Notification
=
{
identifier
:
'
identifier
'
,
data
:
{},
alert
:
'
alert
'
}
;
const
notification
:
Notification
=
new
Notification
({
identifier
:
'
identifier
'
})
;
const
response
:
NotificationResponse
=
{
notification
,
identifier
:
'
responseId
'
};
uut
.
registerRemoteNotificationOpened
(
wrappedCallback
);
...
...
@@ -100,7 +101,7 @@ describe('EventsRegistry', () => {
});
it
(
'
should wrap callback with completion block
'
,
()
=>
{
const
notification
:
Notification
=
{
identifier
:
'
identifier
'
,
data
:
{},
alert
:
'
alert
'
}
const
notification
:
Notification
=
new
Notification
({
identifier
:
'
identifier
'
});
const
expectedResponse
:
NotificationResponse
=
{
notification
,
identifier
:
'
responseId
'
}
uut
.
registerRemoteNotificationOpened
((
response
)
=>
{
...
...
@@ -111,7 +112,7 @@ describe('EventsRegistry', () => {
});
it
(
'
calling completion should invoke finishHandlingAction
'
,
()
=>
{
const
expectedNotification
:
Notification
=
{
identifier
:
'
notificationId
'
,
data
:
{},
alert
:
'
alert
'
}
const
expectedNotification
:
Notification
=
new
Notification
({
identifier
:
'
notificationId
'
});
uut
.
registerRemoteNotificationOpened
((
notification
,
completion
)
=>
{
completion
();
...
...
@@ -125,7 +126,7 @@ describe('EventsRegistry', () => {
it
(
'
should not invoke finishHandlingAction on Android
'
,
()
=>
{
Platform
.
OS
=
'
android
'
;
const
expectedNotification
:
Notification
=
{
identifier
:
'
notificationId
'
,
data
:
{},
alert
:
'
alert
'
}
const
expectedNotification
:
Notification
=
new
Notification
({
identifier
:
'
notificationId
'
});
uut
.
registerRemoteNotificationOpened
((
notification
,
completion
)
=>
{
completion
();
...
...
lib/src/events/EventsRegistry.ts
View file @
4e661458
...
...
@@ -7,7 +7,8 @@ import {
NotificationResponse
}
from
'
../interfaces/NotificationEvents
'
;
import
{
CompletionCallbackWrapper
}
from
'
../adapters/CompletionCallbackWrapper
'
;
import
{
NotificationCompletion
,
Notification
}
from
'
../interfaces/Notification
'
;
import
{
Notification
}
from
'
../interfaces/Notification
'
;
import
{
NotificationCompletion
}
from
'
../interfaces/NotificationCompletion
'
;
export
class
EventsRegistry
{
constructor
(
...
...
lib/src/interfaces/Notification.ts
View file @
4e661458
export
interface
Notification
{
export
class
Notification
{
identifier
:
string
;
data
:
object
;
alert
:
string
private
_data
?:
any
;
sound
?:
string
;
badge
?:
number
;
type
?:
string
;
thread
?:
string
;
}
export
interface
NotificationPermissions
{
badge
:
boolean
;
alert
:
boolean
;
sound
:
boolean
;
}
export
interface
NotificationCategory
{
identifier
:
string
actions
:
[
NotificationAction
?];
}
constructor
(
payload
:
object
)
{
this
.
_data
=
payload
;
this
.
identifier
=
this
.
_data
.
identifier
;
}
export
interface
NotificationTextInput
{
buttonTitle
:
string
;
placeholder
:
string
;
}
export
interface
NotificationAction
{
identifier
:
string
;
activationMode
:
'
foreground
'
|
'
authenticationRequired
'
|
'
destructive
'
;
title
:
string
;
authenticationRequired
:
boolean
;
textInput
:
NotificationTextInput
}
get
data
():
any
{
return
this
.
_data
;
}
export
interface
NotificationActionResponse
{
identifier
:
string
;
text
:
string
;
}
get
title
():
string
{
return
this
.
_data
.
title
;
}
export
interface
NotificationCompletion
{
badge
?:
boolean
;
alert
?:
boolean
;
sound
?:
boolean
;
get
body
():
string
{
return
this
.
_data
.
body
;
}
}
lib/src/interfaces/NotificationActionResponse.ts
0 → 100644
View file @
4e661458
export
interface
NotificationActionResponse
{
identifier
:
string
;
text
:
string
;
}
lib/src/interfaces/NotificationCategory.ts
0 → 100644
View file @
4e661458
export
interface
NotificationCategory
{
identifier
:
string
actions
:
[
NotificationAction
?];
}
export
interface
NotificationTextInput
{
buttonTitle
:
string
;
placeholder
:
string
;
}
export
interface
NotificationAction
{
identifier
:
string
;
activationMode
:
'
foreground
'
|
'
authenticationRequired
'
|
'
destructive
'
;
title
:
string
;
authenticationRequired
:
boolean
;
textInput
:
NotificationTextInput
}
\ No newline at end of file
lib/src/interfaces/NotificationCompletion.ts
0 → 100644
View file @
4e661458
export
interface
NotificationCompletion
{
badge
?:
boolean
;
alert
?:
boolean
;
sound
?:
boolean
;
}
lib/src/interfaces/NotificationEvents.ts
View file @
4e661458
import
{
Notification
,
NotificationActionResponse
}
from
'
./Notification
'
;
import
{
Notification
}
from
'
./Notification
'
;
import
{
NotificationActionResponse
}
from
'
./NotificationActionResponse
'
;
export
interface
Registered
{
deviceToken
:
string
;
...
...
lib/src/interfaces/NotificationPermissions.ts
0 → 100644
View file @
4e661458
export
interface
NotificationPermissions
{
badge
:
boolean
;
alert
:
boolean
;
sound
:
boolean
;
}
\ No newline at end of file
package.json
View file @
4e661458
...
...
@@ -33,7 +33,8 @@
"test-unit-ios"
:
"node ./scripts/test-unit --ios"
,
"test-unit-android"
:
"node ./scripts/test-unit --android"
,
"test-js"
:
"node ./scripts/test-js"
,
"xcode"
:
"open example/ios/NotificationsExampleApp.xcodeproj"
"xcode"
:
"open example/ios/NotificationsExampleApp.xcodeproj"
,
"androidStudio"
:
"open -a /Applications/Android
\\
Studio.app ./example/android"
},
"nativePackage"
:
true
,
"dependencies"
:
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment