Skip to content

Commit

Permalink
Feature/sample UI wallet (#30)
Browse files Browse the repository at this point in the history
* Added demo scene with barebones connect UI page. Created implementation for a basic scale tweening animation.

* Added logic to switch UI pages, supports 'back' (needs to be mapped to the back key on various platforms, but for now, we have a UI button). Added a very minimal login screen for testing this out.

* Added a UIPage class that contains the base logic for a UI screen/page (e.g. open/close methods) and made ConnectPage and LoginPage inherrit from it

* Refactor SequenceUI so that it no longer uses UIStates and instead calls the open/close methods on the UIPages directly.

* Add basic UI. For some reason this wasn't saved properly and wasn't included in my previous commit and I had to rebuild it... *sigh*

* Added a panel behind the UI

* Moved UI scripts into a folder

* Added the ability to choose from a set of tweening presets (implementing the ITween interface) to animate the various UI pages. The main UI panel now scrolls in from the bottom

* Wait for panel to animate onto the screen before animating in the first UI page

* Basic login page

* Made the login page the first page and hooked up buttons on login page such that they debug.log what they are supposed to do when clicked

* Added a color scheme manager that allows you to automatically reskin the UI by creating a scriptable object via 'Assets>Create>Sequence>Color Scheme', setting it as the color scheme in the ColorSchemeManager monobehaviour/gameobject, and clicking Apply in the inspector

* Added dark colour scheme

* Added login success page

* Added login handler to the login page - this is an ILogin and is designed to handle the login request. Currently, mocking the login. Upon success or failed login, an ILogin will emit an appropriate event. SequenceUI is a subscriber to this event.

* Move to login success page upon login success. Fixed UI transition animations (didn't have animations out)

* Added an IValidator interface that is used to validate inputs. For now, there is only email validation - I have both a real (with tests) and mocked implementation of IValidator

* Moved SequenceIndexer into its own assembly - referencing SequenceEthereum. Created assembly for SequenceExamples - referencing all the other Sequence assemblies (minus test assemblies) in the project. Finally, create a SequenceExamplesTests assembly for any tests related to the SequenceExamples and renamed our other test assembly from Tests to SequenceTests for clarity.

* Created a new directory (Authentication) and assembly (SequenceAuthentication) under SequenceSDK and moved the authentication-related logic out of SequenceExamples and into Authentication.

* Created base MFA page

* Updated readme

* Display MFA page and add mocked functionality to it

* Fixed runtime error and erase 2fa code whenever revisiting the page

* Only display back button when usable

* Don't overwrite text that is transparrent with different colors

* Moved SequenceUI monobehaviour off of the Panel and onto the canvas, made it stop being a UIPage. Instead, created a UIPanel which inherrits from UIPage - this is used to create the LoginPanel and will be used for the WalletPanel as well

* Setup for UI integration tests

* Setup for multiple UI tests

* Added additional integration tests for sample UI login flow. Run all UI tests in one test so we don't have to setup and teardown the scene each time - makes test suite faster.

* Updated Makefile to run both edit mode and play mode tests when running 'make test'

* Added scroll view, creating NFT prefab (to be instantiated), created generic object pool

* Added 'powered by sequence' to the bottom of the grid layout

* UIPanels hold their initial page

* Added support for newly supported indexer chains

* Added IIndexer and implementation (ChainIndexer) - this is basically just Indexer.cs with the static methods extracted, no longer requiring chain id as a parameter, instead chain Id is provided in the constructor.

* Fetch nft content when opening WalletPage - for now this is mocked

* Switch to event-driven implementation for fetching as opposed to coroutine

* Instantiate images in wallet view

* Don't make ObjectPool a monobehaviour

* Fix scaling issues

* Fix animation

* Subscribe to scroll event

* Update scroll view size based on number of fetched objects

* Allow object pool to grow. Previously wanted to recycle the elements in the pool; however, since the layout of the objects is managed by the grid layout group, anytime one of the elements is removed, the rest are shifted up and are also removed. Instead, we simply allow the object pool to grow as needed - this should still perform well on initial load, but has the potential to create slowdowns if the user has a bunch of NFTs to display.

* Cleanup object pool when closing wallet page

* Navigate to wallet panel and wallet page

* Setup UI test harness so that we can run separate tests for the login flow and the wallet flow. Running these separately (as opposed to all in one test) feels like a happy middleground to me in terms of test runtime vs clarity (to pinpoint the issue) when tests fail.

* Moved opening of next panel into a separate function that has a separate on click listener for the buttons. The functionality is the same as before, except, now it is easier to customize (developers can simply disable the Open{PanelName} on click listener and replace with some other panel to open next)

* Test that we fetch enough items (random between 0 and 1000) and test that the branding stays at the bottom of the page

* Fix ColorSchemeManager such that all panels have their colors modified when applying a new color scheme

* Populate tokens in wallet - using a mocked fetcher

* Fix token name formatting

* Apply color scheme to token ui elements as well

* Refresh token currency values every x seconds - using mock to generate prices

* Fixed broken UI tests

* Fixed ColorSchemeManager such that the changes applied to the prefab is saved.

* Test that percentchange text is displayed appropriately

* Added basic navigation bar to wallet panel. Tested that we can close and re-open the wallet panel. Fixed some issues with the implementation
  • Loading branch information
BellringerQuinn authored Sep 7, 2023
1 parent 4fa88cc commit e0ce854
Show file tree
Hide file tree
Showing 62 changed files with 5,601 additions and 441 deletions.
459 changes: 459 additions & 0 deletions Assets/InitTestScene638289833950725590.unity

Large diffs are not rendered by default.

7 changes: 7 additions & 0 deletions Assets/InitTestScene638289833950725590.unity.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions Assets/SequenceExamples/Prefabs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

123 changes: 123 additions & 0 deletions Assets/SequenceExamples/Prefabs/NFT.prefab
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &1878011362095268920
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 5219100922419779228}
- component: {fileID: 1585219861179655251}
- component: {fileID: 4291578054636979227}
- component: {fileID: 3153608606666130438}
m_Layer: 5
m_Name: NFT
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &5219100922419779228
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1878011362095268920}
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: 0}
m_RootOrder: 0
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: 100, y: 100}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &1585219861179655251
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1878011362095268920}
m_CullTransparentMesh: 1
--- !u!114 &4291578054636979227
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1878011362095268920}
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: 0}
m_Type: 0
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 &3153608606666130438
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1878011362095268920}
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: 4291578054636979227}
m_OnClick:
m_PersistentCalls:
m_Calls: []
7 changes: 7 additions & 0 deletions Assets/SequenceExamples/Prefabs/NFT.prefab.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit e0ce854

Please sign in to comment.