Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions apps/native/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,10 @@ compiles after the commit that shows it, and the screen restyles.
`NATIVE_THEME=dark`, `NATIVE_WIDTH`/`NATIVE_HEIGHT` set the window; `NATIVE_DEBUG=1` logs every
Message and editor event; `NATIVE_STATS=<file>` appends per-commit timings.
`HAZEL_FIXTURE_HTML=<file.html>` ends the offline #general with a message showing that page as an
HTML render, served from a local port as the api serves one (the file is read on every load).
HTML render, served from a local port as the api serves one (the file is read on every load); a
page URL instead is shown as it is (iOS: `bun run serve-fixture-html page.html` serves the file
and prints the URL to build with). Offline, links still unfurl: the link-preview worker's
requests (previews, tweets) go to the network.

`host/target/release/hazel-native --capture script.json` runs headless on a real-time frame loop and
follows a script (`settle`, `waitText`, `clickText`, `focusEditable`, `type`, `key`, `snap`, `dump`,
Expand Down Expand Up @@ -147,7 +150,12 @@ Motion runs on Rune's display link (`CADisplayLink`), at the screen's rate: 120
ProMotion iPhone (`CADisableMinimumFrameDurationOnPhone`). When WebKit ends the page's process
(memory pressure, a crash), the bridge loads a fresh page and runtime, as a browser reloads a tab.

Not yet on iOS: updates and HTML renders.
HTML renders show as on the Mac (`host/src/frames.rs`, its UIKit side): each page in a `WKWebView`
over its box. A finger on an inline page also reaches Rune's view, so a drag over it scrolls the
list and a long press opens the message's menu, while a tap presses what is under it in the page; a
fullscreen page scrolls itself.

Not yet on iOS: updates.

### TestFlight

Expand Down
1 change: 1 addition & 0 deletions apps/native/host/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 6 additions & 2 deletions apps/native/host/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,17 @@ block2 = "0.6"
objc2-foundation = "0.3"

# The web views HTML render frames show their pages in (`src/frames.rs`).
[target.'cfg(target_os = "macos")'.dependencies]
objc2 = "0.6"
objc2-app-kit = "0.3"
objc2-web-kit = "0.3"
objc2-quartz-core = "0.3"
objc2-core-graphics = "0.3"
objc2-core-foundation = "0.3"

[target.'cfg(target_os = "ios")'.dependencies]
objc2-ui-kit = "0.3"

[target.'cfg(target_os = "macos")'.dependencies]
objc2-app-kit = "0.3"
objc2-user-notifications = { version = "0.3", default-features = false, features = [
"std",
"UNUserNotificationCenter",
Expand Down
7 changes: 5 additions & 2 deletions apps/native/host/ios/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ mod sign_in;

#[cfg(target_os = "ios")]
fn main() {
use hazel_native::{State, TEXT_SMOOTHING, dom_motion, images, view, window_key};
use hazel_native::{State, TEXT_SMOOTHING, dom_motion, frames, images, view, window_key};
use rune::{App, AppSpec};

dom_motion();
Expand All @@ -31,7 +31,10 @@ fn main() {
// iOS gives the window the whole screen whatever size is asked for.
..AppSpec::new("Hazel", (402.0, 874.0), State::default, view)
};
let app = App::new(spec).font_smoothing(TEXT_SMOOTHING);
// HTML renders' web views go where their boxes were drawn, after every frame.
let app = App::new(spec)
.font_smoothing(TEXT_SMOOTHING)
.on_frame_drawn(frames::sync);
bridge::set_handle(app.handle());
app.run();
}
Expand Down
Loading
Loading