mirror of
https://github.com/lightpanda-io/browser.git
synced 2026-03-22 12:44:43 +00:00
Removes telemetry dependence on notifications
This commit is contained in:
@@ -5,7 +5,6 @@ const Allocator = std.mem.Allocator;
|
||||
|
||||
const log = @import("../log.zig");
|
||||
const App = @import("../App.zig");
|
||||
const Notification = @import("../Notification.zig");
|
||||
|
||||
const uuidv4 = @import("../id.zig").uuidv4;
|
||||
const IID_FILE = "iid";
|
||||
@@ -63,32 +62,6 @@ fn TelemetryT(comptime P: type) type {
|
||||
log.warn(.telemetry, "record error", .{ .err = err, .type = @tagName(std.meta.activeTag(event)) });
|
||||
};
|
||||
}
|
||||
|
||||
// Called outside of `init` because we need a stable pointer for self.
|
||||
// We care page_navigate events, but those happen on a Browser's
|
||||
// notification. This doesn't exist yet, and there isn't only going to
|
||||
// be 1, browsers come and go.
|
||||
// What we can do is register for the `notification_created` event.
|
||||
// In the callback for that, `onNotificationCreated`, we can then register
|
||||
// for the browser-events that we care about.
|
||||
pub fn register(self: *Self, notification: *Notification) !void {
|
||||
if (self.disabled) {
|
||||
return;
|
||||
}
|
||||
try notification.register(.notification_created, self, onNotificationCreated);
|
||||
}
|
||||
|
||||
fn onNotificationCreated(ctx: *anyopaque, new: *Notification) !void {
|
||||
return new.register(.page_navigate, ctx, onPageNavigate);
|
||||
}
|
||||
|
||||
fn onPageNavigate(ctx: *anyopaque, data: *const Notification.PageNavigate) !void {
|
||||
const self: *Self = @ptrCast(@alignCast(ctx));
|
||||
self.record(.{ .navigate = .{
|
||||
.proxy = false,
|
||||
.tls = std.ascii.startsWithIgnoreCase(data.url, "https://"),
|
||||
} });
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user