Esempio n. 1
0
        void NextPage()
        {
            var me    = RealmUserServices.GetMe(true);
            var realm = RealmManager.SharedInstance.GetRealm(null);

            //cache facebook image
            var str   = "https://graph.facebook.com/" + Shared.FacebookUserId + "/picture?type=large";
            var image = UIImage.LoadFromData(NSData.FromUrl(NSUrl.FromString(str)));
            var bytes = ImageUtils.ByteArrayFromImage(image, 50);

            S3Utils.UploadPhoto(bytes, me.LocalProfileImageURL, me.RemoteProfileImageURL, "Profile.png", null, null);

            Shared.NextPage();

            UIView.Animate(1, delegate
            {
                View.Alpha = 0;
            }, delegate
            {
                if (String.IsNullOrEmpty(me.FirstName) || String.IsNullOrEmpty(me.LastName))
                {
                    ((LandingTabbarController)TabBarController).SetSelectedViewControllerByType(typeof(HelloViewController), false, null);
                }
                else
                {
                    SlinkUser.SetNextHandelByNameIfNecessary();
                    ApplicationExtensions.ShowOnboarding(false);
                }
            });
        }
Esempio n. 2
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            if (((SharingTableViewController)TargetViewController).Shared.SelectedCard.IsMine())
            {
                NavigationItem.RightBarButtonItem = new UIBarButtonItem(UIBarButtonSystemItem.Edit, (sender, e) =>
                {
                    //this is used to counter the auto reload. See NewCardTableViewController
                    Transporter.SharedInstance.RemoveObject(Transporter.NewOutletAddedTransporterKey);
                    Transporter.SharedInstance.RemoveObject(Transporter.NewOutletAddedValueTransporterKey);

                    var vc = new NewCardViewController();
                    (vc.TargetViewController as NewCardTableViewController).Shared.SelectedCard = (TargetViewController as SharingTableViewController).Shared.SelectedCard;
                    ApplicationExtensions.PushViewController(vc, true);
                });
            }
            else
            {
                NavigationItem.RightBarButtonItem = new UIBarButtonItem(UIBarButtonSystemItem.Trash, (sender, e) =>
                {
                    ((SharingTableViewController)TargetViewController).Shared.DeleteCard();
                    NavigationController.PopViewController(true);
                });
            }

            RemoveBackBarButtonTitle();
        }
Esempio n. 3
0
        partial void StartButtonClicked(Foundation.NSObject sender)
        {
            string firstName = FirstNameTextField.Text.Trim();
            string lastName  = LastNameTextField.Text.Trim();

            bool allFieldsValid = ValidateAllFields();

            if (!allFieldsValid)
            {
                return;
            }

            var realm = RealmManager.SharedInstance.GetRealm(null);
            var me    = RealmUserServices.GetMe(false);


            realm.Write(() =>
            {
                me.FirstName = firstName;
                me.LastName  = lastName;
            });

            SlinkUser.SetNextHandelByNameIfNecessary();

            UIView.Animate(1, delegate
            {
                View.Alpha = 0;
            }, delegate
            {
                ApplicationExtensions.ShowOnboarding(true);
            });
        }
        public override void ViewDidLoad()
        {
            PullToRefresh = false;

            base.ViewDidLoad();

            AutomaticallyAdjustsScrollViewInsets = false;

            TableSource = new SettingsTableViewSource();
            TableSource.ItemSelected += (NSIndexPath arg1, SettingsShared.SettingsModel arg2) =>
            {
                if (arg2 == null || String.IsNullOrEmpty(arg2.Title))
                {
                    return;
                }

                if (arg2.Title.Equals(SettingsShared.navigation_item_my_outlets, StringComparison.InvariantCultureIgnoreCase))
                {
                    //this is used to counter the auto reload. See NewCardTableViewController
                    Transporter.SharedInstance.RemoveObject(Transporter.NewOutletAddedTransporterKey);
                    Transporter.SharedInstance.RemoveObject(Transporter.NewOutletAddedValueTransporterKey);

                    ApplicationExtensions.PushViewController(new MyOutletsViewController(), true);
                    return;
                }

                if (arg2.Title.Equals(SettingsShared.navigation_item_edit_profile, StringComparison.InvariantCultureIgnoreCase))
                {
                    ApplicationExtensions.PushViewController(new EditProfileViewController(), true);
                    return;
                }


                if (arg2.Title.Equals(SettingsShared.navigation_item_design, StringComparison.InvariantCultureIgnoreCase))
                {
                    Shared.DesignChanged();
                    TableView.ReloadRows(new NSIndexPath[] { arg1 }, UITableViewRowAnimation.Automatic);
                    return;
                }

                if (arg2.Title.Equals(SettingsShared.navigation_item_logout, StringComparison.InvariantCultureIgnoreCase))
                {
                    RealmUserServices.Logout();

                    if (Profile.CurrentProfile != null)
                    {
                        new LoginManager().LogOut();
                    }

                    var iPersistant = ServiceLocator.Instance.Resolve <IPersistantStorage>();
                    iPersistant.RemoveAll();

                    ApplicationExtensions.LoadStoryboardRoot("Landing", false);
                    return;
                }
            };
            TableView.Source = TableSource;
            TableSource.SetItems(TableView, Shared.GetTableItems());
        }
Esempio n. 5
0
 void SetupUnauthorizedCatcher()
 {
     if (UnauthorizedBoradcastNotification != null)
     {
         return;
     }
     UnauthorizedBoradcastNotification = NSNotificationCenter.DefaultCenter.AddObserver(new NSString(NVCRestHelper.UnauthorizedExceptionThrown), (NSNotification obj) =>
     {
         ApplicationExtensions.LoadStoryboardRoot("Landing", false);
     });
 }
        void ShowMyOutletsViewController()
        {
            Transporter.SharedInstance.SetObject(Transporter.NewOutletAddedTransporterKey, true);

            var vc = new MyOutletsViewController();

            vc.OutletSelected += (Outlet obj) =>
            {
                AddOutletToCard(obj, true);
            };
            ApplicationExtensions.PushViewController(vc, true);
        }
        public override void ViewDidLoad()
        {
            PullToRefresh = false;

            base.ViewDidLoad();

            TableSource = new SharingTableViewSource();
            ((SharingTableViewSource)TableSource).ShowsAccessory = Shared.SelectedCard.IsMine();
            TableSource.ItemSelected += (arg1, arg2) =>
            {
                if (Shared.SelectedCard.IsMine())
                {
                    var footer = ChildViewControllers.Where(c => c.GetType() == typeof(CardSharingStatusViewController)).FirstOrDefault() as CardSharingStatusViewController;
                    if (footer == null)
                    {
                        return;
                    }
                    if (footer.Sharing)
                    {
                        return;
                    }

                    Shared.OutletSelected(arg2);
                    TableView.ReloadRows(new NSIndexPath[] { arg1 }, UITableViewRowAnimation.Automatic);

                    HeaderView.Update(false);

                    footer.Update();
                    return;
                }

                ApplicationExtensions.OpenApplicationFromOutlet(arg2);
            };
            TableView.Source = TableSource;

            HeaderView = new CardViewController();
            HeaderView.SelectedCard   = Shared.SelectedCard;
            HeaderView.View.Frame     = new CGRect(0, 0, TableView.Frame.Width, CardViewController.GetCalculatedHeight());
            TableView.TableHeaderView = HeaderView.View;
            AddChildViewController(HeaderView);
            HeaderView.DidMoveToParentViewController(this);

            if (Shared.SelectedCard.IsMine())
            {
                CardSharingStatusViewController footerView = new CardSharingStatusViewController();
                footerView.SelectedCard   = Shared.SelectedCard;
                footerView.View.Frame     = new CGRect(0, 0, TableView.Frame.Width, footerView.GetHeight());
                TableView.TableFooterView = footerView.View;
                AddChildViewController(footerView);
            }
        }
Esempio n. 8
0
        public override void ViewDidLoad()
        {
            PullToRefresh = false;

            base.ViewDidLoad();

            TableSource = new ConnectionsTableViewSource();
            ((ConnectionsTableViewSource)TableSource).CardSelected += (NSIndexPath arg1, Card arg2) =>
            {
                var vc = new SharingViewController();
                vc.Title = arg2.Name;
                (vc.TargetViewController as SharingTableViewController).Shared.SelectedCard = arg2;
                ApplicationExtensions.PushViewController(vc, true);
            };
            TableView.Source         = TableSource;
            TableView.SeparatorStyle = UIKit.UITableViewCellSeparatorStyle.None;


            var label = LabelWithActivityIndicatorView.Create();

            label.BindDataToView("No Connections", true);
            TableViewEmptyBackground = label;

            var swipeGesture = new UISwipeGestureRecognizer((obj) =>
            {
                var swipeLocatioin = obj.LocationInView(TableView);

                var indexPath = TableView.IndexPathForRowAtPoint(swipeLocatioin);
                if (indexPath == null)
                {
                    return;
                }

                var cell = TableView.CellAt(indexPath) as MyCardsTableViewCell;
                if (cell == null)
                {
                    return;
                }

                var model = ((ConnectionsTableViewSource)TableSource).GetCardAtIndexPath(indexPath);
                if (model == null)
                {
                    return;
                }

                cell.Flip(model);
            });

            swipeGesture.Direction = UISwipeGestureRecognizerDirection.Left | UISwipeGestureRecognizerDirection.Right;
            TableView.AddGestureRecognizer(swipeGesture);
        }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            NavigationItem.LeftBarButtonItem = new UIBarButtonItem(UIImage.FromBundle("Hamburger"), UIBarButtonItemStyle.Plain, (sender, e) =>
            {
                if (DrawerViewController == null)
                {
                    DrawerViewController = new DrawerViewController();
                    DrawerViewController.TransitioningDelegate  = new ShowDrawerTransitionDelegate(DrawerDirection.Left, 270);
                    DrawerViewController.ModalPresentationStyle = UIModalPresentationStyle.Custom;
                }
                PresentViewController(DrawerViewController, true, null);
            });

            ApplicationExtensions.ActivatePage(typeof(MyCardsViewController), false, false);
        }
Esempio n. 10
0
        public override void ViewDidLoad()
        {
            PullToRefresh = false;

            base.ViewDidLoad();

            TableSource = new DrawerTableViewSource();
            TableSource.ItemSelected += (NSIndexPath arg1, DrawerShared.DrawerModel arg2) =>
            {
                if (arg2 == null || String.IsNullOrEmpty(arg2.Title))
                {
                    return;
                }

                Type target = null;

                if (arg2.Title.Equals(DrawerShared.navigation_item_my_cards, StringComparison.InvariantCultureIgnoreCase))
                {
                    target = typeof(MyCardsViewController);
                }

                else if (arg2.Title.Equals(DrawerShared.navigation_item_settings, StringComparison.InvariantCultureIgnoreCase))
                {
                    target = typeof(SettingsViewController);
                }

                else if (arg2.Title.Equals(DrawerShared.navigation_item_discover, StringComparison.InvariantCultureIgnoreCase))
                {
                    target = typeof(DiscoverViewController);
                }

                else if (arg2.Title.Equals(DrawerShared.navigation_item_connections, StringComparison.InvariantCultureIgnoreCase))
                {
                    target = typeof(ConnectionsTableViewController);
                }

                if (target != null)
                {
                    ApplicationExtensions.ActivatePage(target, true, false);
                    DismissViewController(true, null);
                }
            };
            TableView.Source = TableSource;
        }
Esempio n. 11
0
        public override bool FinishedLaunching(UIApplication application, NSDictionary launchOptions)
        {
            Window = new UIWindow(UIScreen.MainScreen.Bounds);

            // Override point for customization after application launch.
            // If not required for your application you can safely delete this method

            // Code to start the Xamarin Test Cloud Agent
#if ENABLE_TEST_CLOUD
            //Xamarin.Calabash.Start();
#endif

            ServiceLocator.Instance.Add <IS3Service, S3Service>();
            ServiceLocator.Instance.Add <IImageDownloader, ImageDownloader>();
            ServiceLocator.Instance.Add <IPersistantStorage, PersistantStorage>();
            ServiceLocator.Instance.Add <IBroadcastNotificaion, BroadCastNotificaion>();

            Profile.EnableUpdatesOnAccessTokenChange(true);
            Settings.AppID       = NotSensitive.SlinkKeys.facebook_app_id;
            Settings.DisplayName = NotSensitive.SlinkKeys.facebook_display_name;

            if (RealmUserServices.DidUserPersist())
            {
                ApplicationExtensions.EnterApplication(false, true);
            }
            else
            {
                ApplicationExtensions.LoadStoryboardRoot("Landing", false);
            }

            SetupUnauthorizedCatcher();
            PredownloadImages();

            AppCenter.Start("fa06eb43-8be9-426c-97f9-42f3ab13cd3b", typeof(Analytics), typeof(Crashes));
            ServiceRunner.SharedInstance.StartService <AppCenterManager>();

            MobileAds.Configure("ca-app-pub-4252799872870196~2848379026");
            return(true);
        }
Esempio n. 12
0
        public override void ViewDidAppear(bool animated)
        {
            base.ViewDidAppear(animated);

            CollectionViewTappedNotificaion = NSNotificationCenter.DefaultCenter.AddObserver(new NSString(Strings.InternalNotifications.notification_collection_view_tapped), (obj) =>
            {
                InvokeOnMainThread(() =>
                {
                    var indexPath = obj.Object as NSIndexPath;
                    if (indexPath == null)
                    {
                        return;
                    }

                    var card = TableSource.GetModelInList(indexPath);

                    var vc = new SharingViewController();
                    (vc.TargetViewController as SharingTableViewController).Shared.SelectedCard = card;
                    ApplicationExtensions.PushViewController(vc, true);
                });
            });
        }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();


            //if user has no cards, create their facebook one
            var me = RealmUserServices.GetMe(false);

            if (me.Cards.Count() == 0)
            {
                var outlet = me.Outlets.Where(c => c.Type.Equals(Outlet.outlet_type_facebook, StringComparison.InvariantCultureIgnoreCase)).FirstOrDefault();
                if (outlet != null)
                {
                    var card = Card.Create();
                    card.AddOutlet(outlet);

                    var realm = RealmManager.SharedInstance.GetRealm(null);
                    realm.Write(() =>
                    {
                        card.Name  = "Facebook Card";
                        card.Owner = me;
                    });
                }
            }


            NavigationItem.RightBarButtonItem = new UIBarButtonItem(Strings.Basic.skip, UIBarButtonItemStyle.Plain, (sender, e) =>
            {
                Cancelled = true;

                removeAllSubviews(false, () =>
                {
                    //ApplicationExtensions.LoadStoryboardRoot("Landing", false);
                    ApplicationExtensions.EnterApplication(false, true);
                });
            });
        }
Esempio n. 14
0
 static void GoToDiscoverPage(bool animated)
 {
     ApplicationExtensions.DismissAllViewControllers(animated, true);
     ApplicationExtensions.ActivatePage(typeof(DiscoverViewController), animated, true);
 }
        void StartPartFour(Action completed)
        {
            if (Cancelled)
            {
                return;
            }

            var get_notified_label = GetDefaultLabel(Strings.Onboarding.get_notified);

            get_notified_label.Frame = new CGRect(100, 50, 200, 70);
            get_notified_label.Alpha = 0;
            View.AddSubview(get_notified_label);

            var redDot = new UIView();

            redDot.Frame               = new CGRect(20, 120, 20, 20);
            redDot.Alpha               = 0;
            redDot.BackgroundColor     = UIColor.Red;
            redDot.Layer.MasksToBounds = true;
            redDot.Layer.CornerRadius  = redDot.Layer.Bounds.Width / 2;
            View.AddSubview(redDot);

            var redDotTwo = new UIView();

            redDotTwo.Frame               = new CGRect(20, 120, 20, 20);
            redDotTwo.Alpha               = 0;
            redDotTwo.BackgroundColor     = UIColor.Red;
            redDotTwo.Layer.MasksToBounds = true;
            redDotTwo.Layer.CornerRadius  = redDotTwo.Layer.Bounds.Width / 2;
            View.AddSubview(redDotTwo);

            var redDotThree = new UIView();

            redDotThree.Frame               = new CGRect(20, 120, 20, 20);
            redDotThree.Alpha               = 0;
            redDotThree.BackgroundColor     = UIColor.Red;
            redDotThree.Layer.MasksToBounds = true;
            redDotThree.Layer.CornerRadius  = redDotThree.Layer.Bounds.Width / 2;
            View.AddSubview(redDotThree);

            var whitePhone = new UIImageView(UIImage.FromBundle("PhoneWhiteLarge"));

            whitePhone.ContentMode = UIViewContentMode.ScaleToFill;
            whitePhone.Frame       = new CGRect(View.Frame.GetMaxX() - 120, View.Frame.GetMidY() - 100, 100, 210);
            whitePhone.Alpha       = 0;
            View.AddSubview(whitePhone);

            var arrowImageView = new UIImageView(UIImage.FromBundle("ArrowWhite"));

            arrowImageView.Transform = CGAffineTransform.MakeRotation(1.5708f);
            arrowImageView.Frame     = new CGRect(View.Frame.GetMaxX() - 70, 40, 40, 100);
            arrowImageView.Alpha     = 0;
            View.AddSubview(arrowImageView);

            var enablePushNotificaionsButton = new UIButton(UIButtonType.System);

            enablePushNotificaionsButton.SetTitle("Enable\nPush Notificaions", new UIControlState());
            enablePushNotificaionsButton.SetTitleColor(UIColor.White, new UIControlState());
            enablePushNotificaionsButton.TitleLabel.Font          = UIFont.FromName("Avenir-Medium", 18);
            enablePushNotificaionsButton.TitleLabel.Lines         = 0;
            enablePushNotificaionsButton.TitleLabel.LineBreakMode = UILineBreakMode.WordWrap;
            enablePushNotificaionsButton.TitleLabel.TextAlignment = UITextAlignment.Center;
            enablePushNotificaionsButton.Frame          = new CGRect(20, View.Frame.GetMidY(), whitePhone.Frame.X - 20, 50);
            enablePushNotificaionsButton.Alpha          = 0;
            enablePushNotificaionsButton.TouchUpInside += (sender, e) =>
            {
                if (!PushNotDetermined)
                {
                    return;
                }

                var appDelegate = UIApplication.SharedApplication.Delegate as AppDelegate;
                appDelegate.SetUpPushNotificaions();
                enablePushNotificaionsButton.Alpha = 0;
            };
            View.AddSubview(enablePushNotificaionsButton);


            UIView.Animate(animationDuration, () =>
            {
                get_notified_label.Alpha           = 1;
                whitePhone.Alpha                   = 1;
                redDot.Alpha                       = 1;
                redDotTwo.Alpha                    = 1;
                redDotThree.Alpha                  = 1;
                enablePushNotificaionsButton.Alpha = PushNotDetermined ? 1 : 0;
            }, () =>
            {
                if (Cancelled)
                {
                    return;
                }

                UIView.Animate(animationDuration / 3, () =>
                {
                    redDot.Frame = new CGRect(whitePhone.Center, redDot.Frame.Size);
                }, () =>
                {
                    if (Cancelled)
                    {
                        return;
                    }

                    UIView.Animate(animationDuration / 3, () =>
                    {
                        redDotTwo.Frame = new CGRect(whitePhone.Center, redDotTwo.Frame.Size);
                    }, () =>
                    {
                        if (Cancelled)
                        {
                            return;
                        }

                        UIView.Animate(animationDuration / 3, () =>
                        {
                            redDotThree.Frame = new CGRect(whitePhone.Center, redDotThree.Frame.Size);
                        }, () =>
                        {
                            if (Cancelled)
                            {
                                return;
                            }

                            UIView.Animate(animationDuration, () =>
                            {
                                get_notified_label.Alpha = 0;
                                whitePhone.Alpha         = 0;
                                redDot.Alpha             = 0;
                                redDotTwo.Alpha          = 0;
                                redDotThree.Alpha        = 0;

                                SlinkLogoImageView.Alpha = 0;
                            }, () =>
                            {
                                arrowImageView.Alpha = 1;
                                NavigationItem.RightBarButtonItem = new UIBarButtonItem(Strings.Basic.lets_go, UIBarButtonItemStyle.Plain, (sender, e) =>
                                {
                                    Cancelled = true;

                                    removeAllSubviews(false, () =>
                                    {
                                        ApplicationExtensions.EnterApplication(false, true);
                                    });
                                });
                            });
                        });
                    });
                });
            });
        }
Esempio n. 16
0
        public override void ViewDidLoad()
        {
            PullToRefresh = false;

            base.ViewDidLoad();


            TableSource = new MyCardsTableViewSource();
            TableSource.ItemSelected += (NSIndexPath arg1, Card arg2) =>
            {
                var vc = new SharingViewController();
                (vc.TargetViewController as SharingTableViewController).Shared.SelectedCard = arg2;
                ApplicationExtensions.PushViewController(vc, true);
            };
            TableView.Source         = TableSource;
            TableView.SeparatorStyle = UITableViewCellSeparatorStyle.None;

            var label = LabelWithActivityIndicatorView.Create();

            label.BindDataToView("No Cards", true);
            TableViewEmptyBackground = label;

            AddRowViewController FooterView = new AddRowViewController();

            FooterView.LabelAddText = MyCardsShared.CreateNewCard;
            FooterView.Clicked     += (editingCreateNewCard) =>
            {
                var vc = new NewCardViewController();
                (vc.TargetViewController as NewCardTableViewController).Shared.SelectedCard = Card.Create();
                ApplicationExtensions.PushViewController(vc, true);
            };
            FooterView.View.Frame     = new CGRect(0, 0, TableView.Frame.Width, FooterView.GetHeight());
            TableView.TableFooterView = FooterView.View;
            AddChildViewController(FooterView);



            var swipeGesture = new UISwipeGestureRecognizer((obj) =>
            {
                var swipeLocatioin = obj.LocationInView(TableView);

                var indexPath = TableView.IndexPathForRowAtPoint(swipeLocatioin);
                if (indexPath == null)
                {
                    return;
                }

                var cell = TableView.CellAt(indexPath) as MyCardsTableViewCell;
                if (cell == null)
                {
                    return;
                }

                var model = TableSource.GetModelInList(indexPath);
                if (model == null)
                {
                    return;
                }

                cell.Flip(model);
            });

            swipeGesture.Direction = UISwipeGestureRecognizerDirection.Left | UISwipeGestureRecognizerDirection.Right;
            TableView.AddGestureRecognizer(swipeGesture);
        }