@@ -65,17 +65,20 @@ - (void)rightItemClick:(UIButton *)sender {
6565 }
6666 Class cls = NSClassFromString (self.webViewClass );
6767
68- UIViewController *customViewController = [LLConfig shared ].htmlViewControllerProvider (urlString);
69- if (customViewController && cls == [customViewController class ]) {
70- [LLSettingManager shared ].lastWebViewUrl = urlString;
71- [self .navigationController pushViewController: customViewController animated: YES ];
72- return ;
73- }
74-
7568#pragma clang diagnostic push
7669#pragma clang diagnostic ignored "-Wdeprecated-declarations"
7770 if (cls != [UIWebView class ] && cls != [WKWebView class ]) {
7871#pragma clang diagnostic pop
72+ if ([LLConfig shared ].htmlViewControllerProvider != nil ) {
73+ UIViewController *customViewController = [LLConfig shared ].htmlViewControllerProvider (urlString);
74+ if (customViewController && cls == [customViewController class ]) {
75+ [LLSettingManager shared ].lastWebViewUrl = urlString;
76+ [self .navigationController pushViewController: customViewController animated: YES ];
77+ return ;
78+ }
79+ [[LLToastUtils shared ] toastMessage: @" Provider custom webView failed." ];
80+ return ;
81+ }
7982 [[LLToastUtils shared ] toastMessage: @" Invalid webView class" ];
8083 return ;
8184 }
@@ -141,9 +144,11 @@ - (void)showWebViewClassAlert {
141144#pragma clang diagnostic ignored "-Wdeprecated-declarations"
142145 [actions addObject: NSStringFromClass ([UIWebView class ])];
143146#pragma clang diagnostic pop
144- UIViewController *vc = [LLConfig shared ].htmlViewControllerProvider (nil );
145- if (vc) {
146- [actions addObject: NSStringFromClass ([vc class ])];
147+ if ([LLConfig shared ].htmlViewControllerProvider != nil ) {
148+ UIViewController *vc = [LLConfig shared ].htmlViewControllerProvider (nil );
149+ if (vc) {
150+ [actions addObject: NSStringFromClass ([vc class ])];
151+ }
147152 }
148153 __weak typeof (self) weakSelf = self;
149154 [self LL_showActionSheetWithTitle: @" Web View Style" actions: actions currentAction: self .webViewClass completion: ^(NSInteger index) {
0 commit comments