Removed unnamed constructors for all Singleton classes to avoid incorrect usage

This commit is contained in:
Lorenzo Pichilli 2022-10-19 02:42:23 +02:00
parent 652ee52c75
commit 486b3207a0
9 changed files with 33 additions and 9 deletions

View File

@ -44,6 +44,16 @@
- Removed `URLProtectionSpace.iosIsProxy` property
- `historyUrl` and `baseUrl` of `InAppWebViewInitialData` can be `null`
## 5.5.0+3
- Fixed iOS `toolbarTopTintColor` InAppBrowser option
- Fixed iOS `InAppBrowserOptions.hideProgressBar` when getting options
- Fixed missing implementation `InAppBrowser.isHidden` method on Android and iOS
- Fixed "Attempt to invoke virtual method 'java.lang.String android.webkit.WebView.getUrl()' on a null object reference" [#1324](https://github.com/pichillilorenzo/flutter_inappwebview/issues/1324)
- Fixed "(Crash) NullPointerException at in_app_browser.InAppBrowserActivity.close' on a null object reference" [#1278](https://github.com/pichillilorenzo/flutter_inappwebview/issues/1278)
- Fixed "ios system version parser error" [#1355](https://github.com/pichillilorenzo/flutter_inappwebview/issues/1355)
- Removed unnamed constructors for all Singleton classes to avoid incorrect usage
## 5.5.0+2
- Fixed README

View File

@ -37,7 +37,7 @@ public class InAppBrowserSettings: ISettings<InAppBrowserWebViewController> {
if let inAppBrowserWebViewController = obj {
realOptions["hidden"] = inAppBrowserWebViewController.isHidden
realOptions["hideUrlBar"] = inAppBrowserWebViewController.searchBar.isHidden
realOptions["progressBar"] = inAppBrowserWebViewController.progressBar.isHidden
realOptions["hideProgressBar"] = inAppBrowserWebViewController.progressBar.isHidden
realOptions["closeButtonCaption"] = inAppBrowserWebViewController.closeButton.title
realOptions["closeButtonColor"] = inAppBrowserWebViewController.closeButton.tintColor?.hexString
if let navController = inAppBrowserWebViewController.navigationController {

View File

@ -19,6 +19,8 @@ class ProxyController {
static const MethodChannel _channel = const MethodChannel(
'com.pichillilorenzo/flutter_inappwebview_proxycontroller');
ProxyController._();
///Gets the [ProxyController] shared instance.
///
///This method should only be called if [WebViewFeature.isFeatureSupported] returns `true` for [WebViewFeature.PROXY_OVERRIDE].
@ -35,7 +37,7 @@ class ProxyController {
print(e.stackTrace);
}
});
_instance = ProxyController();
_instance = ProxyController._();
return _instance!;
}

View File

@ -15,6 +15,8 @@ class ServiceWorkerController {
static const MethodChannel _channel = const MethodChannel(
'com.pichillilorenzo/flutter_inappwebview_serviceworkercontroller');
ServiceWorkerController._();
///Gets the [ServiceWorkerController] shared instance.
///
///This method should only be called if [WebViewFeature.isFeatureSupported] returns `true` for [WebViewFeature.SERVICE_WORKER_BASIC_USAGE].
@ -47,7 +49,7 @@ class ServiceWorkerController {
print(e.stackTrace);
}
});
_instance = ServiceWorkerController();
_instance = ServiceWorkerController._();
return _instance!;
}

View File

@ -27,6 +27,8 @@ class CookieManager {
static const MethodChannel _channel = const MethodChannel(
'com.pichillilorenzo/flutter_inappwebview_cookiemanager');
CookieManager._();
///Use [CookieManager] instead.
@Deprecated("Use CookieManager instead")
late IOSCookieManager ios;
@ -45,7 +47,7 @@ class CookieManager {
print(e.stackTrace);
}
});
_instance = CookieManager();
_instance = CookieManager._();
// ignore: deprecated_member_use_from_same_package
_instance!.ios = IOSCookieManager.instance();
return _instance!;
@ -542,8 +544,10 @@ class IOSCookieManager {
return (_instance != null) ? _instance! : _init();
}
IOSCookieManager._();
static IOSCookieManager _init() {
_instance = IOSCookieManager();
_instance = IOSCookieManager._();
return _instance!;
}

View File

@ -18,6 +18,8 @@ class HttpAuthCredentialDatabase {
static const MethodChannel _channel = const MethodChannel(
'com.pichillilorenzo/flutter_inappwebview_credential_database');
HttpAuthCredentialDatabase._();
///Gets the database shared instance.
static HttpAuthCredentialDatabase instance() {
return (_instance != null) ? _instance! : _init();
@ -32,7 +34,7 @@ class HttpAuthCredentialDatabase {
print(e.stackTrace);
}
});
_instance = HttpAuthCredentialDatabase();
_instance = HttpAuthCredentialDatabase._();
return _instance!;
}

View File

@ -6,6 +6,8 @@ class PlatformUtil {
static const MethodChannel _channel = const MethodChannel(
'com.pichillilorenzo/flutter_inappwebview_platformutil');
PlatformUtil._();
///Get [PlatformUtil] instance.
static PlatformUtil instance() {
return (_instance != null) ? _instance! : _init();
@ -20,7 +22,7 @@ class PlatformUtil {
print(e.stackTrace);
}
});
_instance = PlatformUtil();
_instance = PlatformUtil._();
return _instance!;
}

View File

@ -22,6 +22,8 @@ class WebStorageManager {
static WebStorageManager? _instance;
static const MethodChannel _staticChannel = WEB_STORAGE_STATIC_CHANNEL;
WebStorageManager._();
///Use [WebStorageManager] instead.
@Deprecated("Use WebStorageManager instead")
AndroidWebStorageManager android = AndroidWebStorageManager();
@ -44,7 +46,7 @@ class WebStorageManager {
print(e.stackTrace);
}
});
_instance = new WebStorageManager();
_instance = new WebStorageManager._();
return _instance!;
}

View File

@ -26,7 +26,7 @@ public class InAppBrowserSettings: ISettings<InAppBrowserWebViewController> {
if let inAppBrowserWebViewController = obj {
realOptions["hidden"] = inAppBrowserWebViewController.isHidden
realOptions["hideUrlBar"] = inAppBrowserWebViewController.window?.searchBar?.isHidden
realOptions["progressBar"] = inAppBrowserWebViewController.progressBar.isHidden
realOptions["hideProgressBar"] = inAppBrowserWebViewController.progressBar.isHidden
realOptions["hideToolbarTop"] = !(inAppBrowserWebViewController.window?.toolbar?.isVisible ?? true)
realOptions["toolbarTopBackgroundColor"] = inAppBrowserWebViewController.window?.backgroundColor.hexString
}