I’m using the InterApp methods to open waze or google maps from my app, but, i need to check if that ap exists before calling it, so thats the reason of this module.
when I try to preview, i got the message: checkUrl is not on this scope, do you forgot to require a module?
that’s my code:
using Fuse;
using Fuse.Scripting;
using Fuse.Reactive;
using Uno.UX;
using Uno.Compiler.ExportTargetInterop;
[UXGlobalModule]
public class UrlModule : NativeModule
{
static readonly UrlModule _instance;
public UrlModule()
{
// Make sure we're only initializing the module once
if(_instance != null) return;
_instance = this;
Resource.SetGlobalKey(_instance, "UrlModule");
AddMember(new NativeFunction("canOpenUrl", (NativeCallback)canOpenUrl));
}
[Foreign(Language.ObjC)]
public static extern(iOS) bool checkUrl(string url)
@{
NSString* appURL = [NSString stringWithFormat:@"%@", url];
BOOL canOpenURL = [[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:appUrl]];
return canOpenURL;
@}
static object canOpenUrl(Context c, object[] args)
{
return checkUrl("maps://");
}
}
thanks in advance.