public void PresentChannelInterface(InviteChannel inviteChannel, InvitePackage invitePackage,
                                        Action onComplete, Action onCancel, Action <GetSocialError> onFailure)
    {
        GetSocialDebugLogger.D(string.Format("FacebookSharePlugin.PresentChannelInterface(), inviteChannel: {0}, invite package: {1}",
                                             inviteChannel, invitePackage));

        // GetSocialUi needs to be closed while Facebook activity is opened
        // because othewise it cannot deliever the result back to the app
        GetSocialUi.CloseView(true);
        SendInvite(invitePackage.ReferralDataUrl, onComplete, onCancel, onFailure);
    }
Beispiel #2
0
        public CreateUser(AppContext app, InvitePackage invite)
        {
            InitializeComponent();

            App      = app;
            Context  = app.Context;
            Invite   = invite;
            OpName   = invite.Info.OpName;
            OpAccess = invite.Info.OpAccess;

            OpNameLabel.Text = OpName;
            TextName.Text    = invite.Info.UserName;

            BrowseLink.Text = (Context.Sim == null) ? Application.StartupPath : Context.Sim.Internet.LoadedPath;
        }
    public void PresentChannelInterface(InviteChannel inviteChannel, InvitePackage invitePackage,
                                        Action onComplete, Action onCancel, Action <GetSocialError> onFailure)
    {
        GetSocialDebugLogger.D(string.Format("FacebookInvitePlugin.PresentChannelInterface(), inviteChannel: {0}, invite package: {1}",
                                             inviteChannel, invitePackage));

#if UNITY_ANDROID && USE_GETSOCIAL_UI
        // Get Social UI needs to be closed while Facebook activity is opened
        // because othewise it cannot deliever the result back to the app
        GetSocialUi.CloseView(true);
#endif
        Uri imageUri = null;
        if (invitePackage.ImageUrl != null)
        {
            imageUri = new Uri(invitePackage.ImageUrl);
        }
        SendInvite(invitePackage.ReferralDataUrl, imageUri, onComplete, onCancel, onFailure);
    }
Beispiel #4
0
        private CreateUser ReadInvite(string link)
        {
            string[] mainParts = link.Replace("deops://", "").Split('/');

            if (mainParts.Length < 4)
            {
                throw new Exception("Invalid Link");
            }

            // Select John Marshall's Global IM Profile
            string[] nameParts = mainParts[2].Split('@');
            string   name      = HttpUtility.UrlDecode(nameParts[0]);
            string   op        = HttpUtility.UrlDecode(nameParts[1]);

            byte[] data      = Utilities.HextoBytes(mainParts[3]);
            byte[] pubOpID   = Utilities.ExtractBytes(data, 0, 8);
            byte[] encrypted = Utilities.ExtractBytes(data, 8, data.Length - 8);
            byte[] decrypted = null;

            // try opening invite with a currently loaded core
            Context.Cores.LockReading(delegate()
            {
                foreach (var core in Context.Cores)
                {
                    try
                    {
                        if (Utilities.MemCompare(pubOpID, core.User.Settings.PublicOpID))
                        {
                            decrypted = core.User.Settings.KeyPair.Decrypt(encrypted, false);
                        }
                    }
                    catch { }
                }
            });

            // have user select profile associated with the invite
            while (decrypted == null)
            {
                OpenFileDialog open = new OpenFileDialog();

                open.Title            = "Open " + name + "'s " + op + " Profile to Verify Invitation";
                open.InitialDirectory = Application.StartupPath;
                open.Filter           = "DeOps Identity (*.dop)|*.dop";

                if (open.ShowDialog() != DialogResult.OK)
                {
                    return(null); // user doesnt want to try any more
                }
                GetTextDialog pass = new GetTextDialog("Passphrase", "Enter the passphrase for this profile", "");
                pass.ResultBox.UseSystemPasswordChar = true;

                if (pass.ShowDialog() != DialogResult.OK)
                {
                    continue; // let user choose another profile
                }
                try
                {
                    // open profile
                    var user = new OpUser(open.FileName, pass.ResultBox.Text, null);
                    user.Load(LoadModeType.Settings);

                    // ensure the invitation is for this op specifically
                    if (!Utilities.MemCompare(pubOpID, user.Settings.PublicOpID))
                    {
                        MessageBox.Show("This is not a " + op + " profile");
                        continue;
                    }

                    // try to decrypt the invitation
                    try
                    {
                        decrypted = user.Settings.KeyPair.Decrypt(encrypted, false);
                    }
                    catch
                    {
                        MessageBox.Show("Could not open the invitation with this profile");
                        continue;
                    }
                }
                catch
                {
                    MessageBox.Show("Wrong password");
                }
            }

            CreateUser created = null;

            try
            {
                InvitePackage invite = OpCore.OpenInvite(decrypted, Protocol);

                if (invite != null)
                {
                    created = new CreateUser(App, invite);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }

            return(created);
        }