public static Task Authenticate(this Kidozen.KidoApplication app, Context context) { currentApplication = app; var url = A.fetchConfigValue("signInUrl", app.marketplace, app.application, app.key); var startPassiveAuthIntent = new Intent(context, typeof(PassiveAuthActivity)); startPassiveAuthIntent.AddFlags(ActivityFlags.NewTask); startPassiveAuthIntent.PutExtra("signInUrl", url.Result.Replace("\"", string.Empty)); context.StartActivity(startPassiveAuthIntent); return(Task.WhenAny(new Task[] { dummyPassiveAuthenticationTask, dummyPassiveFailTask })); }
private static void ShowVisualization(this Kidozen.KidoApplication app, IDataVisualization datavisualization, String visualization) { var baseurl = A.fetchConfigValue("url", app.marketplace, app.application, app.key); String url = String.Format("{0}api/v2/visualizations/{1}/app/download?type=mobile", baseurl.Result.Trim("\"".ToCharArray()), visualization); var files = new Files(app.GetIdentity); Task.Factory.StartNew(() => { var bytes = files.DownloadFromUrl(url).Result; var targetDir = datavisualization.GetTargetDirectory(); var filename = string.Format("{0}{1}", visualization, ".zip"); System.IO.File.WriteAllBytes(Path.Combine(targetDir, filename), bytes); if (datavisualization.UnzipFiles(targetDir, visualization)) { replacePlaceholders(app, visualization); datavisualization.LaunchView(visualization, targetDir); } }); }
public static Task Authenticate(this Kidozen.KidoApplication app) { currentApplication = app; var url = A.fetchConfigValue("signInUrl", app.marketplace, app.application, app.key); var authController = new PassiveAuthViewController(url.Result.Replace("\"", string.Empty)); authController.AuthenticationResponseArrived += HandleAuthenticationResponseArrived; var navController = new UINavigationController(authController); #if __UNIFIED__ UIApplication.SharedApplication.Delegate.GetWindow().RootViewController.PresentViewController(navController, true, new Action(() => Debug.WriteLine("passive view loaded")) ); #else UIApplication.SharedApplication.Delegate.Window.RootViewController.PresentViewController(navController, true, new NSAction(() => Debug.WriteLine("passive view loaded")) ); #endif return(Task.WhenAny(new Task[] { dummyPassiveAuthenticationTask, dummyPassiveFailTask })); }