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

Request for adding UWP support #58

Open
roxk opened this issue Sep 28, 2022 · 8 comments
Open

Request for adding UWP support #58

roxk opened this issue Sep 28, 2022 · 8 comments
Assignees
Labels
enhancement New feature or request

Comments

@roxk
Copy link
Contributor

roxk commented Sep 28, 2022

FormX is experimenting with WinUI/Uno and needs to use authgear with UWP.

  • Make it compile and output UWP lib
  • Add .uwp.cs to all files which have .android/ios.cs file extensions
  • Can ignore biometrics for the moment
@roxk roxk added the enhancement New feature or request label Sep 28, 2022
@roxk roxk self-assigned this Sep 28, 2022
@roxk
Copy link
Contributor Author

roxk commented Sep 28, 2022

@louischan-oursky I'm getting invalid device info error after authentication. Seems server is validating device info :( Should I put a dummy android device info for now? I reckon you guys wouldn't have time to update server to add a windows to device info field.

@louischan-oursky
Copy link
Collaborator

You can use dummy values during development. It would be great if you can help implementing device info for Windows devices :)

@roxk
Copy link
Contributor Author

roxk commented Sep 28, 2022

I'd love to but I think I don't have time to setup server development environment 😅 I will setup dummy value for now.

@roxk
Copy link
Contributor Author

roxk commented Sep 28, 2022

UWP AuthenticateAsync is done. Since UWP's system authentication API uses old edge's engine (spartan) which is no longer supported by most sites (authgear is tested to be unsable), system browser is used instead.

Still working on Uno WASM support and it requires major code structure change as there is no specific WASM TFM. To reference Uno's polyfill of Windows API, a special project Authgear.Xamarin.Wasm is created side-by-side with the original project to create a cross-runtime library. Essentially, it's an additional binary built with uno's windows API polyfill located in a specific folder in the nuget. I have not tested how it works but I guess uno has specific build time logic to pick the binary up.

Uno also provides Xamarin WASM support (experimental). I have created a test project but apparently cross-runtime library only works in nuget. Referencing the project doesn't work (no WASM output), and referencing the wasm project directly produces type conflict (duplicate definition). Will proceed to create local nuget to test.

@roxk
Copy link
Contributor Author

roxk commented Sep 29, 2022

The local nuget can be created as expected, but the WASM specific content isn't picked up. Manually moved the nupkg to another project for consumption and again WASM specific content (e.g. AuthgearSDK constructor) isn't picked up. I have inspected the nupkg and resultant dll, can confirm the WASM specific content are all there, which means it's the build process that didn't pick it up.

Asked in discord for troubleshooting tips.

@roxk
Copy link
Contributor Author

roxk commented Sep 29, 2022

unoplatform/uno#10015

Pending reply.

@roxk
Copy link
Contributor Author

roxk commented Sep 29, 2022

  • Support cancellation token in UWP as it's now logging in in external browser and the app has no way to "go back"
  • Exclude uno from nupkg dependency (set private assets = all)

@roxk
Copy link
Contributor Author

roxk commented Sep 30, 2022

They replied. Basically, due to WASM not being a specific TFM, there is no way to pick up WASM specific method.

The solution I will employ is to create a "general" method in .netstandard.cs that accepts object and cast the object to the correct type. WASM project can then pass any required param to the method. Unfortunate situation, yes, but workable.

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

No branches or pull requests

2 participants