diff --git a/.gitignore b/.gitignore index b07e3754f..9f0850be5 100644 --- a/.gitignore +++ b/.gitignore @@ -24,3 +24,4 @@ DerivedData extern/ *.pyc +.build \ No newline at end of file diff --git a/Package.swift b/Package.swift new file mode 100644 index 000000000..9f01b9f14 --- /dev/null +++ b/Package.swift @@ -0,0 +1,42 @@ +// swift-tools-version:5.3 +import PackageDescription + +let package = Package( + name: "SocketRocket", + platforms: [.iOS(.v9)], + products: [ + .library( + name: "SocketRocket", + targets: ["SocketRocket"] + ), + ], + dependencies: [ + // Dependencies declare other packages that this package depends on. + // .package(url: /* package url */, from: "1.0.0"), + ], + targets: [ + .target( + name: "SocketRocket", + path: "SocketRocket", + exclude: ["Resources"], // Исключите ненужные файлы или директории + sources: [".", "Internal"], // Указание исходных файлов + publicHeadersPath: "include", // Все публичные заголовки должны быть перемещены в 'include' + cSettings: [ + .headerSearchPath("."), + .headerSearchPath("Internal"), + .headerSearchPath("Internal/Delegate"), + .headerSearchPath("Internal/IOConsumer"), + .headerSearchPath("Internal/Proxy"), + .headerSearchPath("Internal/RunLoop"), + .headerSearchPath("Internal/Security"), + .headerSearchPath("Internal/Utilities") + ], + linkerSettings: [ + .linkedFramework("CFNetwork", .when(platforms: [.iOS, .tvOS])), + .linkedFramework("Security"), + .linkedFramework("CoreServices", .when(platforms: [.macOS])), + .linkedLibrary("icucore") + ] + ) + ] +) diff --git a/SocketRocket/Internal/Delegate/SRDelegateController.h b/SocketRocket/Internal/Delegate/SRDelegateController.h index 43634a120..a1a3adb99 100644 --- a/SocketRocket/Internal/Delegate/SRDelegateController.h +++ b/SocketRocket/Internal/Delegate/SRDelegateController.h @@ -9,7 +9,8 @@ #import -#import +// #import +#import "SRWebSocket.h" NS_ASSUME_NONNULL_BEGIN diff --git a/SocketRocket/Internal/NSRunLoop+SRWebSocketPrivate.h b/SocketRocket/Internal/NSRunLoop+SRWebSocketPrivate.h index 098f7a818..df51baa36 100644 --- a/SocketRocket/Internal/NSRunLoop+SRWebSocketPrivate.h +++ b/SocketRocket/Internal/NSRunLoop+SRWebSocketPrivate.h @@ -7,7 +7,7 @@ // of patent rights can be found in the PATENTS file in the same directory. // -#import - +// #import +#import "NSRunLoop+SRWebSocket.h" // Empty function that force links the object file for the category. extern void import_NSRunLoop_SRWebSocket(void); diff --git a/SocketRocket/Internal/NSURLRequest+SRWebSocketPrivate.h b/SocketRocket/Internal/NSURLRequest+SRWebSocketPrivate.h index b09dde420..290cd7749 100644 --- a/SocketRocket/Internal/NSURLRequest+SRWebSocketPrivate.h +++ b/SocketRocket/Internal/NSURLRequest+SRWebSocketPrivate.h @@ -7,7 +7,7 @@ // of patent rights can be found in the PATENTS file in the same directory. // -#import - +// #import +#import "NSURLRequest+SRWebSocket.h" // Empty function that force links the object file for the category. extern void import_NSURLRequest_SRWebSocket(void); diff --git a/SocketRocket/Internal/Security/SRPinningSecurityPolicy.h b/SocketRocket/Internal/Security/SRPinningSecurityPolicy.h index 0d498b211..af7b06110 100644 --- a/SocketRocket/Internal/Security/SRPinningSecurityPolicy.h +++ b/SocketRocket/Internal/Security/SRPinningSecurityPolicy.h @@ -9,7 +9,8 @@ #import -#import +// #import +#import "SRSecurityPolicy.h" NS_ASSUME_NONNULL_BEGIN diff --git a/SocketRocket/Internal/Utilities/SRLog.m b/SocketRocket/Internal/Utilities/SRLog.m index 459601781..529ab9b73 100644 --- a/SocketRocket/Internal/Utilities/SRLog.m +++ b/SocketRocket/Internal/Utilities/SRLog.m @@ -20,7 +20,7 @@ extern void SRErrorLog(NSString *format, ...) va_end(arg_list); - NSLog(@"[SocketRocket] %@", formattedString); + // NSLog(@"[SocketRocket] %@", formattedString); } extern void SRDebugLog(NSString *format, ...) diff --git a/SocketRocket/include/SocketRocket.h b/SocketRocket/include/SocketRocket.h new file mode 100644 index 000000000..4572c1334 --- /dev/null +++ b/SocketRocket/include/SocketRocket.h @@ -0,0 +1,15 @@ +// +// Copyright 2012 Square Inc. +// Portions Copyright (c) 2016-present, Facebook, Inc. +// +// All rights reserved. +// +// This source code is licensed under the BSD-style license found in the +// LICENSE file in the root directory of this source tree. An additional grant +// of patent rights can be found in the PATENTS file in the same directory. +// + + #import "../NSRunLoop+SRWebSocket.h" + #import "../NSURLRequest+SRWebSocket.h" + #import "../SRSecurityPolicy.h" + #import "../SRWebSocket.h" diff --git a/TestChat/TCViewController.m b/TestChat/TCViewController.m index 1f79f7e55..a96247feb 100644 --- a/TestChat/TCViewController.m +++ b/TestChat/TCViewController.m @@ -9,7 +9,8 @@ #import "TCViewController.h" -#import +// #import +#import "SocketRocket.h" #import "TCChatCell.h" @@ -142,13 +143,13 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N - (void)webSocketDidOpen:(SRWebSocket *)webSocket; { - NSLog(@"Websocket Connected"); + // NSLog(@"Websocket Connected"); self.title = @"Connected!"; } - (void)webSocket:(SRWebSocket *)webSocket didFailWithError:(NSError *)error; { - NSLog(@":( Websocket Failed With Error %@", error); + // NSLog(@":( Websocket Failed With Error %@", error); self.title = @"Connection Failed! (see logs)"; _webSocket = nil; @@ -156,20 +157,20 @@ - (void)webSocket:(SRWebSocket *)webSocket didFailWithError:(NSError *)error; - (void)webSocket:(SRWebSocket *)webSocket didReceiveMessageWithString:(nonnull NSString *)string { - NSLog(@"Received \"%@\"", string); + // NSLog(@"Received \"%@\"", string); [self _addMessage:[[TCMessage alloc] initWithMessage:string incoming:YES]]; } - (void)webSocket:(SRWebSocket *)webSocket didCloseWithCode:(NSInteger)code reason:(NSString *)reason wasClean:(BOOL)wasClean; { - NSLog(@"WebSocket closed"); + // NSLog(@"WebSocket closed"); self.title = @"Connection Closed! (see logs)"; _webSocket = nil; } - (void)webSocket:(SRWebSocket *)webSocket didReceivePong:(NSData *)pongPayload; { - NSLog(@"WebSocket received pong"); + // NSLog(@"WebSocket received pong"); } ///-------------------------------------- diff --git a/Tests/Operations/SRTWebSocketOperation.h b/Tests/Operations/SRTWebSocketOperation.h index c4d53c2c3..0d6fea3c0 100644 --- a/Tests/Operations/SRTWebSocketOperation.h +++ b/Tests/Operations/SRTWebSocketOperation.h @@ -9,7 +9,8 @@ // of patent rights can be found in the PATENTS file in the same directory. // -#import +// #import +#import "SRWebSocket.h" @interface SRTWebSocketOperation : NSOperation diff --git a/Tests/SRAutobahnTests.m b/Tests/SRAutobahnTests.m index cc9fc17f7..b6b3068f3 100644 --- a/Tests/SRAutobahnTests.m +++ b/Tests/SRAutobahnTests.m @@ -12,7 +12,8 @@ @import XCTest; @import ObjectiveC; -#import +// #import +#import "SRWebSocket.h" #import "SRTWebSocketOperation.h" #import "SRAutobahnOperation.h" diff --git a/create_symlinks.sh b/create_symlinks.sh new file mode 100755 index 000000000..6cd450b6e --- /dev/null +++ b/create_symlinks.sh @@ -0,0 +1,27 @@ +#!/bin/bash + +if [ "$#" -ne 1 ]; then + echo "Usage: $0 /path/to" + exit 1 +fi + +SOURCE_DIR=$1 +INCLUDE_DIR="$SOURCE_DIR/include" + +mkdir -p "$INCLUDE_DIR" + +find "$SOURCE_DIR" -type f -name "*.h" | while read -r file; do + filename=$(basename "$file") + symlink_path="$INCLUDE_DIR/$filename" + if [ ! -e "$symlink_path" ]; then + ln -s "../$file" "$symlink_path" + # cp "$file" "$symlink_path" + echo "Создана ссылка для: $file" + # Выводим исходный путь файла, на который ссылка указывает + echo "Исходный путь: $file" + else + echo "Ссылка для $file уже существует" + fi +done + +echo "Обработка завершена."