| | 1 | | using Cysharp.Threading.Tasks; |
| | 2 | | using DCL.Helpers; |
| | 3 | | using DCL.Providers; |
| | 4 | | using DCL.World.PortableExperiences; |
| | 5 | | using DCLServices.PortableExperiences.Analytics; |
| | 6 | | using System.Threading; |
| | 7 | |
|
| | 8 | | namespace DCL.PortableExperiences.Confirmation |
| | 9 | | { |
| | 10 | | public class ExperiencesConfirmationPlugin : IPlugin |
| | 11 | | { |
| 0 | 12 | | private readonly CancellationTokenSource pluginCancellationToken = new (); |
| | 13 | | private ExperiencesConfirmationPopupController popupController; |
| | 14 | |
|
| 0 | 15 | | public ExperiencesConfirmationPlugin() |
| | 16 | | { |
| 0 | 17 | | Initialize(pluginCancellationToken.Token).Forget(); |
| 0 | 18 | | } |
| | 19 | |
|
| | 20 | | private async UniTaskVoid Initialize(CancellationToken cancellationToken) |
| | 21 | | { |
| 0 | 22 | | var view = await Environment.i.serviceLocator |
| | 23 | | .Get<IAddressableResourceProvider>() |
| | 24 | | .Instantiate<ExperiencesConfirmationPopupComponentView>("ExperiencesConfirmation |
| | 25 | | "ExperiencesConfirmationPopup", cancellationToken: cancellationToken); |
| | 26 | |
|
| 0 | 27 | | popupController = new ExperiencesConfirmationPopupController(view, |
| | 28 | | DataStore.i, |
| | 29 | | new PlayerPrefsConfirmedExperiencesRepository(new DefaultPlayerPrefs()), |
| | 30 | | new UserProfileWebInterfaceBridge(), |
| | 31 | | Environment.i.serviceLocator.Get<IPortableExperiencesAnalyticsService>()); |
| 0 | 32 | | } |
| | 33 | |
|
| | 34 | | public void Dispose() |
| | 35 | | { |
| 0 | 36 | | popupController.Dispose(); |
| 0 | 37 | | pluginCancellationToken.Cancel(); |
| 0 | 38 | | pluginCancellationToken.Dispose(); |
| 0 | 39 | | } |
| | 40 | | } |
| | 41 | | } |