diff --git a/CHANGELOG.md b/CHANGELOG.md index 8eb3543..937e33f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +## [5.5.0] - 2024-09-09 + +### Added +* Web debugging server adds the function of generating QR code images from URL +* Browse object interface supports adding custom entry function +* Synchronize the latest trunk code of FLEX + ## [5.4.3] - 2024-08-27 ### Added diff --git a/CHANGELOG_CN.md b/CHANGELOG_CN.md index 42e844e..fb4708a 100644 --- a/CHANGELOG_CN.md +++ b/CHANGELOG_CN.md @@ -1,5 +1,12 @@ # 更新日志 +## [5.5.0] - 2024-09-09 + +### Added +* Web调试服务器新增URL生成二维码图片功能 +* 浏览对象界面支持新增自定义入口功能 +* 同步FLEX最新主干代码 + ## [5.4.3] - 2024-08-27 ### Added diff --git a/Example/Example/ObjectivecController.m b/Example/Example/ObjectivecController.m index c482d87..ec2bcfa 100644 --- a/Example/Example/ObjectivecController.m +++ b/Example/Example/ObjectivecController.m @@ -175,7 +175,7 @@ - (void)onWebView { WKWebView *webView = [[WKWebView alloc] initWithFrame:webController.view.bounds]; webView.allowsBackForwardNavigationGestures = YES; [webController.view addSubview:webView]; - [webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"https://www.wuyong.site/"]]]; + [webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"http://www.wuyong.site/"]]]; UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:webController]; navController.modalPresentationStyle = UIModalPresentationFullScreen; diff --git a/Example/Example/SwiftController.swift b/Example/Example/SwiftController.swift index 4b1800d..f734246 100644 --- a/Example/Example/SwiftController.swift +++ b/Example/Example/SwiftController.swift @@ -63,31 +63,54 @@ import CoreLocation chooseFileButton.frame = CGRect(x: self.view.frame.size.width / 2 - 100, y: 120, width: 200, height: 30) self.view.addSubview(chooseFileButton) + let requestImageButton = UIButton(type: .system) + requestImageButton.setTitle("Request Image", for: .normal) + requestImageButton.addTarget(self, action: #selector(onRequestImage), for: .touchUpInside) + requestImageButton.frame = CGRect(x: self.view.frame.size.width / 2 - 100, y: 170, width: 200, height: 30) + self.view.addSubview(requestImageButton) + let crashButton = UIButton(type: .system) crashButton.setTitle("Crash", for: .normal) crashButton.addTarget(self, action: #selector(onCrash), for: .touchUpInside) - crashButton.frame = CGRect(x: self.view.frame.size.width / 2 - 100, y: 170, width: 200, height: 30) + crashButton.frame = CGRect(x: self.view.frame.size.width / 2 - 100, y: 220, width: 200, height: 30) self.view.addSubview(crashButton) let nslogButton = UIButton(type: .system) nslogButton.setTitle("NSLog", for: .normal) nslogButton.addTarget(self, action: #selector(onNSLog), for: .touchUpInside) - nslogButton.frame = CGRect(x: self.view.frame.size.width / 2 - 100, y: 220, width: 200, height: 30) + nslogButton.frame = CGRect(x: self.view.frame.size.width / 2 - 100, y: 270, width: 200, height: 30) self.view.addSubview(nslogButton) let oslogButton = UIButton(type: .system) oslogButton.setTitle("OSLog", for: .normal) oslogButton.addTarget(self, action: #selector(onOSLog), for: .touchUpInside) - oslogButton.frame = CGRect(x: self.view.frame.size.width / 2 - 100, y: 270, width: 200, height: 30) + oslogButton.frame = CGRect(x: self.view.frame.size.width / 2 - 100, y: 320, width: 200, height: 30) self.view.addSubview(oslogButton) let imageView = UIImageView() self.imageView = imageView imageView.contentMode = .scaleAspectFit - imageView.frame = CGRect(x: self.view.frame.size.width / 2 - 50, y: 320, width: 100, height: 100) + imageView.frame = CGRect(x: self.view.frame.size.width / 2 - 50, y: 370, width: 100, height: 100) self.view.addSubview(imageView) } + // MARK: - Public + public static func registerCustomEntry() { + FWDebugManager.sharedInstance().registerEntry("📱 Custom Entry") { vc in + vc.dismiss(animated: true) { + print("Custom Entry clicked") + } + } + + FWDebugManager.sharedInstance().registerObjectEntry("Custom Entry", title: "Custom") { object in + return object is UIViewController + } actionBlock: { vc, object in + vc.dismiss(animated: true) { + print("Custom Entry clicked") + } + } + } + // MARK: - CLLocationManagerDelegate func locationManager(_ manager: CLLocationManager, didUpdateLocations locations: [CLLocation]) { //if let location = locations.last { @@ -144,6 +167,17 @@ import CoreLocation } } + func onRequestImage() { + let urlRequest = URLRequest(url: URL(string: "http://kvm.wuyong.site/images/images/progressive.jpg")!) + let dataTask = URLSession.shared.dataTask(with: urlRequest) { [weak self] data, _, _ in + guard let data = data else { return } + DispatchQueue.main.async { [weak self] in + self?.imageView?.image = UIImage(data: data) + } + } + dataTask.resume() + } + func onClose() { dismiss(animated: true) } diff --git a/Example/Example/ViewController.m b/Example/Example/ViewController.m index e54ef32..d54a489 100644 --- a/Example/Example/ViewController.m +++ b/Example/Example/ViewController.m @@ -20,6 +20,7 @@ @implementation ViewController - (void)viewDidLoad { [super viewDidLoad]; + [SwiftController registerCustomEntry]; self.title = @"Example"; self.edgesForExtendedLayout = UIRectEdgeNone; self.view.backgroundColor = [UIColor whiteColor]; diff --git a/FWDebug.podspec b/FWDebug.podspec index 111ff2f..120e96e 100644 --- a/FWDebug.podspec +++ b/FWDebug.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "FWDebug" - s.version = "5.4.3" + s.version = "5.5.0" s.summary = "ios debug library" s.homepage = "http://wuyong.site" s.license = "MIT" diff --git a/FWDebug/Assets/GCDWebUploader.bundle/Contents/Resources/js/url.js b/FWDebug/Assets/GCDWebUploader.bundle/Contents/Resources/js/url.js index 83e8fa6..5cbf43c 100644 --- a/FWDebug/Assets/GCDWebUploader.bundle/Contents/Resources/js/url.js +++ b/FWDebug/Assets/GCDWebUploader.bundle/Contents/Resources/js/url.js @@ -149,6 +149,16 @@ function _openUrl() { }); } +function _qrcodeUrl() { + var text = $("#input-url").val().trim(); + var url = "qrcode?text=" + encodeURIComponent(text); + + $("#image-title").text("Qrcode"); + $("#image-view").attr("src", url); + $("#copy-textarea").val(text); + $("#image-modal").modal("show"); +} + $(document).ready(function() { $("#share-confirm").click(function(event) { @@ -157,6 +167,19 @@ $(document).ready(function() { event.preventDefault(); }); + $("#image-confirm").click(function(event) { + $("#image-modal").modal("hide"); + _copyText(); + event.preventDefault(); + }); + + $("#image-open").click(function(event) { + $("#image-modal").modal("hide"); + var url = $("#image-view").attr("src"); + window.open(url + "&size=", "_blank"); + event.preventDefault(); + }); + $("#reload").click(function(event) { _reload(_path); event.preventDefault(); @@ -270,6 +293,11 @@ $(document).ready(function() { _openUrl(); event.preventDefault(); }); + + $("#qrcode-url").click(function(event) { + _qrcodeUrl(); + event.preventDefault(); + }); $("#select-type").val(_inputType); if (_inputType == "") { diff --git a/FWDebug/Assets/GCDWebUploader.bundle/Contents/Resources/url.html b/FWDebug/Assets/GCDWebUploader.bundle/Contents/Resources/url.html index 29c0f07..dd36c88 100644 --- a/FWDebug/Assets/GCDWebUploader.bundle/Contents/Resources/url.html +++ b/FWDebug/Assets/GCDWebUploader.bundle/Contents/Resources/url.html @@ -105,6 +105,9 @@