1717 * along with LiquidLauncher. If not, see <https://www.gnu.org/licenses/>.
1818 */
1919
20+ use crate :: app:: gui:: ShareableWindow ;
2021use crate :: minecraft:: {
2122 launcher:: LauncherData ,
2223 progress:: { ProgressReceiver , ProgressUpdate } ,
2324} ;
2425use anyhow:: { anyhow, bail, Context , Result } ;
2526use serde:: Deserialize ;
26- use std:: {
27- sync:: {
28- atomic:: { AtomicBool , Ordering } ,
29- Arc , Mutex ,
30- } ,
31- time:: Duration ,
32- } ;
27+ use std:: { sync:: {
28+ atomic:: { AtomicBool , Ordering } ,
29+ Arc , Mutex ,
30+ } , time:: Duration } ;
3331use tauri:: { Listener , Manager , Url , WebviewWindowBuilder } ;
3432use tokio:: time:: sleep;
3533use tracing:: { debug, error, info} ;
3634
37- use super :: gui:: ShareableWindow ;
38-
3935const MAX_DOWNLOAD_ATTEMPTS : u8 = 2 ;
4036
4137pub async fn open_download_page (
@@ -101,6 +97,11 @@ async fn show_webview(url: Url, window: &Arc<Mutex<tauri::Window>>) -> Result<St
10197 }
10298 } ?;
10399
100+ // Redirect the download view to the download page
101+ if let Err ( e) = download_view. navigate ( url. clone ( ) ) {
102+ error ! ( "Failed to navigate to download page: {:?}" , e) ;
103+ }
104+
104105 // Show and maximize the download view
105106 download_view
106107 . show ( )
@@ -109,9 +110,14 @@ async fn show_webview(url: Url, window: &Arc<Mutex<tauri::Window>>) -> Result<St
109110 . maximize ( )
110111 . context ( "Failed to maximize the download view" ) ?;
111112
112- // Redirect the download view to the download page
113- if let Err ( e) = download_view. navigate ( url. clone ( ) ) {
114- error ! ( "Failed to navigate to download page: {:?}" , e) ;
113+ // Attempt to navigate to the download page using a JavaScript redirect
114+ #[ cfg( target_os = "macos" ) ]
115+ {
116+ // On macOS, we need to wait for the window to be fully loaded before redirecting
117+ if * crate :: utils:: ARCHITECTURE == crate :: utils:: Architecture :: AARCH64 {
118+ sleep ( Duration :: from_millis ( 500 ) ) . await ;
119+ download_view. eval ( & format ! ( "window.location.href = '{}';" , url) ) ?;
120+ }
115121 }
116122
117123 debug ! ( "Download view URL: {}" , download_view. url( ) ?) ;
0 commit comments