ios start using lightweight generics
This commit is contained in:
parent
f298b2a95d
commit
defd529dc2
|
@ -1,10 +1,9 @@
|
|||
# OSX
|
||||
#
|
||||
.DS_Store
|
||||
|
||||
# Xcode
|
||||
#
|
||||
build/
|
||||
!**/*.xcodeproj
|
||||
!**/*.pbxproj
|
||||
!**/*.xcworkspacedata
|
||||
!**/*.xcsettings
|
||||
!**/*.xcscheme
|
||||
*.pbxuser
|
||||
!default.pbxuser
|
||||
*.mode1v3
|
||||
|
@ -22,13 +21,19 @@ DerivedData
|
|||
*.xcuserstate
|
||||
project.xcworkspace
|
||||
|
||||
# Android/IJ
|
||||
#
|
||||
# Xcode, Gradle
|
||||
build/
|
||||
|
||||
# Android
|
||||
.idea
|
||||
.gradle
|
||||
local.properties
|
||||
*.iml
|
||||
|
||||
# node.js
|
||||
#
|
||||
node_modules/
|
||||
npm-debug.log
|
||||
# Node
|
||||
node_modules
|
||||
*.log
|
||||
.nvm
|
||||
|
||||
# OS X
|
||||
.DS_Store
|
||||
|
|
|
@ -21,7 +21,7 @@ NSString *const RCTUDPErrorDomain = @"RCTUDPErrorDomain";
|
|||
NSString* _address;
|
||||
GCDAsyncUdpSocket *_udpSocket;
|
||||
id<SocketClientDelegate> _clientDelegate;
|
||||
NSMutableDictionary* _pendingSends;
|
||||
NSMutableDictionary<NSNumber *, RCTResponseSenderBlock> *_pendingSends;
|
||||
long tag;
|
||||
}
|
||||
|
||||
|
|
|
@ -16,6 +16,6 @@
|
|||
|
||||
@interface UdpSockets : NSObject<SocketClientDelegate, RCTBridgeModule>
|
||||
|
||||
+(NSMutableDictionary *)clients;
|
||||
+(NSMutableDictionary<NSNumber *, UdpSocketClient *> *)clients;
|
||||
|
||||
@end
|
||||
|
|
|
@ -44,7 +44,7 @@ RCT_EXPORT_METHOD(createSocket:(nonnull NSNumber*)cId withOptions:(NSDictionary*
|
|||
{
|
||||
// if (!UdpSockets._clients) UdpSockets._clients = [[NSMutableDictionary alloc] init];
|
||||
|
||||
NSMutableDictionary* _clients = [UdpSockets clients];
|
||||
NSMutableDictionary<NSNumber *, UdpSocketClient *> *_clients = [UdpSockets clients];
|
||||
if (!cId) {
|
||||
RCTLogError(@"%@.createSocket called with nil id parameter.", [self class]);
|
||||
return;
|
||||
|
@ -126,8 +126,8 @@ RCT_EXPORT_METHOD(dropMembership:(nonnull NSNumber*)cId
|
|||
|
||||
- (void) onData:(UdpSocketClient*) client data:(NSData *)data host:(NSString *)host port:(uint16_t)port
|
||||
{
|
||||
NSMutableDictionary* _clients = [UdpSockets clients];
|
||||
NSString *clientID = [[_clients allKeysForObject:client] objectAtIndex:0];
|
||||
NSMutableDictionary<NSNumber *, UdpSocketClient *> *_clients = [UdpSockets clients];
|
||||
NSNumber *clientID = [[_clients allKeysForObject:client] objectAtIndex:0];
|
||||
NSString *base64String = [data base64EncodedStringWithOptions:0];
|
||||
[self.bridge.eventDispatcher sendDeviceEventWithName:[NSString stringWithFormat:@"udp-%@-data", clientID]
|
||||
body:@{
|
||||
|
@ -140,7 +140,7 @@ RCT_EXPORT_METHOD(dropMembership:(nonnull NSNumber*)cId
|
|||
|
||||
+(UdpSocketClient*)findClient:(nonnull NSNumber*)cId callback:(RCTResponseSenderBlock)callback
|
||||
{
|
||||
NSMutableDictionary* _clients = [UdpSockets clients];
|
||||
NSMutableDictionary<NSNumber *, UdpSocketClient *> *_clients = [UdpSockets clients];
|
||||
UdpSocketClient *client = [_clients objectForKey:cId];
|
||||
if (!client) {
|
||||
if (!callback) {
|
||||
|
@ -159,7 +159,7 @@ RCT_EXPORT_METHOD(dropMembership:(nonnull NSNumber*)cId
|
|||
+(void) closeClient:(nonnull NSNumber*)cId
|
||||
callback:(RCTResponseSenderBlock)callback
|
||||
{
|
||||
NSMutableDictionary* _clients = [UdpSockets clients];
|
||||
NSMutableDictionary<NSNumber *, UdpSocketClient *> *_clients = [UdpSockets clients];
|
||||
UdpSocketClient* client = [UdpSockets findClient:cId callback:callback];
|
||||
if (!client) return;
|
||||
|
||||
|
@ -170,7 +170,7 @@ RCT_EXPORT_METHOD(dropMembership:(nonnull NSNumber*)cId
|
|||
}
|
||||
|
||||
+(void) closeAllSockets {
|
||||
NSMutableDictionary* _clients = [UdpSockets clients];
|
||||
NSMutableDictionary<NSNumber *, UdpSocketClient *> *_clients = [UdpSockets clients];
|
||||
for (NSNumber* cId in _clients) {
|
||||
[UdpSockets closeClient:cId callback:nil];
|
||||
}
|
||||
|
|
Binary file not shown.
Loading…
Reference in New Issue