Skip to content

Commit 9aa7b60

Browse files
committed
Bridging gap between Android and iOS
1 parent 2fc4e90 commit 9aa7b60

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

index.ios.js

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,26 @@ const emitter = new NativeEventEmitter(RNActivityRecognition);
66
var subscription = null;
77

88
var ActivityRecognition = {
9-
test: function() {
10-
RNActivityRecognition.echo()
11-
},
129
start: function(time: number) {
1310
RNActivityRecognition.startActivity(time);
1411
},
15-
subscribe: function(success: Function) {
12+
unsubscribe: function(success: Function) {
1613
subscription = emitter.addListener(
1714
"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+
}
1924
);
25+
return () => subscription.remove();
2026
},
2127
stop: function() {
2228
RNActivityRecognition.stopActivity();
23-
subscription = null;
2429
}
2530
}
2631

ios/RNActivityRecognition.m

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -69,11 +69,6 @@ - (void)activityManager
6969
}
7070
}
7171

72-
RCT_EXPORT_METHOD(echo)
73-
{
74-
RCTLogInfo(@"The code is strong on this side.");
75-
}
76-
7772
RCT_EXPORT_METHOD(startActivity:(float) time)
7873
{
7974
checkActivityConfig();

0 commit comments

Comments
 (0)