diff --git a/Explorer/Assets/DCL/ApplicationVersionGuard/ApplicationVersionGuard.cs b/Explorer/Assets/DCL/ApplicationVersionGuard/ApplicationVersionGuard.cs index 81ab0d2d319..1a88d76813c 100644 --- a/Explorer/Assets/DCL/ApplicationVersionGuard/ApplicationVersionGuard.cs +++ b/Explorer/Assets/DCL/ApplicationVersionGuard/ApplicationVersionGuard.cs @@ -19,14 +19,15 @@ namespace DCL.ApplicationVersionGuard { public class ApplicationVersionGuard { - private const string LAUNCHER_EXECUTABLE_NAME = "Decentraland Launcher"; + private const string LAUNCHER_EXECUTABLE_NAME = "Decentraland"; + private const string LEGACY_LAUNCHER_EXECUTABLE_NAME = "Decentraland Launcher"; + private const string LAUNCHER_EXECUTABLE_FILENAME = "dcl_launcher.exe"; private const string LAUNCHER_PATH_MAC = "/Applications/" + LAUNCHER_EXECUTABLE_NAME + ".app"; - private const string LAUNCHER_PATH_WIN_MAIN = @"C:\Program Files\Decentraland Launcher\" + LAUNCHER_EXECUTABLE_NAME + ".exe"; - private const string LAUNCHER_PATH_WIN_86 = @"C:\Program Files (x86)\Decentraland Launcher\" + LAUNCHER_EXECUTABLE_NAME + ".exe"; - private const string LAUNCHER_PATH_WIN_COMBINED = @"Programs\Decentraland Launcher\" + LAUNCHER_EXECUTABLE_NAME + ".exe"; - private const string DECENTRALAND_LAUNCHER_WIN_X64_EXE = "Decentraland-Launcher-win-x64.exe"; - private const string DECENTRALAND_LAUNCHER_MAC_ARM_64DMG = "Decentraland-Launcher-mac-arm64.dmg"; - private const string DECENTRALAND_LAUNCHER_MAC_X_64DMG = "Decentraland-Launcher-mac-x64.dmg"; + private const string LEGACY_LAUNCHER_PATH_MAC = "/Applications/" + LEGACY_LAUNCHER_EXECUTABLE_NAME + ".app"; + private const string DECENTRALAND_LAUNCHER_WIN_X64_EXE = "Decentraland_x64-setup.exe"; + private const string DECENTRALAND_LAUNCHER_MAC_ARM_64DMG = "Decentraland_aarch64.dmg"; + //Aga: Rust version of launcher does not support intel macs, until fully deprecating it, we need to keep the old launcher for intel based macs + private const string DECENTRALAND_LEGACY_LAUNCHER_MAC_X_64DMG = "Decentraland Launcher-mac-x64.dmg"; private readonly IWebRequestController webRequestController; private readonly IWebBrowser webBrowser; @@ -58,7 +59,7 @@ public async UniTask LaunchOrDownloadLauncherAsync(CancellationToken ct = defaul if (string.IsNullOrEmpty(launcherPath)) { - await DownloadLauncherAsync(ct); + DownloadLauncher(); Quit(); } else @@ -90,40 +91,34 @@ private static void Quit() #endif } - private async UniTask DownloadLauncherAsync(CancellationToken ct) + private void DownloadLauncher() { - string downloadUrl = await GetLauncherDownloadUrlAsync(ct); + string assetName = GetLauncherAssetName(); + string downloadUrl = $"{GetLauncherDownloadPath()}/{assetName}"; if (!string.IsNullOrEmpty(downloadUrl)) webBrowser.OpenUrl(downloadUrl); else ReportHub.LogError(ReportCategory.VERSION_CONTROL, "Failed to get launcher download URL."); + } - return; - - async UniTask GetLauncherDownloadUrlAsync(CancellationToken cancellationToken) + private static string GetLauncherAssetName() + { + return Application.platform switch { - FlatFetchResponse response = await webRequestController.GetAsync, FlatFetchResponse>( - IDecentralandUrlsSource.LAUNCHER_LATEST_RELEASE_URL, - new FlatFetchResponse(), - cancellationToken, - ReportCategory.VERSION_CONTROL, - new WebRequestHeadersInfo()); - - GitHubRelease latestRelease = JsonUtility.FromJson(response.body); - string version = latestRelease.tag_name.TrimStart('v'); - - string assetName = GetLauncherAssetName(); - return $"{IDecentralandUrlsSource.LAUNCHER_DOWNLOAD_URL}/{version}/{assetName}"; - } + RuntimePlatform.WindowsEditor or RuntimePlatform.WindowsPlayer => DECENTRALAND_LAUNCHER_WIN_X64_EXE, + RuntimePlatform.OSXEditor or RuntimePlatform.OSXPlayer => IsAppleSiliconMac ? DECENTRALAND_LAUNCHER_MAC_ARM_64DMG : DECENTRALAND_LEGACY_LAUNCHER_MAC_X_64DMG, + _ => throw new NotSupportedException("Unsupported platform for launcher download."), + }; } - private static string GetLauncherAssetName() + + private static string GetLauncherDownloadPath() { return Application.platform switch { - RuntimePlatform.WindowsEditor or RuntimePlatform.WindowsPlayer => DECENTRALAND_LAUNCHER_WIN_X64_EXE, - RuntimePlatform.OSXEditor or RuntimePlatform.OSXPlayer => SystemInfo.processorType.ToLower().Contains("arm") ? DECENTRALAND_LAUNCHER_MAC_ARM_64DMG : DECENTRALAND_LAUNCHER_MAC_X_64DMG, + RuntimePlatform.WindowsEditor or RuntimePlatform.WindowsPlayer => IDecentralandUrlsSource.LAUNCHER_DOWNLOAD_URL, + RuntimePlatform.OSXEditor or RuntimePlatform.OSXPlayer => IsAppleSiliconMac ? IDecentralandUrlsSource.LAUNCHER_DOWNLOAD_URL : IDecentralandUrlsSource.LEGACY_LAUNCHER_DOWNLOAD_URL, _ => throw new NotSupportedException("Unsupported platform for launcher download."), }; } @@ -138,30 +133,39 @@ private static string GetLauncherAssetName() case RuntimePlatform.WindowsPlayer: possiblePaths = new[] { - LAUNCHER_PATH_WIN_MAIN, - LAUNCHER_PATH_WIN_86, - Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), LAUNCHER_PATH_WIN_COMBINED), + Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), LAUNCHER_EXECUTABLE_NAME, LAUNCHER_EXECUTABLE_FILENAME), }; - break; + case RuntimePlatform.OSXEditor: case RuntimePlatform.OSXPlayer: - possiblePaths = new[] - { - LAUNCHER_PATH_MAC, - $"{Environment.GetFolderPath(Environment.SpecialFolder.Personal)}{LAUNCHER_PATH_MAC}", - }; - + possiblePaths = IsAppleSiliconMac + ? new[] + { + LAUNCHER_PATH_MAC, + $"{Environment.GetFolderPath(Environment.SpecialFolder.Personal)}{LAUNCHER_PATH_MAC}", + } + : new[] + { + LEGACY_LAUNCHER_PATH_MAC, + $"{Environment.GetFolderPath(Environment.SpecialFolder.Personal)}{LEGACY_LAUNCHER_PATH_MAC}", + }; break; + default: ReportHub.LogError(ReportCategory.VERSION_CONTROL, "Unsupported platform for launching the application."); return null; } - return possiblePaths.FirstOrDefault(path => File.Exists(path) - || (Directory.Exists(path) && (Application.platform == RuntimePlatform.OSXEditor || Application.platform == RuntimePlatform.OSXPlayer))); + return possiblePaths.FirstOrDefault(path => + File.Exists(path) || + (Directory.Exists(path) && (Application.platform == RuntimePlatform.OSXEditor || Application.platform == RuntimePlatform.OSXPlayer))); } + private static bool IsAppleSiliconMac => + Application.platform is RuntimePlatform.OSXEditor or RuntimePlatform.OSXPlayer && + SystemInfo.processorType.Contains("apple", StringComparison.OrdinalIgnoreCase); + [Serializable] private struct GitHubRelease { diff --git a/Explorer/Assets/DCL/Browser/DecentralandUrls/IDecentralandUrlsSource.cs b/Explorer/Assets/DCL/Browser/DecentralandUrls/IDecentralandUrlsSource.cs index 194a00dddbc..c11bbb51705 100644 --- a/Explorer/Assets/DCL/Browser/DecentralandUrls/IDecentralandUrlsSource.cs +++ b/Explorer/Assets/DCL/Browser/DecentralandUrls/IDecentralandUrlsSource.cs @@ -3,8 +3,8 @@ namespace DCL.Multiplayer.Connections.DecentralandUrls public interface IDecentralandUrlsSource { const string EXPLORER_LATEST_RELEASE_URL = "https://api.github.com/repos/decentraland/unity-explorer/releases/latest"; - const string LAUNCHER_LATEST_RELEASE_URL = "https://api.github.com/repos/decentraland/launcher/releases/latest"; - const string LAUNCHER_DOWNLOAD_URL = "https://github.com/decentraland/launcher/releases/download"; + const string LAUNCHER_DOWNLOAD_URL = "https://explorer-artifacts.decentraland.org/launcher-rust"; + const string LEGACY_LAUNCHER_DOWNLOAD_URL = "https://explorer-artifacts.decentraland.org/launcher/dcl"; string DecentralandDomain { get; } DecentralandEnvironment Environment { get; } diff --git a/Explorer/Assets/DCL/Infrastructure/Global/Dynamic/DynamicWorldContainer.cs b/Explorer/Assets/DCL/Infrastructure/Global/Dynamic/DynamicWorldContainer.cs index 6092035c268..84037ccbbdd 100644 --- a/Explorer/Assets/DCL/Infrastructure/Global/Dynamic/DynamicWorldContainer.cs +++ b/Explorer/Assets/DCL/Infrastructure/Global/Dynamic/DynamicWorldContainer.cs @@ -701,8 +701,10 @@ await MapRendererContainer friendsEventBus, chatMessageFactory, staticContainer.FeatureFlagsCache, + profileRepositoryWrapper, friendServiceProxy, - profileRepositoryWrapper), + staticContainer.RealmData, + realmNavigator), new ExplorePanelPlugin( assetsProvisioner, mvcManager, diff --git a/Explorer/Assets/DCL/PerformanceAndDiagnostics/Analytics/AnalyticsConfiguration.asset b/Explorer/Assets/DCL/PerformanceAndDiagnostics/Analytics/AnalyticsConfiguration.asset index 8ceaf2e95cf..25fdedfa53e 100644 --- a/Explorer/Assets/DCL/PerformanceAndDiagnostics/Analytics/AnalyticsConfiguration.asset +++ b/Explorer/Assets/DCL/PerformanceAndDiagnostics/Analytics/AnalyticsConfiguration.asset @@ -135,6 +135,18 @@ MonoBehaviour: isEnabled: 1 - eventName: unblock_user isEnabled: 1 + - groupName: MarketplaceCredits + events: + - eventName: marketplace_credits_opened + isEnabled: 1 + - groupName: Settings + events: + - eventName: chat-bubbles-visibility-changed + isEnabled: 1 + - groupName: FeatureFlags + events: + - eventName: feature_flags + isEnabled: 1 useLocalEnvVariableFallback: 0 flushSize: 20 flushInterval: 60 diff --git a/Explorer/Assets/DCL/PerformanceAndDiagnostics/Analytics/Playgrounds/AnalyticsConfiguration Playground.asset b/Explorer/Assets/DCL/PerformanceAndDiagnostics/Analytics/Playgrounds/AnalyticsConfiguration Playground.asset index 0966fd49664..21057879e3c 100644 --- a/Explorer/Assets/DCL/PerformanceAndDiagnostics/Analytics/Playgrounds/AnalyticsConfiguration Playground.asset +++ b/Explorer/Assets/DCL/PerformanceAndDiagnostics/Analytics/Playgrounds/AnalyticsConfiguration Playground.asset @@ -131,6 +131,18 @@ MonoBehaviour: isEnabled: 1 - eventName: unblock_user isEnabled: 1 + - groupName: MarketplaceCredits + events: + - eventName: marketplace_credits_opened + isEnabled: 1 + - groupName: Settings + events: + - eventName: chat-bubbles-visibility-changed + isEnabled: 1 + - groupName: FeatureFlags + events: + - eventName: feature_flags + isEnabled: 1 useLocalEnvVariableFallback: 0 flushSize: 20 flushInterval: 30 diff --git a/Explorer/Assets/DCL/PluginSystem/Global/ChatPlugin.cs b/Explorer/Assets/DCL/PluginSystem/Global/ChatPlugin.cs index fc5e969e095..57baf4dd9e3 100644 --- a/Explorer/Assets/DCL/PluginSystem/Global/ChatPlugin.cs +++ b/Explorer/Assets/DCL/PluginSystem/Global/ChatPlugin.cs @@ -27,6 +27,8 @@ using DCL.Utilities; using MVC; using System.Threading; +using ECS; +using ECS.SceneLifeCycle.Realm; using UnityEngine; using UnityEngine.AddressableAssets; @@ -64,7 +66,9 @@ public class ChatPlugin : IDCLGlobalPlugin private readonly ProfileRepositoryWrapper profileRepositoryWrapper; private ChatController chatController; - + private IRealmData realmData; + private IRealmNavigator realmNavigator; + public ChatPlugin( IMVCManager mvcManager, IChatMessagesBus chatMessagesBus, @@ -90,8 +94,10 @@ public ChatPlugin( IFriendsEventBus friendsEventBus, ChatMessageFactory chatMessageFactory, FeatureFlagsCache featureFlagsCache, + ProfileRepositoryWrapper profileDataProvider, ObjectProxy friendsServiceProxy, - ProfileRepositoryWrapper profileDataProvider) + IRealmData realmData, + IRealmNavigator realmNavigator) { this.mvcManager = mvcManager; this.chatHistory = chatHistory; @@ -120,6 +126,8 @@ public ChatPlugin( this.socialServiceProxy = socialServiceProxy; this.friendsEventBus = friendsEventBus; this.profileRepositoryWrapper = profileDataProvider; + this.realmData = realmData; + this.realmNavigator = realmNavigator; } public void Dispose() @@ -176,6 +184,31 @@ public async UniTask InitializeAsync(ChatPluginSettings settings, CancellationTo // Log out / log in web3IdentityCache.OnIdentityCleared += OnIdentityCleared; web3IdentityCache.OnIdentityChanged += OnIdentityChanged; + + realmData.RealmType.OnUpdate += OnRealmChange; + realmNavigator.NavigationExecuted += OnNavigationExecuted; + } + + /// + /// TODO: This is a temporary solution to show the chat when the user navigates to a parcel. + /// NOTE: check this PR for more details: + /// https://github.com/decentraland/unity-explorer/issues/4324 + /// + /// + private void OnNavigationExecuted(Vector2Int parcel) + { + sharedSpaceManager.ShowAsync(PanelsSharingSpace.Chat, new ChatControllerShowParams(true,false)).Forget(); + } + + /// + /// TODO: This is a temporary solution to show the chat when the user changes realm. + /// NOTE: check this PR for more details: + /// https://github.com/decentraland/unity-explorer/issues/4324 + /// + /// + private void OnRealmChange(RealmKind realmKind) + { + sharedSpaceManager.ShowAsync(PanelsSharingSpace.Chat, new ChatControllerShowParams(true,false)).Forget(); } private void OnIdentityCleared() diff --git a/Explorer/Assets/DCL/UI/MainUIContainer/MainUIController.cs b/Explorer/Assets/DCL/UI/MainUIContainer/MainUIController.cs index 9fe36937453..67ba61561d6 100644 --- a/Explorer/Assets/DCL/UI/MainUIContainer/MainUIController.cs +++ b/Explorer/Assets/DCL/UI/MainUIContainer/MainUIController.cs @@ -56,7 +56,6 @@ protected override void OnViewInstantiated() viewInstance.pointerDetectionArea.OnExitArea += OnPointerExit; mvcManager.ShowAsync(SidebarController.IssueCommand()).Forget(); mvcManager.ShowAsync(MinimapController.IssueCommand()).Forget(); - sharedSpaceManager.ShowAsync(PanelsSharingSpace.Chat, new ChatControllerShowParams(true)).Forget(); mvcManager.ShowAsync(ConnectionStatusPanelController.IssueCommand()).Forget(); if (isFriendsEnabled)