refactor(ios): 替换NSLog为SGGC_Log进行统一日志记录

This commit is contained in:
2026-01-15 14:48:05 +08:00
parent bd44518b74
commit d72b9fd94a

View File

@@ -2,6 +2,7 @@
#import <Cordova/CDV.h>
#import <WebKit/WebKit.h>
#import "SGGC_Log.h"
@interface ShutoApi : CDVPlugin <NSObject> {
// ID
@@ -27,7 +28,7 @@
NSString *jsString = @"window.postMessage('closeApp', '*')";
[wkWebView evaluateJavaScript:jsString completionHandler:^(id _Nullable result, NSError * _Nullable error) {
if (error) {
NSLog(@"执行关闭JS方法失败: %@", error.localizedDescription);
[SGGC_Log log:@"SGGC_CDVFile" message:(@"执行关闭JS方法失败: %@", error.localizedDescription)];
}
}];
}
@@ -36,22 +37,22 @@
if (self.viewController.navigationController) {
// push使popViewController
[self.viewController.navigationController popViewControllerAnimated:YES];
NSLog(@"从导航栈弹出视图控制器完成");
[SGGC_Log log:@"SGGC_CDVFile" message:(@"从导航栈弹出视图控制器完成")];
} else if (self.viewController.presentingViewController) {
// 使dismiss
[self.viewController dismissViewControllerAnimated:YES completion:^{
NSLog(@"关闭当前视图控制器完成");
[SGGC_Log log:@"SGGC_CDVFile" message:(@"关闭当前视图控制器完成")];
}];
} else if (self.viewController.parentViewController) {
//
[self.viewController willMoveToParentViewController:nil];
[self.viewController.view removeFromSuperview];
[self.viewController removeFromParentViewController];
NSLog(@"从父视图控制器移除视图控制器完成");
[SGGC_Log log:@"SGGC_CDVFile" message:(@"从父视图控制器移除视图控制器完成")];
} else {
//
[self.viewController.view removeFromSuperview];
NSLog(@"从父视图移除视图控制器的视图完成");
[SGGC_Log log:@"SGGC_CDVFile" message:(@"从父视图移除视图控制器的视图完成")];
}
CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK];
@@ -87,16 +88,16 @@
//
if (userInfo) {
_userInfo = userInfo;
NSLog(@"ShutoApi: User info set successfully: %@", userInfo);
[SGGC_Log log:@"SGGC_CDVFile" message:(@"ShutoApi: User info set successfully: %@", userInfo)];
} else {
NSLog(@"ShutoApi: Invalid user info provided");
[SGGC_Log log:@"SGGC_CDVFile" message:(@"ShutoApi: Invalid user info provided")];
}
}
//
- (void)navigateToRoute:(NSString*)route parameters:(NSDictionary*)parameters {
if (!_eventCallbackId) {
NSLog(@"ShutoApi: No event callback registered");
[SGGC_Log log:@"SGGC_CDVFile" message:(@"ShutoApi: No event callback registered")];
return;
}