Skip to content

Commit

Permalink
Support payloadSize option on iOS (#111)
Browse files Browse the repository at this point in the history
* Support payloadSize option on iOS

* Update peer dependencies
  • Loading branch information
benletchford authored Sep 15, 2023
1 parent 2f80221 commit 1863c83
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 6 additions & 0 deletions ios/RNReactNativePing.m
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ - (dispatch_queue_t)methodQueue
) {
__block GBPing * ping = [[GBPing alloc] init];
ping.timeout = 1.0;
ping.payloadSize = 56;
ping.pingPeriod = 0.9;
ping.host = ipAddress;
NSNumber *nsTimeout = option[@"timeout"];
Expand All @@ -37,6 +38,11 @@ - (dispatch_queue_t)methodQueue
ping.timeout = timeout;
}

NSNumber *nsPayloadSize = option[@"payloadSize"];
if (nsPayloadSize) {
unsigned long long payloadSize = nsPayloadSize.unsignedLongLongValue;
ping.payloadSize = payloadSize;
}

[ping setupWithBlock:^(BOOL success, NSError *_Nullable err) {
if (!success) {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@
"author": "[email protected]",
"license": "MIT",
"peerDependencies": {
"react-native": "^0.41.2 || ^0.57.0 || ^0.68.0"
"react-native": "^0.41.2 || ^0.57.0 || ^0.68.0 || ^0.70.0"
}
}

0 comments on commit 1863c83

Please sign in to comment.