Skip to content

Commit

Permalink
style: fix lint issues
Browse files Browse the repository at this point in the history
  • Loading branch information
nattb8 committed Jun 25, 2023
1 parent 0cf7dd4 commit 14d89dc
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 12 deletions.
6 changes: 6 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
root = true

# Treat everything in ThirdParty as generated code so
# analysers don't analyse it
[src/Packages/Passport/Runtime/Assets/ThirdParty/**]
generated_code = true
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@

namespace Immutable.Passport.Auth
{
public interface IAuthManager
public interface IAuthManager
{
public UniTask<string?> Login();
public void Logout();
public UniTask<User> ConfirmCode();
public User? GetUser();
public bool HasCredentialsSaved();

}
public class AuthManager : IAuthManager
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
namespace Immutable.Passport.Core
{
public delegate void OnBrowserReadyDelegate();

public interface IBrowserCommunicationsManager
{
public void SetCallTimeout(int ms);
Expand Down Expand Up @@ -57,7 +57,7 @@ public UniTask<string> Call(string fxName, string? data = null)
requestTaskMap.Add(requestId, t);
CallFunction(requestId, fxName, data);
return t.Task
.Timeout(TimeSpan.FromMilliseconds(callTimeout));;
.Timeout(TimeSpan.FromMilliseconds(callTimeout)); ;
}

private void CallFunction(string requestId, string fxName, string? data = null)
Expand Down Expand Up @@ -94,7 +94,8 @@ private void HandleResponse(string message)
}

// Special case to detect if index.js is loaded
if (response.responseFor == INIT && response.requestId == INIT_REQUEST_ID) {
if (response.responseFor == INIT && response.requestId == INIT_REQUEST_ID)
{
Debug.Log($"{TAG} Browser is ready");
OnReady?.Invoke();
return;
Expand Down
11 changes: 6 additions & 5 deletions src/Packages/Passport/Runtime/Assets/Scripts/Passport.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public static UniTask<Passport> Init()
Instance = new Passport();
Instance.Initialise();
}
else
else
{
readySignalReceived = true;
}
Expand All @@ -65,7 +65,8 @@ public static UniTask<Passport> Init()
});
}

private async void Initialise() {
private async void Initialise()
{
try
{
BrowserCommunicationsManager communicationsManager = new(webBrowserClient);
Expand Down Expand Up @@ -95,7 +96,7 @@ private void OnQuit()
/// Sets the timeout time for` waiting for each call to respond (in milliseconds).
/// This only applies to functions that uses the browser communications manager.
/// </summary>
public void SetCallTimeout(int ms)
public void SetCallTimeout(int ms)
{
GetPassportImpl().communicationsManager.SetCallTimeout(ms);
}
Expand All @@ -113,12 +114,12 @@ public void SetCallTimeout(int ms)
return await GetPassportImpl().Connect();
}

public async UniTask ConfirmCode()
public async UniTask ConfirmCode()
{
await GetPassportImpl().ConfirmCode();
}

public async UniTask<string?> GetAddress()
public async UniTask<string?> GetAddress()
{
return await GetPassportImpl().GetAddress();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,8 @@ public bool HasValidCredentials()
}
}

private bool IsTokenValid(string jwt) {
private bool IsTokenValid(string jwt)
{
Debug.Log($"{TAG} Decoding {jwt}...");
string? token = JwtUtility.DecodeJwt(jwt);
if (token == null)
Expand All @@ -83,7 +84,7 @@ private bool IsTokenValid(string jwt) {
TokenPayload? tokenPayload = JsonConvert.DeserializeObject<TokenPayload>(token);
long expiresAt = tokenPayload?.exp ?? 0;
Debug.Log($"{TAG} Token expires (UTC seconds): {expiresAt}");

long now = GetCurrentTimeSeconds() + VALID_CREDENTIALS_MIN_TTL_SEC;
Debug.Log($"{TAG} Time now (UTC seconds): {now}");

Expand Down

0 comments on commit 14d89dc

Please sign in to comment.