[Mobile] Add live viewer, check license
This commit is contained in:
		
							parent
							
								
									5a730ffccd
								
							
						
					
					
						commit
						a0437e9dbc
					
				|  | @ -46,6 +46,11 @@ class CollaborationController extends Component { | |||
|             api.asc_SetFastCollaborative(isFastCoauth); | ||||
|             window.editorType === 'de' && api.SetCollaborativeMarksShowType(Asc.c_oAscCollaborativeMarksShowType.None); | ||||
|             api.asc_setAutoSaveGap(1); | ||||
|         } else if (appOptions.canLiveView) { // viewer | ||||
|             isFastCoauth = !(appOptions.config.coEditing && appOptions.config.coEditing.mode==='strict'); | ||||
|             api.asc_SetFastCollaborative(isFastCoauth); | ||||
|             window.editorType === 'de' && api.SetCollaborativeMarksShowType(Asc.c_oAscCollaborativeMarksShowType.None); | ||||
|             api.asc_setAutoSaveGap(1); | ||||
|         } else { | ||||
|             isFastCoauth = false; | ||||
|             api.asc_SetFastCollaborative(isFastCoauth); | ||||
|  |  | |||
|  | @ -133,18 +133,18 @@ class MainController extends Component { | |||
|                     docInfo.put_Lang(this.editorConfig.lang); | ||||
|                     docInfo.put_Mode(this.editorConfig.mode); | ||||
| 
 | ||||
|                     // var coEditMode = !(this.editorConfig.coEditing && typeof this.editorConfig.coEditing == 'object') ? 'fast' : // fast by default | ||||
|                     //     this.editorConfig.mode === 'view' && this.editorConfig.coEditing.change!==false ? 'fast' : // if can change mode in viewer - set fast for using live viewer | ||||
|                     //         this.editorConfig.coEditing.mode || 'fast'; | ||||
|                     // docInfo.put_CoEditingMode(coEditMode); | ||||
|                     docInfo.put_CoEditingMode('strict'); // need to change!!! | ||||
|                     let type = /^(?:(pdf|djvu|xps|oxps))$/.exec(data.doc.fileType); | ||||
|                     let coEditMode = (type && typeof type[1] === 'string') ? 'strict' :  // offline viewer for pdf|djvu|xps|oxps | ||||
|                                     !(this.editorConfig.coEditing && typeof this.editorConfig.coEditing == 'object') ? 'fast' : // fast by default | ||||
|                                     this.editorConfig.mode === 'view' && this.editorConfig.coEditing.change!==false ? 'fast' : // if can change mode in viewer - set fast for using live viewer | ||||
|                                     this.editorConfig.coEditing.mode || 'fast'; | ||||
|                     docInfo.put_CoEditingMode(coEditMode); | ||||
| 
 | ||||
|                     let enable = !this.editorConfig.customization || (this.editorConfig.customization.macros !== false); | ||||
|                     docInfo.asc_putIsEnabledMacroses(!!enable); | ||||
|                     enable = !this.editorConfig.customization || (this.editorConfig.customization.plugins !== false); | ||||
|                     docInfo.asc_putIsEnabledPlugins(!!enable); | ||||
| 
 | ||||
|                     let type = /^(?:(pdf|djvu|xps|oxps))$/.exec(data.doc.fileType); | ||||
|                     if (type && typeof type[1] === 'string') { | ||||
|                         this.permissions.edit = this.permissions.review = false; | ||||
|                     } | ||||
|  | @ -426,6 +426,10 @@ class MainController extends Component { | |||
|             (licType === Asc.c_oLicenseResult.Connections || licType === Asc.c_oLicenseResult.UsersCount || licType === Asc.c_oLicenseResult.ConnectionsOS || licType === Asc.c_oLicenseResult.UsersCountOS | ||||
|                 || licType === Asc.c_oLicenseResult.SuccessLimit && (appOptions.trialMode & Asc.c_oLicenseMode.Limited) !== 0)) | ||||
|             this._state.licenseType = licType; | ||||
| 
 | ||||
|         if (licType !== undefined && appOptions.canLiveView && (licType===Asc.c_oLicenseResult.ConnectionsLive || licType===Asc.c_oLicenseResult.ConnectionsLiveOS)) | ||||
|             this._state.licenseType = licType; | ||||
| 
 | ||||
|         if (this._isDocReady && this._state.licenseType) | ||||
|             this.applyLicense(); | ||||
|     } | ||||
|  | @ -457,7 +461,13 @@ class MainController extends Component { | |||
|             return; | ||||
|         } | ||||
| 
 | ||||
|         if (this._state.licenseType) { | ||||
|         if (appOptions.config.mode === 'view') { | ||||
|             if (appOptions.canLiveView && (this._state.licenseType===Asc.c_oLicenseResult.ConnectionsLive || this._state.licenseType===Asc.c_oLicenseResult.ConnectionsLiveOS)) { | ||||
|                 appOptions.canLiveView = false; | ||||
|                 this.api.asc_SetFastCollaborative(false); | ||||
|             } | ||||
|             Common.Notifications.trigger('toolbar:activatecontrols'); | ||||
|         } else if (this._state.licenseType) { | ||||
|             let license = this._state.licenseType; | ||||
|             let buttons = [{text: 'OK'}]; | ||||
|             if ((appOptions.trialMode & Asc.c_oLicenseMode.Limited) !== 0 && | ||||
|  |  | |||
|  | @ -145,6 +145,8 @@ export class storeAppOptions { | |||
|         this.canUseReviewPermissions && AscCommon.UserInfoParser.setReviewPermissions(permissions.reviewGroups, this.customization.reviewPermissions); | ||||
|         this.canUseCommentPermissions && AscCommon.UserInfoParser.setCommentPermissions(permissions.commentGroups);     | ||||
|         this.canUseUserInfoPermissions && AscCommon.UserInfoParser.setUserInfoPermissions(permissions.userInfoGroups); | ||||
| 
 | ||||
|         this.canLiveView = !!params.asc_getLiveViewerSupport() && (this.config.mode === 'view') && !(type && typeof type[1] === 'string') && isSupportEditFeature; | ||||
|     } | ||||
|     setCanViewReview (value) { | ||||
|         this.canViewReview = value; | ||||
|  |  | |||
|  | @ -124,11 +124,10 @@ class MainController extends Component { | |||
|                     docInfo.put_Lang(this.editorConfig.lang); | ||||
|                     docInfo.put_Mode(this.editorConfig.mode); | ||||
| 
 | ||||
|                     // var coEditMode = !(this.editorConfig.coEditing && typeof this.editorConfig.coEditing == 'object') ? 'fast' : // fast by default | ||||
|                     //     this.editorConfig.mode === 'view' && this.editorConfig.coEditing.change!==false ? 'fast' : // if can change mode in viewer - set fast for using live viewer | ||||
|                     //         this.editorConfig.coEditing.mode || 'fast'; | ||||
|                     // docInfo.put_CoEditingMode(coEditMode); | ||||
|                     docInfo.put_CoEditingMode('strict'); // need to change!!! | ||||
|                     let coEditMode = !(this.editorConfig.coEditing && typeof this.editorConfig.coEditing == 'object') ? 'fast' : // fast by default | ||||
|                                     this.editorConfig.mode === 'view' && this.editorConfig.coEditing.change!==false ? 'fast' : // if can change mode in viewer - set fast for using live viewer | ||||
|                                     this.editorConfig.coEditing.mode || 'fast'; | ||||
|                     docInfo.put_CoEditingMode(coEditMode); | ||||
| 
 | ||||
|                     let enable = !this.editorConfig.customization || (this.editorConfig.customization.macros !== false); | ||||
|                     docInfo.asc_putIsEnabledMacroses(!!enable); | ||||
|  | @ -499,6 +498,10 @@ class MainController extends Component { | |||
|             (licType === Asc.c_oLicenseResult.Connections || licType === Asc.c_oLicenseResult.UsersCount || licType === Asc.c_oLicenseResult.ConnectionsOS || licType === Asc.c_oLicenseResult.UsersCountOS | ||||
|                 || licType === Asc.c_oLicenseResult.SuccessLimit && (appOptions.trialMode & Asc.c_oLicenseMode.Limited) !== 0)) | ||||
|             this._state.licenseType = licType; | ||||
| 
 | ||||
|         if (licType !== undefined && appOptions.canLiveView && (licType===Asc.c_oLicenseResult.ConnectionsLive || licType===Asc.c_oLicenseResult.ConnectionsLiveOS)) | ||||
|             this._state.licenseType = licType; | ||||
| 
 | ||||
|         if (this._isDocReady && this._state.licenseType) | ||||
|             this.applyLicense(); | ||||
|     } | ||||
|  | @ -530,7 +533,13 @@ class MainController extends Component { | |||
|             return; | ||||
|         } | ||||
| 
 | ||||
|         if (this._state.licenseType) { | ||||
|         if (appOptions.config.mode === 'view') { | ||||
|             if (appOptions.canLiveView && (this._state.licenseType===Asc.c_oLicenseResult.ConnectionsLive || this._state.licenseType===Asc.c_oLicenseResult.ConnectionsLiveOS)) { | ||||
|                 appOptions.canLiveView = false; | ||||
|                 this.api.asc_SetFastCollaborative(false); | ||||
|             } | ||||
|             Common.Notifications.trigger('toolbar:activatecontrols'); | ||||
|         } else if (this._state.licenseType) { | ||||
|             let license = this._state.licenseType; | ||||
|             let buttons = [{text: 'OK'}]; | ||||
|             if ((appOptions.trialMode & Asc.c_oLicenseMode.Limited) !== 0 && | ||||
|  |  | |||
|  | @ -116,5 +116,7 @@ export class storeAppOptions { | |||
|         this.canUseReviewPermissions && AscCommon.UserInfoParser.setReviewPermissions(permissions.reviewGroups, this.customization.reviewPermissions); | ||||
|         this.canUseCommentPermissions && AscCommon.UserInfoParser.setCommentPermissions(permissions.commentGroups); | ||||
|         this.canUseUserInfoPermissions && AscCommon.UserInfoParser.setUserInfoPermissions(permissions.userInfoGroups); | ||||
| 
 | ||||
|         this.canLiveView = !!params.asc_getLiveViewerSupport() && (this.config.mode === 'view') && isSupportEditFeature; | ||||
|     } | ||||
| } | ||||
|  | @ -171,11 +171,10 @@ class MainController extends Component { | |||
|                     docInfo.put_Lang(this.editorConfig.lang); | ||||
|                     docInfo.put_Mode(this.editorConfig.mode); | ||||
| 
 | ||||
|                     // var coEditMode = !(this.editorConfig.coEditing && typeof this.editorConfig.coEditing == 'object') ? 'fast' : // fast by default | ||||
|                     //     this.editorConfig.mode === 'view' && this.editorConfig.coEditing.change!==false ? 'fast' : // if can change mode in viewer - set fast for using live viewer | ||||
|                     //         this.editorConfig.coEditing.mode || 'fast'; | ||||
|                     // docInfo.put_CoEditingMode(coEditMode); | ||||
|                     docInfo.put_CoEditingMode('strict'); // need to change!!! | ||||
|                     let coEditMode = !(this.editorConfig.coEditing && typeof this.editorConfig.coEditing == 'object') ? 'fast' : // fast by default | ||||
|                                     this.editorConfig.mode === 'view' && this.editorConfig.coEditing.change!==false ? 'fast' : // if can change mode in viewer - set fast for using live viewer | ||||
|                                     this.editorConfig.coEditing.mode || 'fast'; | ||||
|                     docInfo.put_CoEditingMode(coEditMode); | ||||
| 
 | ||||
|                     const appOptions = this.props.storeAppOptions; | ||||
|                     let enable = !appOptions.customization || (appOptions.customization.macros !== false); | ||||
|  | @ -622,6 +621,9 @@ class MainController extends Component { | |||
|                 || licType === Asc.c_oLicenseResult.SuccessLimit && (appOptions.trialMode & Asc.c_oLicenseMode.Limited) !== 0)) | ||||
|             this._state.licenseType = licType; | ||||
| 
 | ||||
|         if (licType !== undefined && appOptions.canLiveView && (licType===Asc.c_oLicenseResult.ConnectionsLive || licType===Asc.c_oLicenseResult.ConnectionsLiveOS)) | ||||
|             this._state.licenseType = licType; | ||||
| 
 | ||||
|         if (this._isDocReady && this._state.licenseType) | ||||
|             this.applyLicense(); | ||||
|     } | ||||
|  | @ -653,7 +655,13 @@ class MainController extends Component { | |||
|             return; | ||||
|         } | ||||
| 
 | ||||
|         if (this._state.licenseType) { | ||||
|         if (appOptions.config.mode === 'view') { | ||||
|             if (appOptions.canLiveView && (this._state.licenseType===Asc.c_oLicenseResult.ConnectionsLive || this._state.licenseType===Asc.c_oLicenseResult.ConnectionsLiveOS)) { | ||||
|                 appOptions.canLiveView = false; | ||||
|                 this.api.asc_SetFastCollaborative(false); | ||||
|             } | ||||
|             Common.Notifications.trigger('toolbar:activatecontrols'); | ||||
|         } else if (this._state.licenseType) { | ||||
|             let license = this._state.licenseType; | ||||
|             let buttons = [{text: 'OK'}]; | ||||
|             if ((appOptions.trialMode & Asc.c_oLicenseMode.Limited) !== 0 && | ||||
|  |  | |||
|  | @ -111,5 +111,7 @@ export class storeAppOptions { | |||
|         this.canUseReviewPermissions && AscCommon.UserInfoParser.setReviewPermissions(permissions.reviewGroups, this.customization.reviewPermissions); | ||||
|         this.canUseCommentPermissions && AscCommon.UserInfoParser.setCommentPermissions(permissions.commentGroups);   | ||||
|         this.canUseUserInfoPermissions && AscCommon.UserInfoParser.setUserInfoPermissions(permissions.userInfoGroups); | ||||
| 
 | ||||
|         this.canLiveView = !!params.asc_getLiveViewerSupport() && (this.config.mode === 'view') && isSupportEditFeature; | ||||
|     } | ||||
| } | ||||
		Loading…
	
		Reference in a new issue