Skip to content

[DX-2959] fix: throw an error if provider is not set #218

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -89,3 +89,6 @@ src/Packages/Passport/Runtime/Assets/ImmutableAndroid.androidlib/**/*.meta
src/Packages/Passport/Runtime/ThirdParty/Gree/Assets/Plugins/WebView.bundle/**/*.meta

*.idea

# Code coverage
sample/ProjectSettings/Packages/com.unity.testtools.codecoverage/Settings.json
65 changes: 50 additions & 15 deletions sample/Assets/Scripts/AuthenticatedScript.cs
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ public async void Connect()
// Use existing credentials to connect to Passport
ShowOutput("Connecting into Passport using saved credentials...");
ConnectButton.gameObject.SetActive(false);
bool connected = await passport.ConnectImx();
bool connected = await passport.ConnectImx(useCachedSession: true);
if (connected)
{
IsRegisteredOffchainButton.gameObject.SetActive(true);
Expand Down Expand Up @@ -186,39 +186,74 @@ public async void GetAddress()

public async void Logout()
{
ShowOutput("Logging out...");
try
{
ShowOutput("Logging out...");
#if (UNITY_ANDROID && !UNITY_EDITOR_WIN) || (UNITY_IPHONE && !UNITY_EDITOR_WIN) || UNITY_STANDALONE_OSX
await passport.LogoutPKCE();
await passport.LogoutPKCE();
#else
await passport.Logout();
await passport.Logout();
#endif
SampleAppManager.IsConnected = false;
passport.OnAuthEvent -= OnPassportAuthEvent;
SceneManager.LoadScene(sceneName: "UnauthenticatedScene");
SampleAppManager.IsConnected = false;
passport.OnAuthEvent -= OnPassportAuthEvent;
SceneManager.LoadScene(sceneName: "UnauthenticatedScene");
}
catch (Exception ex)
{
ShowOutput($"Failed to log out: {ex.Message}");
}
}

public async void GetAccessToken()
{
string accessToken = await passport.GetAccessToken();
ShowOutput(accessToken ?? "No access token");
try
{
string accessToken = await passport.GetAccessToken();
ShowOutput(accessToken);
}
catch (Exception ex)
{
ShowOutput($"Failed to get ID token: {ex.Message}");
}
}

public async void GetIdToken()
{
string idToken = await passport.GetIdToken();
ShowOutput(idToken ?? "No ID token");
try
{
string idToken = await passport.GetIdToken();
ShowOutput(idToken);
}
catch (Exception ex)
{
ShowOutput($"Failed to get ID token: {ex.Message}");
}
}

public async void GetEmail()
{
string email = await passport.GetEmail();
ShowOutput(email ?? "No email");
try
{
string email = await passport.GetEmail();
ShowOutput(email);
}
catch (Exception ex)
{
ShowOutput($"Failed to get email: {ex.Message}");
}
}

public async void GetPassportId()
{
string passportId = await passport.GetPassportId();
ShowOutput(passportId ?? "No Passport ID");
try
{
string passportId = await passport.GetPassportId();
ShowOutput(passportId);
}
catch (Exception ex)
{
ShowOutput($"Failed to get Passport ID: {ex.Message}");
}
}

public void ShowTransfer()
Expand Down
10 changes: 4 additions & 6 deletions sample/Assets/Scripts/UnauthenticatedScript.cs
Original file line number Diff line number Diff line change
Expand Up @@ -130,15 +130,14 @@ public async void Relogin()
}
else
{
ShowOutput($"Could not login using saved credentials");
ClearStorageAndCache();

ShowOutput($"Could not login using saved credentials");
}
}
catch (Exception ex)
{
ShowOutput($"Relogin() error: {ex.Message}");
ClearStorageAndCache();
ShowOutput($"Relogin() error: {ex.Message}");
}
}

Expand Down Expand Up @@ -201,15 +200,14 @@ public async void Reconnect()
}
else
{
ShowOutput($"Could not connect using saved credentials");
ClearStorageAndCache();

ShowOutput($"Could not connect using saved credentials");
}
}
catch (Exception ex)
{
ShowOutput($"Reconnect() error: {ex.Message}");
ClearStorageAndCache();
ShowOutput($"Reconnect() error: {ex.Message}");
}
}

Expand Down
2 changes: 1 addition & 1 deletion sample/Packages/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,4 @@
]
}
]
}
}

This file was deleted.

58 changes: 17 additions & 41 deletions sample/ProjectSettings/ProjectSettings.asset
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
--- !u!129 &1
PlayerSettings:
m_ObjectHideFlags: 0
serializedVersion: 26
serializedVersion: 24
productGUID: 23782f6f9e1e0cd4fab77e7d94090ba2
AndroidProfiler: 0
AndroidFilterTouchesWhenObscured: 0
Expand Down Expand Up @@ -48,16 +48,14 @@ PlayerSettings:
defaultScreenHeightWeb: 600
m_StereoRenderingPath: 0
m_ActiveColorSpace: 0
unsupportedMSAAFallback: 0
m_SpriteBatchVertexThreshold: 300
m_MTRendering: 1
mipStripping: 0
numberOfMipsStripped: 0
numberOfMipsStrippedPerMipmapLimitGroup: {}
m_StackTraceTypes: 010000000100000001000000010000000100000001000000
iosShowActivityIndicatorOnLoading: -1
androidShowActivityIndicatorOnLoading: -1
iosUseCustomAppBackgroundBehavior: 0
iosAllowHTTPDownload: 1
allowedAutorotateToPortrait: 1
allowedAutorotateToPortraitUpsideDown: 1
allowedAutorotateToLandscapeRight: 1
Expand All @@ -76,7 +74,6 @@ PlayerSettings:
androidMinimumWindowWidth: 400
androidMinimumWindowHeight: 300
androidFullscreenMode: 1
androidAutoRotationBehavior: 1
defaultIsNativeResolution: 1
macRetinaSupport: 0
runInBackground: 0
Expand All @@ -88,7 +85,6 @@ PlayerSettings:
hideHomeButton: 0
submitAnalytics: 1
usePlayerLog: 1
dedicatedServerOptimizations: 0
bakeCollisionMeshes: 0
forceSingleInstance: 0
useFlipModelSwapchain: 1
Expand Down Expand Up @@ -123,20 +119,21 @@ PlayerSettings:
switchNVNShaderPoolsGranularity: 33554432
switchNVNDefaultPoolsGranularity: 16777216
switchNVNOtherPoolsGranularity: 16777216
switchGpuScratchPoolGranularity: 2097152
switchAllowGpuScratchShrinking: 0
switchNVNMaxPublicTextureIDCount: 0
switchNVNMaxPublicSamplerIDCount: 0
switchNVNGraphicsFirmwareMemory: 32
switchMaxWorkerMultiple: 8
stadiaPresentMode: 0
stadiaTargetFramerate: 0
vulkanNumSwapchainBuffers: 3
vulkanEnableSetSRGBWrite: 0
vulkanEnablePreTransform: 0
vulkanEnableLateAcquireNextImage: 0
vulkanEnableCommandBufferRecycling: 1
loadStoreDebugModeEnabled: 0
m_SupportedAspectRatios:
4:3: 1
5:4: 1
16:10: 1
16:9: 1
Others: 1
bundleVersion: 1.0
preloadedAssets: []
metroInputSource: 0
Expand All @@ -149,9 +146,8 @@ PlayerSettings:
isWsaHolographicRemotingEnabled: 0
enableFrameTimingStats: 0
enableOpenGLProfilerGPURecorders: 1
allowHDRDisplaySupport: 0
useHDRDisplay: 0
hdrBitDepth: 0
D3DHDRBitDepth: 0
m_ColorGamuts: 00000000
targetPixelDensity: 30
resolutionScalingMode: 0
Expand Down Expand Up @@ -180,15 +176,12 @@ PlayerSettings:
APKExpansionFiles: 0
keepLoadedShadersAlive: 0
StripUnusedMeshComponents: 0
strictShaderVariantMatching: 0
VertexChannelCompressionMask: 4054
iPhoneSdkVersion: 988
iOSTargetOSVersionString: 13.0
tvOSSdkVersion: 0
tvOSRequireExtendedGameController: 0
tvOSTargetOSVersionString: 12.0
VisionOSSdkVersion: 0
VisionOSTargetOSVersionString: 1.0
uIPrerenderedIcon: 0
uIRequiresPersistentWiFi: 0
uIRequiresFullScreen: 1
Expand Down Expand Up @@ -237,10 +230,8 @@ PlayerSettings:
appleDeveloperTeamID:
iOSManualSigningProvisioningProfileID:
tvOSManualSigningProvisioningProfileID:
VisionOSManualSigningProvisioningProfileID:
iOSManualSigningProvisioningProfileType: 0
tvOSManualSigningProvisioningProfileType: 0
VisionOSManualSigningProvisioningProfileType: 0
appleEnableAutomaticSigning: 0
iOSRequireARKit: 0
iOSAutomaticallyDetectAndAddCapabilities: 1
Expand All @@ -255,15 +246,13 @@ PlayerSettings:
useCustomLauncherGradleManifest: 0
useCustomBaseGradleTemplate: 0
useCustomGradlePropertiesTemplate: 0
useCustomGradleSettingsTemplate: 0
useCustomProguardFile: 1
AndroidTargetArchitectures: 2
AndroidTargetDevices: 0
AndroidSplashScreenScale: 0
androidSplashScreen: {fileID: 0}
AndroidKeystoreName:
AndroidKeyaliasName:
AndroidEnableArmv9SecurityFeatures: 0
AndroidBuildApkPerCpuArchitecture: 0
AndroidTVCompatibility: 0
AndroidIsGame: 1
Expand All @@ -277,6 +266,7 @@ PlayerSettings:
banner: {fileID: 0}
androidGamepadSupportLevel: 0
chromeosInputEmulation: 1
AndroidMinifyWithR8: 0
AndroidMinifyRelease: 0
AndroidMinifyDebug: 0
AndroidValidateAppBundleSize: 1
Expand Down Expand Up @@ -521,9 +511,7 @@ PlayerSettings:
iPhone: 1
tvOS: 1
m_BuildTargetGroupLightmapEncodingQuality: []
m_BuildTargetGroupHDRCubemapEncodingQuality: []
m_BuildTargetGroupLightmapSettings: []
m_BuildTargetGroupLoadStoreDebugModeSettings: []
m_BuildTargetNormalMapEncoding: []
m_BuildTargetDefaultTextureCompressionFormat:
- m_BuildTarget: Android
Expand All @@ -538,19 +526,17 @@ PlayerSettings:
locationUsageDescription:
microphoneUsageDescription:
bluetoothUsageDescription:
macOSTargetOSVersion: 10.13.0
switchNMETAOverride:
switchNetLibKey:
switchSocketMemoryPoolSize: 6144
switchSocketAllocatorPoolSize: 128
switchSocketConcurrencyLimit: 14
switchScreenResolutionBehavior: 2
switchUseCPUProfiler: 0
switchEnableFileSystemTrace: 0
switchUseGOLDLinker: 0
switchLTOSetting: 0
switchApplicationID: 0x01004b9000490000
switchNSODependencies:
switchCompilerFlags:
switchTitleNames_0:
switchTitleNames_1:
switchTitleNames_2:
Expand Down Expand Up @@ -676,6 +662,7 @@ PlayerSettings:
switchSocketBufferEfficiency: 4
switchSocketInitializeEnabled: 1
switchNetworkInterfaceManagerInitializeEnabled: 1
switchPlayerConnectionEnabled: 1
switchUseNewStyleFilepaths: 0
switchUseLegacyFmodPriorities: 1
switchUseMicroSleepForYield: 1
Expand Down Expand Up @@ -765,7 +752,6 @@ PlayerSettings:
webGLMemorySize: 32
webGLExceptionSupport: 1
webGLNameFilesAsHashes: 0
webGLShowDiagnostics: 0
webGLDataCaching: 1
webGLDebugSymbols: 0
webGLEmscriptenArgs:
Expand All @@ -778,12 +764,6 @@ PlayerSettings:
webGLLinkerTarget: 1
webGLThreadsSupport: 0
webGLDecompressionFallback: 0
webGLInitialMemorySize: 32
webGLMaximumMemorySize: 2048
webGLMemoryGrowthMode: 2
webGLMemoryLinearGrowthStep: 16
webGLMemoryGeometricGrowthStep: 0.2
webGLMemoryGeometricGrowthCap: 96
webGLPowerPreference: 2
scriptingDefineSymbols: {}
additionalCompilerArguments:
Expand All @@ -794,7 +774,6 @@ PlayerSettings:
Android: 1
Standalone: 0
il2cppCompilerConfiguration: {}
il2cppCodeGeneration: {}
managedStrippingLevel:
EmbeddedLinux: 1
GameCoreScarlett: 1
Expand All @@ -813,9 +792,12 @@ PlayerSettings:
suppressCommonWarnings: 1
allowUnsafeCode: 0
useDeterministicCompilation: 1
enableRoslynAnalyzers: 1
selectedPlatform: 0
additionalIl2CppArgs:
scriptingRuntimeVersion: 1
gcIncremental: 1
assemblyVersionValidation: 1
gcWBarrierValidation: 0
apiCompatibilityLevelPerPlatform: {}
m_RenderingPath: 1
Expand Down Expand Up @@ -887,11 +869,6 @@ PlayerSettings:
luminVersion:
m_VersionCode: 1
m_VersionName:
hmiPlayerDataPath:
hmiForceSRGBBlit: 1
embeddedLinuxEnableGamepadInput: 1
hmiLogStartupTiming: 0
hmiCpuConfiguration:
apiCompatibilityLevel: 6
activeInputHandler: 0
windowsGamepadBackendHint: 0
Expand All @@ -902,7 +879,6 @@ PlayerSettings:
organizationId:
cloudEnabled: 0
legacyClampBlendShapeWeights: 0
hmiLoadingImage: {fileID: 0}
platformRequiresReadableAssets: 0
playerDataPath:
forceSRGBBlit: 1
virtualTexturingSupportEnabled: 0
insecureHttpOption: 0
Loading
Loading