Skip to content

Commit

Permalink
Add support for networkUrl
Browse files Browse the repository at this point in the history
  • Loading branch information
chaitanyapotti committed Oct 5, 2022
1 parent 017529c commit 6041cda
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
11 changes: 9 additions & 2 deletions sdk/src/main/java/org/torusresearch/customauth/CustomAuth.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import org.torusresearch.fetchnodedetails.FetchNodeDetails;
import org.torusresearch.fetchnodedetails.types.NodeDetails;
import org.torusresearch.torusutils.TorusUtils;
import org.torusresearch.torusutils.helpers.Utils;
import org.torusresearch.torusutils.types.RetrieveSharesResponse;
import org.torusresearch.torusutils.types.TorusCtorOptions;
import org.torusresearch.torusutils.types.TorusPublicKey;
Expand All @@ -36,7 +37,6 @@
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Objects;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ForkJoinPool;

Expand All @@ -48,7 +48,14 @@ public class CustomAuth {

public CustomAuth(CustomAuthArgs _customAuthArgs, Context context) {
this.customAuthArgs = _customAuthArgs;
this.nodeDetailManager = new FetchNodeDetails(_customAuthArgs.getNetwork(), CustomAuthArgs.CONTRACT_MAP.get(_customAuthArgs.getNetwork()));
if (Utils.isEmpty(_customAuthArgs.getNetworkUrl())) {
this.nodeDetailManager = new FetchNodeDetails(_customAuthArgs.getNetwork(),
CustomAuthArgs.CONTRACT_MAP.get(_customAuthArgs.getNetwork()));
} else {
this.nodeDetailManager = new FetchNodeDetails(_customAuthArgs.getNetworkUrl(),
CustomAuthArgs.CONTRACT_MAP.get(_customAuthArgs.getNetwork()));
}

TorusCtorOptions opts = new TorusCtorOptions(context.getPackageName());
opts.setEnableOneKey(_customAuthArgs.isEnableOneKey());
opts.setNetwork(_customAuthArgs.getNetwork().toString());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ public class CustomAuthArgs {
private String redirectUri;
private TorusNetwork network;
private boolean enableOneKey;
private String networkUrl;


public CustomAuthArgs(String browserRedirectUri, TorusNetwork network, String _redirectUri) {
Expand Down Expand Up @@ -70,4 +71,12 @@ public boolean isEnableOneKey() {
public void setEnableOneKey(boolean enableOneKey) {
this.enableOneKey = enableOneKey;
}

public String getNetworkUrl() {
return networkUrl;
}

public void setNetworkUrl(String networkUrl) {
this.networkUrl = networkUrl;
}
}

0 comments on commit 6041cda

Please sign in to comment.