Skip to content

Commit

Permalink
feat(client-interaction): remember minimized status on persistence, m…
Browse files Browse the repository at this point in the history
…imize mobile chat on link click
  • Loading branch information
fsanna committed Jul 7, 2021
1 parent 1049642 commit d4dfeb6
Show file tree
Hide file tree
Showing 3 changed files with 105 additions and 12 deletions.
17 changes: 16 additions & 1 deletion interaction/app/default/src/app/app.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ export class AppComponent implements OnInit, OnDestroy {
const step = this.getCloseStep(context);
this.interactionService.track('close-contact', step);
// console.log('CLOSE CONTACT', step, context.variables, context);

this.trackMinizedStatus(false);
switch (step) {
case 'remove-app':
this.closeApp();
Expand Down Expand Up @@ -189,6 +189,7 @@ export class AppComponent implements OnInit, OnDestroy {
}
}
expandWidget(isFullScreen) {
this.trackMinizedStatus(false);
this.interactionService.maximizeWidget(isFullScreen, (isFullScreen || this.isMobile) ? this.dimensions.fullscreen : this.dimensions.normal);
}
getCloseStep(context) {
Expand Down Expand Up @@ -277,15 +278,26 @@ export class AppComponent implements OnInit, OnDestroy {
this.interactionService.minimizeWidget(isMobile ? this.dimensions.minimizedCbnMobile : this.dimensions.minimizedCbn);
}
minimizeWidget() {
this.trackMinizedStatus(true);
this.interactionService.minimizeWidget(this.dimensions.minimized);
}
minimizeMedia() {
this.interactionService.minimizeMedia();
}
trackMinizedStatus(status){
if(status){
sessionStorage.setItem("vvcMinimizedStatus", status);
}else{
sessionStorage.removeItem("vvcMinimizedStatus");
}
}
muteToggle(muted) {
this.interactionService.muteToggle(muted);
}
openAttachment(url: string, click?: boolean) {
if(this.isMobile){
this.minimizeWidget();
}
this.interactionService.openAttachment(url, click);
}
processAction(action) {
Expand Down Expand Up @@ -330,6 +342,9 @@ export class AppComponent implements OnInit, OnDestroy {
if (context.mediaPreset === 'sync' || !!context.conversationId) {
this.interactionService.setDimensions(this.dimensions.minimized);
}
if (sessionStorage.vvcMinimizedStatus && context.variables && (context.variables.rememberMinimizedStatus || (context.variables.minimizeOnLink && this.isMobile))) {
this.minimizeWidget();
}
}
showCloseDialog(context) {
return context && !context.isCLosed && context.variables && context.variables.askCloseConfirm && !this.closeModalVisible;
Expand Down
20 changes: 20 additions & 0 deletions interaction/app/default/src/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,26 @@
"General_DimensionAndPosition"
]
},
{
"id": "minimizeOnLink",
"nameId": "META.VARIABLES.APP.MINIMIZE_ON_LINK",
"defaultValue": false,
"type": "boolean",
"hidden": false,
"categoryIds": [
"General_Minimized"
]
},
{
"id": "rememberMinimizedStatus",
"nameId": "META.VARIABLES.APP.REMEMBER_MINIMIZED_STATUS",
"defaultValue": false,
"type": "boolean",
"hidden": false,
"categoryIds": [
"General_Minimized"
]
},
{
"id": "enableDebug",
"nameId": "META.VARIABLES.APP.ENABLE_DEBUG",
Expand Down
80 changes: 69 additions & 11 deletions interaction/app/default/src/strings.json
Original file line number Diff line number Diff line change
Expand Up @@ -377,31 +377,31 @@
}
},
{
"id": "META.GROUPS.DimensionAndPosition",
"id": "META.GROUPS.Minimized",
"values": {
"de": {
"value": "Abmessungen und Platzierung",
"state": "final"
"value": "Minimized State",
"state": "new"
},
"en": {
"value": "Dimensions and position",
"value": "Minimized State",
"state": "final"
},
"es": {
"value": "Dimensiones y posicionamiento",
"state": "final"
"value": "Minimized State",
"state": "new"
},
"fr": {
"value": "Dimensions et positionnement",
"state": "final"
"value": "Minimized State",
"state": "new"
},
"it": {
"value": "Dimensioni e posizionamento",
"value": "Stato minimizzato",
"state": "final"
},
"ja": {
"value": "サイズと位置",
"state": "final"
"value": "Minimized State",
"state": "new"
}
}
},
Expand Down Expand Up @@ -1391,6 +1391,64 @@
}
}
},
{
"id": "META.VARIABLES.APP.MINIMIZE_ON_LINK",
"values": {
"de": {
"value": "On Mobile, Minimize chat on Link's Click",
"state": "new"
},
"en": {
"value": "On Mobile, Minimize chat on Link's Click",
"state": "final"
},
"es": {
"value": "On Mobile, Minimize chat on Link's Click",
"state": "new"
},
"fr": {
"value": "On Mobile, Minimize chat on Link's Click",
"state": "new"
},
"it": {
"value": "Minimizza la chat quando si clicca su un link da dispositivo Mobile",
"state": "final"
},
"ja": {
"value": "On Mobile, Minimize chat on Link's Click",
"state": "new"
}
}
},
{
"id": "META.VARIABLES.APP.REMEMBER_MINIMIZED_STATUS",
"values": {
"de": {
"value": "Remember minimized status on page refresh",
"state": "new"
},
"en": {
"value": "Remember minimized status on page refresh",
"state": "final"
},
"es": {
"value": "Remember minimized status on page refresh",
"state": "new"
},
"fr": {
"value": "Remember minimized status on page refresh",
"state": "new"
},
"it": {
"value": "Ricorda lo stato minimizzato al refresh della pagina",
"state": "final"
},
"ja": {
"value": "Remember minimized status on page refresh",
"state": "new"
}
}
},
{
"id": "META.VARIABLES.APP.MINIMIZED_BOTTOM",
"values": {
Expand Down

0 comments on commit d4dfeb6

Please sign in to comment.