Skip to content

Commit

Permalink
[wpe] Fix linter issues
Browse files Browse the repository at this point in the history
  • Loading branch information
Jani HautakangaS committed Mar 10, 2024
1 parent fbe1b7e commit ec75478
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 9 deletions.
8 changes: 5 additions & 3 deletions wpe/src/main/java/com/wpe/wpe/WKCookieManager.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package com.wpe.wpe;

import androidx.annotation.NonNull;

public class WKCookieManager {
public enum CookieAcceptPolicy {
AcceptAlways(0),
Expand All @@ -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;
Expand All @@ -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());
}
Expand Down
2 changes: 1 addition & 1 deletion wpe/src/main/java/com/wpe/wpe/WKWebContext.java
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
2 changes: 1 addition & 1 deletion wpe/src/main/java/com/wpe/wpe/WKWebsiteDataManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ void destroy() {
return cookieManager;
}

public void clear(EnumSet<WebsiteDataType> websiteDataTypes, @Nullable Callback callback) {
public void clear(@NonNull EnumSet<WebsiteDataType> 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));
Expand Down
3 changes: 1 addition & 2 deletions wpe/src/main/java/com/wpe/wpeview/WPEContext.java
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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) {
Expand Down
5 changes: 3 additions & 2 deletions wpe/src/main/java/com/wpe/wpeview/WPECookieManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

package com.wpe.wpeview;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import com.wpe.wpe.WKCookieManager;
Expand Down Expand Up @@ -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()]);
}

Expand Down

0 comments on commit ec75478

Please sign in to comment.