public static void DeepLinkToApplication(string appId, string packageName, string extraData = null, string roomId = null)
    {
        if (UnityActivity == null || DeepLinkHelperClass == null)
        {
            Initialize();
        }

        LaunchingOtherApp = true;

        DeepLinkData data = new DeepLinkData();

        data.SenderAppId       = GetAppIDFromConfig();
        data.ExtraData         = extraData;
        data.MultiplayerRoomId = roomId;

#if !UNITY_EDITOR
        if (packageName.Contains("vrhealth"))
        {
            data.ExtraData = data.ExtraData + ";" + GetAndroidDeviceID();
        }
#endif
        string dataJsonStr = JsonConvert.SerializeObject(data);

        Debug.Log(dataJsonStr);

        Debug.Log("Launching app with data string " + dataJsonStr);

#if UNITY_ANDROID && !UNITY_EDITOR
        DeepLinkHelperClass.CallStatic("LaunchApp", UnityActivity, appId, packageName, dataJsonStr);
#endif
    }
示例#2
0
    public static DeepLinkData ParseLaunchDetails(LaunchDetails launchDetails)
    {
        try
        {
            DeepLinkData launchData =
                JsonConvert.DeserializeObject <DeepLinkData>(launchDetails.DeeplinkMessage);
            return(launchData);
        }
        catch (Exception e)
        {
            Debug.LogError("Failed to parse deep link message. Printing Exception.");
            Debug.LogException(e);

            Debug.Log("Deep link message was " + launchDetails.DeeplinkMessage);
            return(null);
        }
    }
示例#3
0
    public static void DeepLinkToApplication(ulong appId, string packageName, string extraData = null, string roomId = null, DeepLinkErrorDelegate errorCallback = null, DeepLinkSuccessDelegate successCallback = null)
    {
        LaunchingOtherApp = true;

        DeepLinkData data = new DeepLinkData();

        data.SenderAppId       = GetAppIDFromConfig();
        data.ExtraData         = extraData;
        data.MultiplayerRoomId = roomId;

#if !UNITY_EDITOR
        data.DeviceId = GetAndroidDeviceID();
#endif

#if !UNITY_EDITOR
        if (packageName.Contains("vrhealth"))
        {
            data.ExtraData = data.ExtraData + ";" + GetAndroidDeviceID();
        }
#endif

        var options = new ApplicationOptions(); options.SetDeeplinkMessage(JsonConvert.SerializeObject(data));
        Oculus.Platform.Application.LaunchOtherApp(appId, options).OnComplete(delegate(Message <string> message)
        {
            if (message.IsError)
            {
                Debug.Log("Error launching other app: " + message.GetError().Message);
                LaunchingOtherApp = false;
                if (errorCallback != null)
                {
                    errorCallback(message.GetError().Message);
                }
            }
            else
            {
                if (successCallback != null)
                {
                    successCallback(message.Data);
                }
            }
        });
    }
示例#4
0
    public static bool CheckForAlcoveLaunch()
    {
        LaunchDetails launchDetails = Oculus.Platform.ApplicationLifecycle.GetLaunchDetails();

        switch (launchDetails.LaunchType)
        {
        case LaunchType.Deeplink:
            DeepLinkData launchData = ParseLaunchDetails(launchDetails);
            if (launchData.SenderAppId.Equals("2855012877858033", StringComparison.InvariantCultureIgnoreCase))
            {
                return(true);
            }
            break;

        default:
            break;
        }

        return(false);
    }
示例#5
0
        private void PageLoad()
        {
            var editPossible = !RequestEmbedded;
            var isExtenral   = false;

            File file;
            var  fileUri = string.Empty;

            try
            {
                if (string.IsNullOrEmpty(RequestFileUrl))
                {
                    var app = ThirdPartySelector.GetAppByFileId(RequestFileId);
                    if (app == null)
                    {
                        file = DocumentServiceHelper.GetParams(RequestFileId, RequestVersion, RequestShareLinkKey, editPossible, !RequestView, true, out _configuration);
                        if (_valideShareLink)
                        {
                            _configuration.Document.SharedLinkKey += RequestShareLinkKey;
                            _configuration.Document.Info.Favorite  = null;

                            if (CoreContext.Configuration.Personal && !SecurityContext.IsAuthenticated)
                            {
                                var user    = CoreContext.UserManager.GetUsers(file.CreateBy);
                                var culture = CultureInfo.GetCultureInfo(user.CultureName);
                                Thread.CurrentThread.CurrentCulture   = culture;
                                Thread.CurrentThread.CurrentUICulture = culture;
                            }
                        }
                    }
                    else
                    {
                        isExtenral = true;

                        bool editable;
                        _thirdPartyApp = true;
                        file           = app.GetFile(RequestFileId, out editable);
                        file           = DocumentServiceHelper.GetParams(file, true, editPossible ? FileShare.ReadWrite : FileShare.Read, false, editable, editable, editable, true, out _configuration);

                        _configuration.Document.Url = app.GetFileStreamUrl(file);
                        _configuration.EditorConfig.Customization.GobackUrl = string.Empty;
                        _configuration.Document.Info.Favorite = null;
                    }
                }
                else
                {
                    isExtenral = true;

                    fileUri = RequestFileUrl;
                    var fileTitle = Request[FilesLinkUtility.FileTitle];
                    if (string.IsNullOrEmpty(fileTitle))
                    {
                        fileTitle = Path.GetFileName(HttpUtility.UrlDecode(fileUri)) ?? "";
                    }

                    file = new File
                    {
                        ID    = RequestFileUrl,
                        Title = Global.ReplaceInvalidCharsAndTruncate(fileTitle)
                    };

                    file = DocumentServiceHelper.GetParams(file, true, FileShare.Read, false, false, false, false, false, out _configuration);
                    _configuration.Document.Permissions.Edit          = editPossible && !CoreContext.Configuration.Standalone;
                    _configuration.Document.Permissions.Rename        = false;
                    _configuration.Document.Permissions.Review        = false;
                    _configuration.Document.Permissions.FillForms     = false;
                    _configuration.Document.Permissions.ChangeHistory = false;
                    _configuration.Document.Permissions.ModifyFilter  = false;
                    _editByUrl = true;

                    _configuration.Document.Url           = fileUri;
                    _configuration.Document.Info.Favorite = null;
                }
                ErrorMessage = _configuration.ErrorMessage;
            }
            catch (Exception ex)
            {
                Global.Logger.Warn("DocEditor", ex);
                ErrorMessage = ex.Message;
                return;
            }

            var        userAgent      = Request.UserAgent.ToString().ToLower();
            HttpCookie deeplinkCookie = Request.Cookies.Get("deeplink");
            var        deepLink       = ConfigurationManagerExtension.AppSettings["deeplink.documents.url"];

            if (!_valideShareLink &&
                deepLink != null && MobileDetector.IsMobile &&
                ((!userAgent.Contains("version/") && userAgent.Contains("android")) || !userAgent.Contains("android")) &&       //check webkit
                ((Request[DeepLinking.WithoutDeeplinkRedirect] == null && deeplinkCookie == null) ||
                 Request[DeepLinking.WithoutDeeplinkRedirect] == null && deeplinkCookie != null && deeplinkCookie.Value == "app"))
            {
                var          currentUser  = CoreContext.UserManager.GetUsers(SecurityContext.CurrentAccount.ID);
                DeepLinkData deepLinkData = new DeepLinkData
                {
                    Email  = currentUser.Email,
                    Portal = CoreContext.TenantManager.GetCurrentTenant().TenantDomain,
                    File   = new DeepLinkDataFile
                    {
                        Id        = file.ID.ToString(),
                        Title     = file.Title,
                        Extension = file.ConvertedExtension
                    },
                    Folder = new DeepLinkDataFolder
                    {
                        Id             = file.FolderID.ToString(),
                        ParentId       = file.RootFolderId.ToString(),
                        RootFolderType = (int)file.RootFolderType
                    },
                    OriginalUrl = Request.GetUrlRewriter().ToString()
                };

                var    jsonDeeplinkData   = JsonConvert.SerializeObject(deepLinkData);
                string base64DeeplinkData = Convert.ToBase64String(Encoding.UTF8.GetBytes(jsonDeeplinkData));

                Response.Redirect("~/DeepLink.aspx?data=" + HttpUtility.UrlEncode(base64DeeplinkData));
            }


            if (_configuration.EditorConfig.ModeWrite && FileConverter.MustConvert(file))
            {
                try
                {
                    file = FileConverter.ExecSync(file, RequestShareLinkKey);
                }
                catch (Exception ex)
                {
                    _configuration = null;
                    Global.Logger.Error("DocEditor", ex);
                    ErrorMessage = ex.Message;
                    return;
                }

                var comment = "#message/" + HttpUtility.UrlEncode(string.Format(FilesCommonResource.ConvertForEdit, file.Title));

                Response.Redirect(FilesLinkUtility.GetFileWebEditorUrl(file.ID) + comment);
                return;
            }

            var fileSecurity = Global.GetFilesSecurity();

            if (_configuration.EditorConfig.ModeWrite &&
                FileUtility.CanWebRestrictedEditing(file.Title) &&
                fileSecurity.CanFillForms(file) &&
                !fileSecurity.CanEdit(file))
            {
                if (!file.IsFillFormDraft)
                {
                    FileMarker.RemoveMarkAsNew(file);

                    Folder folderIfNew;
                    try
                    {
                        file = EntryManager.GetFillFormDraft(file, out folderIfNew);
                    }
                    catch (Exception ex)
                    {
                        _configuration = null;
                        Global.Logger.Error("DocEditor", ex);
                        ErrorMessage = ex.Message;
                        return;
                    }

                    var comment = folderIfNew == null
                        ? string.Empty
                        : "#message/" + HttpUtility.UrlEncode(string.Format(FilesCommonResource.MessageFillFormDraftCreated, folderIfNew.Title));

                    Response.Redirect(FilesLinkUtility.GetFileWebEditorUrl(file.ID) + comment);
                    return;
                }
                else if (!EntryManager.CheckFillFormDraft(file))
                {
                    var comment = "#message/" + HttpUtility.UrlEncode(FilesCommonResource.MessageFillFormDraftDiscard);

                    Response.Redirect(FilesLinkUtility.GetFileWebEditorUrl(file.ID) + comment);
                    return;
                }
            }

            Title = file.Title + GetPageTitlePostfix();

            if (_configuration.EditorConfig.Customization.Goback == null || string.IsNullOrEmpty(_configuration.EditorConfig.Customization.Goback.Url))
            {
                _configuration.EditorConfig.Customization.GobackUrl = Request[FilesLinkUtility.FolderUrl] ?? "";
            }

            _configuration.EditorConfig.Customization.IsRetina = TenantLogoManager.IsRetina(Request);

            if (RequestEmbedded)
            {
                _configuration.Type = Services.DocumentService.Configuration.EditorType.Embedded;

                _configuration.EditorConfig.Embedded.ShareLinkParam = string.IsNullOrEmpty(RequestShareLinkKey) ? string.Empty : "&" + FilesLinkUtility.DocShareKey + "=" + RequestShareLinkKey;
            }
            else
            {
                _configuration.Type = IsMobile ? Services.DocumentService.Configuration.EditorType.Mobile : Services.DocumentService.Configuration.EditorType.Desktop;

                if (FileSharing.CanSetAccess(file) &&
                    !(file.Encrypted &&
                      (!Request.DesktopApp() ||
                       CoreContext.Configuration.Personal)))
                {
                    _configuration.EditorConfig.SharingSettingsUrl = CommonLinkUtility.GetFullAbsolutePath(
                        Share.Location
                        + "?" + FilesLinkUtility.FileId + "=" + HttpUtility.UrlEncode(file.ID.ToString())
                        + (Request.DesktopApp() ? "&desktop=true" : string.Empty));
                }

                if (file.RootFolderType == FolderType.Privacy)
                {
                    if (!PrivacyRoomSettings.Enabled)
                    {
                        _configuration = null;
                        ErrorMessage   = FilesCommonResource.ErrorMassage_FileNotFound;
                        return;
                    }
                    else
                    {
                        if (Request.DesktopApp())
                        {
                            var keyPair = EncryptionKeyPair.GetKeyPair();
                            if (keyPair != null)
                            {
                                _configuration.EditorConfig.EncryptionKeys = new Services.DocumentService.Configuration.EditorConfiguration.EncryptionKeysConfig
                                {
                                    PrivateKeyEnc = keyPair.PrivateKeyEnc,
                                    PublicKey     = keyPair.PublicKey,
                                };
                            }
                        }
                    }
                }
            }

            if (!isExtenral)
            {
                _docKeyForTrack = DocumentServiceHelper.GetDocKey(file.ID, -1, DateTime.MinValue);

                FileMarker.RemoveMarkAsNew(file);
                if (!file.Encrypted && !file.ProviderEntry)
                {
                    EntryManager.MarkAsRecent(file);
                }

                if (RequestView)
                {
                    FilesMessageService.Send(file, MessageInitiator.DocsService, MessageAction.FileReaded, file.Title);
                }
                else
                {
                    FilesMessageService.Send(file, MessageInitiator.DocsService, MessageAction.FileOpenedForChange, file.Title);
                }
            }

            if (SecurityContext.IsAuthenticated)
            {
                var saveAsUrl = SaveAs.GetUrl;
                using (var folderDao = Global.DaoFactory.GetFolderDao())
                {
                    var folder = folderDao.GetFolder(file.FolderID);
                    if (folder != null && Global.GetFilesSecurity().CanCreate(folder))
                    {
                        saveAsUrl = SaveAs.GetUrlToFolder(file.FolderID);
                    }
                }

                _configuration.EditorConfig.SaveAsUrl = CommonLinkUtility.GetFullAbsolutePath(saveAsUrl);
            }

            if (_configuration.EditorConfig.ModeWrite)
            {
                _tabId = FileTracker.Add(file.ID);

                Global.SocketManager.FilesChangeEditors(file.ID);

                if (SecurityContext.IsAuthenticated)
                {
                    _configuration.EditorConfig.FileChoiceUrl = CommonLinkUtility.GetFullAbsolutePath(FileChoice.GetUrlForEditor);
                }
            }
            else
            {
                _linkToEdit = _editByUrl
                                  ? CommonLinkUtility.GetFullAbsolutePath(FilesLinkUtility.GetFileWebEditorExternalUrl(fileUri, file.Title))
                                  : CommonLinkUtility.GetFullAbsolutePath(FilesLinkUtility.GetFileWebEditorUrl(file.ID));
                if (Request.DesktopApp())
                {
                    _linkToEdit += "&desktop=true";
                }

                if (FileConverter.MustConvert(_configuration.Document.Info.File))
                {
                    _editByUrl = true;
                }
            }

            var actionAnchor = Request[FilesLinkUtility.Anchor];

            if (!string.IsNullOrEmpty(actionAnchor))
            {
                _configuration.EditorConfig.ActionLinkString = actionAnchor;
            }
        }
示例#6
0
        /// <summary>
        /// Creates the data for the specified row.
        /// </summary>
        /// <param name="Row">The row.</param>
        internal Data Create(Row Row)
        {
            Data Data;

            switch (this.Index)
            {
            case 0:
            {
                Data = new BuildingData(Row, this);
                break;
            }

            case 1:
            {
                Data = new LocaleData(Row, this);
                break;
            }

            case 2:
            {
                Data = new ResourceData(Row, this);
                break;
            }

            case 3:
            {
                Data = new CharacterData(Row, this);
                break;
            }

            case 6:
            {
                Data = new BuildingClassData(Row, this);
                break;
            }

            case 7:
            {
                Data = new ObstacleData(Row, this);
                break;
            }

            case 8:
            {
                Data = new EffectData(Row, this);
                break;
            }

            case 9:
            {
                Data = new ParticleEmitterData(Row, this);
                break;
            }

            case 10:
            {
                Data = new ExperienceLevelData(Row, this);
                break;
            }

            case 11:
            {
                Data = new TrapData(Row, this);
                break;
            }

            case 12:
            {
                Data = new AllianceBadgeData(Row, this);
                break;
            }

            case 13:
            {
                Data = new GlobalData(Row, this);
                break;
            }

            case 14:
            {
                Data = new TownhallLevelData(Row, this);
                break;
            }

            case 15:
            {
                Data = new PrototypeData(Row, this);
                break;
            }

            case 16:
            {
                Data = new NpcData(Row, this);
                break;
            }

            case 17:
            {
                Data = new DecoData(Row, this);
                break;
            }

            case 18:
            {
                Data = new ResourcePackData(Row, this);
                break;
            }

            case 20:
            {
                Data = new MissionData(Row, this);
                break;
            }

            case 21:
            {
                Data = new BillingPackageData(Row, this);
                break;
            }

            case 22:
            {
                Data = new AchievementData(Row, this);
                break;
            }

            case 25:
            {
                Data = new SpellData(Row, this);
                break;
            }

            case 26:
            {
                Data = new HintData(Row, this);
                break;
            }

            case 27:
            {
                Data = new LandingShipData(Row, this);
                break;
            }

            case 28:
            {
                Data = new ArtifactData(Row, this);
                break;
            }

            case 29:
            {
                Data = new ArtifactBonusData(Row, this);
                break;
            }

            case 30:
            {
                Data = new DeepseaParameterData(Row, this);
                break;
            }

            case 31:
            {
                Data = new ExplorationCostData(Row, this);
                break;
            }

            case 34:
            {
                Data = new ResourceShipData(Row, this);
                break;
            }

            case 35:
            {
                Data = new LootBoxData(Row, this);
                break;
            }

            case 36:
            {
                Data = new LiberatedIncomeData(Row, this);
                break;
            }

            case 37:
            {
                Data = new RegionData(Row, this);
                break;
            }

            case 38:
            {
                Data = new DefenseRewardData(Row, this);
                break;
            }

            case 39:
            {
                Data = new LocatorData(Row, this);
                break;
            }

            case 40:
            {
                Data = new EventData(Row, this);
                break;
            }

            case 41:
            {
                Data = new FootstepData(Row, this);
                break;
            }

            case 42:
            {
                Data = new PersistentEventRewardData(Row, this);
                break;
            }

            case 43:
            {
                Data = new CommunityLinkData(Row, this);
                break;
            }

            case 44:
            {
                Data = new ShieldData(Row, this);
                break;
            }

            case 45:
            {
                Data = new AbTestData(Row, this);
                break;
            }

            case 46:
            {
                Data = new LetterData(Row, this);
                break;
            }

            case 47:
            {
                Data = new RankData(Row, this);
                break;
            }

            case 48:
            {
                Data = new CountryData(Row, this);
                break;
            }

            case 51:
            {
                Data = new BoomboxData(Row, this);
                break;
            }

            case 52:
            {
                Data = new HeroData(Row, this);
                break;
            }

            case 53:
            {
                Data = new HeroAbilityData(Row, this);
                break;
            }

            case 54:
            {
                Data = new OfferData(Row, this);
                break;
            }

            case 55:
            {
                Data = new DeepLinkData(Row, this);
                break;
            }

            case 56:
            {
                Data = new SectorData(Row, this);
                break;
            }

            case 57:
            {
                Data = new SectorBonusData(Row, this);
                break;
            }

            default:
            {
                Data = new Data(Row, this);
                break;
            }
            }

            return(Data);
        }