mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2025-07-31 17:38:28 +00:00
[MOBILEAPPS-1701] Custom URL schema issues fixed (#2998)
* Custom URL schema issues * code implementation changes for checkForMobileAppFlag * updated test cases * requested changed addressed * requested changed addressed * cspell changes * review comments addressed
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
<div class="container">
|
||||
<button mat-button (click)="openInApp()" data-automation-id="open-in-app-button">
|
||||
<span>{{ 'APP.DIALOGS.MOBILE_APP.MOBILE_APP_BUTTON_LABEL' }}</span>
|
||||
<button mat-button (click)="openInApp()" data-automation-id="open-in-app-button" class="open-in-app">
|
||||
<span>{{ 'APP.DIALOGS.MOBILE_APP.MOBILE_APP_BUTTON_LABEL' | translate }}</span>
|
||||
</button>
|
||||
<button mat-button mat-dialog-close>
|
||||
<button mat-button (click)="onCloseDialog()">
|
||||
<mat-icon>close</mat-icon>
|
||||
</button>
|
||||
</div>
|
||||
|
@@ -6,8 +6,12 @@
|
||||
}
|
||||
|
||||
.mat-dialog-container{
|
||||
padding: 12px;
|
||||
padding: 5px;
|
||||
border-radius: 36px;
|
||||
background-color: var(--theme-blue-button-color);
|
||||
color: var(--theme-about-panel-background-color);
|
||||
}
|
||||
|
||||
.open-in-app.mat-button {
|
||||
overflow-x: hidden;
|
||||
}
|
||||
|
@@ -1,16 +1,29 @@
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { MAT_DIALOG_DATA } from '@angular/material/dialog';
|
||||
import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';
|
||||
import { By } from '@angular/platform-browser';
|
||||
import { OpenInAppComponent } from './open-in-app.component';
|
||||
import { initialState, LibTestingModule } from '../../testing/lib-testing-module';
|
||||
import { provideMockStore } from '@ngrx/store/testing';
|
||||
import { TranslateModule } from '@ngx-translate/core';
|
||||
|
||||
describe('OpenInAppComponent', () => {
|
||||
let fixture: ComponentFixture<OpenInAppComponent>;
|
||||
let component: OpenInAppComponent;
|
||||
|
||||
const mockDialogRef = {
|
||||
close: jasmine.createSpy('close'),
|
||||
open: jasmine.createSpy('open')
|
||||
};
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [OpenInAppComponent],
|
||||
providers: [{ provide: MAT_DIALOG_DATA, useValue: { redirectUrl: 'mockRedirectUrl' } }]
|
||||
imports: [LibTestingModule, TranslateModule],
|
||||
providers: [
|
||||
provideMockStore({ initialState }),
|
||||
{ provide: MAT_DIALOG_DATA, useValue: { redirectUrl: 'mockRedirectUrl' } },
|
||||
{ provide: MatDialogRef, useValue: mockDialogRef }
|
||||
]
|
||||
}).compileComponents();
|
||||
|
||||
fixture = TestBed.createComponent(OpenInAppComponent);
|
||||
@@ -35,4 +48,11 @@ describe('OpenInAppComponent', () => {
|
||||
|
||||
expect(currentLocation).toBe('mockRedirectUrl');
|
||||
});
|
||||
|
||||
it('should set the value `mobile_notification_expires_in` in session storage on dialog close', async () => {
|
||||
sessionStorage.clear();
|
||||
component.onCloseDialog();
|
||||
expect(sessionStorage.getItem('mobile_notification_expires_in')).not.toBeNull();
|
||||
expect(mockDialogRef.close).toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
|
@@ -24,7 +24,7 @@
|
||||
*/
|
||||
|
||||
import { Component, Inject, ViewEncapsulation } from '@angular/core';
|
||||
import { MAT_DIALOG_DATA } from '@angular/material/dialog';
|
||||
import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';
|
||||
|
||||
export interface OpenInAppDialogOptions {
|
||||
redirectUrl: string;
|
||||
@@ -41,7 +41,8 @@ export class OpenInAppComponent {
|
||||
|
||||
constructor(
|
||||
@Inject(MAT_DIALOG_DATA)
|
||||
public data: OpenInAppDialogOptions
|
||||
public data: OpenInAppDialogOptions,
|
||||
private dialog: MatDialogRef<OpenInAppComponent>
|
||||
) {
|
||||
if (data) {
|
||||
this.redirectUrl = data.redirectUrl;
|
||||
@@ -51,4 +52,10 @@ export class OpenInAppComponent {
|
||||
openInApp(): void {
|
||||
this.window.location.href = this.redirectUrl;
|
||||
}
|
||||
|
||||
onCloseDialog(): void {
|
||||
const time: number = new Date().getTime();
|
||||
sessionStorage.setItem('mobile_notification_expires_in', time.toString());
|
||||
this.dialog.close();
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user