I'm currently trying to use Azure Authentication within my Flutter app. I've searched and have not found an existing library that supports MSAL/AAD for Flutter on Windows.
If I use the MSAL package within Visual Studio for a WPF app, the authentication works fine, so the app within Azure is set up correctly. I think I need to use the legitimate client tooling that Microsoft provides in order to get my tokens and such.
Unfortunately, Flutter doesn't provide any integration with .NET, so I can't write a platform-specific integration in .NET and then the rest of my app in Flutter, so that's a shame. But it seems like Flutter can reference a standard C library.
It also seems like Microsoft makes a client for Go, and Go can compile to a C Shared library. So, in my mind, I should be able to compile this library to a C Shared library, and then write up my platform specific implementation in Flutter. In my attempts to build the MSAL GO library so far, it seems like because the MSAL GO library (https://github.com/AzureAD/microsoft-authentication-library-for-go) lacks a main method, and is more to be used as a plugin, so it can't be built directly into a c-shared library by Go.
How can I build the Microsoft MSAL library as a c-shared library? Please note, I am hilariously new to Go.
This does not answer your question directly, but it has been done without any plugin or native development, as far as I understand:
https://blog.objektkultur.de/azure-ad-authentication-flutter-apps/
I also looked up available libraries for AzureAD, and besides the Go library there seem to be versions for Java and ObjectiveC, which you could use to develop your own integration using Flutter platform channels for example.
If you really want to use Go from within Dart / Flutter, I would try to compile the Go code to web assembly and use something like:
https://pub.dev/packages/wasm
No guarantee, this leads in the right direction, though.
Related
It's probably not a programming question and a bit too generic but I can't find any resource about the differences of writing plugin for flutter using Kotlin vs Java. From my research, almost every plugin in pub.dev that I found is written in Java. I don't say Java is bad but I personally prefer Kotlin over Java because of the syntax.
I'm planning to build native code to interact with native libs both on iOS and Android for my project since I couldn't find any plugin that satisfy the project requirements. I'd like to share it on pubdev when it's done (hopefully) so I have to think twice before writing it.
The question is, if I do so (developing Kotlin-based plugin), will it make any difference? Like maybe requires the user to add some extra configuration to their project? Or maybe any Flutter project that uses Java can't use my package? and.. will it do the same for iOS (using Swift over Objective-C)? The docs is telling us that we can switch both in between, but doesn't tell any side effects about it.
No there is nothing to worry about. Flutter apps are now by default created with Kotlin/Swift and not with Java/ObjC. Of course if someone has an ultra old Flutter configuration, then he might have some problems but I wouldn't concern myself with it.
All the native plugin code is converted to a Gradle dependency or Pod(spec) dependency. The app developer doesn't have to care about it and that is a good thing.
I'm working with Parse Server, my task is to build a flutter application that using Parse SDK to communicate with the Parse Server. You can see the Parse SDK here, these are two packages, one is for Flutter, and another is for Dart. I don't know the difference between these two, and which one I should use.
If you create a Flutter app you should use Parse-SDK-Flutter package. In Migration Guide plugin developers provide this reason for moving from Dart to separate package:
This was done in order to provide a dart package for the parse-server, while keeping maintenance simple. You can find both packages in the package directory..
Does anyone have any experience combining React Native and Unity? I'm looking to start a Unity project that's very UI Heavy and I'm thinking about using React Native to take advantage of its UI capabilities on mobile and web.
I'm curious what the workflow for such an approach would be.
Finally after a lot of trials managed to do this. These are the steps.
1) Using this link, export android project for Gradle.
Select Gradle in the Build Settings window and check the Export Project checkbox.
Click Export and select the destination folder.
2) Import the generated folder in Android studio. Select ok whenever prompted. In this process, you will encounter following issues
2a) Gradle Sync Failed due to org.gradle.api.internal.tasks issues. Resolve using this link
3) Create React Native App using this link
4) Start Integrating Android exported folder inside created react native app using this link. Don't upgrade Gradle as Android studio will ask you again and again. You will encounter following issues. Don't go through "Test Integration" until you are finished with #5 here.
4a) While configuring maven, use this url for maven url "$rootDir/../node_modules/react-native/android" .
4b) While configuring maven, if you encounter problem related to javax.inject:javax.inject". Use this link.
4c) You may also encounter this error "Conflict with dependency 'com.google.code.findbugs:jsr305'". You can solve this link.
4d) During Code integration section of this link, focus on the following section: If you are using a starter kit for React Native, replace the "HelloWorld" string with the one in your index.android.js file (it’s the first argument to the AppRegistry.registerComponent() method). Here you have to replace with project name.
5) Before going through "Test your Integration" section, you have to add code to call MyReactActivity from UnityActivity. This link will help.
6) Go through "Test your Integration" section of link provided in #4. You may encounter following problems.
6a) unable to load script from assets index.android.bundle. Use this link.
6b) could not connect to development server on android. Use this link.
Check my article on Medium
I've shown with an example on How to integrate react native with Unity 3D step by step. My aim was to use the react native within the Unity3D like a module which is quite convenient if you're gonna heavily work on Unity 3D. Hope this helps for someone who comes here later.
I'm unsure as how a Unity game is built for iOS, if it uses Cocoa Touch for rendering its core classes.
If it does, and you have access or ability to render a UIViewController then you can render your React Native application. The only thing you would have to facilitate is setting up communication between the two applications.
Here is an example of rendering a native UI Component inside a React Native app that may help. http://moduscreate.com/leverage-existing-ios-views-react-native-app/
I was curious as well, and created an example project of how to do this for Android: https://github.com/marijnz/unity-react.
If this is a viable option, at least depends on:
How long the project will be running, both React and Unity have to be updated and this gets probably tougher over time.
The amount of sdk's/dependencies the project has.
If you want to do iOS as well.
In general, I'd probably avoid going this way.
Even though the example seems pretty simple now, it was a pain to get to that (as Shaunak's answer already hints at ;))
In porting my WPF MVVM app to MvvmCross, what would be the recommended approach for persistent user settings in the Core assembly? Currently I'm using Properties.Settings for this task. Ideally, I'd like a solution that can play nicely with ClickOnce upgrades on Windows.
Thanks!
If you only want to support WPF, then you could continue using properties.settings.
If you want to support settings using native techniques on other platforms as well, then you could create an interface/abstraction for your settings and then use dependency injection to inject an appropriate settings implementation on each platform. You could do this in a plugin if you wanted to - but for getting started it's easiest to start by injecting this in your UI projects in Setup.cs (for how to build a plugin, see https://speakerdeck.com/cirrious/plugins-in-mvvmcross)
What I would probably do... is to use a portable settings implementation - either using a simple JSON file or using a small SQLite database (accessed via SQLite-net). This would enable you to reuse exactly the same code on all platforms. I don't know how this would work with ClickOnce (I don't know much about ClickOnce) but I'm assuming ClickOnce would preserve these data files during upgrades.
For portably saving a JSON file, see https://github.com/slodge/MvvmCross-Tutorials/blob/master/Sample%20-%20CirriousConference/Cirrious.Conference.Core/Models/FavoritesSaver.cs
For using SQLite-net, see https://speakerdeck.com/cirrious/using-sqlite-dot-net-in-mvvmcross - but be aware that the nuget packages for SQLite-net still suffer from the open issue on x64/x86/ARM differences - see How to distribute processor-specific WindowsStore assemblies with nuget :/
I'm work in an aplication that need be capable of support plugins, but i dont know how this work.
See Design Pattern for implementing plugins in your application?
The answers tend to get very platform specific. It also depends on how much control of your core app data and logic the plugin must have.
The C++ QT4 book has a good description of adding a file-type plugin to it's architecture, there area also a bunch of modeling apps (openscenegraph, blender, povray ) that have good documentation for their plugin architectures.
You need to design your application's API in such a way that plugins can be created, and you need to add the necessary plugin management interfaces and supporting code to invoke the plugins. There is no catch-all way of managing plugins.
Take a look at the open source application called Rawr (c#). Each addin is a seperate .dll and the main app uses reflection to access the code. Very nicely done.
www.codeplex.com/Rawr