Skip to content

Commit 6070810

Browse files
authored
Merge pull request #3 from reason-react-native/fix-finish-binding
Fix finish/FetchResult binding.
2 parents debde3e + 17e1564 commit 6070810

File tree

2 files changed

+21
-11
lines changed

2 files changed

+21
-11
lines changed
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
'use strict';
22

33

4+
var FetchResult = { };
5+
46
var $$Notification = { };
57

8+
exports.FetchResult = FetchResult;
69
exports.$$Notification = $$Notification;
710
/* No side effect */

src/ReactNativePushNotificationIOS.re

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
module FetchResult = {
2+
type t;
3+
4+
[@bs.module "@react-native-community/push-notification-ios"]
5+
[@bs.scope ("default", "FetchResult")]
6+
external newData: t = "NewData";
7+
8+
[@bs.module "@react-native-community/push-notification-ios"]
9+
[@bs.scope ("default", "FetchResult")]
10+
external noData: t = "NoData";
11+
12+
[@bs.module "@react-native-community/push-notification-ios"]
13+
[@bs.scope ("default", "FetchResult")]
14+
external resultFailed: t = "ResultFailed";
15+
};
16+
117
module Notification = {
218
type t;
319

@@ -24,6 +40,8 @@ module Notification = {
2440

2541
[@bs.send] [@bs.return nullable]
2642
external getThreadID: t => option(string) = "getThreadID";
43+
44+
[@bs.send] external finish: (t, FetchResult.t) => unit = "finish";
2745
};
2846

2947
type localNotification;
@@ -206,17 +224,6 @@ external abandonPermissions: unit => unit = "abandonPermissions";
206224
[@bs.scope "default"]
207225
external checkPermissions: (unit => permissions) => unit = "checkPermissions";
208226

209-
type fetchResult;
210-
[@bs.obj]
211-
external fetchResult:
212-
(~_NewData: string=?, ~_NoData: string=?, ~_ResultFailed: string=?, unit) =>
213-
fetchResult =
214-
"";
215-
216-
[@bs.module "@react-native-community/push-notification-ios"]
217-
[@bs.scope "default"]
218-
external finish: fetchResult => unit = "fetchResult";
219-
220227
[@bs.module "@react-native-community/push-notification-ios"]
221228
[@bs.scope "default"]
222229
external getInitialNotification:

0 commit comments

Comments
 (0)