mirror of
https://github.com/4gray/iptvnator.git
synced 2026-10-15 05:36:17 -08:00
feat: add "what is new" dialog
ci: adapt registry config in ci scripts ci: adapt registry config in ci scripts ci: adapt registry config in ci scripts refactor: revert ci changes, update import of dependency
This commit is contained in:
13 files changed
+42272
-94
No files matched your search
@@ -0,0 +1,38 @@
|
||||
/* eslint-disable @typescript-eslint/unbound-method */
|
||||
import { TestBed, inject } from '@angular/core/testing';
|
||||
import { WhatsNewService } from './whats-new.service';
|
||||
|
||||
describe('Service: WhatsNew', () => {
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
providers: [WhatsNewService],
|
||||
});
|
||||
});
|
||||
|
||||
it('should ...', inject([WhatsNewService], (service: WhatsNewService) => {
|
||||
expect(service).toBeTruthy();
|
||||
}));
|
||||
|
||||
it('should change the state', inject(
|
||||
[WhatsNewService],
|
||||
(service: WhatsNewService) => {
|
||||
spyOn(service.dialogState$, 'next');
|
||||
service.changeDialogVisibleState(true);
|
||||
expect(service.dialogState$.next).toHaveBeenCalledTimes(1);
|
||||
expect(service.dialogState$.next).toHaveBeenCalledWith(true);
|
||||
service.changeDialogVisibleState(false);
|
||||
expect(service.dialogState$.next).toHaveBeenCalledTimes(2);
|
||||
expect(service.dialogState$.next).toHaveBeenCalledWith(false);
|
||||
}
|
||||
));
|
||||
|
||||
it('should return modal windows for the requested version ', inject(
|
||||
[WhatsNewService],
|
||||
(service: WhatsNewService) => {
|
||||
const version = '0.6.0';
|
||||
const modals = service.getModalsByVersion(version);
|
||||
expect(modals).toBeDefined();
|
||||
expect(modals).toHaveLength(service.modals[version].length);
|
||||
}
|
||||
));
|
||||
});
|
||||
@@ -0,0 +1,82 @@
|
||||
import { ModalWindow } from 'ngx-whats-new/lib/modal-window.interface';
|
||||
import { Injectable } from '@angular/core';
|
||||
import { BehaviorSubject } from 'rxjs';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root',
|
||||
})
|
||||
export class WhatsNewService {
|
||||
/** Visibility state of the modal */
|
||||
dialogState$ = new BehaviorSubject<boolean>(false);
|
||||
|
||||
/** Array with all available modals */
|
||||
modals = {
|
||||
'0.6.0': [
|
||||
{
|
||||
imageHeight: 470,
|
||||
imageBgColor: '#333',
|
||||
imageSrc: './assets/updates/060/dark-theme.png',
|
||||
title: 'New in v0.6.0 - Dark theme 🎉',
|
||||
text:
|
||||
'Finally, the dark theme is now available. Check the settings page of the application to change the theme.',
|
||||
button: {
|
||||
text: 'OKAY',
|
||||
textColor: '#ccc',
|
||||
bgColor: '#111',
|
||||
},
|
||||
},
|
||||
{
|
||||
imageHeight: 470,
|
||||
imageBgColor: '#333',
|
||||
imageSrc: './assets/updates/060/channel-logos.png',
|
||||
title: 'Channel logos 📺',
|
||||
text:
|
||||
'The channel list was extended with the visualization of logotypes (only visible if they are defined in the playlist)',
|
||||
button: {
|
||||
text: 'OKAY',
|
||||
textColor: '#ccc',
|
||||
bgColor: '#111',
|
||||
},
|
||||
},
|
||||
{
|
||||
imageHeight: 470,
|
||||
imageBgColor: '#333',
|
||||
imageSrc: './assets/updates/060/custom-user-agent.png',
|
||||
title: 'Custom user agent 🕵️♂️',
|
||||
text:
|
||||
'Some IPTV providers need a specific user-agent in order to play their playlist. Support of custom user agent is available now.',
|
||||
button: {
|
||||
text: 'GOT IT',
|
||||
textColor: '#ccc',
|
||||
bgColor: '#111',
|
||||
},
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
/** Options for the "what is new" modal dialogs */
|
||||
options = {
|
||||
width: '500px',
|
||||
customStyle: {
|
||||
boxShadow: '0px 0px 10px 5px #111',
|
||||
backgroundColor: '#333',
|
||||
textColor: '#eee',
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
* Changes the visibility state of the modal dialog
|
||||
* @param value flag to set
|
||||
*/
|
||||
changeDialogVisibleState(value: boolean): void {
|
||||
this.dialogState$.next(value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an array with modals for the provided version of the application
|
||||
* @param version version string
|
||||
*/
|
||||
getModalsByVersion(version: string): ModalWindow[] {
|
||||
return this.modals[version] || [];
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user