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

Desktop (Windows/Linux) support #51

Open
marandaneto opened this issue Oct 9, 2023 · 13 comments
Open

Desktop (Windows/Linux) support #51

marandaneto opened this issue Oct 9, 2023 · 13 comments
Labels
Desktop enhancement New feature or request

Comments

@marandaneto
Copy link
Member

marandaneto commented Oct 9, 2023

https://posthog.com/questions/flutter-for-windows-support
https://posthoghelp.zendesk.com/agent/tickets/16890

The Flutter SDK depends on the Android and iOS SDK.
Ideally, the SDK would also have a pure Dart client that works on Desktop or we should embed a Native SDK for Desktop such as the Rust SDK.

macOS is supported already.

@marandaneto marandaneto added enhancement New feature or request Desktop labels Oct 9, 2023
@marandaneto
Copy link
Member Author

A workaround, for now, would be to create a Flutter bridge and call a Native SDK via FFI, eg, Rust SDK

@CaptainDario
Copy link

Is there anything planned in regard to this?
I would like to switch to this plugin but I need desktop support.

@marandaneto
Copy link
Member Author

@CaptainDario unfortunately not yet, but please upvote for gathering interest.

We'd need to write a pure Dart SDK (not depending on the Native SDKs such as Android and iOS for Desktop) or embed a Native SDK for Desktop, such as the Rust SDK.

However, adding macOS support should be easier since the iOS SDK supports a macOS target.

Which targets do you need? Win/Lin/macOS or all of them?

@CaptainDario
Copy link

Thank you for the quick response! I upvoted this issue.

I would need support for all platforms. But I also see quite an opportunity in supporting these platforms for this package. Because firebase does not support desktop, and everybody needing desktop support will look somewhere else (just like me)

@marandaneto
Copy link
Member Author

A quick workaround, for now, is to just call the API directly until we provide first-class support for Flutter Desktop.

@CaptainDario
Copy link

I totally missed the direct API access, this seems like a good solution.

@CaptainDario
Copy link

CaptainDario commented Jan 15, 2024

@marandaneto How can I overwrite the default timestamp?
When I try to set it the events are not registered anymore in the web UI.

This works and the event is registered in the UI

Map response = jsonDecode((await http.post(
    Uri.parse('https://eu.posthog.com/capture/'),
    headers: {
      "Content-Type": "application/json",
    },
    body: jsonEncode({
      "api_key": Env.POSTHOG_API_KEY,
      "event": eventName,
      "properties" : completeProps,
      //"timestamp" : DateTime(2023, 10, 5).toIso8601String(),
    })
  )).body);

this even is not registered.

Map response = jsonDecode((await http.post(
    Uri.parse('https://eu.posthog.com/capture/'),
    headers: {
      "Content-Type": "application/json",
    },
    body: jsonEncode({
      "api_key": Env.POSTHOG_API_KEY,
      "event": eventName,
      "properties" : completeProps,
      "timestamp" : DateTime(2023, 10, 5).toIso8601String(),
    })
  )).body);

However, in both cases, the return value is "{status: 1}".
Do you have an idea how to overwrite it?

Edit: It works I had the time filters set to 24h.

@CaptainDario
Copy link

For anybody finding this, the current time can be set with (DateTime.now().toUtc()).toIso8601String().

@marandaneto
Copy link
Member Author

For anybody finding this, the current time can be set with (DateTime.now().toUtc()).toIso8601String().

Yes, the docs mention the ISO8601 format.

@CaptainDario
Copy link

CaptainDario commented Jan 15, 2024

Yes, the format is mentioned, but they did not mention (or I did not see) that the time needs to be normalized to UTC. When sending my time zone (UTC+1), the server did not return an error, it sent the same response as with UTC but the data was not visible in the dashboard.

If this is obvious, I am sorry to spam this issue, I thought somebody else may have the same problems.

@marandaneto marandaneto mentioned this issue Jan 16, 2024
4 tasks
@marandaneto marandaneto changed the title Desktop support Desktop (Windows/Linux) support Jan 17, 2024
@marandaneto
Copy link
Member Author

macOS support has landed at least https://github.com/PostHog/posthog-flutter/releases/tag/4.0.0-beta.2

@stephane-archer
Copy link

I hope to see a Windows version even if it's a quick and dirty version with helpers that call the API directly.

@kirill-21
Copy link

Waiting for windows support

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Desktop enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants