From defd529dc2ec6470df235316fe4687cb9a30674c Mon Sep 17 00:00:00 2001 From: Andy Prock Date: Wed, 16 Dec 2015 11:47:43 -0800 Subject: [PATCH] ios start using lightweight generics --- .gitignore | 29 ++++++++++-------- ios/UdpSocketClient.m | 2 +- ios/UdpSockets.h | 2 +- ios/UdpSockets.m | 12 ++++---- .../UserInterfaceState.xcuserstate | Bin 9872 -> 0 bytes 5 files changed, 25 insertions(+), 20 deletions(-) delete mode 100644 ios/UdpSockets.xcodeproj/project.xcworkspace/xcuserdata/aprock.xcuserdatad/UserInterfaceState.xcuserstate diff --git a/.gitignore b/.gitignore index 94fc867..c4b7a9b 100644 --- a/.gitignore +++ b/.gitignore @@ -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 diff --git a/ios/UdpSocketClient.m b/ios/UdpSocketClient.m index 4181eae..ba0be3a 100644 --- a/ios/UdpSocketClient.m +++ b/ios/UdpSocketClient.m @@ -21,7 +21,7 @@ NSString *const RCTUDPErrorDomain = @"RCTUDPErrorDomain"; NSString* _address; GCDAsyncUdpSocket *_udpSocket; id _clientDelegate; - NSMutableDictionary* _pendingSends; + NSMutableDictionary *_pendingSends; long tag; } diff --git a/ios/UdpSockets.h b/ios/UdpSockets.h index 487174d..6d5e7a8 100644 --- a/ios/UdpSockets.h +++ b/ios/UdpSockets.h @@ -16,6 +16,6 @@ @interface UdpSockets : NSObject -+(NSMutableDictionary *)clients; ++(NSMutableDictionary *)clients; @end diff --git a/ios/UdpSockets.m b/ios/UdpSockets.m index feb6677..dd66c35 100644 --- a/ios/UdpSockets.m +++ b/ios/UdpSockets.m @@ -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 *_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 *_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 *_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 *_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 *_clients = [UdpSockets clients]; for (NSNumber* cId in _clients) { [UdpSockets closeClient:cId callback:nil]; } diff --git a/ios/UdpSockets.xcodeproj/project.xcworkspace/xcuserdata/aprock.xcuserdatad/UserInterfaceState.xcuserstate b/ios/UdpSockets.xcodeproj/project.xcworkspace/xcuserdata/aprock.xcuserdatad/UserInterfaceState.xcuserstate deleted file mode 100644 index d2a2239f4a35576c5dcc2338bd04e7d18337853f..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 9872 zcmbtZ30zcF)W7$>Sr}%VjoIJK0|m=c76B2|lw}|-MP&d5)Nz0(jsioopt$7GGA*;z z%FN6J%%!r;w7qP%)wRVIGuz87%goI3yKf#dFn-$4-}k}q$1v}nd(OG%p5=eet8HoY z27(zG2N6aDF-U@>NXFDL^%GNCd4Is`Yo3_mtDV8u1p`$n9)I0*FMV8|67;p`5x!}| zquR4bj^a=PG9V-Bi!MW#qkiZLbS3JK($OH4gNC7eur(Q)((`W2l*f1=Y^g?nK&)?h8xVLeX325iJ8Y{nLB z#Wu|1RGfy>aRwfUGjSHq#)EJk9*f7}@wg1Ta5=8Pm3RW4h^w#8^j8u|pQbQ(@sl-ES z$u!bH0whR6q?ODfH;^02VsaB%LT(`|$V#%BtS9%A4P*=1N**MSk;lmn@*LSkc9XZr z+hjjEKn{{m$QR^0@;&*LoFIRZGvse_mQgXi7&W6|w2Y3?GZx0mBr-`%Z>A5^k4a;) znOtT#<77rNW0+E=l9|9vWTrA6rnVxbIn>yA04Y#BQX&=7ApL|=SK3UzEl^EAyPT#n zrLNHv2y~!cNDTy-4x~jokU%x`c54lzoW&D-{+WRmPaW^{)rFe)=Ac`flAYnq8I)6y znVM0QQ<$2aS6q;qn_HNhT39qVHzOx+a8_2HGa}f894KWIG9wGJA{%0n9i$)wImCei z;x{1fFMbe0UD<1o)*8aZf1Isubxk*V(Nmag4k9*HB{e{?)3%IE9zTZl!6Zi z(q`9DDoQ^ieLotEa#0={QZ3$6v!{ulDE`X_DoS1Sa2<4c=)_Xj*l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