Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update to ios13 requirements #34

Open
wants to merge 18 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
.vscode/
lib/
types/
Checkouts/

# OSX
Expand Down
1 change: 0 additions & 1 deletion .npmignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
.git/
.vscode/
.tscache/
src/
Checkouts/

tsconfig.json
Expand Down
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.

### [0.1.10](https://github.com/davesters/rn-native-mqtt/compare/v0.1.8...v0.1.10) (2022-02-02)

### [0.1.8](https://github.com/davesters/rn-native-mqtt/compare/v0.1.7...v0.1.8) (2020-06-26)

### [0.1.7](https://github.com/davesters/rn-native-mqtt/compare/v0.1.6...v0.1.7) (2020-06-04)
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# React Native - Native MQTT

**Minimum deployment target updated to 13.0 for ios.**

This is an MQTT client library for React Native. It utilizes native MQTT client libraries and exposes them via a unified Javascript interface. There are a few other React Native MQTT libraries, but they did not seem to work as expected, or did not support more advanced TLS configurations.

NOTE: This is currently tested only on React Native 0.60 and above using the automatic linking functionality.
Expand Down
5 changes: 3 additions & 2 deletions ios/Libraries/CocoaAsyncSocket/GCDAsyncSocket.m
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
#import <sys/uio.h>
#import <sys/un.h>
#import <unistd.h>
#import <PushKit/PushKit.h>

#if ! __has_feature(objc_arc)
#warning This file must be compiled with ARC. Use -fobjc-arc flag (or convert project to ARC).
Expand Down Expand Up @@ -8110,8 +8111,8 @@ - (BOOL)enableBackgroundingOnSocketWithCaveat:(BOOL)caveat

LogVerbose(@"Enabling backgrouding on socket");

r1 = CFReadStreamSetProperty(readStream, kCFStreamNetworkServiceType, kCFStreamNetworkServiceTypeVoIP);
r2 = CFWriteStreamSetProperty(writeStream, kCFStreamNetworkServiceType, kCFStreamNetworkServiceTypeVoIP);
r1 = CFReadStreamSetProperty(readStream, kCFStreamNetworkServiceType, PKPushTypeVoIP);
r2 = CFWriteStreamSetProperty(writeStream, kCFStreamNetworkServiceType, PKPushTypeVoIP);

if (!r1 || !r2)
{
Expand Down
9 changes: 6 additions & 3 deletions ios/Libraries/CocoaMQTT/CocoaMQTTTypes.swift
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,15 @@ extension UInt8 {
}

public enum CocoaMQTTError: Error {

@available(OSX 10.15, iOS 13.0, watchOS 6.0, tvOS 13.0, *)
enum FoundationConnection : Error {
case closed(URLSessionWebSocketTask.CloseCode)
}

case invalidURL
case readTimeout
case writeTimeout

@available(OSX 10.15, iOS 13.0, watchOS 6.0, tvOS 13.0, *)
case closed(URLSessionWebSocketTask.CloseCode)
}

extension Array where Element == UInt8 {
Expand Down
2 changes: 1 addition & 1 deletion ios/Libraries/CocoaMQTT/CocoaMQTTWebSocket.swift
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ extension CocoaMQTTWebSocket.FoundationConnection: URLSessionWebSocketDelegate {

public func urlSession(_ session: URLSession, webSocketTask: URLSessionWebSocketTask, didCloseWith closeCode: URLSessionWebSocketTask.CloseCode, reason: Data?) {
queue.async {
self.delegate?.connectionClosed(self, withError: CocoaMQTTError.closed(closeCode))
self.delegate?.connectionClosed(self, withError: CocoaMQTTError.FoundationConnection.closed(closeCode))
}
}
}
Expand Down
6 changes: 3 additions & 3 deletions ios/NativeMqtt-Bridging-Header.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
#import <React/RCTBridgeModule.h>
#import <React/RCTEventEmitter.h>

#import "Libraries/CocoaMQTT/CocoaMQTT.h"
#import "Libraries/CocoaAsyncSocket/GCDAsyncSocket.h"
#import "Libraries/CocoaAsyncSocket/GCDAsyncUdpSocket.h"
#import "CocoaMQTT.h"
#import "GCDAsyncSocket.h"
#import "GCDAsyncUdpSocket.h"
4 changes: 2 additions & 2 deletions ios/NativeMqtt.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -660,7 +660,7 @@
"$(SRCROOT)/../../../React/**",
"$(SRCROOT)/../../react-native/React/**",
);
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
LIBRARY_SEARCH_PATHS = "$(inherited)";
OTHER_LDFLAGS = "-ObjC";
Expand All @@ -683,7 +683,7 @@
"$(SRCROOT)/../../../React/**",
"$(SRCROOT)/../../react-native/React/**",
);
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
LIBRARY_SEARCH_PATHS = "$(inherited)";
OTHER_LDFLAGS = "-ObjC";
Expand Down
137 changes: 137 additions & 0 deletions lib/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions lib/index.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading