diff --git a/wpe/src/main/java/com/wpe/wpe/WKCookieManager.java b/wpe/src/main/java/com/wpe/wpe/WKCookieManager.java index 35b5e1ff3..3942bdf36 100644 --- a/wpe/src/main/java/com/wpe/wpe/WKCookieManager.java +++ b/wpe/src/main/java/com/wpe/wpe/WKCookieManager.java @@ -1,5 +1,7 @@ package com.wpe.wpe; +import androidx.annotation.NonNull; + public class WKCookieManager { public enum CookieAcceptPolicy { AcceptAlways(0), @@ -10,7 +12,7 @@ public enum CookieAcceptPolicy { CookieAcceptPolicy(int value) { this.value = value; } - private int getValue() { return value; } + int getValue() { return value; } } protected long nativePtr; @@ -19,9 +21,9 @@ public enum CookieAcceptPolicy { WKCookieManager(long nativePtr) { this.nativePtr = nativePtr; } - public CookieAcceptPolicy getCookieAcceptPolicy() { return cookieAcceptPolicy; } + public @NonNull CookieAcceptPolicy getCookieAcceptPolicy() { return cookieAcceptPolicy; } - public void setCookieAcceptPolicy(CookieAcceptPolicy policy) { + public void setCookieAcceptPolicy(@NonNull CookieAcceptPolicy policy) { cookieAcceptPolicy = policy; nativeSetCookieAcceptPolicy(nativePtr, policy.getValue()); } diff --git a/wpe/src/main/java/com/wpe/wpe/WKWebContext.java b/wpe/src/main/java/com/wpe/wpe/WKWebContext.java index 0e1ec0aed..42d339b7b 100644 --- a/wpe/src/main/java/com/wpe/wpe/WKWebContext.java +++ b/wpe/src/main/java/com/wpe/wpe/WKWebContext.java @@ -49,7 +49,7 @@ public void destroy() { public @NonNull WKWebsiteDataManager getWebsiteDataManager() { return websiteDataManager; } - public void setClient(Client client) { this.client = client; } + public void setClient(@Nullable Client client) { this.client = client; } @Keep private long createPageForAutomation() { diff --git a/wpe/src/main/java/com/wpe/wpe/WKWebsiteDataManager.java b/wpe/src/main/java/com/wpe/wpe/WKWebsiteDataManager.java index d329e15d8..5d843b65b 100644 --- a/wpe/src/main/java/com/wpe/wpe/WKWebsiteDataManager.java +++ b/wpe/src/main/java/com/wpe/wpe/WKWebsiteDataManager.java @@ -54,7 +54,7 @@ void destroy() { return cookieManager; } - public void clear(EnumSet websiteDataTypes, @Nullable Callback callback) { + public void clear(@NonNull EnumSet websiteDataTypes, @Nullable Callback callback) { int flags = websiteDataTypes.stream().map(WebsiteDataType::getValue).reduce(0, (x, y) -> x | y); if (flags != 0) { nativeClear(nativePtr, flags, new CallbackHolder(callback)); diff --git a/wpe/src/main/java/com/wpe/wpeview/WPEContext.java b/wpe/src/main/java/com/wpe/wpeview/WPEContext.java index 5f72b5943..7bcad20a2 100644 --- a/wpe/src/main/java/com/wpe/wpeview/WPEContext.java +++ b/wpe/src/main/java/com/wpe/wpeview/WPEContext.java @@ -5,7 +5,6 @@ import androidx.annotation.NonNull; import androidx.annotation.Nullable; -import com.wpe.wpe.Page; import com.wpe.wpe.WKWebContext; public class WPEContext { @@ -35,7 +34,7 @@ public WPEContext(@NonNull Context context, boolean automationMode) { return cookieManager; } - public void setClient(WPEContext.Client client) { + public void setClient(@Nullable WPEContext.Client client) { this.client = client; if (client != null) { diff --git a/wpe/src/main/java/com/wpe/wpeview/WPECookieManager.java b/wpe/src/main/java/com/wpe/wpeview/WPECookieManager.java index 17b219495..79811805d 100644 --- a/wpe/src/main/java/com/wpe/wpeview/WPECookieManager.java +++ b/wpe/src/main/java/com/wpe/wpeview/WPECookieManager.java @@ -19,6 +19,7 @@ package com.wpe.wpeview; +import androidx.annotation.NonNull; import androidx.annotation.Nullable; import com.wpe.wpe.WKCookieManager; @@ -53,11 +54,11 @@ public interface Callback { this.cookieManager = dataManager.getCookieManager(); } - public CookieAcceptPolicy getCookieAcceptPolicy() { + public @NonNull CookieAcceptPolicy getCookieAcceptPolicy() { return CookieAcceptPolicy.values()[cookieManager.getCookieAcceptPolicy().ordinal()]; } - public void setCookieAcceptPolicy(CookieAcceptPolicy policy) { + public void setCookieAcceptPolicy(@NonNull CookieAcceptPolicy policy) { cookieManager.setCookieAcceptPolicy(WKCookieManager.CookieAcceptPolicy.values()[policy.ordinal()]); }