halildurmus / dartwinrt

Idiomatic Dart projection of the modern Windows Runtime (WinRT) APIs.
BSD 3-Clause "New" or "Revised" License
49 stars 3 forks source link

Add `WebAuthenticationCoreManager` and `WebAuthenticationCoreManagerInterop` classes #191

Closed halildurmus closed 1 year ago

halildurmus commented 1 year ago

Description

Depends on https://github.com/dart-windows/win32/pull/703

Previous PR #190

Related Issue

Fixes #159

Type of Change

halildurmus commented 1 year ago

I wonder if we can detect automatically whether a calling UI thread is a console window or a Flutter window?

I don't know if this is possible but I will definitely check it out.

Would that affect how you'd write a function like this (e.g. a default value for appWindow)?

Yes, we would just make the appWindow parameters optional and use a default value for them.

And is this function generalizable? Will we need it again for other APIs?

These articles provide some information about these interop interfaces:

I wonder if there's a standard annotation (attribute, mixin) or something that we should use?

I don't think there is.

I'm planning to mention these interop helper classes in WinRT docs. So far we have InitializeWithWindow and WebAuthenticationCoreManagerInterop.

timsneath commented 1 year ago

According to the team (and I've tested it), this is a reliable way to detect whether you're running in console or Flutter:

bool get isFlutter => const bool.fromEnvironment('dart.library.ui');
halildurmus commented 1 year ago

According to the team (and I've tested it), this is a reliable way to detect whether you're running in console or Flutter:

bool get isFlutter => const bool.fromEnvironment('dart.library.ui');

Nice! I just created #197 which uses this flag.