Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(macos): migrate to objc2 #1316

Merged
merged 45 commits into from
Oct 11, 2024
Merged

refactor(macos): migrate to objc2 #1316

merged 45 commits into from
Oct 11, 2024

Conversation

pewsheen
Copy link
Contributor

@pewsheen pewsheen commented Jul 10, 2024

Issue: #1239

Roadmap

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

Functionality Test:

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

Issues

if catch_unwind(|| {
  config_unwind_safe.setURLSchemeHandler_forURLScheme(
    Some(&*(handler_unwind_safe.cast::<ProtocolObject<dyn WKURLSchemeHandler>>())),
    &NSString::from_str(&name),
  );
})

Copy link
Contributor

github-actions bot commented Jul 10, 2024

Package Changes Through faef2eb

There are 1 changes which include wry with minor

Planned Package Versions

The following package releases are the planned based on the context of changes in this pull request.

package current next
wry 0.45.0 0.46.0

Add another change file through the GitHub UI by following this link.


Read about change files or the docs at github.com/jbolda/covector

@pewsheen pewsheen force-pushed the refactor/migrate-to-objc2 branch 3 times, most recently from 17287ab to fdd1534 Compare July 10, 2024 10:41
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Cargo.toml Outdated Show resolved Hide resolved
@pewsheen
Copy link
Contributor Author

pewsheen commented Sep 8, 2024

Note: iOS can now be built and run on the iOS simulator from Tauri (it requires some modification in Tauri to use objc2). It's still WIP for testing some functionalities and organizing the code.

https://github.com/pewsheen/tauri/tree/refactor/wry-objc2

@pewsheen pewsheen marked this pull request as ready for review October 7, 2024 03:52
@pewsheen pewsheen requested a review from a team as a code owner October 7, 2024 03:52
@pewsheen
Copy link
Contributor Author

pewsheen commented Oct 7, 2024

I think the review will take a long time, and this PR is about 90% complete, so it might be worth starting the review and having some feedback earlier.

src/wkwebview/mod.rs Outdated Show resolved Hide resolved
@lucasfernog lucasfernog merged commit 0abc221 into dev Oct 11, 2024
14 checks passed
@lucasfernog lucasfernog deleted the refactor/migrate-to-objc2 branch October 11, 2024 19:11
let app: id = msg_send![app_class, sharedApplication];
let _: () = msg_send![app, activateIgnoringOtherApps: YES];
let app = NSApplication::sharedApplication(mtm);
NSApplication::activate(&app);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this change seems to be panicing, see tauri-apps/tauri#11340

cc @lucasfernog @pewsheen @madsmtm

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice finding @pewsheen, so I guess we need to gate that behind a version check

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can't test but here is the PR, #1389 thanks @pewsheen

lucasfernog added a commit that referenced this pull request Oct 14, 2024
* fix: use `activateIgnoringOtherApps` on older macOS versions

closes tauri-apps/tauri#11340

ref: #1316 (comment)

* clippy

---------

Co-authored-by: Lucas Nogueira <lucas@tauri.app>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants