Skip to content

Commit 2d1117d

Browse files
committed
Removed deprecated RCTEventDispatcher & cleanup
1 parent fc9b1b2 commit 2d1117d

File tree

19 files changed

+118
-168
lines changed

19 files changed

+118
-168
lines changed

index.android.js

Lines changed: 0 additions & 13 deletions
This file was deleted.

index.ios.js

Lines changed: 0 additions & 15 deletions
This file was deleted.

index.js

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
import { Platform } from "react-native"
2-
import RNRabbitMqIos from "./index.ios.js"
3-
import RNRabbitMqAndroid from "./index.android.js"
4-
5-
const RNRabbitMq = Platform.OS === "ios" ? RNRabbitMqIos : RNRabbitMqAndroid
6-
7-
export default RNRabbitMq
1+
export { Connection } from './lib/Connection';
2+
export { Queue } from './lib/Queue';
3+
export { Exchange } from './lib/Exchange';

ios/RCTReactNativeRabbitMq.xcodeproj/project.pbxproj

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,10 @@
77
objects = {
88

99
/* Begin PBXBuildFile section */
10-
5D72D2EC1C16249000E22EC1 /* RCTReactNativeRabbitMq.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 5D72D2EB1C16249000E22EC1 /* RCTReactNativeRabbitMq.h */; };
11-
5D72D2EE1C16249000E22EC1 /* RCTReactNativeRabbitMq.m in Sources */ = {isa = PBXBuildFile; fileRef = 5D72D2ED1C16249000E22EC1 /* RCTReactNativeRabbitMq.m */; };
1210
E82757861DD4899200DEF92C /* RabbitMqConnection.m in Sources */ = {isa = PBXBuildFile; fileRef = E82757851DD4899200DEF92C /* RabbitMqConnection.m */; };
1311
E82757A61DD4CEDF00DEF92C /* RabbitMqQueue.m in Sources */ = {isa = PBXBuildFile; fileRef = E82757A51DD4CEDF00DEF92C /* RabbitMqQueue.m */; };
1412
E84EF0841DDB5832000F141B /* RabbitMqDelegateLogger.m in Sources */ = {isa = PBXBuildFile; fileRef = E84EF0831DDB5832000F141B /* RabbitMqDelegateLogger.m */; };
13+
E8547EE0227C7A0C008ABBC5 /* EventEmitter.m in Sources */ = {isa = PBXBuildFile; fileRef = E8547EDF227C7A0C008ABBC5 /* EventEmitter.m */; };
1514
/* End PBXBuildFile section */
1615

1716
/* Begin PBXCopyFilesBuildPhase section */
@@ -21,22 +20,21 @@
2120
dstPath = "include/$(PRODUCT_NAME)";
2221
dstSubfolderSpec = 16;
2322
files = (
24-
5D72D2EC1C16249000E22EC1 /* RCTReactNativeRabbitMq.h in CopyFiles */,
2523
);
2624
runOnlyForDeploymentPostprocessing = 0;
2725
};
2826
/* End PBXCopyFilesBuildPhase section */
2927

3028
/* Begin PBXFileReference section */
3129
5D72D2E81C16249000E22EC1 /* libRCTReactNativeRabbitMq.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libRCTReactNativeRabbitMq.a; sourceTree = BUILT_PRODUCTS_DIR; };
32-
5D72D2EB1C16249000E22EC1 /* RCTReactNativeRabbitMq.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RCTReactNativeRabbitMq.h; sourceTree = "<group>"; };
33-
5D72D2ED1C16249000E22EC1 /* RCTReactNativeRabbitMq.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RCTReactNativeRabbitMq.m; sourceTree = "<group>"; };
3430
E82757841DD4899200DEF92C /* RabbitMqConnection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RabbitMqConnection.h; sourceTree = "<group>"; };
3531
E82757851DD4899200DEF92C /* RabbitMqConnection.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RabbitMqConnection.m; sourceTree = "<group>"; };
3632
E82757A41DD4CEDF00DEF92C /* RabbitMqQueue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RabbitMqQueue.h; sourceTree = "<group>"; };
3733
E82757A51DD4CEDF00DEF92C /* RabbitMqQueue.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RabbitMqQueue.m; sourceTree = "<group>"; };
3834
E84EF0821DDB5832000F141B /* RabbitMqDelegateLogger.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RabbitMqDelegateLogger.h; sourceTree = "<group>"; };
3935
E84EF0831DDB5832000F141B /* RabbitMqDelegateLogger.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RabbitMqDelegateLogger.m; sourceTree = "<group>"; };
36+
E8547EDE227C7A0C008ABBC5 /* EventEmitter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EventEmitter.h; sourceTree = "<group>"; };
37+
E8547EDF227C7A0C008ABBC5 /* EventEmitter.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = EventEmitter.m; sourceTree = "<group>"; };
4038
/* End PBXFileReference section */
4139

4240
/* Begin PBXFrameworksBuildPhase section */
@@ -69,14 +67,14 @@
6967
5D72D2EA1C16249000E22EC1 /* RCTReactNativeRabbitMq */ = {
7068
isa = PBXGroup;
7169
children = (
70+
E8547EDE227C7A0C008ABBC5 /* EventEmitter.h */,
71+
E8547EDF227C7A0C008ABBC5 /* EventEmitter.m */,
7272
E84EF0821DDB5832000F141B /* RabbitMqDelegateLogger.h */,
7373
E84EF0831DDB5832000F141B /* RabbitMqDelegateLogger.m */,
7474
E82757A41DD4CEDF00DEF92C /* RabbitMqQueue.h */,
7575
E82757A51DD4CEDF00DEF92C /* RabbitMqQueue.m */,
7676
E82757841DD4899200DEF92C /* RabbitMqConnection.h */,
7777
E82757851DD4899200DEF92C /* RabbitMqConnection.m */,
78-
5D72D2EB1C16249000E22EC1 /* RCTReactNativeRabbitMq.h */,
79-
5D72D2ED1C16249000E22EC1 /* RCTReactNativeRabbitMq.m */,
8078
);
8179
path = RCTReactNativeRabbitMq;
8280
sourceTree = "<group>";
@@ -138,9 +136,9 @@
138136
buildActionMask = 2147483647;
139137
files = (
140138
E84EF0841DDB5832000F141B /* RabbitMqDelegateLogger.m in Sources */,
141-
5D72D2EE1C16249000E22EC1 /* RCTReactNativeRabbitMq.m in Sources */,
142139
E82757861DD4899200DEF92C /* RabbitMqConnection.m in Sources */,
143140
E82757A61DD4CEDF00DEF92C /* RabbitMqQueue.m in Sources */,
141+
E8547EE0227C7A0C008ABBC5 /* EventEmitter.m in Sources */,
144142
);
145143
runOnlyForDeploymentPostprocessing = 0;
146144
};

ios/RCTReactNativeRabbitMq.xcodeproj/xcuserdata/timhonders.xcuserdatad/xcschemes/xcschememanagement.plist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<key>RCTReactNativeRabbitMq.xcscheme</key>
88
<dict>
99
<key>orderHint</key>
10-
<integer>6</integer>
10+
<integer>5</integer>
1111
</dict>
1212
</dict>
1313
<key>SuppressBuildableAutocreation</key>
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#import <React/RCTBridgeModule.h>
2+
#import <React/RCTEventEmitter.h>
3+
4+
@interface EventEmitter : RCTEventEmitter <RCTBridgeModule>
5+
6+
+ (void)emitEventWithName:(NSString *)name body:(NSDictionary *)body;
7+
8+
@end
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
#import "EventEmitter.h"
2+
3+
@implementation EventEmitter
4+
5+
RCT_EXPORT_MODULE();
6+
7+
- (NSArray<NSString *> *)supportedEvents {
8+
return @[@"RabbitMqQueueEvent", @"RabbitMqConnectionEvent"];
9+
}
10+
11+
12+
- (void)startObserving {
13+
NSNotificationCenter *center = [NSNotificationCenter defaultCenter];
14+
for (NSString *notificationName in [self supportedEvents]) {
15+
[center addObserver:self
16+
selector:@selector(emitEventInternal:)
17+
name:notificationName
18+
object:nil];
19+
}
20+
}
21+
22+
- (void)stopObserving {
23+
[[NSNotificationCenter defaultCenter] removeObserver:self];
24+
}
25+
26+
- (void)emitEventInternal:(NSNotification *)notification {
27+
[self sendEventWithName:notification.name
28+
body:notification.userInfo];
29+
}
30+
31+
+ (void)emitEventWithName:(NSString *)name body:(NSDictionary *)body {
32+
[[NSNotificationCenter defaultCenter] postNotificationName:name
33+
object:self
34+
userInfo:body];
35+
}
36+
37+
38+
@end

ios/RCTReactNativeRabbitMq/RCTReactNativeRabbitMq.h

Lines changed: 0 additions & 12 deletions
This file was deleted.

ios/RCTReactNativeRabbitMq/RCTReactNativeRabbitMq.m

Lines changed: 0 additions & 26 deletions
This file was deleted.

ios/RCTReactNativeRabbitMq/RabbitMqConnection.h

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,11 @@
1-
2-
#ifdef OLDER_IMPORT
3-
#import "RCTBridge.h"
4-
#import "RCTEventDispatcher.h"
5-
#else
6-
#import <React/RCTBridgeModule.h>
7-
#import <React/RCTEventDispatcher.h>
8-
#endif
1+
#import <React/RCTBridgeModule.h>
92

103
#import <RMQClient/RMQClient.h>
114
#import <RMQClient/RMQChannel.h>
5+
126
#import "RabbitMqQueue.h"
137
#import "RabbitMqDelegateLogger.h"
8+
#import "EventEmitter.h"
149

1510
@interface RabbitMqConnection : NSObject <RCTBridgeModule>
1611

0 commit comments

Comments
 (0)