File tree Expand file tree Collapse file tree 2 files changed +11
-11
lines changed Expand file tree Collapse file tree 2 files changed +11
-11
lines changed Original file line number Diff line number Diff line change @@ -6,21 +6,26 @@ const emitter = new NativeEventEmitter(RNActivityRecognition);
6
6
var subscription = null ;
7
7
8
8
var ActivityRecognition = {
9
- test : function ( ) {
10
- RNActivityRecognition . echo ( )
11
- } ,
12
9
start : function ( time : number ) {
13
10
RNActivityRecognition . startActivity ( time ) ;
14
11
} ,
15
- subscribe : function ( success : Function ) {
12
+ unsubscribe : function ( success : Function ) {
16
13
subscription = emitter . addListener (
17
14
"ActivityDetection" ,
18
- success
15
+ activity => {
16
+ success ( {
17
+ ...activity ,
18
+ get sorted ( ) {
19
+ return Object . keys ( activity )
20
+ . map ( type => ( { type : type , confidence : activity [ type ] } ) )
21
+ }
22
+ } )
23
+ }
19
24
) ;
25
+ return ( ) => subscription . remove ( ) ;
20
26
} ,
21
27
stop : function ( ) {
22
28
RNActivityRecognition . stopActivity ( ) ;
23
- subscription = null ;
24
29
}
25
30
}
26
31
Original file line number Diff line number Diff line change @@ -69,11 +69,6 @@ - (void)activityManager
69
69
}
70
70
}
71
71
72
- RCT_EXPORT_METHOD (echo)
73
- {
74
- RCTLogInfo (@" The code is strong on this side." );
75
- }
76
-
77
72
RCT_EXPORT_METHOD (startActivity:(float ) time)
78
73
{
79
74
checkActivityConfig ();
You can’t perform that action at this time.
0 commit comments