wry icon indicating copy to clipboard operation
wry copied to clipboard

refactor(macos): migrate to `objc2`

Open pewsheen opened this issue 7 months ago • 2 comments

Issue: #1239

Roadmap

  • [x] Remove objc dependency
  • [x] Merge dev branch
  • [x] Declare Custom Class
    • [x] WryWebView
    • [x] ~~{}URLSchemeHandler~~ (We need to create it dynamically)
    • [x] WebViewDelegate -> WryWebViewDelegate
    • [x] DocumentTitleChangedDelegate
    • [x] WryNavigationDelegate
    • [x] WryDownloadDelegate
    • [x] WebViewUIDelegate -> WryWebViewUIDelegate
    • [x] WryWebViewParent
  • [ ] Test Functionality
  • [ ] Update Tauri to use wry with objc2 pewsheen/refactor/wry-objc2

Functionality Test:

  • [x] Window (single webview)
  • [x] Window (multiple webviews)
  • [x] Window iOS
  • [x] PerformKeyEquivalent (menu shortcut)
  • [x] Picture in picture
  • [x] Fullscreen (feature = fullscreen)
  • [x] Document title changed handler
  • [x] Navigation Policy (download handler?)
  • [x] [mac] Reparent
  • [ ] UIDelegate
    • [x] File upload
    • [ ] Media capture permission
  • [ ] [ios] setAllowsInlineMediaPlayback (not merged yet, in dev)
  • [x] [mac] Synthetic mouse event
  • [x] [mac] Tab focuses links
  • [x] with_*
    • [x] [mac] with_back_forward_navigation_gestures
    • [x] with_transparent
    • [x] with_visible
    • [x] with_autoplay (false is not working, dev as well)
    • [x] with_initialization_script
    • [x] with_custom_protocol
    • [x] with_asynchronous_custom_protocol
    • [x] with_ipc_handler
    • [x] [mac] with_drag_drop_handler
    • [x] with_url_and_headers
    • [x] with_url
    • [x] with_headers
    • [x] with_html
    • [x] with_user_agent
    • [x] with_devtools
    • [x] with_navigation_handler
    • [x] with_download_started_handler
    • [x] with_download_completed_handler
    • [x] with_new_window_req_handler
    • [x] [mac] with_accept_first_mouse
    • [x] with_document_title_changed_handler
    • [x] with_incognito
    • [x] with_on_page_load_handler
    • [x] with_proxy_config (feature = mac-proxy)
    • [x] with_bounds (child webview)
  • [x] pub fn
    • [x] [mac] print
    • [x] url
    • [x] load_url
    • [x] load_url_with_headers
    • [x] eval
    • [x] clear_all_browsing_data
    • [x] [mac] open_devtools
    • [x] [mac] close_devtools
    • [x] [mac] is_devtools_open
    • [x] zoom
    • [x] bounds
    • [x] [mac] set_bounds (child webview)
    • [x] set_visible
    • [x] focus
    • [x] url_from_webview
    • [x] platform_webview_version

Issues

  • [ ] Async custom protocol has lifetime issue and might cause panic: https://github.com/tauri-apps/wry/pull/1316/commits/2fb6be9d6403e20540d00f90075e644b1f6ed842
  • [x] (WIP) objc2-web-kit not support WKWebView on iOS. We need this so we can continue the migration.
    • https://github.com/madsmtm/objc2/issues/408
    • https://github.com/madsmtm/objc2/issues/637
  • [x] Any way to catch NSException so we can recover from some situations? I'm using catch_unwind now for the exception, but I think this is not ideal.
if catch_unwind(|| {
  config_unwind_safe.setURLSchemeHandler_forURLScheme(
    Some(&*(handler_unwind_safe.cast::<ProtocolObject<dyn WKURLSchemeHandler>>())),
    &NSString::from_str(&name),
  );
})
  • [x] (WIP) tauri-runtime-wry need to use objc2 as well
    • https://github.com/pewsheen/tauri/tree/refactor/wry-objc2

pewsheen avatar Jul 10 '24 10:07 pewsheen