From 09d3028f777c2a1a821e42004df12a85fc5805e1 Mon Sep 17 00:00:00 2001 From: Julia Svinareva Date: Mon, 26 Aug 2019 10:55:11 +0300 Subject: [PATCH] [mobile] Display review for view mode --- .../mobile/lib/controller/Collaboration.js | 22 +++++++++++++------ .../mobile/app/controller/Main.js | 16 ++++++++++++++ 2 files changed, 31 insertions(+), 7 deletions(-) diff --git a/apps/common/mobile/lib/controller/Collaboration.js b/apps/common/mobile/lib/controller/Collaboration.js index 63d5296a4..4bdd605ab 100644 --- a/apps/common/mobile/lib/controller/Collaboration.js +++ b/apps/common/mobile/lib/controller/Collaboration.js @@ -60,6 +60,7 @@ define([ editUsers = [], editor = !!window.DE ? 'DE' : !!window.PE ? 'PE' : 'SSE', displayMode = "Markup", + canViewReview, arrChangeReview = [], dateChange = [], _fileKey; @@ -208,11 +209,8 @@ define([ me.initComments(); Common.Utils.addScrollIfNeed('.page[data-page=comments-view]', '.page[data-page=comments-view] .page-content'); } else { - if(editor === 'DE' && !this.appConfig.canReview) { - this.canViewReview = me.api.asc_HaveRevisionsChanges(true); - if (!this.canViewReview) { - $('#reviewing-settings').hide(); - } + if(editor === 'DE' && !this.appConfig.canReview && !canViewReview) { + $('#reviewing-settings').hide(); } } }, @@ -317,9 +315,14 @@ define([ }, initDisplayMode: function() { - var me = this; + var me = this, + value; $('input:radio').single('change', _.bind(me.onReviewViewClick, me)); - var value = displayMode; + if (me.appConfig.canReview) { + value = displayMode; + } else if (canViewReview) { + value = Common.localStorage.getItem("de-view-review-mode") || 'Original'; + } if (value == null || value === "Markup") { $('input[value="Markup"]').attr('checked', true); } else if (value === 'Final') { @@ -333,9 +336,14 @@ define([ return displayMode; }, + setCanViewReview: function(config) { + canViewReview = config; + }, + onReviewViewClick: function(event) { var value = $(event.currentTarget).val(); this.turnDisplayMode(value); + !this.appConfig.canReview && Common.localStorage.setItem("de-view-review-mode", value); }, turnDisplayMode: function(value) { diff --git a/apps/documenteditor/mobile/app/controller/Main.js b/apps/documenteditor/mobile/app/controller/Main.js index 09a87a897..17140c063 100644 --- a/apps/documenteditor/mobile/app/controller/Main.js +++ b/apps/documenteditor/mobile/app/controller/Main.js @@ -604,6 +604,22 @@ define([ me.applyLicense(); $(document).on('contextmenu', _.bind(me.onContextMenu, me)); + + if (!me.appOptions.canReview) { + var canViewReview = me.api.asc_HaveRevisionsChanges(true); + if (canViewReview) { + var viewReviewMode = Common.localStorage.getItem("de-view-review-mode"); + viewReviewMode = viewReviewMode || 'Original'; + if (viewReviewMode === 'Original') + me.api.asc_BeginViewModeInReview(false); + else if (viewReviewMode === 'Final') + me.api.asc_BeginViewModeInReview(true); + else + me.api.asc_EndViewModeInReview(); + } + DE.getController('Common.Controllers.Collaboration').setCanViewReview(canViewReview); + } + Common.Gateway.documentReady(); },