diff --git a/README.md b/README.md index f6e12ed7..11bdc79c 100644 --- a/README.md +++ b/README.md @@ -5,6 +5,8 @@ You can inspect and modify views in iOS app via Lookin, just like UI Inspector i Official Website:https://lookin.work/ +Fork maintenance notes: [Imported Upstream Patches](UPSTREAM_PATCHES.md) + # Integration Guide To use Lookin macOS app, you need to integrate LookinServer (iOS Framework of Lookin) into your iOS project. diff --git a/Src/Main/Server/Connection/LKS_ConnectionManager.m b/Src/Main/Server/Connection/LKS_ConnectionManager.m index c1ec8fc1..bcc2dbc5 100644 --- a/Src/Main/Server/Connection/LKS_ConnectionManager.m +++ b/Src/Main/Server/Connection/LKS_ConnectionManager.m @@ -1,4 +1,4 @@ -#ifdef SHOULD_COMPILE_LOOKIN_SERVER +#ifdef SHOULD_COMPILE_LOOKIN_SERVER // // LookinServer.m @@ -39,6 +39,10 @@ + (instancetype)sharedInstance { } + (void)load { + if (NSProcessInfo.processInfo.environment[@"XCODE_RUNNING_FOR_PREVIEWS"]) { + return; + } + // 触发 init 方法 [LKS_ConnectionManager sharedInstance]; } diff --git a/Src/Main/Server/Others/LKS_ExportManager.m b/Src/Main/Server/Others/LKS_ExportManager.m index be040b9c..9c6cc0ff 100644 --- a/Src/Main/Server/Others/LKS_ExportManager.m +++ b/Src/Main/Server/Others/LKS_ExportManager.m @@ -95,7 +95,7 @@ @interface LKS_ExportManager () @property(nonatomic, strong) UIDocumentInteractionController *documentController; #endif -@property(nonatomic, strong) LKS_ExportManagerMaskView *maskView; +@property(nonatomic, strong) LKS_ExportManagerMaskView *lks_maskView; @end @@ -129,11 +129,11 @@ - (void)exportAndShare { [[NSNotificationCenter defaultCenter] postNotificationName:@"Lookin_WillExport" object:nil]; - if (!self.maskView) { - self.maskView = [LKS_ExportManagerMaskView new]; + if (!self.lks_maskView) { + self.lks_maskView = [LKS_ExportManagerMaskView new]; } - [visibleVc.view.window addSubview:self.maskView]; - self.maskView.frame = visibleVc.view.window.bounds; + [visibleVc.view.window addSubview:self.lks_maskView]; + self.lks_maskView.frame = visibleVc.view.window.bounds; dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ LookinHierarchyInfo *info = [LookinHierarchyInfo exportedInfo]; @@ -165,7 +165,7 @@ - (void)exportAndShare { NSString *path = [NSString stringWithFormat:@"%@%@", NSTemporaryDirectory(), fileName]; [data writeToFile:path atomically:YES]; - [self.maskView removeFromSuperview]; + [self.lks_maskView removeFromSuperview]; if (!self.documentController) { self.documentController = [UIDocumentInteractionController new]; diff --git a/Src/Main/Shared/Peertalk/Lookin_PTProtocol.m b/Src/Main/Shared/Peertalk/Lookin_PTProtocol.m index 72e85f8a..d18ca125 100644 --- a/Src/Main/Shared/Peertalk/Lookin_PTProtocol.m +++ b/Src/Main/Shared/Peertalk/Lookin_PTProtocol.m @@ -246,7 +246,7 @@ - (void)readPayloadOfSize:(size_t)payloadSize overChannel:(dispatch_io_t)channel __block dispatch_data_t allData = NULL; dispatch_io_read(channel, 0, payloadSize, queue_, ^(bool done, dispatch_data_t data, int error) { //NSLog(@"dispatch_io_read: done=%d data=%p error=%d", done, data, error); - size_t dataSize = dispatch_data_get_size(data); + size_t dataSize = data ? dispatch_data_get_size(data) : 0; if (dataSize) { if (!allData) { diff --git a/UPSTREAM_PATCHES.md b/UPSTREAM_PATCHES.md new file mode 100644 index 00000000..870dbb79 --- /dev/null +++ b/UPSTREAM_PATCHES.md @@ -0,0 +1,11 @@ +# Imported Upstream Patches + +This fork incorporates selected community pull requests that were not merged by the original project. Imported commits preserve the original author whenever possible. A listed pull request remains unmerged upstream unless its status is updated here. + +| Local commit | Upstream pull request | Original commit | Local adaptation | +| --- | --- | --- | --- | +| `ee11b92` | [QMUI/LookinServer#159](https://github.com/QMUI/LookinServer/pull/159) | `6db2bb1858865255f7fa6c5424d08b509a4b9190` | None. Renames the export overlay property to avoid the iOS 18 `maskView` collision. | +| `d9f34d9` | [QMUI/LookinServer#165](https://github.com/QMUI/LookinServer/pull/165) | `2377dc6cb63be48bc6aef825110e35e8a86bb9ec` | Uses an early return when running inside SwiftUI Previews. | +| `7929384` | [QMUI/LookinServer#173](https://github.com/QMUI/LookinServer/pull/173) | `cb1f9baeda8c294c758a0a131a63283efe103e8a` | Treats a null dispatch payload as zero bytes so the existing completion and error paths still run. | + +Large or cross-repository features are ported on dedicated branches instead of being applied directly. Every imported patch must build against the fork's current default branch before it is merged.