public void showShopikaAndRegisterForEvents() { #if UNITY_EDITOR //en editor no hay webview return; #endif videoModal.SetActive(true); if (ShopikaManager.GetCastedInstance <ShopikaManager> ().currentUserId == ShopikaManager.GetCastedInstance <ShopikaManager> ().ANONYMOUS_USER) { if (((DataManagerKubera)DataManagerKubera.GetInstance()).currentUser.firstTimeShopping) { ((DataManagerKubera)DataManagerKubera.GetInstance()).currentUser.firstTimeShopping = false; } showShopikaLogin(); } else { loginToShopika(ShopikaManager.GetCastedInstance <ShopikaManager> ().currentUserId, ShopikaManager.GetCastedInstance <ShopikaManager> ().currentUser.accesToken); } isWaiting = true; WebViewManager.GetInstance().OnFinishLoading += showToolBar; registerForMessages(); }
public void onCustomUrl(string url) { if (url.StartsWith("unity:")) { WebViewManager.ProcessGotoEvent(url.Replace("unity:", string.Empty)); } }
Widget _buildNavigationBar() { return(new CustomAppBar( () => { this._onClose = true; this.setState(() => { }); if (Router.navigator.canPop()) { Router.navigator.pop(); } if (!Application.isEditor) { this._webViewObject.SetVisibility(false); WebViewManager.destroyWebView(); } }, rightWidget: new CustomButton( onPressed: () => StoreProvider.store.dispatcher.dispatch(new OpenUrlAction { url = this.widget.url }), child: new Icon( icon: Icons.open_in_browser, size: 24, color: CColors.Icon ) ) )); }
public override void dispose() { if (this._timer != null) { this._timer.cancel(); this._timer.Dispose(); } if (!Application.isEditor) { this._webViewObject.SetVisibility(false); WebViewManager.destroyWebView(); if (this.widget.landscape) { Screen.orientation = ScreenOrientation.Portrait; } if (this.widget.fullScreen) { Screen.fullScreen = false; } } Router.routeObserve.unsubscribe(this); base.dispose(); }
Widget _buildNavigationBar() { return(new CustomAppBar( () => { this._onClose = true; this.setState(() => { }); if (Router.navigator.canPop()) { Router.navigator.pop(); } if (!Application.isEditor) { this._webViewObject.SetVisibility(false); WebViewManager.destroyWebView(); } }, rightWidget: this.widget.showOpenInBrowser ? (Widget) new CustomButton( onPressed: () => StoreProvider.store.dispatcher.dispatch(new OpenUrlAction { url = this.widget.url }), child: new Icon( icon: Icons.open_in_browser, size: 24, color: CColors.Icon ) ) : new Container(), backgroundColor: this._progress == 1 && this.widget.fullScreen ? CColors.Black : null, bottomSeparatorColor: this._progress == 1 && this.widget.fullScreen ? CColors.Black : null )); }
public void didPop() { if (!Application.isEditor) { this._webViewObject.SetVisibility(false); WebViewManager.destroyWebView(); } }
internal Task RemoveFromWebViewManagerAsync(WebViewManager webviewManager) { if (string.IsNullOrWhiteSpace(Selector)) { throw new InvalidOperationException($"{nameof(RootComponent)} requires a value for its {nameof(Selector)} property, but no value was set."); } return(webviewManager.RemoveRootComponentAsync(Selector)); }
static public void Init(WebViewObject webObj) { if (instance == null) { instance = new WebViewManager(); instance.webViewObject = webObj; instance.InitWebView(); } }
public void closeWebView() { if (videoModal.activeInHierarchy) { videoModal.SetActive(false); } WebViewManager.GetInstance().OnFinishLoading -= showToolBar; WebViewManager.GetInstance().stopLoading(); WebViewManager.GetInstance().hideWebView(); customToolBar.SetActive(false); }
protected void loginToShopika(string userID, string tokenID) { string tempHtml = "<script type=\"text/javascript\">\n\tvar tokenId = \"{{TokenID}}\";\n\tvar userId = \"{{UserID}}\";\n</script>\n<form method=\"post\" action=\"http://shopika-store.cuatromedios.net/token-login\" id=\"tokenLoginForm\">\n\t<input type=\"hidden\" name=\"action\" value=\"token-login\">\n\t<input type=\"hidden\" name=\"tokenId\">\n\t<input type=\"hidden\" name=\"userId\">\n</form>\n<script type=\"text/javascript\">\n\tvar form = document.getElementById(\"tokenLoginForm\");\n\tform.tokenId.value = tokenId;\n\tform.userId.value = userId;\n\tform.submit();\n</script> "; tempHtml = tempHtml.Replace("{{TokenID}}", tokenID); tempHtml = tempHtml.Replace("{{UserID}}", userID); videoModal.SetActive(true); WebViewManager.GetInstance().createWebView(tempHtml, webViewSize, webViewRectCanvasCamera, true); //WebViewManager.GetInstance ().displayWebView.CanBounce = true; }
void Awake() { if (_instance != null && _instance != this) { Destroy(this.gameObject); return; } else { _instance = this; } DontDestroyOnLoad(transform.gameObject); }
void Start() { exitBTN.gameObject.SetActive(false); title.text = MultiLanguageTextManager.instance.getTextByID(MultiLanguageTextManager.CONNECTING_SHOPIKA_TITLE); Info.text = MultiLanguageTextManager.instance.getTextByID(MultiLanguageTextManager.CONNECTING_SHOPIKA_INFO); utils.gems.sync.ShopikaSyncManager.GetCastedInstance <utils.gems.sync.ShopikaSyncManager> ().OnDataRetrieved += popUpCompleted; utils.gems.sync.ShopikaSyncManager.GetCastedInstance <utils.gems.sync.ShopikaSyncManager> ().OnDataRetrievedFailure += failure; utils.gems.sync.ShopikaSyncManager.GetCastedInstance <utils.gems.sync.ShopikaSyncManager> ().OnLoginFailure += failure; WebViewManager.GetInstance().OnFinishLoading += webClosed; }
void Update() { if (isWaiting) { waitForAnswerTime += Time.deltaTime; if (waitForAnswerTime >= totalTime) { closeWebView(); isWaiting = false; waitForAnswerTime = 0; WebViewManager.GetInstance().OnFinishLoading(WebViewManager.GetInstance().displayWebView); } } }
public override void dispose() { if (this._timer != null) { this._timer.cancel(); this._timer.Dispose(); } if (!Application.isEditor) { this._webViewObject.SetVisibility(false); WebViewManager.destroyWebView(); } base.dispose(); }
public void showShopikaLanding() { videoModal.SetActive(true); string url = shopikaLandingURI; if (ShopikaManager.GetCastedInstance <ShopikaManager> ().currentUserId != ShopikaManager.GetCastedInstance <ShopikaManager> ().ANONYMOUS_USER) { url += "?userId=" + ShopikaManager.GetCastedInstance <ShopikaManager> ().currentUserId; } isWaiting = true; WebViewManager.GetInstance().OnFinishLoading += showToolBar; registerForMessages(); WebViewManager.GetInstance().createWebView(url, webViewSize, webViewRectCanvasCamera, false); }
Widget _buildNavigationBar() { return(new CustomAppBar( () => { this._onClose = true; this.setState(() => { }); if (Router.navigator.canPop()) { Router.navigator.pop(); } if (!Application.isEditor) { this._webViewObject.SetVisibility(false); WebViewManager.destroyWebView(); } } )); }
public void messageCallBack(WebView webview, WebViewMessage message) { /*Debug.Log ("Soy el registrado"); * Debug.Log (message.Host); * Debug.Log (message.Scheme); * Debug.Log (message.URL); * Debug.Log (message.Arguments.ToJSON().ToString());*/ Debug.Log(message.Arguments ["tokenId"]); Debug.Log(message.Arguments ["userId"]); string tempHtml = "<script type=\"text/javascript\">\n\tvar tokenId = \"{{TokenID}}\";\n\tvar userId = \"{{UserID}}\";\n</script>\n<form method=\"post\" action=\"http://45.55.222.58:3003/token-login\" id=\"tokenLoginForm\">\n\t<input type=\"hidden\" name=\"action\" value=\"token-login\">\n\t<input type=\"hidden\" name=\"tokenId\">\n\t<input type=\"hidden\" name=\"userId\">\n</form>\n<script type=\"text/javascript\">\n\tvar form = document.getElementById(\"tokenLoginForm\");\n\tform.tokenId.value = tokenId;\n\tform.userId.value = userId;\n\tform.submit();\n</script> "; tempHtml = tempHtml.Replace("{{TokenID}}", message.Arguments ["tokenId"]); tempHtml = tempHtml.Replace("{{UserID}}", message.Arguments ["userId"]); Debug.Log(tempHtml); WebViewManager.GetInstance().createWebView(tempHtml, true); }
internal Task AddToWebViewManagerAsync(WebViewManager webViewManager) { // As a characteristic of XAML,we can't rely on non-default constructors. So we have to // validate that the required properties were set. We could skip validating this and allow // the lower-level renderer code to throw, but that would be harder for developers to understand. if (string.IsNullOrWhiteSpace(Selector)) { throw new InvalidOperationException($"{nameof(RootComponent)} requires a value for its {nameof(Selector)} property, but no value was set."); } if (ComponentType is null) { throw new InvalidOperationException($"{nameof(RootComponent)} requires a value for its {nameof(ComponentType)} property, but no value was set."); } var parameterView = Parameters == null ? ParameterView.Empty : ParameterView.FromDictionary(Parameters); return(webViewManager.AddRootComponentAsync(ComponentType, Selector, parameterView)); }
protected void showShopikaLogin() { videoModal.SetActive(true); WebViewManager.GetInstance().createWebView("http://shopika-store.cuatromedios.net/standalone-login", webViewSize, webViewRectCanvasCamera, false); //WebViewManager.GetInstance ().displayWebView.CanBounce = true; }
public void createWebView() { WebViewManager.GetInstance().createWebView("http://45.55.222.58:3003/standalone-login", webViewSize, webViewRectCanvasCamera, false); }
public void showToolBar(WebView webview) { WebViewManager.GetInstance().showWebView(); customToolBar.SetActive(true); isWaiting = false; }
protected void registerForMessages() { WebViewManager.GetInstance().registerToReceiveMessageFromWebView(WEBVIEW_SCHEME, messageCallBack); }
internal Task AddToWebViewManagerAsync(WebViewManager webViewManager) { var parameterView = Parameters == null ? ParameterView.Empty : ParameterView.FromDictionary(Parameters); return(webViewManager.AddRootComponentAsync(ComponentType, Selector, parameterView)); }
void Awake() { _instance = this; }
public void unregisterForTelMessage() { WebViewManager.GetInstance().unRegisterFromMessage("tel", messageCallBack); }
public void setCloseButton() { WebViewManager.GetInstance().changeViewControls(eWebviewControlType.CLOSE_BUTTON); }
public void setWholeHUD() { WebViewManager.GetInstance().changeViewControls(eWebviewControlType.TOOLBAR); }
public void registerForMailToMessage() { WebViewManager.GetInstance().registerToReceiveMessageFromWebView("mailto", messageCallBack); }
public void registerForTelMessage() { WebViewManager.GetInstance().registerToReceiveMessageFromWebView("login", messageCallBack); }
public void OpenContentPage() { if (IsHidden) { // This fragment is hidden, need not open page return; } if (wvContent == null || // WebView does not requested DataCache.INSTATNCE.Toc == null // Toc has not been retrieved ) { return; } var pub = ((ContentActivity)Activity).Publication; if (!DataCache.INSTATNCE.Toc.IsCurrentPublication(pub.Value.BookId)) { // The toc is not belong to current publication return; } var tocNode = DataCache.INSTATNCE.Toc.ShowingLeafNode; var tag = wvContent.Tag as JavaObjWrapper <WebViewTag>; if (tag != null && tag.Value.IsCurrentTOC(pub.Value.BookId, tocNode.ID)) { /* * wvContent.Tag = new JavaObjWrapper<WebViewTag>( * WebViewTag.CreateWebViewTagByTOC( * pub.Value.BookId, * tocNode.ID)); */ ((ContentActivity)Activity).ClosePleaseWaitPageLoadDialog(); UpdateNavigationIcon(); if (!tag.Value.IsCurrentNavigationItem()) { wvContent.LoadUrl("javascript:android.red.applyHighLight();android.red.scrollByNavigation();"); tag.Value.BindNavigationItem(); if (((ContentActivity)Activity).IsPbo()) { var pboPageItem = AsyncHelpers.RunSync <PageItem>( () => PageSearchUtil.Instance.GetFirstPageItem(pub.Value.BookId, tocNode.ID)); currentPboPage = pboPageItem != null?pboPageItem.Identifier.ToString() : null; } //UpdatePboPage(); } return; } var result = AsyncHelpers.RunSync <string>( () => PublicationContentUtil.Instance.GetContentFromTOC(pub.Value.BookId, tocNode, true, false)); //result = SlideToc(result); // Only large content need show wait dialog if (result.Length > WebViewManager.ShowWaitContentMinLength || WebViewManager.CountATag(result) > WebViewManager.ShowWaitMinATagCount) { ((ContentActivity)Activity).ShowPleaseWaitDialog(); Task.Run(() => { Thread.Sleep(100); result = PublicationContentUtil.Instance.RenderHyperLink(result, pub.Value.BookId); result = "<div id='toc_" + tocNode.ID + "' class='tocpagediv' >" + result + "</div>"; Application.SynchronizationContext.Post(_ => { tag = new JavaObjWrapper <WebViewTag>( WebViewTag.CreateWebViewTagByTOC( pub.Value.BookId, tocNode.ID)); tag.Value.BindNavigationItem(); wvContent.Tag = tag; wvContent.LoadDataWithBaseURL( "file:///android_asset/html/", WebViewManager.Instance.ApplyTemplate(WebViewManager.WebViewType.Content, result), "text/html", "utf-8", null); if (((ContentActivity)Activity).IsPbo()) { var pboPageItem = AsyncHelpers.RunSync <PageItem>( () => PageSearchUtil.Instance.GetFirstPageItem(pub.Value.BookId, tocNode.ID)); currentPboPage = pboPageItem != null ? pboPageItem.Identifier.ToString() : null; } UpdatePboPage(); UpdateNavigationIcon(); }, null); }); return; } //result = PublicationContentUtil.Instance.RenderHyperLink(result, pub.Value.BookId); //result = "<div id='toc_" + tocNode.ID + "' class='tocpagediv' >" + result + "</div>"; //DumpToc(pub.Value.BookId, tocNode.ID, WebViewManager.Instance.ApplyTemplate(WebViewManager.WebViewType.Content, result)); //tag = new JavaObjWrapper<WebViewTag>( // WebViewTag.CreateWebViewTagByTOC( // pub.Value.BookId, // tocNode.ID)); //tag.Value.BindNavigationItem(); //wvContent.Tag = tag; //wvContent.LoadDataWithBaseURL( // "file:///android_asset/html/", // WebViewManager.Instance.ApplyTemplate(WebViewManager.WebViewType.Content, result), // "text/html", // "utf-8", // null); //if (((ContentActivity)Activity).IsPbo()) //{ // var pboPageItem = AsyncHelpers.RunSync<PageItem>( // () => PageSearchUtil.Instance.GetFirstPageItem(pub.Value.BookId, tocNode.ID)); // currentPboPage = pboPageItem != null ? pboPageItem.Identifier.ToString() : null; //} //UpdatePboPage(); //UpdateNavigationIcon(); }
public void unregisterForMailToMessage() { WebViewManager.GetInstance().unRegisterFromMessage("mailto", messageCallBack); }