| | 1 | | using DCL.Browser; |
| | 2 | | using DCL.Guests.HUD.ConnectWallet; |
| | 3 | | using DCL.MyAccount; |
| | 4 | | using DCL.Providers; |
| | 5 | | using DCL.Tasks; |
| | 6 | | using System.Threading; |
| | 7 | |
|
| | 8 | | namespace DCL.Wallet |
| | 9 | | { |
| | 10 | | public class WalletPlugin : IPlugin |
| | 11 | | { |
| 0 | 12 | | private readonly CancellationTokenSource cts = new (); |
| | 13 | |
|
| | 14 | | private WalletSectionHUDController walletSectionController; |
| | 15 | | private ConnectWalletComponentController connectWalletController; |
| | 16 | |
|
| 0 | 17 | | public WalletPlugin() |
| | 18 | | { |
| 0 | 19 | | Initialize(cts.Token); |
| 0 | 20 | | } |
| | 21 | |
|
| | 22 | | private async void Initialize(CancellationToken ct) |
| | 23 | | { |
| 0 | 24 | | var walletSectionView = await Environment.i.serviceLocator.Get<IAddressableResourceProvider>() |
| | 25 | | .Instantiate<WalletSectionHUDComponentView>("WalletSectionHUD", can |
| 0 | 26 | | var dataStore = DataStore.i; |
| 0 | 27 | | var userProfileWebInterfaceBridge = new UserProfileWebInterfaceBridge(); |
| 0 | 28 | | var webInterfaceBrowserBridge = new WebInterfaceBrowserBridge(); |
| | 29 | |
|
| 0 | 30 | | walletSectionController = new WalletSectionHUDController( |
| | 31 | | walletSectionView, |
| | 32 | | dataStore, |
| | 33 | | userProfileWebInterfaceBridge, |
| | 34 | | Environment.i.platform.clipboard, |
| | 35 | | webInterfaceBrowserBridge, |
| | 36 | | Environment.i.platform.serviceProviders.theGraph, |
| | 37 | | new MyAccountAnalyticsService(Environment.i.platform.serviceProviders.analytics)); |
| | 38 | |
|
| 0 | 39 | | connectWalletController = new ConnectWalletComponentController( |
| | 40 | | walletSectionView.connectWalletView, |
| | 41 | | webInterfaceBrowserBridge, |
| | 42 | | userProfileWebInterfaceBridge, |
| | 43 | | dataStore); |
| 0 | 44 | | } |
| | 45 | |
|
| | 46 | | public void Dispose() |
| | 47 | | { |
| 0 | 48 | | cts.SafeCancelAndDispose(); |
| 0 | 49 | | walletSectionController.Dispose(); |
| 0 | 50 | | connectWalletController.Dispose(); |
| 0 | 51 | | } |
| | 52 | | } |
| | 53 | | } |