Ejemplo n.º 1
0
        public void RegisterUser(UserModel user)
        {
            if (user == null)
            {
                Intercom.RegisterUnidentifiedUser();
                return;
            }

            var currentUser = AppSettings.CurrentUser;

            ICMCompany company = null;

            if (currentUser.Company != null)
            {
                company           = new ICMCompany();
                company.Name      = currentUser.Company.Name;
                company.CompanyId = currentUser.Company.Id;
            }

            var attributes = new ICMUserAttributes();

            attributes.Name       = currentUser.Firstname;
            attributes.Email      = currentUser.Mail;
            attributes.UserId     = currentUser.Id;
            attributes.Phone      = currentUser.PhoneNumber;
            attributes.SignedUpAt = DateTimeToNSDate(currentUser.SubscriptionDate);

            var companies = new ICMCompany[1];

            companies[0]         = company;
            attributes.Companies = companies;

            Intercom.UpdateUser(attributes);
            Intercom.RegisterUserWithUserId(user.Id, user.Mail);
            //Intercom.HandleIntercomPushNotification();
        }