diff --git a/Explorer/Assets/DCL/AuthenticationScreenFlow.meta b/Explorer/Assets/DCL/AuthenticationScreenFlow.meta new file mode 100644 index 0000000000..62ebef9f16 --- /dev/null +++ b/Explorer/Assets/DCL/AuthenticationScreenFlow.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 83ad38ffbfba4467be1b416d5b0407f5 +timeCreated: 1703084565 \ No newline at end of file diff --git a/Explorer/Assets/DCL/AuthenticationScreenFlow/Assets.meta b/Explorer/Assets/DCL/AuthenticationScreenFlow/Assets.meta new file mode 100644 index 0000000000..494c6ed739 --- /dev/null +++ b/Explorer/Assets/DCL/AuthenticationScreenFlow/Assets.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: cbbfe5a4d445a4723b1c6b4c1be2e849 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Explorer/Assets/DCL/AuthenticationScreenFlow/Assets/AuthenticationScreen.prefab b/Explorer/Assets/DCL/AuthenticationScreenFlow/Assets/AuthenticationScreen.prefab new file mode 100644 index 0000000000..3cf037c486 --- /dev/null +++ b/Explorer/Assets/DCL/AuthenticationScreenFlow/Assets/AuthenticationScreen.prefab @@ -0,0 +1,515 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1 &4025918575016128116 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 2738432536231946919} + - component: {fileID: 8686350791673708494} + - component: {fileID: 4699316331700586057} + m_Layer: 0 + m_Name: PendingAuthentication + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 0 +--- !u!224 &2738432536231946919 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4025918575016128116} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 9199866600602126572} + m_RootOrder: -1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchoredPosition: {x: 0, y: 61.8} + m_SizeDelta: {x: 200, y: 50} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &8686350791673708494 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4025918575016128116} + m_CullTransparentMesh: 1 +--- !u!114 &4699316331700586057 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4025918575016128116} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_text: LOADING + m_isRightToLeft: 0 + m_fontAsset: {fileID: 11400000, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} + m_sharedMaterial: {fileID: 2180264, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} + m_fontSharedMaterials: [] + m_fontMaterial: {fileID: 0} + m_fontMaterials: [] + m_fontColor32: + serializedVersion: 2 + rgba: 4294967295 + m_fontColor: {r: 1, g: 1, b: 1, a: 1} + m_enableVertexGradient: 0 + m_colorMode: 3 + m_fontColorGradient: + topLeft: {r: 1, g: 1, b: 1, a: 1} + topRight: {r: 1, g: 1, b: 1, a: 1} + bottomLeft: {r: 1, g: 1, b: 1, a: 1} + bottomRight: {r: 1, g: 1, b: 1, a: 1} + m_fontColorGradientPreset: {fileID: 0} + m_spriteAsset: {fileID: 0} + m_tintAllSprites: 0 + m_StyleSheet: {fileID: 0} + m_TextStyleHashCode: -1183493901 + m_overrideHtmlColors: 0 + m_faceColor: + serializedVersion: 2 + rgba: 4294967295 + m_fontSize: 36 + m_fontSizeBase: 36 + m_fontWeight: 400 + m_enableAutoSizing: 0 + m_fontSizeMin: 18 + m_fontSizeMax: 72 + m_fontStyle: 0 + m_HorizontalAlignment: 1 + m_VerticalAlignment: 256 + m_textAlignment: 65535 + m_characterSpacing: 0 + m_wordSpacing: 0 + m_lineSpacing: 0 + m_lineSpacingMax: 0 + m_paragraphSpacing: 0 + m_charWidthMaxAdj: 0 + m_enableWordWrapping: 1 + m_wordWrappingRatios: 0.4 + m_overflowMode: 0 + m_linkedTextComponent: {fileID: 0} + parentLinkedComponent: {fileID: 0} + m_enableKerning: 1 + m_enableExtraPadding: 0 + checkPaddingRequired: 0 + m_isRichText: 1 + m_parseCtrlCharacters: 1 + m_isOrthographic: 1 + m_isCullingEnabled: 0 + m_horizontalMapping: 0 + m_verticalMapping: 0 + m_uvLineOffset: 0 + m_geometrySortingOrder: 0 + m_IsTextObjectScaleStatic: 0 + m_VertexBufferAutoSizeReduction: 0 + m_useMaxVisibleDescender: 1 + m_pageToDisplay: 1 + m_margin: {x: 0, y: 0, z: 0, w: 0} + m_isUsingLegacyAnimationComponent: 0 + m_isVolumetricText: 0 + m_hasFontAssetChanged: 0 + m_baseMaterial: {fileID: 0} + m_maskOffset: {x: 0, y: 0, z: 0, w: 0} +--- !u!1 &5357728835287357475 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 9199866600602126572} + - component: {fileID: 2814871423585080172} + - component: {fileID: 8169330921431457158} + - component: {fileID: 8454101078806804241} + - component: {fileID: 8636253938733285890} + m_Layer: 0 + m_Name: AuthenticationScreen + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &9199866600602126572 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5357728835287357475} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 0, y: 0, z: 0} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 1595850679337479926} + - {fileID: 2738432536231946919} + m_Father: {fileID: 0} + m_RootOrder: 10 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0, y: 0} +--- !u!223 &2814871423585080172 +Canvas: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5357728835287357475} + m_Enabled: 1 + serializedVersion: 3 + m_RenderMode: 0 + m_Camera: {fileID: 0} + m_PlaneDistance: 100 + m_PixelPerfect: 0 + m_ReceivesEvents: 1 + m_OverrideSorting: 0 + m_OverridePixelPerfect: 0 + m_SortingBucketNormalizedSize: 0 + m_VertexColorAlwaysGammaSpace: 0 + m_AdditionalShaderChannelsFlag: 25 + m_UpdateRectTransformForStandalone: 0 + m_SortingLayerID: 0 + m_SortingOrder: 0 + m_TargetDisplay: 0 +--- !u!114 &8169330921431457158 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5357728835287357475} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 0cd44c1031e13a943bb63640046fad76, type: 3} + m_Name: + m_EditorClassIdentifier: + m_UiScaleMode: 1 + m_ReferencePixelsPerUnit: 100 + m_ScaleFactor: 1 + m_ReferenceResolution: {x: 1920, y: 1080} + m_ScreenMatchMode: 0 + m_MatchWidthOrHeight: 0 + m_PhysicalUnit: 3 + m_FallbackScreenDPI: 96 + m_DefaultSpriteDPI: 96 + m_DynamicPixelsPerUnit: 1 + m_PresetInfoIsWorld: 0 +--- !u!114 &8454101078806804241 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5357728835287357475} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: dc42784cf147c0c48a680349fa168899, type: 3} + m_Name: + m_EditorClassIdentifier: + m_IgnoreReversedGraphics: 1 + m_BlockingObjects: 0 + m_BlockingMask: + serializedVersion: 2 + m_Bits: 4294967295 +--- !u!114 &8636253938733285890 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5357728835287357475} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 11560c96ccf142eab9ae39a4729d920c, type: 3} + m_Name: + m_EditorClassIdentifier: + k__BackingField: {fileID: 2814871423585080172} + k__BackingField: {fileID: 8454101078806804241} + k__BackingField: {fileID: 4708745492529117082} + k__BackingField: {fileID: 4025918575016128116} +--- !u!1 &6351262394580509030 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1595850679337479926} + - component: {fileID: 7327401095768751964} + - component: {fileID: 3159600912255300349} + - component: {fileID: 4708745492529117082} + m_Layer: 0 + m_Name: LoginButton + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1595850679337479926 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6351262394580509030} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 8683738497372510641} + m_Father: {fileID: 9199866600602126572} + m_RootOrder: -1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 160, y: 30} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &7327401095768751964 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6351262394580509030} + m_CullTransparentMesh: 1 +--- !u!114 &3159600912255300349 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6351262394580509030} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 10905, guid: 0000000000000000f000000000000000, type: 0} + m_Type: 1 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 +--- !u!114 &4708745492529117082 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6351262394580509030} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 4e29b1a8efbd4b44bb3f3716e73f07ff, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Navigation: + m_Mode: 3 + m_WrapAround: 0 + m_SelectOnUp: {fileID: 0} + m_SelectOnDown: {fileID: 0} + m_SelectOnLeft: {fileID: 0} + m_SelectOnRight: {fileID: 0} + m_Transition: 1 + m_Colors: + m_NormalColor: {r: 1, g: 1, b: 1, a: 1} + m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1} + m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608} + m_ColorMultiplier: 1 + m_FadeDuration: 0.1 + m_SpriteState: + m_HighlightedSprite: {fileID: 0} + m_PressedSprite: {fileID: 0} + m_SelectedSprite: {fileID: 0} + m_DisabledSprite: {fileID: 0} + m_AnimationTriggers: + m_NormalTrigger: Normal + m_HighlightedTrigger: Highlighted + m_PressedTrigger: Pressed + m_SelectedTrigger: Selected + m_DisabledTrigger: Disabled + m_Interactable: 1 + m_TargetGraphic: {fileID: 3159600912255300349} + m_OnClick: + m_PersistentCalls: + m_Calls: [] +--- !u!1 &8820783725442413826 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 8683738497372510641} + - component: {fileID: 4329986661537451966} + - component: {fileID: 7514318739302491950} + m_Layer: 0 + m_Name: Text (TMP) + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &8683738497372510641 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8820783725442413826} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 1595850679337479926} + m_RootOrder: -1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &4329986661537451966 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8820783725442413826} + m_CullTransparentMesh: 1 +--- !u!114 &7514318739302491950 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8820783725442413826} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_text: Login + m_isRightToLeft: 0 + m_fontAsset: {fileID: 11400000, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} + m_sharedMaterial: {fileID: 2180264, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} + m_fontSharedMaterials: [] + m_fontMaterial: {fileID: 0} + m_fontMaterials: [] + m_fontColor32: + serializedVersion: 2 + rgba: 4281479730 + m_fontColor: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1} + m_enableVertexGradient: 0 + m_colorMode: 3 + m_fontColorGradient: + topLeft: {r: 1, g: 1, b: 1, a: 1} + topRight: {r: 1, g: 1, b: 1, a: 1} + bottomLeft: {r: 1, g: 1, b: 1, a: 1} + bottomRight: {r: 1, g: 1, b: 1, a: 1} + m_fontColorGradientPreset: {fileID: 0} + m_spriteAsset: {fileID: 0} + m_tintAllSprites: 0 + m_StyleSheet: {fileID: 0} + m_TextStyleHashCode: -1183493901 + m_overrideHtmlColors: 0 + m_faceColor: + serializedVersion: 2 + rgba: 4294967295 + m_fontSize: 24 + m_fontSizeBase: 24 + m_fontWeight: 400 + m_enableAutoSizing: 0 + m_fontSizeMin: 18 + m_fontSizeMax: 72 + m_fontStyle: 0 + m_HorizontalAlignment: 2 + m_VerticalAlignment: 512 + m_textAlignment: 65535 + m_characterSpacing: 0 + m_wordSpacing: 0 + m_lineSpacing: 0 + m_lineSpacingMax: 0 + m_paragraphSpacing: 0 + m_charWidthMaxAdj: 0 + m_enableWordWrapping: 1 + m_wordWrappingRatios: 0.4 + m_overflowMode: 0 + m_linkedTextComponent: {fileID: 0} + parentLinkedComponent: {fileID: 0} + m_enableKerning: 1 + m_enableExtraPadding: 0 + checkPaddingRequired: 0 + m_isRichText: 1 + m_parseCtrlCharacters: 1 + m_isOrthographic: 1 + m_isCullingEnabled: 0 + m_horizontalMapping: 0 + m_verticalMapping: 0 + m_uvLineOffset: 0 + m_geometrySortingOrder: 0 + m_IsTextObjectScaleStatic: 0 + m_VertexBufferAutoSizeReduction: 0 + m_useMaxVisibleDescender: 1 + m_pageToDisplay: 1 + m_margin: {x: 0, y: 0, z: 0, w: 0} + m_isUsingLegacyAnimationComponent: 0 + m_isVolumetricText: 0 + m_hasFontAssetChanged: 0 + m_baseMaterial: {fileID: 0} + m_maskOffset: {x: 0, y: 0, z: 0, w: 0} diff --git a/Explorer/Assets/DCL/AuthenticationScreenFlow/Assets/AuthenticationScreen.prefab.meta b/Explorer/Assets/DCL/AuthenticationScreenFlow/Assets/AuthenticationScreen.prefab.meta new file mode 100644 index 0000000000..e8f4535b24 --- /dev/null +++ b/Explorer/Assets/DCL/AuthenticationScreenFlow/Assets/AuthenticationScreen.prefab.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 08d42937d0bc54b48baaa23c8c520175 +PrefabImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Explorer/Assets/DCL/AuthenticationScreenFlow/AuthenticationScreenController.cs b/Explorer/Assets/DCL/AuthenticationScreenFlow/AuthenticationScreenController.cs new file mode 100644 index 0000000000..6fea5d0040 --- /dev/null +++ b/Explorer/Assets/DCL/AuthenticationScreenFlow/AuthenticationScreenController.cs @@ -0,0 +1,56 @@ +using Cysharp.Threading.Tasks; +using DCL.Web3Authentication; +using MVC; +using System.Threading; + +namespace DCL.AuthenticationScreenFlow +{ + public class AuthenticationScreenController : ControllerBase + { + private readonly IWeb3Authenticator web3Authenticator; + + private CancellationTokenSource? loginCancellationToken; + + public override CanvasOrdering.SortingLayer Layer => CanvasOrdering.SortingLayer.Overlay; + + public AuthenticationScreenController(ViewFactoryMethod viewFactory, + IWeb3Authenticator web3Authenticator) + : base(viewFactory) + { + this.web3Authenticator = web3Authenticator; + } + + public override void Dispose() + { + base.Dispose(); + + loginCancellationToken?.Cancel(); + loginCancellationToken?.Dispose(); + } + + protected override void OnViewInstantiated() + { + base.OnViewInstantiated(); + + viewInstance.LoginButton.onClick.AddListener(Login); + } + + protected override UniTask WaitForCloseIntent(CancellationToken ct) => + UniTask.Never(ct); + + private void Login() + { + async UniTaskVoid LoginAsync(CancellationToken ct) + { + viewInstance.PendingAuthentication.SetActive(true); + await web3Authenticator.LoginAsync(ct); + viewInstance.PendingAuthentication.SetActive(false); + } + + loginCancellationToken?.Cancel(); + loginCancellationToken?.Dispose(); + loginCancellationToken = new CancellationTokenSource(); + LoginAsync(loginCancellationToken.Token).Forget(); + } + } +} diff --git a/Explorer/Assets/DCL/AuthenticationScreenFlow/AuthenticationScreenController.cs.meta b/Explorer/Assets/DCL/AuthenticationScreenFlow/AuthenticationScreenController.cs.meta new file mode 100644 index 0000000000..a131f87571 --- /dev/null +++ b/Explorer/Assets/DCL/AuthenticationScreenFlow/AuthenticationScreenController.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 330827414fef4d858f0c0a882cb0f95b +timeCreated: 1703084819 \ No newline at end of file diff --git a/Explorer/Assets/DCL/AuthenticationScreenFlow/AuthenticationScreenFlow.asmdef b/Explorer/Assets/DCL/AuthenticationScreenFlow/AuthenticationScreenFlow.asmdef new file mode 100644 index 0000000000..eff475b67c --- /dev/null +++ b/Explorer/Assets/DCL/AuthenticationScreenFlow/AuthenticationScreenFlow.asmdef @@ -0,0 +1,18 @@ +{ + "name": "AuthenticationScreenFlow", + "rootNamespace": "", + "references": [ + "GUID:f51ebe6a0ceec4240a699833d6309b23", + "GUID:5ab29fa8ae5769b49ab29e390caca7a4", + "GUID:45f6fff651a0a514f8edfdaf9cce45af" + ], + "includePlatforms": [], + "excludePlatforms": [], + "allowUnsafeCode": false, + "overrideReferences": false, + "precompiledReferences": [], + "autoReferenced": true, + "defineConstraints": [], + "versionDefines": [], + "noEngineReferences": false +} \ No newline at end of file diff --git a/Explorer/Assets/DCL/AuthenticationScreenFlow/AuthenticationScreenFlow.asmdef.meta b/Explorer/Assets/DCL/AuthenticationScreenFlow/AuthenticationScreenFlow.asmdef.meta new file mode 100644 index 0000000000..4ccece515f --- /dev/null +++ b/Explorer/Assets/DCL/AuthenticationScreenFlow/AuthenticationScreenFlow.asmdef.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 28964ef7dc9441b6b8671b61a8106690 +timeCreated: 1703084583 \ No newline at end of file diff --git a/Explorer/Assets/DCL/AuthenticationScreenFlow/AuthenticationScreenView.cs b/Explorer/Assets/DCL/AuthenticationScreenFlow/AuthenticationScreenView.cs new file mode 100644 index 0000000000..a293ef5b15 --- /dev/null +++ b/Explorer/Assets/DCL/AuthenticationScreenFlow/AuthenticationScreenView.cs @@ -0,0 +1,15 @@ +using MVC; +using UnityEngine; +using UnityEngine.UI; + +namespace DCL.AuthenticationScreenFlow +{ + public class AuthenticationScreenView : ViewBase, IView + { + [field: SerializeField] + public Button LoginButton { get; private set; } = null!; + + [field: SerializeField] + public GameObject PendingAuthentication { get; private set; } = null!; + } +} diff --git a/Explorer/Assets/DCL/AuthenticationScreenFlow/AuthenticationScreenView.cs.meta b/Explorer/Assets/DCL/AuthenticationScreenFlow/AuthenticationScreenView.cs.meta new file mode 100644 index 0000000000..4d7e8c6d23 --- /dev/null +++ b/Explorer/Assets/DCL/AuthenticationScreenFlow/AuthenticationScreenView.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 11560c96ccf142eab9ae39a4729d920c +timeCreated: 1703099077 \ No newline at end of file diff --git a/Explorer/Assets/DCL/AuthenticationScreenFlow/csc.rsp b/Explorer/Assets/DCL/AuthenticationScreenFlow/csc.rsp new file mode 100644 index 0000000000..dcc377f897 --- /dev/null +++ b/Explorer/Assets/DCL/AuthenticationScreenFlow/csc.rsp @@ -0,0 +1 @@ +-nullable:enable \ No newline at end of file diff --git a/Explorer/Assets/DCL/AuthenticationScreenFlow/csc.rsp.meta b/Explorer/Assets/DCL/AuthenticationScreenFlow/csc.rsp.meta new file mode 100644 index 0000000000..ba76a67c64 --- /dev/null +++ b/Explorer/Assets/DCL/AuthenticationScreenFlow/csc.rsp.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 883728cd7dd545669a1e589075b599b2 +timeCreated: 1703084583 \ No newline at end of file diff --git a/Explorer/Assets/DCL/PluginSystem/DCL.Plugins.asmdef b/Explorer/Assets/DCL/PluginSystem/DCL.Plugins.asmdef index 1437a78bb6..dca9918716 100644 --- a/Explorer/Assets/DCL/PluginSystem/DCL.Plugins.asmdef +++ b/Explorer/Assets/DCL/PluginSystem/DCL.Plugins.asmdef @@ -55,7 +55,8 @@ "GUID:15bc5ce9b9f747c8a365e7dff4e2ebd7", "GUID:393a5d2fbaa249d09c260018aaeb4fc0", "GUID:e56a0d6a94c144c784012e63b6043100", - "GUID:91cf8206af184dac8e30eb46747e9939" + "GUID:91cf8206af184dac8e30eb46747e9939", + "GUID:28964ef7dc9441b6b8671b61a8106690" ], "includePlatforms": [], "excludePlatforms": [], diff --git a/Explorer/Assets/DCL/PluginSystem/Global/Global Plugins Settings.asset b/Explorer/Assets/DCL/PluginSystem/Global/Global Plugins Settings.asset index e2e2fe56c0..6a44ffcc81 100644 --- a/Explorer/Assets/DCL/PluginSystem/Global/Global Plugins Settings.asset +++ b/Explorer/Assets/DCL/PluginSystem/Global/Global Plugins Settings.asset @@ -22,9 +22,18 @@ MonoBehaviour: - rid: 5215741520409264129 - rid: 1501337502808539138 - rid: 2152807656697888768 + - rid: 1095376790733193218 references: version: 2 RefIds: + - rid: 1095376790733193218 + type: {class: Web3AuthPluginSettings, ns: DCL.PluginSystem.Global, asm: DCL.Plugins} + data: + k__BackingField: + m_AssetGUID: 08d42937d0bc54b48baaa23c8c520175 + m_SubObjectName: + m_SubObjectType: + m_EditorAssetChanged: 0 - rid: 1268264176566403074 type: {class: GlobalInteractionPlugin/Settings, ns: DCL.PluginSystem.Global, asm: DCL.Plugins} data: @@ -154,6 +163,9 @@ MonoBehaviour: m_SubObjectName: m_SubObjectType: m_EditorAssetChanged: 0 + k__BackingField: 33 + k__BackingField: 100 + k__BackingField: 50 - rid: 6784895265412481026 type: {class: CharacterCameraSettings, ns: DCL.PluginSystem.Global, asm: DCL.Plugins} data: diff --git a/Explorer/Assets/DCL/PluginSystem/Global/Web3AuthenticationPlugin.cs b/Explorer/Assets/DCL/PluginSystem/Global/Web3AuthenticationPlugin.cs index ddeebfa03b..06caeabe2e 100644 --- a/Explorer/Assets/DCL/PluginSystem/Global/Web3AuthenticationPlugin.cs +++ b/Explorer/Assets/DCL/PluginSystem/Global/Web3AuthenticationPlugin.cs @@ -1,29 +1,50 @@ using Arch.SystemGroups; using Cysharp.Threading.Tasks; +using DCL.AssetsProvision; +using DCL.AuthenticationScreenFlow; using DCL.DebugUtilities; +using DCL.ExplorePanel; using DCL.Web3Authentication; +using MVC; using System.Threading; +using UnityEngine; +using UnityEngine.AddressableAssets; namespace DCL.PluginSystem.Global { - public class Web3AuthenticationPlugin : IDCLGlobalPlugin + public class Web3AuthenticationPlugin : IDCLGlobalPlugin { + private readonly IAssetsProvisioner assetsProvisioner; private readonly IWeb3Authenticator web3Authenticator; private readonly IDebugContainerBuilder debugContainerBuilder; + private readonly MVCManager mvcManager; private CancellationTokenSource? cancellationTokenSource; - public Web3AuthenticationPlugin(IWeb3Authenticator web3Authenticator, - IDebugContainerBuilder debugContainerBuilder) + public Web3AuthenticationPlugin( + IAssetsProvisioner assetsProvisioner, + IWeb3Authenticator web3Authenticator, + IDebugContainerBuilder debugContainerBuilder, + MVCManager mvcManager) { + this.assetsProvisioner = assetsProvisioner; this.web3Authenticator = web3Authenticator; this.debugContainerBuilder = debugContainerBuilder; + this.mvcManager = mvcManager; } public void Dispose() { } - public UniTask Initialize(IPluginSettingsContainer container, CancellationToken ct) => - UniTask.CompletedTask; + public async UniTask InitializeAsync(Web3AuthPluginSettings settings, CancellationToken ct) + { + AuthenticationScreenView authScreenPrefab = (await assetsProvisioner.ProvideMainAssetAsync(settings.AuthScreenPrefab, ct: ct)) + .Value.GetComponent(); + + ControllerBase.ViewFactoryMethod? authScreenFactory = AuthenticationScreenController.CreateLazily(authScreenPrefab, null); + mvcManager.RegisterController(new AuthenticationScreenController(authScreenFactory, web3Authenticator)); + + mvcManager.ShowAsync(AuthenticationScreenController.IssueCommand()).Forget(); + } public void InjectToWorld(ref ArchSystemsWorldBuilder builder, in GlobalPluginArguments arguments) { @@ -39,4 +60,12 @@ private void Login() web3Authenticator.LoginAsync(cancellationTokenSource.Token).Forget(); } } + + public struct Web3AuthPluginSettings : IDCLPluginSettings + { + [field: Header(nameof(Web3AuthenticationPlugin) + "." + nameof(Web3AuthPluginSettings))] + [field: Space] + [field: SerializeField] + public AssetReferenceGameObject AuthScreenPrefab { get; private set; } + } } diff --git a/Explorer/Assets/Scripts/Global/Dynamic/DynamicSceneLoader.cs b/Explorer/Assets/Scripts/Global/Dynamic/DynamicSceneLoader.cs index 02a7dd0520..fe19018fe8 100644 --- a/Explorer/Assets/Scripts/Global/Dynamic/DynamicSceneLoader.cs +++ b/Explorer/Assets/Scripts/Global/Dynamic/DynamicSceneLoader.cs @@ -128,6 +128,9 @@ void OnPluginInitialized((TPluginInterface plugin, bool succes dynamicWorldContainer.DebugContainer.Builder.Build(debugUiRoot); + // TODO: remove this, a proper app authentication flow should be implemented + await UniTask.WaitUntil(() => web3Authenticator.Identity != null, cancellationToken: ct); + realmLauncher.OnRealmSelected += ChangeRealm; } catch (OperationCanceledException) diff --git a/Explorer/Assets/Scripts/Global/Dynamic/DynamicWorldContainer.cs b/Explorer/Assets/Scripts/Global/Dynamic/DynamicWorldContainer.cs index e2fe133bd1..aecfb31af5 100644 --- a/Explorer/Assets/Scripts/Global/Dynamic/DynamicWorldContainer.cs +++ b/Explorer/Assets/Scripts/Global/Dynamic/DynamicWorldContainer.cs @@ -94,7 +94,7 @@ public void Dispose() new MinimapPlugin(staticContainer.AssetsProvisioner, mvcManager, mapRendererContainer, placesAPIService), new ExplorePanelPlugin(staticContainer.AssetsProvisioner, mvcManager, mapRendererContainer, placesAPIService, parcelServiceContainer.TeleportController), new WebRequestsPlugin(staticContainer.WebRequestsContainer.AnalyticsContainer, debugBuilder), - new Web3AuthenticationPlugin(web3Authenticator, debugBuilder), + new Web3AuthenticationPlugin(staticContainer.AssetsProvisioner, web3Authenticator, debugBuilder, mvcManager), }; globalPlugins.AddRange(staticContainer.SharedPlugins);