protected void Handle_LearnMore( )
        {
            // don't process the link if there's no ReferenceURL
            if (string.IsNullOrWhiteSpace(NewsItem.ReferenceURL) == false)
            {
                // if this is an app-url, then let the task (which forwards it to the springboard) handle it.
                if (SpringboardViewController.IsAppURL(NewsItem.ReferenceURL) == true)
                {
                    Task.HandleAppURL(NewsItem.ReferenceURL);
                }
                else
                {
                    // copy the news item's relevant members. That way, if we're running in debug,
                    // and they want to override the news item, we can do that below.
                    string newsUrl             = NewsItem.ReferenceURL;
                    bool   newsImpersonation   = NewsItem.IncludeImpersonationToken;
                    bool   newsExternalBrowser = NewsItem.ReferenceUrlLaunchesBrowser;

                    // If we're running a debug build, see if we should override the news
    #if DEBUG
                    if (DebugConfig.News_Override_Item == true)
                    {
                        newsUrl             = DebugConfig.News_Override_ReferenceURL;
                        newsImpersonation   = DebugConfig.News_Override_IncludeImpersonationToken;
                        newsExternalBrowser = DebugConfig.News_Override_ReferenceUrlLaunchesBrowser;
                    }
    #endif

                    TaskWebViewController.HandleUrl(newsExternalBrowser, newsImpersonation, newsUrl, Task, this, false, false, false);
                }
            }
        }
        public void RowClicked(int row)
        {
            if (row < News.Count)
            {
                // mark that they tapped this item.
                NewsAnalytic.Instance.Trigger(NewsAnalytic.Read, News[row].News.Title);

                if (News[row].News.SkipDetailsPage == true && string.IsNullOrEmpty(News[row].News.ReferenceURL) == false)
                {
                    // if this is an app-url, then let the task (which forwards it to the springboard) handle it.
                    if (SpringboardViewController.IsAppURL(News[row].News.ReferenceURL) == true)
                    {
                        Task.HandleAppURL(News[row].News.ReferenceURL);
                    }
                    else
                    {
                        // copy the news item's relevant members. That way, if we're running in debug,
                        // and they want to override the news item, we can do that below.
                        string newsUrl             = News[row].News.ReferenceURL;
                        bool   newsImpersonation   = News[row].News.IncludeImpersonationToken;
                        bool   newsExternalBrowser = News[row].News.ReferenceUrlLaunchesBrowser;

                        // If we're running a debug build, see if we should override the news
                        #if DEBUG
                        if (DebugConfig.News_Override_Item == true)
                        {
                            newsUrl             = DebugConfig.News_Override_ReferenceURL;
                            newsImpersonation   = DebugConfig.News_Override_IncludeImpersonationToken;
                            newsExternalBrowser = DebugConfig.News_Override_ReferenceUrlLaunchesBrowser;
                        }
                        #endif

                        TaskWebViewController.HandleUrl(newsExternalBrowser, newsImpersonation, newsUrl, Task, this, false, false, false);
                    }
                }
                else
                {
                    NewsDetailsUIViewController viewController = new NewsDetailsUIViewController();
                    viewController.NewsItem = News[row].News;

                    Task.PerformSegue(this, viewController);
                }
            }
        }
Beispiel #3
0
        public override void TouchesEnded(NSSet touches, UIEvent evt)
        {
            Rock.Mobile.Util.Debug.WriteLine("Touches Ended");

            // for base.TouchesEnded, we do not want to call that FIRST if we're destroying the notes and switching to another page within the App.

            // if the tutorial is showing, all we want to do is hide it.
            // If we process input, it's possible they'll tap thru it to a URL, which will
            // switch pages and cause a lot of user confustion
            if (TutorialShowing( ))
            {
                AnimateTutorialScreen(false);
            }
            else
            {
                UITouch touch = touches.AnyObject as UITouch;
                if (touch != null)
                {
                    if (Note != null)
                    {
                        // should we visit a website?
                        bool urlLaunchesExternalBrowser = false;
                        bool urlUsesRockImpersonation   = false;

                        string activeUrl = Note.TouchesEnded(touch.LocationInView(UIScrollView).ToPointF( ), out urlLaunchesExternalBrowser, out urlUsesRockImpersonation);
                        if (string.IsNullOrEmpty(activeUrl) == false)
                        {
                            // see if the task should handle it (as in its a redirect within the app)
                            if (SpringboardViewController.IsAppURL(activeUrl) == true)
                            {
                                // HACK JHM 9-1-2017: We don't currently have the ability to transition from a landscape Note to a portrait Task.
                                // Because of that, they either need to be on an iPad, or have their phone in portrait mode. This isn't ideal,
                                // but without adding support for landscape->portrait, we don't have any other choice.
                                if (SpringboardViewController.SupportsLandscapeWide( ) == true || SpringboardViewController.IsDevicePortrait( ) == true)
                                {
                                    SaveNoteState(UIScrollView.ContentOffset.Y / ( nfloat )Math.Max(1, UIScrollView.ContentSize.Height));
                                    DestroyNotes( );

                                    // if the url uses the rock impersonation token, it's safe to assume they tapped the takeaway.
                                    if (urlUsesRockImpersonation)
                                    {
                                        MessageAnalytic.Instance.Trigger(MessageAnalytic.Takeaway, activeUrl);
                                    }

                                    Task.HandleAppURL(activeUrl);
                                }
                            }
                            else
                            {
                                // cleanup the notes before leaving
                                SaveNoteState(UIScrollView.ContentOffset.Y / ( nfloat )Math.Max(1, UIScrollView.ContentSize.Height));
                                DestroyNotes( );

                                // if not, it's either a websie or bible verse
                                Task.NavToolbar.Reveal(true);
                                Task.NavToolbar.SetBackButtonEnabled(true);

                                if (App.Shared.BibleRenderer.IsBiblePrefix(activeUrl))
                                {
                                    BiblePassageViewController viewController = new BiblePassageViewController(activeUrl, Task);
                                    Task.PerformSegue(this, viewController);
                                }
                                else
                                {
                                    TaskWebViewController.HandleUrl(urlLaunchesExternalBrowser, urlUsesRockImpersonation, activeUrl, Task, this, true, false, false);
                                }
                            }
                        }
                    }
                }

                // when a touch is released, re-enabled scrolling
                UIScrollView.ScrollEnabled = true;
            }

            // Process TouchesEnded AFTER handling locally- we need to do this
            // in case the Note above wants to switch to another activity within the app.
            base.TouchesEnded(touches, evt);
        }