diff --git a/src/app/app.module.ts b/src/app/app.module.ts index f5312c5c0..52f8aeb9e 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -34,7 +34,6 @@ import { AppComponent } from './app.component'; import { FanartApi } from './common/api/fanart/fanart.api'; import { GitHubApi } from './common/api/git-hub/git-hub.api'; import { LastfmApi } from './common/api/lastfm/lastfm.api'; -import { ContextMenuOpener } from './common/context-menu-opener'; import { AlbumKeyGenerator } from './data/album-key-generator'; import { DatabaseFactory } from './data/database-factory'; import { DatabaseMigrator } from './data/database-migrator'; @@ -44,7 +43,6 @@ import { FolderTrackRepository } from './data/repositories/folder-track-reposito import { RemovedTrackRepository } from './data/repositories/removed-track-repository'; import { TrackRepository } from './data/repositories/track-repository'; import { DateTime } from './common/date-time'; -import { FileValidator } from './common/file-validator'; import { GuidFactory } from './common/guid.factory'; import { Hacks } from './common/hacks'; import { ImageProcessor } from './common/image-processor'; @@ -65,7 +63,6 @@ import { NativeElementProxy } from './common/native-element-proxy'; import { ArtistOrdering } from './common/ordering/artist-ordering'; import { GenreOrdering } from './common/ordering/genre-ordering'; import { TrackOrdering } from './common/ordering/track-ordering'; -import { PathValidator } from './common/path-validator'; import { Scheduler } from './common/scheduling/scheduler'; import { SemanticZoomHeaderAdder } from './common/semantic-zoom-header-adder'; import { SettingsBase } from './common/settings/settings.base'; @@ -306,6 +303,9 @@ import { DesktopBase } from './common/io/desktop.base'; import { FileAccessBase } from './common/io/file-access.base'; import { FileMetadataFactoryBase } from './common/metadata/file-metadata.factory.base'; import { SchedulerBase } from './common/scheduling/scheduler.base'; +import { ContextMenuOpener } from './ui/components/context-menu-opener'; +import { PathValidator } from './common/validation/path-validator'; +import { FileValidator } from './common/validation/file-validator'; export function HttpLoaderFactory(http: HttpClient): TranslateHttpLoader { return new TranslateHttpLoader(http, './assets/i18n/', '.json'); diff --git a/src/app/common/api/git-hub/git-hub.api.ts b/src/app/common/api/git-hub/git-hub.api.ts index f8b54dc6a..190613fbc 100644 --- a/src/app/common/api/git-hub/git-hub.api.ts +++ b/src/app/common/api/git-hub/git-hub.api.ts @@ -7,7 +7,7 @@ /* eslint-disable @typescript-eslint/no-unsafe-assignment */ import { HttpClient } from '@angular/common/http'; import { Injectable } from '@angular/core'; -import { Strings } from '../../strings'; +import { StringUtils } from '../../utils/string-utils'; @Injectable() export class GitHubApi { @@ -26,7 +26,7 @@ export class GitHubApi { } if (latestRelease != undefined && latestRelease.tag_name != undefined) { - return Strings.replaceFirst(latestRelease.tag_name, 'v', ''); + return StringUtils.replaceFirst(latestRelease.tag_name, 'v', ''); } return ''; diff --git a/src/app/common/api/lastfm/lastfm-album.ts b/src/app/common/api/lastfm/lastfm-album.ts index e0cfc648d..207db05f4 100644 --- a/src/app/common/api/lastfm/lastfm-album.ts +++ b/src/app/common/api/lastfm/lastfm-album.ts @@ -1,4 +1,4 @@ -import { Strings } from '../../strings'; +import { StringUtils } from '../../utils/string-utils'; export class LastfmAlbum { public name: string; @@ -11,23 +11,23 @@ export class LastfmAlbum { public imageMega: string; public largestImage(): string { - if (!Strings.isNullOrWhiteSpace(this.imageMega)) { + if (!StringUtils.isNullOrWhiteSpace(this.imageMega)) { return this.imageMega; } - if (!Strings.isNullOrWhiteSpace(this.imageExtraLarge)) { + if (!StringUtils.isNullOrWhiteSpace(this.imageExtraLarge)) { return this.imageExtraLarge; } - if (!Strings.isNullOrWhiteSpace(this.imageLarge)) { + if (!StringUtils.isNullOrWhiteSpace(this.imageLarge)) { return this.imageLarge; } - if (!Strings.isNullOrWhiteSpace(this.imageMedium)) { + if (!StringUtils.isNullOrWhiteSpace(this.imageMedium)) { return this.imageMedium; } - if (!Strings.isNullOrWhiteSpace(this.imageSmall)) { + if (!StringUtils.isNullOrWhiteSpace(this.imageSmall)) { return this.imageSmall; } diff --git a/src/app/common/api/lastfm/lastfm-artist.ts b/src/app/common/api/lastfm/lastfm-artist.ts index 448b1132b..7be4bf98f 100644 --- a/src/app/common/api/lastfm/lastfm-artist.ts +++ b/src/app/common/api/lastfm/lastfm-artist.ts @@ -1,5 +1,5 @@ -import { Strings } from '../../strings'; import { LastfmBiography } from './lastfm-biography'; +import { StringUtils } from '../../utils/string-utils'; export class LastfmArtist { public name: string; @@ -14,23 +14,23 @@ export class LastfmArtist { public biography: LastfmBiography | undefined; public largestImage(): string { - if (!Strings.isNullOrWhiteSpace(this.imageMega)) { + if (!StringUtils.isNullOrWhiteSpace(this.imageMega)) { return this.imageMega; } - if (!Strings.isNullOrWhiteSpace(this.imageExtraLarge)) { + if (!StringUtils.isNullOrWhiteSpace(this.imageExtraLarge)) { return this.imageExtraLarge; } - if (!Strings.isNullOrWhiteSpace(this.imageLarge)) { + if (!StringUtils.isNullOrWhiteSpace(this.imageLarge)) { return this.imageLarge; } - if (!Strings.isNullOrWhiteSpace(this.imageMedium)) { + if (!StringUtils.isNullOrWhiteSpace(this.imageMedium)) { return this.imageMedium; } - if (!Strings.isNullOrWhiteSpace(this.imageSmall)) { + if (!StringUtils.isNullOrWhiteSpace(this.imageSmall)) { return this.imageSmall; } diff --git a/src/app/common/api/lastfm/lastfm.api.ts b/src/app/common/api/lastfm/lastfm.api.ts index 43b3d2182..0320eb0cc 100644 --- a/src/app/common/api/lastfm/lastfm.api.ts +++ b/src/app/common/api/lastfm/lastfm.api.ts @@ -10,10 +10,10 @@ import { Md5 } from 'md5-typescript'; import fetch from 'node-fetch'; import { SensitiveInformation } from '../../application/sensitive-information'; import { DateTime } from '../../date-time'; -import { Strings } from '../../strings'; import { LastfmAlbum } from './lastfm-album'; import { LastfmArtist } from './lastfm-artist'; import { LastfmBiography } from './lastfm-biography'; +import {StringUtils} from "../../utils/string-utils"; @Injectable() export class LastfmApi { @@ -47,7 +47,7 @@ export class LastfmApi { ['api_key', SensitiveInformation.lastfmApiKey], ]); - if (!Strings.isNullOrWhiteSpace(languageCode)) { + if (!StringUtils.isNullOrWhiteSpace(languageCode)) { parameters.set('lang', languageCode); } @@ -102,7 +102,7 @@ export class LastfmApi { ['api_key', SensitiveInformation.lastfmApiKey], ]); - if (!Strings.isNullOrWhiteSpace(languageCode)) { + if (!StringUtils.isNullOrWhiteSpace(languageCode)) { parameters.set('lang', languageCode); } @@ -129,7 +129,7 @@ export class LastfmApi { artist: string, trackTitle: string, albumTitle: string, - playbackStartTime: Date + playbackStartTime: Date, ): Promise { let isScrobbleSuccessful: boolean = false; @@ -143,7 +143,7 @@ export class LastfmApi { ['sk', sessionKey], ]); - if (!Strings.isNullOrWhiteSpace(albumTitle)) { + if (!StringUtils.isNullOrWhiteSpace(albumTitle)) { parameters.set('album', albumTitle); } @@ -171,7 +171,7 @@ export class LastfmApi { ['sk', sessionKey], ]); - if (!Strings.isNullOrWhiteSpace(albumTitle)) { + if (!StringUtils.isNullOrWhiteSpace(albumTitle)) { parameters.set('album', albumTitle); } diff --git a/src/app/common/api/lyrics/web-search-lyrics/sources/a-z-lyrics-source.ts b/src/app/common/api/lyrics/web-search-lyrics/sources/a-z-lyrics-source.ts index 18fd99bc3..34dcf987c 100644 --- a/src/app/common/api/lyrics/web-search-lyrics/sources/a-z-lyrics-source.ts +++ b/src/app/common/api/lyrics/web-search-lyrics/sources/a-z-lyrics-source.ts @@ -1,7 +1,7 @@ import { IWebSearchLyricsSource } from './i-web-search-lyrics-source'; import htmlParser from 'node-html-parser'; import { HTMLElement } from 'node-html-parser'; -import { Strings } from '../../../../strings'; +import { StringUtils } from '../../../../utils/string-utils'; export class AZLyricsSource implements IWebSearchLyricsSource { public get name(): string { @@ -20,10 +20,10 @@ export class AZLyricsSource implements IWebSearchLyricsSource { const content: string | undefined = possibleContent?.textContent.trim(); - if (Strings.isNullOrWhiteSpace(content)) { + if (StringUtils.isNullOrWhiteSpace(content)) { return ''; } - return Strings.replaceAll(content!, '\n\n', '\n'); + return StringUtils.replaceAll(content!, '\n\n', '\n'); } } diff --git a/src/app/common/api/lyrics/web-search-lyrics/web-search-lyrics.api.ts b/src/app/common/api/lyrics/web-search-lyrics/web-search-lyrics.api.ts index 5a9c63375..959166c8d 100644 --- a/src/app/common/api/lyrics/web-search-lyrics/web-search-lyrics.api.ts +++ b/src/app/common/api/lyrics/web-search-lyrics/web-search-lyrics.api.ts @@ -6,12 +6,12 @@ import { WebSearchResult } from './web-search-result'; import { WebSearchApi } from './web-search.api'; import { IWebSearchLyricsSource } from './sources/i-web-search-lyrics-source'; import { AZLyricsSource } from './sources/a-z-lyrics-source'; -import { Strings } from '../../../strings'; import { HttpClient } from '@angular/common/http'; import { GeniusSource } from './sources/genius-source'; import { MusixmatchSource } from './sources/musixmatch-source'; import { LyricsSource } from './sources/lyrics-source'; import { Logger } from '../../../logger'; +import { StringUtils } from '../../../utils/string-utils'; @Injectable() export class WebSearchLyricsApi implements ILyricsApi { @@ -43,13 +43,13 @@ export class WebSearchLyricsApi implements ILyricsApi { webSearchResults.filter((x: WebSearchResult) => [...this.sources.keys()].includes(x.name)) || []; for (const possibleSite of possibleSites) { - if (!Strings.isNullOrWhiteSpace(possibleSite.name)) { + if (!StringUtils.isNullOrWhiteSpace(possibleSite.name)) { try { const source: IWebSearchLyricsSource = this.sources.get(possibleSite.name)!; const htmlString: string = await this.httpClient.get(possibleSite.fullUrl, { responseType: 'text' }).toPromise(); const lyricsText: string = source.parse(htmlString); - if (Strings.isNullOrWhiteSpace(lyricsText)) { + if (StringUtils.isNullOrWhiteSpace(lyricsText)) { continue; } diff --git a/src/app/common/api/lyrics/web-search-lyrics/web-search.api.ts b/src/app/common/api/lyrics/web-search-lyrics/web-search.api.ts index 87d121213..edd43d9e4 100644 --- a/src/app/common/api/lyrics/web-search-lyrics/web-search.api.ts +++ b/src/app/common/api/lyrics/web-search-lyrics/web-search.api.ts @@ -8,7 +8,7 @@ import { Injectable } from '@angular/core'; import { HttpClient } from '@angular/common/http'; import { WebSearchResult } from './web-search-result'; -import { Strings } from '../../../strings'; +import { StringUtils } from '../../../utils/string-utils'; @Injectable() export class WebSearchApi { @@ -20,14 +20,14 @@ export class WebSearchApi { public async webSearchAsync(query: string): Promise { const vqd: string = await this.getVqdAsync(query); - if (Strings.isNullOrWhiteSpace(vqd)) { + if (StringUtils.isNullOrWhiteSpace(vqd)) { throw new Error(`Failed to get the VQD for query "${query}".`); } const requestUrl: string = `https://links.duckduckgo.com/d.js?${this.getSearchRequestParams(query, vqd).toString()}`; const responseString: string = await this.performGetRequestAsync(requestUrl); - if (Strings.isNullOrWhiteSpace(responseString)) { + if (StringUtils.isNullOrWhiteSpace(responseString)) { return []; } @@ -39,7 +39,7 @@ export class WebSearchApi { const rawSearchResults: string = matches[1].replace(/\\t/g, ' '); - if (Strings.isNullOrWhiteSpace(rawSearchResults)) { + if (StringUtils.isNullOrWhiteSpace(rawSearchResults)) { return []; } diff --git a/src/app/common/collections.spec.ts b/src/app/common/collections.spec.ts deleted file mode 100644 index 8158ef030..000000000 --- a/src/app/common/collections.spec.ts +++ /dev/null @@ -1,3 +0,0 @@ -describe('Collections', () => { - test.todo('should write tests'); -}); diff --git a/src/app/common/file-validator.spec.ts b/src/app/common/file-validator.spec.ts deleted file mode 100644 index 95230b86f..000000000 --- a/src/app/common/file-validator.spec.ts +++ /dev/null @@ -1,3 +0,0 @@ -describe('PlaylistFileManager', () => { - test.todo('should write tests'); -}); diff --git a/src/app/common/guid-factory.spec.ts b/src/app/common/guid.factory.spec.ts similarity index 100% rename from src/app/common/guid-factory.spec.ts rename to src/app/common/guid.factory.spec.ts diff --git a/src/app/common/logger.js b/src/app/common/logger.js deleted file mode 100644 index f7987c317..000000000 --- a/src/app/common/logger.js +++ /dev/null @@ -1,38 +0,0 @@ -"use strict"; -var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { - var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; - if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); - else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; - return c > 3 && r && Object.defineProperty(target, key, r), r; -}; -var __metadata = (this && this.__metadata) || function (k, v) { - if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); -}; -Object.defineProperty(exports, "__esModule", { value: true }); -var core_1 = require("@angular/core"); -var electron_log_1 = require("electron-log"); -var Logger = /** @class */ (function () { - function Logger() { - } - Logger.prototype.info = function (message, callerClass, callerMethod) { - electron_log_1.default.info(this.formattedMessage(message, callerClass, callerMethod)); - }; - Logger.prototype.warn = function (message, callerClass, callerMethod) { - electron_log_1.default.warn(this.formattedMessage(message, callerClass, callerMethod)); - }; - Logger.prototype.error = function (message, callerClass, callerMethod) { - electron_log_1.default.error(this.formattedMessage(message, callerClass, callerMethod)); - }; - Logger.prototype.formattedMessage = function (message, callerClass, callerMethod) { - return "[" + callerClass + "] [" + callerMethod + "] " + message; - }; - Logger = __decorate([ - core_1.Injectable({ - providedIn: 'root' - }), - __metadata("design:paramtypes", []) - ], Logger); - return Logger; -}()); -exports.Logger = Logger; -//# sourceMappingURL=logger.js.map \ No newline at end of file diff --git a/src/app/common/logger.js.map b/src/app/common/logger.js.map deleted file mode 100644 index efd1e7f76..000000000 --- a/src/app/common/logger.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"logger.js","sourceRoot":"","sources":["logger.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,sCAA2C;AAC3C,6CAA+B;AAM/B;IACI;IAAgB,CAAC;IAEV,qBAAI,GAAX,UAAY,OAAe,EAAE,WAAmB,EAAE,YAAoB;QAClE,sBAAG,CAAC,IAAI,CAAC,IAAI,CAAC,gBAAgB,CAAC,OAAO,EAAE,WAAW,EAAE,YAAY,CAAC,CAAC,CAAC;IACxE,CAAC;IAEM,qBAAI,GAAX,UAAY,OAAe,EAAE,WAAmB,EAAE,YAAoB;QAClE,sBAAG,CAAC,IAAI,CAAC,IAAI,CAAC,gBAAgB,CAAC,OAAO,EAAE,WAAW,EAAE,YAAY,CAAC,CAAC,CAAC;IACxE,CAAC;IAEM,sBAAK,GAAZ,UAAa,OAAe,EAAE,WAAmB,EAAE,YAAoB;QACnE,sBAAG,CAAC,KAAK,CAAC,IAAI,CAAC,gBAAgB,CAAC,OAAO,EAAE,WAAW,EAAE,YAAY,CAAC,CAAC,CAAC;IACzE,CAAC;IAEO,iCAAgB,GAAxB,UAAyB,OAAe,EAAE,WAAmB,EAAE,YAAoB;QAC/E,OAAO,MAAI,WAAW,WAAM,YAAY,UAAK,OAAS,CAAC;IAC3D,CAAC;IAjBQ,MAAM;QAHlB,iBAAU,CAAC;YACR,UAAU,EAAE,MAAM;SACrB,CAAC;;OACW,MAAM,CAkBlB;IAAD,aAAC;CAAA,AAlBD,IAkBC;AAlBY,wBAAM"} \ No newline at end of file diff --git a/src/app/common/native-element-proxy.ts b/src/app/common/native-element-proxy.ts index 0bc04da17..44a0bcec5 100644 --- a/src/app/common/native-element-proxy.ts +++ b/src/app/common/native-element-proxy.ts @@ -11,10 +11,6 @@ export class NativeElementProxy { return 0; } - // if (!(element.nativeElement instanceof HTMLElement)) { - // return 0; - // } - const htmlElement: HTMLElement = element.nativeElement; if (htmlElement.offsetWidth == undefined) { diff --git a/src/app/common/semantic-zoomable.ts b/src/app/common/semantic-zoomable.ts index 62c79fe7f..f63de007c 100644 --- a/src/app/common/semantic-zoomable.ts +++ b/src/app/common/semantic-zoomable.ts @@ -1,5 +1,5 @@ import { Constants } from './application/constants'; -import { Strings } from './strings'; +import { StringUtils } from './utils/string-utils'; export abstract class SemanticZoomable { public abstract name: string; @@ -8,7 +8,7 @@ export abstract class SemanticZoomable { public isZoomHeader: boolean = false; public get sortableName(): string { - return Strings.getSortableString(this.name, true); + return StringUtils.getSortableString(this.name, true); } public get zoomHeader(): string { diff --git a/src/app/common/collections.ts b/src/app/common/utils/collections-utils.ts similarity index 96% rename from src/app/common/collections.ts rename to src/app/common/utils/collections-utils.ts index ab485c1ab..bac92c989 100644 --- a/src/app/common/collections.ts +++ b/src/app/common/utils/collections-utils.ts @@ -1,4 +1,4 @@ -export class Collections { +export class CollectionUtils { public static groupBy(list: T[], keyGetter: (T) => S): Map { const map: Map = new Map(); diff --git a/src/app/common/strings.spec.ts b/src/app/common/utils/string-utils.spec.ts similarity index 80% rename from src/app/common/strings.spec.ts rename to src/app/common/utils/string-utils.spec.ts index 98a2509b8..ee6f1ae1c 100644 --- a/src/app/common/strings.spec.ts +++ b/src/app/common/utils/string-utils.spec.ts @@ -1,12 +1,12 @@ -import { Strings } from './strings'; +import { StringUtils } from './string-utils'; -describe('Strings', () => { +describe('StringUtils', () => { describe('empty', () => { it('should return an empty string', () => { // Arrange // Act - const emptyString: string = Strings.empty; + const emptyString: string = StringUtils.empty; // Assert expect(emptyString).toEqual(''); @@ -20,7 +20,7 @@ describe('Strings', () => { const string2: string | undefined = undefined; // Act - const stringsAreEqual: boolean = Strings.equalsIgnoreCase(string1, string2); + const stringsAreEqual: boolean = StringUtils.equalsIgnoreCase(string1, string2); // Assert expect(stringsAreEqual).toBeTruthy(); @@ -32,7 +32,7 @@ describe('Strings', () => { const string2: string = 'string 2'; // Act - const stringsAreEqual: boolean = Strings.equalsIgnoreCase(string1, string2); + const stringsAreEqual: boolean = StringUtils.equalsIgnoreCase(string1, string2); // Assert expect(stringsAreEqual).toBeFalsy(); @@ -44,7 +44,7 @@ describe('Strings', () => { const string2: string | undefined = undefined; // Act - const stringsAreEqual: boolean = Strings.equalsIgnoreCase(string1, string2); + const stringsAreEqual: boolean = StringUtils.equalsIgnoreCase(string1, string2); // Assert expect(stringsAreEqual).toBeFalsy(); @@ -56,7 +56,7 @@ describe('Strings', () => { const string2: string = 'thisisastring'; // Act - const stringsAreEqual: boolean = Strings.equalsIgnoreCase(string1, string2); + const stringsAreEqual: boolean = StringUtils.equalsIgnoreCase(string1, string2); // Assert expect(stringsAreEqual).toBeTruthy(); @@ -68,7 +68,7 @@ describe('Strings', () => { const string2: string = 'THISISASTRING'; // Act - const stringsAreEqual: boolean = Strings.equalsIgnoreCase(string1, string2); + const stringsAreEqual: boolean = StringUtils.equalsIgnoreCase(string1, string2); // Assert expect(stringsAreEqual).toBeTruthy(); @@ -81,7 +81,7 @@ describe('Strings', () => { const stringToCheck: string | undefined = undefined; // Act - const stringToCheckIsNullOrWhiteSpace: boolean = Strings.isNullOrWhiteSpace(stringToCheck); + const stringToCheckIsNullOrWhiteSpace: boolean = StringUtils.isNullOrWhiteSpace(stringToCheck); // Assert expect(stringToCheckIsNullOrWhiteSpace).toBeTruthy(); @@ -92,7 +92,7 @@ describe('Strings', () => { const stringToCheck: string = ''; // Act - const stringToCheckIsNullOrWhiteSpace: boolean = Strings.isNullOrWhiteSpace(stringToCheck); + const stringToCheckIsNullOrWhiteSpace: boolean = StringUtils.isNullOrWhiteSpace(stringToCheck); // Assert expect(stringToCheckIsNullOrWhiteSpace).toBeTruthy(); @@ -103,7 +103,7 @@ describe('Strings', () => { const stringToCheck: string = ' '; // Act - const stringToCheckIsNullOrWhiteSpace: boolean = Strings.isNullOrWhiteSpace(stringToCheck); + const stringToCheckIsNullOrWhiteSpace: boolean = StringUtils.isNullOrWhiteSpace(stringToCheck); // Assert expect(stringToCheckIsNullOrWhiteSpace).toBeTruthy(); @@ -114,7 +114,7 @@ describe('Strings', () => { const stringToCheck: string = ' '; // Act - const stringToCheckIsNullOrWhiteSpace: boolean = Strings.isNullOrWhiteSpace(stringToCheck); + const stringToCheckIsNullOrWhiteSpace: boolean = StringUtils.isNullOrWhiteSpace(stringToCheck); // Assert expect(stringToCheckIsNullOrWhiteSpace).toBeTruthy(); @@ -125,7 +125,7 @@ describe('Strings', () => { const stringToCheck: string = 'myString 1'; // Act - const stringToCheckIsNullOrWhiteSpace: boolean = Strings.isNullOrWhiteSpace(stringToCheck); + const stringToCheckIsNullOrWhiteSpace: boolean = StringUtils.isNullOrWhiteSpace(stringToCheck); // Assert expect(stringToCheckIsNullOrWhiteSpace).toBeFalsy(); @@ -138,7 +138,7 @@ describe('Strings', () => { const sourceString: string = `A string 'with' single 'quotes'`; // Act - const newString: string = Strings.replaceFirst(sourceString, `'`, `''`); + const newString: string = StringUtils.replaceFirst(sourceString, `'`, `''`); // Assert expect(newString).toEqual(`A string ''with' single 'quotes'`); @@ -151,7 +151,7 @@ describe('Strings', () => { const sourceString: string = `A string 'with' single 'quotes'`; // Act - const newString: string = Strings.replaceAll(sourceString, `'`, `''`); + const newString: string = StringUtils.replaceAll(sourceString, `'`, `''`); // Assert expect(newString).toEqual(`A string ''with'' single ''quotes''`); @@ -164,7 +164,7 @@ describe('Strings', () => { const sourceString: string = `Ça, c'était une très bonne crème Brulée. Raphaël l'a adoré!`; // Act - const newString: string = Strings.removeAccents(sourceString); + const newString: string = StringUtils.removeAccents(sourceString); // Assert expect(newString).toEqual(`Ca, c'etait une tres bonne creme Brulee. Raphael l'a adore!`); @@ -176,7 +176,7 @@ describe('Strings', () => { // Arrange // Act - const sortableString: string = Strings.getSortableString(undefined, false); + const sortableString: string = StringUtils.getSortableString(undefined, false); // Assert expect(sortableString).toEqual(''); @@ -186,7 +186,7 @@ describe('Strings', () => { // Arrange // Act - const sortableString: string = Strings.getSortableString('', false); + const sortableString: string = StringUtils.getSortableString('', false); // Assert expect(sortableString).toEqual(''); @@ -197,7 +197,7 @@ describe('Strings', () => { const sourceString: string = 'Without prefix'; // Act - const sortableString: string = Strings.getSortableString(sourceString, false); + const sortableString: string = StringUtils.getSortableString(sourceString, false); // Assert expect(sortableString).toEqual('without prefix'); @@ -208,7 +208,7 @@ describe('Strings', () => { const sourceString: string = 'Without prefix'; // Act - const sortableString: string = Strings.getSortableString(sourceString, true); + const sortableString: string = StringUtils.getSortableString(sourceString, true); // Assert expect(sortableString).toEqual('without prefix'); @@ -219,7 +219,7 @@ describe('Strings', () => { const sourceString: string = 'Their big reward'; // Act - const sortableString: string = Strings.getSortableString(sourceString, false); + const sortableString: string = StringUtils.getSortableString(sourceString, false); // Assert expect(sortableString).toEqual('their big reward'); @@ -230,7 +230,7 @@ describe('Strings', () => { const sourceString: string = 'Their big reward'; // Act - const sortableString: string = Strings.getSortableString(sourceString, true); + const sortableString: string = StringUtils.getSortableString(sourceString, true); // Assert expect(sortableString).toEqual('their big reward'); @@ -241,7 +241,7 @@ describe('Strings', () => { const sourceString: string = 'The Gathering'; // Act - const sortableString: string = Strings.getSortableString(sourceString, false); + const sortableString: string = StringUtils.getSortableString(sourceString, false); // Assert expect(sortableString).toEqual('the gathering'); @@ -252,7 +252,7 @@ describe('Strings', () => { const sourceString: string = 'The Gathering'; // Act - const sortableString: string = Strings.getSortableString(sourceString, true); + const sortableString: string = StringUtils.getSortableString(sourceString, true); // Assert expect(sortableString).toEqual('gathering'); @@ -263,7 +263,7 @@ describe('Strings', () => { const sourceString: string = 'The Gathering'; // Act - const sortableString: string = Strings.getSortableString(sourceString, true); + const sortableString: string = StringUtils.getSortableString(sourceString, true); // Assert expect(sortableString).toEqual('gathering'); diff --git a/src/app/common/strings.ts b/src/app/common/utils/string-utils.ts similarity index 96% rename from src/app/common/strings.ts rename to src/app/common/utils/string-utils.ts index 5318ce640..6acc5096c 100644 --- a/src/app/common/strings.ts +++ b/src/app/common/utils/string-utils.ts @@ -1,6 +1,6 @@ -import { Constants } from './application/constants'; +import { Constants } from '../application/constants'; -export class Strings { +export class StringUtils { public static get empty(): string { return ''; } diff --git a/src/app/common/file-validator.ts b/src/app/common/validation/file-validator.ts similarity index 90% rename from src/app/common/file-validator.ts rename to src/app/common/validation/file-validator.ts index a2b665eee..1137571ae 100644 --- a/src/app/common/file-validator.ts +++ b/src/app/common/validation/file-validator.ts @@ -1,6 +1,6 @@ import { Injectable } from '@angular/core'; -import { FileFormats } from './application/file-formats'; -import { FileAccessBase } from './io/file-access.base'; +import { FileFormats } from '../application/file-formats'; +import { FileAccessBase } from '../io/file-access.base'; @Injectable() export class FileValidator { diff --git a/src/app/common/path-validator.spec.ts b/src/app/common/validation/path-validator.spec.ts similarity index 100% rename from src/app/common/path-validator.spec.ts rename to src/app/common/validation/path-validator.spec.ts diff --git a/src/app/common/path-validator.ts b/src/app/common/validation/path-validator.ts similarity index 87% rename from src/app/common/path-validator.ts rename to src/app/common/validation/path-validator.ts index 924c81b00..829b67aeb 100644 --- a/src/app/common/path-validator.ts +++ b/src/app/common/validation/path-validator.ts @@ -1,5 +1,5 @@ import { Injectable } from '@angular/core'; -import { Strings } from './strings'; +import { StringUtils } from '../utils/string-utils'; @Injectable() export class PathValidator { @@ -8,11 +8,11 @@ export class PathValidator { * Based on: https://stackoverflow.com/questions/37521893/determine-if-a-path-is-subdirectory-of-another-in-node-js */ public isParentPath(parentPath: string | undefined, childPath: string | undefined): boolean { - if (Strings.isNullOrWhiteSpace(parentPath)) { + if (StringUtils.isNullOrWhiteSpace(parentPath)) { return false; } - if (Strings.isNullOrWhiteSpace(childPath)) { + if (StringUtils.isNullOrWhiteSpace(childPath)) { return false; } diff --git a/src/app/data/album-key-generator.ts b/src/app/data/album-key-generator.ts index 39cde5d1c..f8ef50c01 100644 --- a/src/app/data/album-key-generator.ts +++ b/src/app/data/album-key-generator.ts @@ -1,11 +1,11 @@ import { Injectable } from '@angular/core'; -import { Strings } from '../common/strings'; +import { StringUtils } from '../common/utils/string-utils'; import { DataDelimiter } from './data-delimiter'; @Injectable() export class AlbumKeyGenerator { public generateAlbumKey(albumTitle: string | undefined, albumArtists: string[] | undefined): string { - if (!Strings.isNullOrWhiteSpace(albumTitle)) { + if (!StringUtils.isNullOrWhiteSpace(albumTitle)) { const albumKeyItems: string[] = []; albumKeyItems.push(albumTitle!); diff --git a/src/app/data/clause-creator.ts b/src/app/data/clause-creator.ts index a7cb134a8..63f2dfbee 100644 --- a/src/app/data/clause-creator.ts +++ b/src/app/data/clause-creator.ts @@ -1,8 +1,8 @@ -import { Strings } from '../common/strings'; +import { StringUtils } from '../common/utils/string-utils'; export class ClauseCreator { public static escapeQuotes(sourceString: string): string { - return Strings.replaceAll(sourceString, `'`, `''`); + return StringUtils.replaceAll(sourceString, `'`, `''`); } public static createTextInClause(columnName: string, clauseItems: string[]): string { @@ -26,11 +26,11 @@ export class ClauseCreator { const orClauses: string[] = []; for (const clauseItem of clauseItems) { - if (Strings.isNullOrWhiteSpace(clauseItem)) { + if (StringUtils.isNullOrWhiteSpace(clauseItem)) { orClauses.push(`(${columnName} IS NULL OR ${columnName}='')`); } else { orClauses.push( - `(LOWER(${columnName}) LIKE LOWER('%${delimiter}${Strings.replaceAll(clauseItem, `'`, `''`)}${delimiter}%'))`, + `(LOWER(${columnName}) LIKE LOWER('%${delimiter}${StringUtils.replaceAll(clauseItem, `'`, `''`)}${delimiter}%'))`, ); } } diff --git a/src/app/data/data-delimiter.ts b/src/app/data/data-delimiter.ts index 5517adaa9..0c445e449 100644 --- a/src/app/data/data-delimiter.ts +++ b/src/app/data/data-delimiter.ts @@ -1,5 +1,5 @@ import { Constants } from '../common/application/constants'; -import { Strings } from '../common/strings'; +import { StringUtils } from '../common/utils/string-utils'; export class DataDelimiter { private static delimiter: string = Constants.columnValueDelimiter; @@ -23,7 +23,7 @@ export class DataDelimiter { } public static fromDelimitedString(delimitedString: string | undefined): string[] { - if (Strings.isNullOrWhiteSpace(delimitedString)) { + if (StringUtils.isNullOrWhiteSpace(delimitedString)) { return []; } diff --git a/src/app/services/album/album-model.ts b/src/app/services/album/album-model.ts index a20b0d8f6..86455be6d 100644 --- a/src/app/services/album/album-model.ts +++ b/src/app/services/album/album-model.ts @@ -1,10 +1,10 @@ import { Constants } from '../../common/application/constants'; import { DataDelimiter } from '../../data/data-delimiter'; import { AlbumData } from '../../data/entities/album-data'; -import { Strings } from '../../common/strings'; +import { StringUtils } from '../../common/utils/string-utils'; import { TranslatorServiceBase } from '../translator/translator.service.base'; import { ISelectable } from '../../ui/interfaces/i-selectable'; -import {FileAccessBase} from "../../common/io/file-access.base"; +import { FileAccessBase } from '../../common/io/file-access.base'; export class AlbumModel implements ISelectable { public constructor( @@ -18,7 +18,7 @@ export class AlbumModel implements ISelectable { public yearHeader: string = ''; public get artworkPath(): string { - if (Strings.isNullOrWhiteSpace(this.albumData.artworkId)) { + if (StringUtils.isNullOrWhiteSpace(this.albumData.artworkId)) { return Constants.emptyImage; } @@ -42,7 +42,7 @@ export class AlbumModel implements ISelectable { } public get albumTitle(): string { - if (Strings.isNullOrWhiteSpace(this.albumData.albumTitle)) { + if (StringUtils.isNullOrWhiteSpace(this.albumData.albumTitle)) { return this.translatorService.get('unknown-title'); } diff --git a/src/app/services/appearance/appearance.service.ts b/src/app/services/appearance/appearance.service.ts index eb485c6e5..702da30aa 100644 --- a/src/app/services/appearance/appearance.service.ts +++ b/src/app/services/appearance/appearance.service.ts @@ -8,7 +8,7 @@ import { ColorConverter } from '../../common/color-converter'; import { DocumentProxy } from '../../common/io/document-proxy'; import { Logger } from '../../common/logger'; import { SettingsBase } from '../../common/settings/settings.base'; -import { Strings } from '../../common/strings'; +import { StringUtils } from '../../common/utils/string-utils'; import { DefaultThemesCreator } from './default-themes-creator'; import { Palette } from './palette'; import { Theme } from './theme/theme'; @@ -241,7 +241,7 @@ export class AppearanceService implements AppearanceServiceBase { if (this.settings.followSystemColor) { const systemAccentColor: string = this.getSystemAccentColor(); - if (!Strings.isNullOrWhiteSpace(systemAccentColor)) { + if (!StringUtils.isNullOrWhiteSpace(systemAccentColor)) { primaryColorToApply = systemAccentColor; secondaryColorToApply = systemAccentColor; accentColorToApply = systemAccentColor; diff --git a/src/app/services/artist-information/artist-information.service.ts b/src/app/services/artist-information/artist-information.service.ts index d878d9228..0352b859b 100644 --- a/src/app/services/artist-information/artist-information.service.ts +++ b/src/app/services/artist-information/artist-information.service.ts @@ -3,7 +3,7 @@ import { FanartApi } from '../../common/api/fanart/fanart.api'; import { LastfmApi } from '../../common/api/lastfm/lastfm.api'; import { LastfmArtist } from '../../common/api/lastfm/lastfm-artist'; import { Logger } from '../../common/logger'; -import { Strings } from '../../common/strings'; +import { StringUtils } from '../../common/utils/string-utils'; import { TrackModel } from '../track/track-model'; import { ArtistInformation } from './artist-information'; import { ArtistInformationFactory } from './artist-information-factory'; @@ -27,7 +27,7 @@ export class ArtistInformationService implements ArtistInformationServiceBase { return artistInformation; } - if (Strings.isNullOrWhiteSpace(track.rawFirstArtist)) { + if (StringUtils.isNullOrWhiteSpace(track.rawFirstArtist)) { return artistInformation; } @@ -39,7 +39,7 @@ export class ArtistInformationService implements ArtistInformationServiceBase { if ( lastfmArtist == undefined || lastfmArtist.biography == undefined || - Strings.isNullOrWhiteSpace(lastfmArtist.biography.content) + StringUtils.isNullOrWhiteSpace(lastfmArtist.biography.content) ) { // In case there is no localized Biography, get the English one. lastfmArtist = await this.lastfmApi.getArtistInfoAsync(track.rawFirstArtist, true, 'EN'); @@ -63,7 +63,7 @@ export class ArtistInformationService implements ArtistInformationServiceBase { let biography: string = ''; - if (lastfmArtist.biography != undefined && !Strings.isNullOrWhiteSpace(lastfmArtist.biography.content)) { + if (lastfmArtist.biography != undefined && !StringUtils.isNullOrWhiteSpace(lastfmArtist.biography.content)) { biography = this.removeUrlAndConvertLineBreaks(lastfmArtist.biography.content); } diff --git a/src/app/services/artist-information/artist-information.ts b/src/app/services/artist-information/artist-information.ts index 52b70d6db..21e3b8892 100644 --- a/src/app/services/artist-information/artist-information.ts +++ b/src/app/services/artist-information/artist-information.ts @@ -1,4 +1,4 @@ -import { Strings } from '../../common/strings'; +import { StringUtils } from '../../common/utils/string-utils'; import { DesktopBase } from '../../common/io/desktop.base'; export class ArtistInformation { @@ -33,7 +33,7 @@ export class ArtistInformation { } public get isEmpty(): boolean { - return Strings.isNullOrWhiteSpace(this.name); + return StringUtils.isNullOrWhiteSpace(this.name); } public get hasSimilarArtists(): boolean { diff --git a/src/app/services/artist/artist-model.ts b/src/app/services/artist/artist-model.ts index 32a70d6b3..592a6e9ba 100644 --- a/src/app/services/artist/artist-model.ts +++ b/src/app/services/artist/artist-model.ts @@ -1,5 +1,5 @@ import { SemanticZoomable } from '../../common/semantic-zoomable'; -import { Strings } from '../../common/strings'; +import { StringUtils } from '../../common/utils/string-utils'; import { ISelectable } from '../../ui/interfaces/i-selectable'; import { TranslatorServiceBase } from '../translator/translator.service.base'; @@ -14,7 +14,7 @@ export class ArtistModel extends SemanticZoomable implements ISelectable { public isSelected: boolean = false; public get displayName(): string { - if (Strings.isNullOrWhiteSpace(this.name)) { + if (StringUtils.isNullOrWhiteSpace(this.name)) { return this.translatorService.get('Artist.UnknownArtist'); } diff --git a/src/app/services/file/file.service.ts b/src/app/services/file/file.service.ts index 955a8d198..94c176307 100644 --- a/src/app/services/file/file.service.ts +++ b/src/app/services/file/file.service.ts @@ -1,6 +1,5 @@ import { Injectable } from '@angular/core'; import { Subscription } from 'rxjs'; -import { FileValidator } from '../../common/file-validator'; import { Logger } from '../../common/logger'; import { PromiseUtils } from '../../common/utils/promise-utils'; import { TrackModel } from '../track/track-model'; @@ -9,6 +8,7 @@ import { FileServiceBase } from './file.service.base'; import { PlaybackServiceBase } from '../playback/playback.service.base'; import { EventListenerServiceBase } from '../event-listener/event-listener.service.base'; import { ApplicationBase } from '../../common/io/application.base'; +import { FileValidator } from '../../common/validation/file-validator'; @Injectable() export class FileService implements FileServiceBase { diff --git a/src/app/services/genre/genre-model.ts b/src/app/services/genre/genre-model.ts index 7a5f85874..b28376d34 100644 --- a/src/app/services/genre/genre-model.ts +++ b/src/app/services/genre/genre-model.ts @@ -1,5 +1,5 @@ import { SemanticZoomable } from '../../common/semantic-zoomable'; -import { Strings } from '../../common/strings'; +import { StringUtils } from '../../common/utils/string-utils'; import { ISelectable } from '../../ui/interfaces/i-selectable'; import { TranslatorServiceBase } from '../translator/translator.service.base'; @@ -14,7 +14,7 @@ export class GenreModel extends SemanticZoomable implements ISelectable { public isSelected: boolean = false; public get displayName(): string { - if (Strings.isNullOrWhiteSpace(this.name)) { + if (StringUtils.isNullOrWhiteSpace(this.name)) { return this.translatorService.get('unknown-genre'); } diff --git a/src/app/services/indexing/external-album-artwork-getter.ts b/src/app/services/indexing/external-album-artwork-getter.ts index e78a63775..4efeea095 100644 --- a/src/app/services/indexing/external-album-artwork-getter.ts +++ b/src/app/services/indexing/external-album-artwork-getter.ts @@ -2,7 +2,7 @@ import { Injectable } from '@angular/core'; import { ImageProcessor } from '../../common/image-processor'; import { Logger } from '../../common/logger'; import { IFileMetadata } from '../../common/metadata/i-file-metadata'; -import { Strings } from '../../common/strings'; +import { StringUtils } from '../../common/utils/string-utils'; import { ExternalArtworkPathGetter } from './external-artwork-path-getter'; @Injectable() @@ -10,7 +10,7 @@ export class ExternalAlbumArtworkGetter { public constructor( private externalArtworkPathGetter: ExternalArtworkPathGetter, private imageProcessor: ImageProcessor, - private logger: Logger + private logger: Logger, ) {} public async getExternalArtworkAsync(fileMetadata: IFileMetadata | undefined): Promise { @@ -23,7 +23,7 @@ export class ExternalAlbumArtworkGetter { try { const externalArtworkPath: string = await this.externalArtworkPathGetter.getExternalArtworkPathAsync(fileMetadata.path); - if (!Strings.isNullOrWhiteSpace(externalArtworkPath)) { + if (!StringUtils.isNullOrWhiteSpace(externalArtworkPath)) { artworkData = await this.imageProcessor.convertLocalImageToBufferAsync(externalArtworkPath); } } catch (e: unknown) { @@ -31,7 +31,7 @@ export class ExternalAlbumArtworkGetter { e, `Could not get external artwork for track with path='${fileMetadata.path}'`, 'ExternalAlbumArtworkGetter', - 'getExternalArtwork' + 'getExternalArtwork', ); } diff --git a/src/app/services/indexing/external-artwork-path-getter.ts b/src/app/services/indexing/external-artwork-path-getter.ts index 0b12e14c3..869e6caee 100644 --- a/src/app/services/indexing/external-artwork-path-getter.ts +++ b/src/app/services/indexing/external-artwork-path-getter.ts @@ -1,6 +1,6 @@ import { Injectable } from '@angular/core'; import { Constants } from '../../common/application/constants'; -import { Strings } from '../../common/strings'; +import { StringUtils } from '../../common/utils/string-utils'; import { FileAccessBase } from '../../common/io/file-access.base'; @Injectable() @@ -8,7 +8,7 @@ export class ExternalArtworkPathGetter { public constructor(private fileAccess: FileAccessBase) {} public async getExternalArtworkPathAsync(audioFilePath: string | undefined): Promise { - if (Strings.isNullOrWhiteSpace(audioFilePath)) { + if (StringUtils.isNullOrWhiteSpace(audioFilePath)) { return ''; } @@ -25,7 +25,7 @@ export class ExternalArtworkPathGetter { const fileNameWithoutExtension: string = this.fileAccess.getFileNameWithoutExtension(filePath); for (const externalCoverArtPattern of Constants.externalCoverArtPatterns) { - const externalCoverArtPatternReplacedByFileName: string = Strings.replaceAll( + const externalCoverArtPatternReplacedByFileName: string = StringUtils.replaceAll( externalCoverArtPattern, '%filename%', fileNameWithoutExtension, diff --git a/src/app/services/indexing/online-album-artwork-getter.ts b/src/app/services/indexing/online-album-artwork-getter.ts index 42ad54047..bef6542e8 100644 --- a/src/app/services/indexing/online-album-artwork-getter.ts +++ b/src/app/services/indexing/online-album-artwork-getter.ts @@ -4,7 +4,7 @@ import { LastfmApi } from '../../common/api/lastfm/lastfm.api'; import { ImageProcessor } from '../../common/image-processor'; import { Logger } from '../../common/logger'; import { IFileMetadata } from '../../common/metadata/i-file-metadata'; -import { Strings } from '../../common/strings'; +import { StringUtils } from '../../common/utils/string-utils'; @Injectable() export class OnlineAlbumArtworkGetter { @@ -23,24 +23,24 @@ export class OnlineAlbumArtworkGetter { const artists: string[] = []; // Title - if (!Strings.isNullOrWhiteSpace(fileMetadata.album)) { + if (!StringUtils.isNullOrWhiteSpace(fileMetadata.album)) { title = fileMetadata.album; - } else if (!Strings.isNullOrWhiteSpace(fileMetadata.title)) { + } else if (!StringUtils.isNullOrWhiteSpace(fileMetadata.title)) { title = fileMetadata.title; } // Artist if (fileMetadata.albumArtists != undefined && fileMetadata.albumArtists.length > 0) { - const nonWhiteSpaceAlbumArtists: string[] = fileMetadata.albumArtists.filter((x) => !Strings.isNullOrWhiteSpace(x)); + const nonWhiteSpaceAlbumArtists: string[] = fileMetadata.albumArtists.filter((x) => !StringUtils.isNullOrWhiteSpace(x)); artists.push(...nonWhiteSpaceAlbumArtists); } if (fileMetadata.artists != undefined && fileMetadata.artists.length > 0) { - const nonWhiteSpaceTrackArtists: string[] = fileMetadata.artists.filter((x) => !Strings.isNullOrWhiteSpace(x)); + const nonWhiteSpaceTrackArtists: string[] = fileMetadata.artists.filter((x) => !StringUtils.isNullOrWhiteSpace(x)); artists.push(...nonWhiteSpaceTrackArtists); } - if (Strings.isNullOrWhiteSpace(title) || artists.length === 0) { + if (StringUtils.isNullOrWhiteSpace(title) || artists.length === 0) { return undefined; } @@ -59,7 +59,7 @@ export class OnlineAlbumArtworkGetter { } if (lastfmAlbum != undefined) { - if (!Strings.isNullOrWhiteSpace(lastfmAlbum.largestImage())) { + if (!StringUtils.isNullOrWhiteSpace(lastfmAlbum.largestImage())) { let artworkData: Buffer; try { diff --git a/src/app/services/indexing/track-filler.ts b/src/app/services/indexing/track-filler.ts index 0ea560163..2fd052261 100644 --- a/src/app/services/indexing/track-filler.ts +++ b/src/app/services/indexing/track-filler.ts @@ -5,7 +5,7 @@ import { DateTime } from '../../common/date-time'; import { Logger } from '../../common/logger'; import { IFileMetadata } from '../../common/metadata/i-file-metadata'; import { MimeTypes } from '../../common/metadata/mime-types'; -import { Strings } from '../../common/strings'; +import { StringUtils } from '../../common/utils/string-utils'; import { TrackFieldCreator } from './track-field-creator'; import { FileAccessBase } from '../../common/io/file-access.base'; import { FileMetadataFactoryBase } from '../../common/metadata/file-metadata.factory.base'; @@ -80,7 +80,7 @@ export class TrackFiller { } private getHasLyrics(lyrics: string): number { - if (!Strings.isNullOrWhiteSpace(lyrics)) { + if (!StringUtils.isNullOrWhiteSpace(lyrics)) { return 1; } diff --git a/src/app/services/lyrics/lrc-lyrics-getter.ts b/src/app/services/lyrics/lrc-lyrics-getter.ts index 515b9dbe4..be51bf4bd 100644 --- a/src/app/services/lyrics/lrc-lyrics-getter.ts +++ b/src/app/services/lyrics/lrc-lyrics-getter.ts @@ -3,7 +3,7 @@ import { TrackModel } from '../track/track-model'; import { ILyricsGetter } from './i-lyrics-getter'; import { LyricsModel } from './lyrics-model'; import { LyricsSourceType } from '../../common/api/lyrics/lyrics-source-type'; -import { Strings } from '../../common/strings'; +import { StringUtils } from '../../common/utils/string-utils'; import { FileAccessBase } from '../../common/io/file-access.base'; @Injectable() @@ -13,7 +13,7 @@ export class LrcLyricsGetter implements ILyricsGetter { public async getLyricsAsync(track: TrackModel): Promise { const lrcFilePath: string = this.getLrcFilePath(track); - if (Strings.isNullOrWhiteSpace(lrcFilePath)) { + if (StringUtils.isNullOrWhiteSpace(lrcFilePath)) { return LyricsModel.default(); } @@ -24,7 +24,7 @@ export class LrcLyricsGetter implements ILyricsGetter { const lineParts: string[] = lines[i].split(']'); const lineWithoutTimestamp: string = lineParts.length > 1 ? lineParts[1] : lineParts[0]; - if (!Strings.isNullOrWhiteSpace(lineWithoutTimestamp) && !lineWithoutTimestamp.startsWith('[')) { + if (!StringUtils.isNullOrWhiteSpace(lineWithoutTimestamp) && !lineWithoutTimestamp.startsWith('[')) { lyricsText += `${lineWithoutTimestamp}`; if (i < lines.length - 1) { diff --git a/src/app/services/lyrics/lyrics.service.ts b/src/app/services/lyrics/lyrics.service.ts index 885612b3a..27faa1d49 100644 --- a/src/app/services/lyrics/lyrics.service.ts +++ b/src/app/services/lyrics/lyrics.service.ts @@ -3,7 +3,7 @@ import { TrackModel } from '../track/track-model'; import { EmbeddedLyricsGetter } from './embedded-lyrics-getter'; import { LrcLyricsGetter } from './lrc-lyrics-getter'; import { OnlineLyricsGetter } from './online-lyrics-getter'; -import { Strings } from '../../common/strings'; +import { StringUtils } from '../../common/utils/string-utils'; import { SettingsBase } from '../../common/settings/settings.base'; import { LyricsModel } from './lyrics-model'; import { Logger } from '../../common/logger'; @@ -28,7 +28,7 @@ export class LyricsService implements LyricsServiceBase { this.logger.error(e, 'Could not get embedded lyrics', 'LyricsService', 'getLyricsAsync'); } - if (!Strings.isNullOrWhiteSpace(lyrics.text)) { + if (!StringUtils.isNullOrWhiteSpace(lyrics.text)) { return lyrics; } @@ -38,7 +38,7 @@ export class LyricsService implements LyricsServiceBase { this.logger.error(e, 'Could not get LRC lyrics', 'LyricsService', 'getLyricsAsync'); } - if (!Strings.isNullOrWhiteSpace(lyrics.text)) { + if (!StringUtils.isNullOrWhiteSpace(lyrics.text)) { return lyrics; } @@ -50,7 +50,7 @@ export class LyricsService implements LyricsServiceBase { } } - if (!Strings.isNullOrWhiteSpace(lyrics.text)) { + if (!StringUtils.isNullOrWhiteSpace(lyrics.text)) { return lyrics; } diff --git a/src/app/services/lyrics/online-lyrics-getter.ts b/src/app/services/lyrics/online-lyrics-getter.ts index e293f1d05..518372347 100644 --- a/src/app/services/lyrics/online-lyrics-getter.ts +++ b/src/app/services/lyrics/online-lyrics-getter.ts @@ -6,7 +6,7 @@ import { LyricsModel } from './lyrics-model'; import { Lyrics } from '../../common/api/lyrics/lyrics'; import { LyricsSourceType } from '../../common/api/lyrics/lyrics-source-type'; import { Logger } from '../../common/logger'; -import { Strings } from '../../common/strings'; +import { StringUtils } from '../../common/utils/string-utils'; import { AZLyricsApi } from '../../common/api/lyrics/a-z-lyrics.api'; import { WebSearchLyricsApi } from '../../common/api/lyrics/web-search-lyrics/web-search-lyrics.api'; @@ -28,7 +28,7 @@ export class OnlineLyricsGetter implements ILyricsGetter { this.logger.error(e, 'Could not get lyrics from ChartLyrics', 'OnlineLyricsGetter', 'getLyricsAsync'); } - if (Strings.isNullOrWhiteSpace(lyrics.text)) { + if (StringUtils.isNullOrWhiteSpace(lyrics.text)) { try { lyrics = await this.azLyricsApi.getLyricsAsync(track.rawFirstArtist, track.title); } catch (e) { @@ -36,7 +36,7 @@ export class OnlineLyricsGetter implements ILyricsGetter { } } - if (Strings.isNullOrWhiteSpace(lyrics.text)) { + if (StringUtils.isNullOrWhiteSpace(lyrics.text)) { try { lyrics = await this.webSearchLyricsApi.getLyricsAsync(track.rawFirstArtist, track.title); } catch (e) { diff --git a/src/app/services/metadata/cached-album-artwork-getter.ts b/src/app/services/metadata/cached-album-artwork-getter.ts index 721f2573b..ccbef0ea7 100644 --- a/src/app/services/metadata/cached-album-artwork-getter.ts +++ b/src/app/services/metadata/cached-album-artwork-getter.ts @@ -1,6 +1,6 @@ import { Injectable } from '@angular/core'; import { AlbumData } from '../../data/entities/album-data'; -import { Strings } from '../../common/strings'; +import { StringUtils } from '../../common/utils/string-utils'; import { TrackRepositoryBase } from '../../data/repositories/track-repository.base'; import { FileAccessBase } from '../../common/io/file-access.base'; @@ -14,7 +14,7 @@ export class CachedAlbumArtworkGetter { public getCachedAlbumArtworkPath(albumKey: string): string { const albumDataForAlbumKey: AlbumData[] = this.trackRepository.getAlbumDataForAlbumKey(albumKey) ?? []; - if (albumDataForAlbumKey.length > 0 && !Strings.isNullOrWhiteSpace(albumDataForAlbumKey[0].artworkId)) { + if (albumDataForAlbumKey.length > 0 && !StringUtils.isNullOrWhiteSpace(albumDataForAlbumKey[0].artworkId)) { return this.fileAccess.coverArtFullPath(albumDataForAlbumKey[0].artworkId!); } diff --git a/src/app/services/metadata/metadata.service.ts b/src/app/services/metadata/metadata.service.ts index ee3d1934f..7648d149d 100644 --- a/src/app/services/metadata/metadata.service.ts +++ b/src/app/services/metadata/metadata.service.ts @@ -5,7 +5,7 @@ import { FileFormats } from '../../common/application/file-formats'; import { ImageProcessor } from '../../common/image-processor'; import { Logger } from '../../common/logger'; import { IFileMetadata } from '../../common/metadata/i-file-metadata'; -import { Strings } from '../../common/strings'; +import { StringUtils } from '../../common/utils/string-utils'; import { AlbumArtworkGetter } from '../indexing/album-artwork-getter'; import { TrackModel } from '../track/track-model'; import { CachedAlbumArtworkGetter } from './cached-album-artwork-getter'; @@ -52,7 +52,7 @@ export class MetadataService implements MetadataServiceBase { const cachedAlbumArtworkPath: string = this.cachedAlbumArtworkGetter.getCachedAlbumArtworkPath(track.albumKey); - if (!Strings.isNullOrWhiteSpace(cachedAlbumArtworkPath) && this.fileAccess.pathExists(cachedAlbumArtworkPath)) { + if (!StringUtils.isNullOrWhiteSpace(cachedAlbumArtworkPath) && this.fileAccess.pathExists(cachedAlbumArtworkPath)) { return 'file:///' + cachedAlbumArtworkPath; } diff --git a/src/app/services/playback-indication/playback-indication.service.ts b/src/app/services/playback-indication/playback-indication.service.ts index 45824de4a..fb9ba3ec9 100644 --- a/src/app/services/playback-indication/playback-indication.service.ts +++ b/src/app/services/playback-indication/playback-indication.service.ts @@ -1,8 +1,8 @@ import { Injectable } from '@angular/core'; -import { PathValidator } from '../../common/path-validator'; import { SubfolderModel } from '../folder/subfolder-model'; import { TrackModel } from '../track/track-model'; -import {PlaybackIndicationServiceBase} from "./playback-indication.service.base"; +import { PlaybackIndicationServiceBase } from './playback-indication.service.base'; +import { PathValidator } from '../../common/validation/path-validator'; @Injectable() export class PlaybackIndicationService implements PlaybackIndicationServiceBase { diff --git a/src/app/services/playlist-folder/playlist-folder-model.ts b/src/app/services/playlist-folder/playlist-folder-model.ts index 1c16f5dc5..976b14844 100644 --- a/src/app/services/playlist-folder/playlist-folder-model.ts +++ b/src/app/services/playlist-folder/playlist-folder-model.ts @@ -1,4 +1,4 @@ -import { Strings } from '../../common/strings'; +import { StringUtils } from '../../common/utils/string-utils'; import { ISelectable } from '../../ui/interfaces/i-selectable'; export class PlaylistFolderModel implements ISelectable { @@ -11,6 +11,6 @@ export class PlaylistFolderModel implements ISelectable { public isSelected: boolean = false; public get isDefault(): boolean { - return Strings.isNullOrWhiteSpace(this.name); + return StringUtils.isNullOrWhiteSpace(this.name); } } diff --git a/src/app/services/playlist-folder/playlist-folder.service.ts b/src/app/services/playlist-folder/playlist-folder.service.ts index 1fef8225e..1033f58b3 100644 --- a/src/app/services/playlist-folder/playlist-folder.service.ts +++ b/src/app/services/playlist-folder/playlist-folder.service.ts @@ -1,6 +1,6 @@ import { Injectable } from '@angular/core'; import { Observable, Subject } from 'rxjs'; -import { Strings } from '../../common/strings'; +import { StringUtils } from '../../common/utils/string-utils'; import { TextSanitizer } from '../../common/text-sanitizer'; import { PlaylistFolderModel } from './playlist-folder-model'; import { PlaylistFolderModelFactory } from './playlist-folder-model-factory'; @@ -51,7 +51,7 @@ export class PlaylistFolderService implements PlaylistFolderServiceBase { } public createPlaylistFolder(playlistFolderName: string): void { - if (Strings.isNullOrWhiteSpace(playlistFolderName)) { + if (StringUtils.isNullOrWhiteSpace(playlistFolderName)) { throw new Error(`playlistFolderName is empty`); } diff --git a/src/app/services/playlist/playlist-decoder.ts b/src/app/services/playlist/playlist-decoder.ts index 3c4ca20a5..8311c96f2 100644 --- a/src/app/services/playlist/playlist-decoder.ts +++ b/src/app/services/playlist/playlist-decoder.ts @@ -1,6 +1,6 @@ import { Injectable } from '@angular/core'; import { FileFormats } from '../../common/application/file-formats'; -import { Strings } from '../../common/strings'; +import { StringUtils } from '../../common/utils/string-utils'; import { PlaylistEntry } from './playlist-entry'; import { FileAccessBase } from '../../common/io/file-access.base'; @@ -27,10 +27,10 @@ export class PlaylistDecoder { for (const fileLine of fileLines) { // We don't process empty lines and lines containing comments - if (!Strings.isNullOrWhiteSpace(fileLine) && !fileLine.startsWith('#')) { + if (!StringUtils.isNullOrWhiteSpace(fileLine) && !fileLine.startsWith('#')) { const fullTrackPath: string = this.ensureFullTrackPath(playlistPath, fileLine); - if (!Strings.isNullOrWhiteSpace(fullTrackPath)) { + if (!StringUtils.isNullOrWhiteSpace(fullTrackPath)) { playlistEntries.push(new PlaylistEntry(fileLine, fullTrackPath)); } } diff --git a/src/app/services/playlist/playlist-file-manager.ts b/src/app/services/playlist/playlist-file-manager.ts index ab7c85a21..248883edd 100644 --- a/src/app/services/playlist/playlist-file-manager.ts +++ b/src/app/services/playlist/playlist-file-manager.ts @@ -2,14 +2,14 @@ import { Injectable } from '@angular/core'; import { ApplicationPaths } from '../../common/application/application-paths'; import { Constants } from '../../common/application/constants'; import { FileFormats } from '../../common/application/file-formats'; -import { Collections } from '../../common/collections'; -import { FileValidator } from '../../common/file-validator'; import { GuidFactory } from '../../common/guid.factory'; import { Logger } from '../../common/logger'; import { PlaylistFolderModel } from '../playlist-folder/playlist-folder-model'; import { PlaylistModel } from './playlist-model'; import { PlaylistModelFactory } from './playlist-model-factory'; -import {FileAccessBase} from "../../common/io/file-access.base"; +import { FileAccessBase } from '../../common/io/file-access.base'; +import { CollectionUtils } from '../../common/utils/collections-utils'; +import { FileValidator } from '../../common/validation/file-validator'; @Injectable() export class PlaylistFileManager { @@ -20,7 +20,7 @@ export class PlaylistFileManager { private guidFactory: GuidFactory, private fileValidator: FileValidator, private fileAccess: FileAccessBase, - private logger: Logger + private logger: Logger, ) { this.initialize(); } @@ -52,8 +52,8 @@ export class PlaylistFileManager { if (this.fileValidator.isSupportedPlaylistFile(currentPath)) { const playlistPath: string = currentPath; - const previousPath: string | undefined = Collections.getPreviousItem(sortedFilePathsInPath, index); - const nextPath: string | undefined = Collections.getNextItem(sortedFilePathsInPath, index); + const previousPath: string | undefined = CollectionUtils.getPreviousItem(sortedFilePathsInPath, index); + const nextPath: string | undefined = CollectionUtils.getNextItem(sortedFilePathsInPath, index); let playlistImagePath: string = ''; diff --git a/src/app/services/playlist/playlist-model-factory.ts b/src/app/services/playlist/playlist-model-factory.ts index 792861878..a23ec28a9 100644 --- a/src/app/services/playlist/playlist-model-factory.ts +++ b/src/app/services/playlist/playlist-model-factory.ts @@ -1,6 +1,6 @@ import { Injectable } from '@angular/core'; import { Constants } from '../../common/application/constants'; -import { Strings } from '../../common/strings'; +import { StringUtils } from '../../common/utils/string-utils'; import { PlaylistModel } from './playlist-model'; import { TranslatorServiceBase } from '../translator/translator.service.base'; import { FileAccessBase } from '../../common/io/file-access.base'; @@ -43,7 +43,7 @@ export class PlaylistModelFactory { } private getPlaylistImage(playlistImagePath: string): string { - if (!Strings.isNullOrWhiteSpace(playlistImagePath)) { + if (!StringUtils.isNullOrWhiteSpace(playlistImagePath)) { return playlistImagePath; } diff --git a/src/app/services/playlist/playlist-model.ts b/src/app/services/playlist/playlist-model.ts index a7709648a..900c4d5fa 100644 --- a/src/app/services/playlist/playlist-model.ts +++ b/src/app/services/playlist/playlist-model.ts @@ -1,4 +1,4 @@ -import { Strings } from '../../common/strings'; +import { StringUtils } from '../../common/utils/string-utils'; import { ISelectable } from '../../ui/interfaces/i-selectable'; export class PlaylistModel implements ISelectable { @@ -12,6 +12,6 @@ export class PlaylistModel implements ISelectable { public isSelected: boolean = false; public get isDefault(): boolean { - return Strings.isNullOrWhiteSpace(this.name); + return StringUtils.isNullOrWhiteSpace(this.name); } } diff --git a/src/app/services/playlist/playlist.service.ts b/src/app/services/playlist/playlist.service.ts index f652b714d..94f44a061 100644 --- a/src/app/services/playlist/playlist.service.ts +++ b/src/app/services/playlist/playlist.service.ts @@ -1,7 +1,5 @@ import { Injectable } from '@angular/core'; import { Observable, Subject } from 'rxjs'; -import { Collections } from '../../common/collections'; -import { FileValidator } from '../../common/file-validator'; import { Logger } from '../../common/logger'; import { AlbumModel } from '../album/album-model'; import { ArtistModel } from '../artist/artist-model'; @@ -9,11 +7,9 @@ import { ArtistType } from '../artist/artist-type'; import { GenreModel } from '../genre/genre-model'; import { PlaylistFolderModel } from '../playlist-folder/playlist-folder-model'; import { PlaylistFolderModelFactory } from '../playlist-folder/playlist-folder-model-factory'; - import { TrackModel } from '../track/track-model'; import { TrackModelFactory } from '../track/track-model-factory'; import { TrackModels } from '../track/track-models'; - import { PlaylistDecoder } from './playlist-decoder'; import { PlaylistEntry } from './playlist-entry'; import { PlaylistFileManager } from './playlist-file-manager'; @@ -22,7 +18,8 @@ import { PlaylistServiceBase } from './playlist.service.base'; import { TrackServiceBase } from '../track/track.service.base'; import { SnackBarServiceBase } from '../snack-bar/snack-bar.service.base'; import { FileAccessBase } from '../../common/io/file-access.base'; - +import { CollectionUtils } from '../../common/utils/collections-utils'; +import { FileValidator } from '../../common/validation/file-validator'; @Injectable() export class PlaylistService implements PlaylistServiceBase { private _playlistsParentFolderPath: string = ''; @@ -132,7 +129,7 @@ export class PlaylistService implements PlaylistServiceBase { } try { - const tracksToRemoveGroupedByPlaylistPath: Map = Collections.groupBy( + const tracksToRemoveGroupedByPlaylistPath: Map = CollectionUtils.groupBy( tracksToRemove, (track: TrackModel) => track.playlistPath, ); diff --git a/src/app/services/scrobbling/scrobbling.service.ts b/src/app/services/scrobbling/scrobbling.service.ts index 7acdf5979..f28ec06f8 100644 --- a/src/app/services/scrobbling/scrobbling.service.ts +++ b/src/app/services/scrobbling/scrobbling.service.ts @@ -3,7 +3,7 @@ import { Observable, Subject, Subscription } from 'rxjs'; import { LastfmApi } from '../../common/api/lastfm/lastfm.api'; import { DateTime } from '../../common/date-time'; import { Logger } from '../../common/logger'; -import { Strings } from '../../common/strings'; +import { StringUtils } from '../../common/utils/string-utils'; import { PromiseUtils } from '../../common/utils/promise-utils'; import { PlaybackProgress } from '../playback/playback-progress'; @@ -52,7 +52,7 @@ export class ScrobblingService implements ScrobblingServiceBase { try { this.sessionKey = await this.lastfmApi.getMobileSessionAsync(this.username, this.password); - if (!Strings.isNullOrWhiteSpace(this.sessionKey)) { + if (!StringUtils.isNullOrWhiteSpace(this.sessionKey)) { this.settings.lastFmUsername = this.username; this.settings.lastFmPassword = this.password; this.settings.lastFmSessionKey = this.sessionKey; @@ -90,7 +90,7 @@ export class ScrobblingService implements ScrobblingServiceBase { } // We can't send track love for an unknown track title - if (Strings.isNullOrWhiteSpace(track.rawTitle)) { + if (StringUtils.isNullOrWhiteSpace(track.rawTitle)) { return; } @@ -121,9 +121,9 @@ export class ScrobblingService implements ScrobblingServiceBase { this.sessionKey = this.settings.lastFmSessionKey; if ( - !Strings.isNullOrWhiteSpace(this.username) && - !Strings.isNullOrWhiteSpace(this.password) && - !Strings.isNullOrWhiteSpace(this.sessionKey) + !StringUtils.isNullOrWhiteSpace(this.username) && + !StringUtils.isNullOrWhiteSpace(this.password) && + !StringUtils.isNullOrWhiteSpace(this.sessionKey) ) { this._signInState = SignInState.SignedIn; } else { @@ -167,7 +167,7 @@ export class ScrobblingService implements ScrobblingServiceBase { const trackTitle: string = this.currentTrack.rawTitle; const albumTitle: string = this.currentTrack.rawAlbumTitle; - if (Strings.isNullOrWhiteSpace(artist) || Strings.isNullOrWhiteSpace(trackTitle)) { + if (StringUtils.isNullOrWhiteSpace(artist) || StringUtils.isNullOrWhiteSpace(trackTitle)) { return; } @@ -214,7 +214,7 @@ export class ScrobblingService implements ScrobblingServiceBase { const trackTitle: string = this.currentTrack.rawTitle; const albumTitle: string = this.currentTrack.rawAlbumTitle; - if (Strings.isNullOrWhiteSpace(artist) || Strings.isNullOrWhiteSpace(trackTitle)) { + if (StringUtils.isNullOrWhiteSpace(artist) || StringUtils.isNullOrWhiteSpace(trackTitle)) { return; } diff --git a/src/app/services/search/search.service.ts b/src/app/services/search/search.service.ts index d57de034b..c444f509f 100644 --- a/src/app/services/search/search.service.ts +++ b/src/app/services/search/search.service.ts @@ -2,7 +2,7 @@ import { Injectable } from '@angular/core'; import { Subject } from 'rxjs'; import { debounceTime, distinctUntilChanged } from 'rxjs/operators'; import { Constants } from '../../common/application/constants'; -import { Strings } from '../../common/strings'; +import { StringUtils } from '../../common/utils/string-utils'; import { SearchServiceBase } from './search.service.base'; @Injectable() @@ -34,7 +34,7 @@ export class SearchService implements SearchServiceBase { } public get hasSearchText(): boolean { - return !Strings.isNullOrWhiteSpace(this.searchText); + return !StringUtils.isNullOrWhiteSpace(this.searchText); } public get isSearching(): boolean { @@ -50,11 +50,11 @@ export class SearchService implements SearchServiceBase { } public matchesSearchText(originalText: string, searchText: string): boolean { - if (Strings.isNullOrWhiteSpace(originalText)) { + if (StringUtils.isNullOrWhiteSpace(originalText)) { return false; } - if (Strings.removeAccents(originalText).toLowerCase().includes(searchText.toLowerCase())) { + if (StringUtils.removeAccents(originalText).toLowerCase().includes(searchText.toLowerCase())) { return true; } diff --git a/src/app/services/track/track-model.ts b/src/app/services/track/track-model.ts index bf785d8e6..9e097bf72 100644 --- a/src/app/services/track/track-model.ts +++ b/src/app/services/track/track-model.ts @@ -1,7 +1,7 @@ import { DataDelimiter } from '../../data/data-delimiter'; import { Track } from '../../data/entities/track'; import { DateTime } from '../../common/date-time'; -import { Strings } from '../../common/strings'; +import { StringUtils } from '../../common/utils/string-utils'; import { TranslatorServiceBase } from '../translator/translator.service.base'; import { ISelectable } from '../../ui/interfaces/i-selectable'; @@ -47,7 +47,7 @@ export class TrackModel implements ISelectable { } public get title(): string { - if (!Strings.isNullOrWhiteSpace(this.track.trackTitle)) { + if (!StringUtils.isNullOrWhiteSpace(this.track.trackTitle)) { return this.track.trackTitle!; } @@ -55,7 +55,7 @@ export class TrackModel implements ISelectable { } public get rawTitle(): string { - if (Strings.isNullOrWhiteSpace(this.track.trackTitle)) { + if (StringUtils.isNullOrWhiteSpace(this.track.trackTitle)) { return ''; } @@ -63,7 +63,7 @@ export class TrackModel implements ISelectable { } public get sortableTitle(): string { - return Strings.getSortableString(this.title, false); + return StringUtils.getSortableString(this.title, false); } public get artists(): string { @@ -73,7 +73,7 @@ export class TrackModel implements ISelectable { return this.translatorService.get('unknown-artist'); } - const commaSeparatedArtists: string = trackArtists.filter((x) => !Strings.isNullOrWhiteSpace(x)).join(', '); + const commaSeparatedArtists: string = trackArtists.filter((x) => !StringUtils.isNullOrWhiteSpace(x)).join(', '); if (commaSeparatedArtists.length === 0) { return this.translatorService.get('unknown-artist'); @@ -89,7 +89,7 @@ export class TrackModel implements ISelectable { return []; } - const nonEmptyArtists: string[] = trackArtists.filter((x) => !Strings.isNullOrWhiteSpace(x)); + const nonEmptyArtists: string[] = trackArtists.filter((x) => !StringUtils.isNullOrWhiteSpace(x)); return nonEmptyArtists; } @@ -99,13 +99,13 @@ export class TrackModel implements ISelectable { return ''; } - const nonEmptyArtists: string[] = this.rawArtists.filter((x) => !Strings.isNullOrWhiteSpace(x)); + const nonEmptyArtists: string[] = this.rawArtists.filter((x) => !StringUtils.isNullOrWhiteSpace(x)); return nonEmptyArtists[0]; } public get sortableArtists(): string { - return Strings.getSortableString(this.artists, false); + return StringUtils.getSortableString(this.artists, false); } public get genres(): string { @@ -115,7 +115,7 @@ export class TrackModel implements ISelectable { return this.translatorService.get('unknown-genre'); } - const commaSeparatedGenres: string = trackGenres.filter((x) => !Strings.isNullOrWhiteSpace(x)).join(', '); + const commaSeparatedGenres: string = trackGenres.filter((x) => !StringUtils.isNullOrWhiteSpace(x)).join(', '); if (commaSeparatedGenres.length === 0) { return this.translatorService.get('unknown-genre'); @@ -125,7 +125,7 @@ export class TrackModel implements ISelectable { } public get sortableGenres(): string { - return Strings.getSortableString(this.genres, false); + return StringUtils.getSortableString(this.genres, false); } public get albumKey(): string { @@ -133,7 +133,7 @@ export class TrackModel implements ISelectable { } public get albumTitle(): string { - if (Strings.isNullOrWhiteSpace(this.track.albumTitle)) { + if (StringUtils.isNullOrWhiteSpace(this.track.albumTitle)) { return this.translatorService.get('unknown-album'); } @@ -141,7 +141,7 @@ export class TrackModel implements ISelectable { } public get rawAlbumTitle(): string { - if (Strings.isNullOrWhiteSpace(this.track.albumTitle)) { + if (StringUtils.isNullOrWhiteSpace(this.track.albumTitle)) { return ''; } @@ -165,11 +165,11 @@ export class TrackModel implements ISelectable { } public get sortableAlbumArtists(): string { - return Strings.getSortableString(this.albumArtists, false); + return StringUtils.getSortableString(this.albumArtists, false); } public get sortableAlbumTitle(): string { - return Strings.getSortableString(this.albumTitle, false); + return StringUtils.getSortableString(this.albumTitle, false); } public get durationInMilliseconds(): number { diff --git a/src/app/services/track/track.service.ts b/src/app/services/track/track.service.ts index 3f4b0e278..6e5d4a2b4 100644 --- a/src/app/services/track/track.service.ts +++ b/src/app/services/track/track.service.ts @@ -1,7 +1,7 @@ import { Injectable } from '@angular/core'; import { FileFormats } from '../../common/application/file-formats'; import { Track } from '../../data/entities/track'; -import { Strings } from '../../common/strings'; +import { StringUtils } from '../../common/utils/string-utils'; import { ArtistType } from '../artist/artist-type'; import { TrackModel } from './track-model'; import { TrackModelFactory } from './track-model-factory'; @@ -19,7 +19,7 @@ export class TrackService implements TrackServiceBase { ) {} public async getTracksInSubfolderAsync(subfolderPath: string): Promise { - if (Strings.isNullOrWhiteSpace(subfolderPath)) { + if (StringUtils.isNullOrWhiteSpace(subfolderPath)) { return new TrackModels(); } diff --git a/src/app/ui/components/add-folder/add-folder.component.ts b/src/app/ui/components/add-folder/add-folder.component.ts index 5876c68c2..83986b46b 100644 --- a/src/app/ui/components/add-folder/add-folder.component.ts +++ b/src/app/ui/components/add-folder/add-folder.component.ts @@ -1,6 +1,6 @@ import { Component, Input, OnInit, ViewEncapsulation } from '@angular/core'; import { Logger } from '../../../common/logger'; -import { Strings } from '../../../common/strings'; +import { StringUtils } from '../../../common/utils/string-utils'; import { PromiseUtils } from '../../../common/utils/promise-utils'; import { FolderModel } from '../../../services/folder/folder-model'; import { TranslatorServiceBase } from '../../../services/translator/translator.service.base'; @@ -84,7 +84,7 @@ export class AddFolderComponent implements OnInit { const selectedFolderPath: string = await this.desktop.showSelectFolderDialogAsync(dialogTitle); - if (!Strings.isNullOrWhiteSpace(selectedFolderPath)) { + if (!StringUtils.isNullOrWhiteSpace(selectedFolderPath)) { try { await this.folderService.addFolderAsync(selectedFolderPath); await this.getFoldersAsync(); diff --git a/src/app/ui/components/add-to-playlist-menu.spec.ts b/src/app/ui/components/add-to-playlist-menu.spec.ts index dd4aacb9e..40182121b 100644 --- a/src/app/ui/components/add-to-playlist-menu.spec.ts +++ b/src/app/ui/components/add-to-playlist-menu.spec.ts @@ -1,18 +1,18 @@ import { IMock, Mock } from 'typemoq'; -import { Logger } from '../common/logger'; -import { BasePlaylistFolderService } from '../services/playlist-folder/base-playlist-folder.service'; -import { BasePlaylistService } from '../services/playlist/base-playlist.service'; import { AddToPlaylistMenu } from './add-to-playlist-menu'; +import { PlaylistFolderServiceBase } from '../../services/playlist-folder/playlist-folder.service.base'; +import { PlaylistServiceBase } from '../../services/playlist/playlist.service.base'; +import { Logger } from '../../common/logger'; describe('PlaylistsContextMenu', () => { - let playlistFolderServiceMock: IMock; - let playlistServiceMock: IMock; + let playlistFolderServiceMock: IMock; + let playlistServiceMock: IMock; let loggerMock: IMock; let playlistsContextMenu: AddToPlaylistMenu; beforeEach(() => { - playlistFolderServiceMock = Mock.ofType(); - playlistServiceMock = Mock.ofType(); + playlistFolderServiceMock = Mock.ofType(); + playlistServiceMock = Mock.ofType(); loggerMock = Mock.ofType(); playlistsContextMenu = new AddToPlaylistMenu(playlistFolderServiceMock.object, playlistServiceMock.object, loggerMock.object); }); diff --git a/src/app/ui/components/collection/album-browser/album-browser.component.ts b/src/app/ui/components/collection/album-browser/album-browser.component.ts index 214ec18d2..96427c5d1 100644 --- a/src/app/ui/components/collection/album-browser/album-browser.component.ts +++ b/src/app/ui/components/collection/album-browser/album-browser.component.ts @@ -2,9 +2,7 @@ import { AfterViewInit, Component, ElementRef, Input, OnInit, ViewChild } from ' import { MatMenuTrigger } from '@angular/material/menu'; import { debounceTime } from 'rxjs/operators'; import { Constants } from '../../../../common/application/constants'; -import { ContextMenuOpener } from '../../../../common/context-menu-opener'; import { Logger } from '../../../../common/logger'; -import { MouseSelectionWatcher } from '../../../../common/mouse-selection-watcher'; import { NativeElementProxy } from '../../../../common/native-element-proxy'; import { AlbumModel } from '../../../../services/album/album-model'; import { AddToPlaylistMenu } from '../../add-to-playlist-menu'; @@ -14,6 +12,8 @@ import { AlbumRow } from './album-row'; import { AlbumRowsGetter } from './album-rows-getter'; import { PlaybackServiceBase } from '../../../../services/playback/playback.service.base'; import { ApplicationServiceBase } from '../../../../services/application/application.service.base'; +import { MouseSelectionWatcher } from '../../mouse-selection-watcher'; +import {ContextMenuOpener} from "../../context-menu-opener"; @Component({ selector: 'app-album-browser', diff --git a/src/app/ui/components/collection/base-albums-persister.ts b/src/app/ui/components/collection/base-albums-persister.ts index 84dc41ee5..b9990a24e 100644 --- a/src/app/ui/components/collection/base-albums-persister.ts +++ b/src/app/ui/components/collection/base-albums-persister.ts @@ -1,7 +1,7 @@ import { Injectable } from '@angular/core'; import { Observable, Subject } from 'rxjs'; import { Logger } from '../../../common/logger'; -import { Strings } from '../../../common/strings'; +import { StringUtils } from '../../../common/utils/string-utils'; import { AlbumModel } from '../../../services/album/album-model'; import { AlbumOrder } from './album-order'; import { SettingsBase } from '../../../common/settings/settings.base'; @@ -83,11 +83,11 @@ export abstract class BaseAlbumsPersister { } private initializeFromSettings(): void { - if (!Strings.isNullOrWhiteSpace(this.getSelectedAlbumFromSettings())) { + if (!StringUtils.isNullOrWhiteSpace(this.getSelectedAlbumFromSettings())) { this.selectedAlbumKeys = [this.getSelectedAlbumFromSettings()]; } - if (!Strings.isNullOrWhiteSpace(this.getSelectedAlbumOrderFromSettings())) { + if (!StringUtils.isNullOrWhiteSpace(this.getSelectedAlbumOrderFromSettings())) { this.selectedAlbumOrder = AlbumOrder[this.getSelectedAlbumOrderFromSettings()] as AlbumOrder; } } diff --git a/src/app/ui/components/collection/base-tracks-persister.ts b/src/app/ui/components/collection/base-tracks-persister.ts index 8b8aa755d..db948ffaa 100644 --- a/src/app/ui/components/collection/base-tracks-persister.ts +++ b/src/app/ui/components/collection/base-tracks-persister.ts @@ -1,6 +1,6 @@ import { Injectable } from '@angular/core'; import { Logger } from '../../../common/logger'; -import { Strings } from '../../../common/strings'; +import { StringUtils } from '../../../common/utils/string-utils'; import { TrackOrder } from './track-order'; import { SettingsBase } from '../../../common/settings/settings.base'; @@ -36,7 +36,7 @@ export abstract class BaseTracksPersister { } private initializeFromSettings(): void { - if (!Strings.isNullOrWhiteSpace(this.getSelectedTrackOrderFromSettings())) { + if (!StringUtils.isNullOrWhiteSpace(this.getSelectedTrackOrderFromSettings())) { this.selectedTrackOrder = TrackOrder[this.getSelectedTrackOrderFromSettings()] as TrackOrder; } } diff --git a/src/app/ui/components/collection/collection-artists/artist-browser/artist-browser.component.ts b/src/app/ui/components/collection/collection-artists/artist-browser/artist-browser.component.ts index a97879987..a9dd815bf 100644 --- a/src/app/ui/components/collection/collection-artists/artist-browser/artist-browser.component.ts +++ b/src/app/ui/components/collection/collection-artists/artist-browser/artist-browser.component.ts @@ -3,9 +3,7 @@ import { Component, Input, OnDestroy, OnInit, ViewChild } from '@angular/core'; import { MatMenuTrigger } from '@angular/material/menu'; import { Subscription } from 'rxjs'; import { Constants } from '../../../../../common/application/constants'; -import { ContextMenuOpener } from '../../../../../common/context-menu-opener'; import { Logger } from '../../../../../common/logger'; -import { MouseSelectionWatcher } from '../../../../../common/mouse-selection-watcher'; import { ArtistOrdering } from '../../../../../common/ordering/artist-ordering'; import { SemanticZoomHeaderAdder } from '../../../../../common/semantic-zoom-header-adder'; import { PromiseUtils } from '../../../../../common/utils/promise-utils'; @@ -18,6 +16,8 @@ import { PlaybackServiceBase } from '../../../../../services/playback/playback.s import { SemanticZoomServiceBase } from '../../../../../services/semantic-zoom/semantic-zoom.service.base'; import { ApplicationServiceBase } from '../../../../../services/application/application.service.base'; import { SchedulerBase } from '../../../../../common/scheduling/scheduler.base'; +import { MouseSelectionWatcher } from '../../../mouse-selection-watcher'; +import {ContextMenuOpener} from "../../../context-menu-opener"; @Component({ selector: 'app-artist-browser', diff --git a/src/app/ui/components/collection/collection-artists/artists-persister.ts b/src/app/ui/components/collection/collection-artists/artists-persister.ts index 3e0f399dd..54b54b02d 100644 --- a/src/app/ui/components/collection/collection-artists/artists-persister.ts +++ b/src/app/ui/components/collection/collection-artists/artists-persister.ts @@ -1,7 +1,7 @@ import { Injectable } from '@angular/core'; import { Observable, Subject } from 'rxjs'; import { Logger } from '../../../../common/logger'; -import { Strings } from '../../../../common/strings'; +import { StringUtils } from '../../../../common/utils/string-utils'; import { ArtistModel } from '../../../../services/artist/artist-model'; import { ArtistType } from '../../../../services/artist/artist-type'; import { ArtistOrder } from './artist-browser/artist-order'; @@ -100,15 +100,15 @@ export class ArtistsPersister { } private initializeFromSettings(): void { - if (!Strings.isNullOrWhiteSpace(this.getSelectedArtistFromSettings())) { + if (!StringUtils.isNullOrWhiteSpace(this.getSelectedArtistFromSettings())) { this.selectedArtistNames = [this.getSelectedArtistFromSettings()]; } - if (!Strings.isNullOrWhiteSpace(this.getSelectedArtistTypeFromSettings())) { + if (!StringUtils.isNullOrWhiteSpace(this.getSelectedArtistTypeFromSettings())) { this.selectedArtistType = ArtistType[this.getSelectedArtistTypeFromSettings()] as ArtistType; } - if (!Strings.isNullOrWhiteSpace(this.getSelectedArtistOrderFromSettings())) { + if (!StringUtils.isNullOrWhiteSpace(this.getSelectedArtistOrderFromSettings())) { this.selectedArtistOrder = ArtistOrder[this.getSelectedArtistOrderFromSettings()] as ArtistOrder; } } diff --git a/src/app/ui/components/collection/collection-folders/collection-folders.component.ts b/src/app/ui/components/collection/collection-folders/collection-folders.component.ts index 4a680423f..a38795762 100644 --- a/src/app/ui/components/collection/collection-folders/collection-folders.component.ts +++ b/src/app/ui/components/collection/collection-folders/collection-folders.component.ts @@ -2,10 +2,8 @@ import { Component, OnDestroy, OnInit, ViewEncapsulation } from '@angular/core'; import { IOutputData } from 'angular-split'; import { Subscription } from 'rxjs'; import { Constants } from '../../../../common/application/constants'; -import { ContextMenuOpener } from '../../../../common/context-menu-opener'; import { Hacks } from '../../../../common/hacks'; import { Logger } from '../../../../common/logger'; -import { MouseSelectionWatcher } from '../../../../common/mouse-selection-watcher'; import { Scheduler } from '../../../../common/scheduling/scheduler'; import { PromiseUtils } from '../../../../common/utils/promise-utils'; import { FolderModel } from '../../../../services/folder/folder-model'; @@ -27,6 +25,8 @@ import { TrackServiceBase } from '../../../../services/track/track.service.base' import { PlaybackIndicationServiceBase } from '../../../../services/playback-indication/playback-indication.service.base'; import { DesktopBase } from '../../../../common/io/desktop.base'; import { SettingsBase } from '../../../../common/settings/settings.base'; +import { MouseSelectionWatcher } from '../../mouse-selection-watcher'; +import {ContextMenuOpener} from "../../context-menu-opener"; @Component({ selector: 'app-collection-folders', diff --git a/src/app/ui/components/collection/collection-folders/folders-persister.ts b/src/app/ui/components/collection/collection-folders/folders-persister.ts index 04e264152..b58784317 100644 --- a/src/app/ui/components/collection/collection-folders/folders-persister.ts +++ b/src/app/ui/components/collection/collection-folders/folders-persister.ts @@ -1,7 +1,7 @@ import { Injectable } from '@angular/core'; import { Logger } from '../../../../common/logger'; import { FolderModel } from '../../../../services/folder/folder-model'; -import { Strings } from '../../../../common/strings'; +import { StringUtils } from '../../../../common/utils/string-utils'; import { SubfolderModel } from '../../../../services/folder/subfolder-model'; import { SettingsBase } from '../../../../common/settings/settings.base'; @@ -22,7 +22,7 @@ export class FoldersPersister { return undefined; } - if (!Strings.isNullOrWhiteSpace(this.openedFolderPath)) { + if (!StringUtils.isNullOrWhiteSpace(this.openedFolderPath)) { try { if (availableFolders.map((x) => x.path).includes(this.openedFolderPath)) { return availableFolders.filter((x) => x.path === this.openedFolderPath)[0]; @@ -44,11 +44,11 @@ export class FoldersPersister { } public getOpenedSubfolder(): SubfolderModel | undefined { - if (Strings.isNullOrWhiteSpace(this.openedFolderPath)) { + if (StringUtils.isNullOrWhiteSpace(this.openedFolderPath)) { return undefined; } - if (Strings.isNullOrWhiteSpace(this.openedSubfolderPath)) { + if (StringUtils.isNullOrWhiteSpace(this.openedSubfolderPath)) { return undefined; } diff --git a/src/app/ui/components/collection/collection-genres/genre-browser/genre-browser.component.ts b/src/app/ui/components/collection/collection-genres/genre-browser/genre-browser.component.ts index bdab1569e..e42f87b7c 100644 --- a/src/app/ui/components/collection/collection-genres/genre-browser/genre-browser.component.ts +++ b/src/app/ui/components/collection/collection-genres/genre-browser/genre-browser.component.ts @@ -3,9 +3,7 @@ import { Component, Input, OnDestroy, OnInit, ViewChild } from '@angular/core'; import { MatMenuTrigger } from '@angular/material/menu'; import { Subscription } from 'rxjs'; import { Constants } from '../../../../../common/application/constants'; -import { ContextMenuOpener } from '../../../../../common/context-menu-opener'; import { Logger } from '../../../../../common/logger'; -import { MouseSelectionWatcher } from '../../../../../common/mouse-selection-watcher'; import { GenreOrdering } from '../../../../../common/ordering/genre-ordering'; import { SemanticZoomHeaderAdder } from '../../../../../common/semantic-zoom-header-adder'; import { PromiseUtils } from '../../../../../common/utils/promise-utils'; @@ -17,6 +15,8 @@ import { PlaybackServiceBase } from '../../../../../services/playback/playback.s import { SemanticZoomServiceBase } from '../../../../../services/semantic-zoom/semantic-zoom.service.base'; import { ApplicationServiceBase } from '../../../../../services/application/application.service.base'; import { SchedulerBase } from '../../../../../common/scheduling/scheduler.base'; +import { MouseSelectionWatcher } from '../../../mouse-selection-watcher'; +import { ContextMenuOpener } from '../../../context-menu-opener'; @Component({ selector: 'app-genre-browser', diff --git a/src/app/ui/components/collection/collection-genres/genres-persister.ts b/src/app/ui/components/collection/collection-genres/genres-persister.ts index 9b46a997e..5e1129fa5 100644 --- a/src/app/ui/components/collection/collection-genres/genres-persister.ts +++ b/src/app/ui/components/collection/collection-genres/genres-persister.ts @@ -1,7 +1,7 @@ import { Injectable } from '@angular/core'; import { Observable, Subject } from 'rxjs'; import { Logger } from '../../../../common/logger'; -import { Strings } from '../../../../common/strings'; +import { StringUtils } from '../../../../common/utils/string-utils'; import { GenreModel } from '../../../../services/genre/genre-model'; import { GenreOrder } from './genre-browser/genre-order'; import { SettingsBase } from '../../../../common/settings/settings.base'; @@ -77,11 +77,11 @@ export class GenresPersister { } private initializeFromSettings(): void { - if (!Strings.isNullOrWhiteSpace(this.getSelectedGenreFromSettings())) { + if (!StringUtils.isNullOrWhiteSpace(this.getSelectedGenreFromSettings())) { this.selectedGenreNames = [this.getSelectedGenreFromSettings()]; } - if (!Strings.isNullOrWhiteSpace(this.getSelectedGenreOrderFromSettings())) { + if (!StringUtils.isNullOrWhiteSpace(this.getSelectedGenreOrderFromSettings())) { this.selectedGenreOrder = GenreOrder[this.getSelectedGenreOrderFromSettings()] as GenreOrder; } } diff --git a/src/app/ui/components/collection/collection-playlists/playlist-browser/playlist-browser.component.ts b/src/app/ui/components/collection/collection-playlists/playlist-browser/playlist-browser.component.ts index 37de34a54..5839fe297 100644 --- a/src/app/ui/components/collection/collection-playlists/playlist-browser/playlist-browser.component.ts +++ b/src/app/ui/components/collection/collection-playlists/playlist-browser/playlist-browser.component.ts @@ -1,8 +1,6 @@ import { AfterViewInit, Component, ElementRef, Input, OnInit, ViewChild } from '@angular/core'; import { MatMenuTrigger } from '@angular/material/menu'; -import { ContextMenuOpener } from '../../../../../common/context-menu-opener'; import { Logger } from '../../../../../common/logger'; -import { MouseSelectionWatcher } from '../../../../../common/mouse-selection-watcher'; import { NativeElementProxy } from '../../../../../common/native-element-proxy'; import { PlaylistModel } from '../../../../../services/playlist/playlist-model'; import { PlaylistRowsGetter } from '../playlist-folder-browser/playlist-rows-getter'; @@ -14,6 +12,8 @@ import { PlaylistServiceBase } from '../../../../../services/playlist/playlist.s import { ApplicationServiceBase } from '../../../../../services/application/application.service.base'; import { TranslatorServiceBase } from '../../../../../services/translator/translator.service.base'; import { DialogServiceBase } from '../../../../../services/dialog/dialog.service.base'; +import { MouseSelectionWatcher } from '../../../mouse-selection-watcher'; +import { ContextMenuOpener } from '../../../context-menu-opener'; @Component({ selector: 'app-playlist-browser', diff --git a/src/app/ui/components/collection/collection-playlists/playlist-folder-browser/playlist-folder-browser.component.ts b/src/app/ui/components/collection/collection-playlists/playlist-folder-browser/playlist-folder-browser.component.ts index 945cbca04..c5007c73d 100644 --- a/src/app/ui/components/collection/collection-playlists/playlist-folder-browser/playlist-folder-browser.component.ts +++ b/src/app/ui/components/collection/collection-playlists/playlist-folder-browser/playlist-folder-browser.component.ts @@ -1,9 +1,7 @@ import { Component, Input, ViewChild } from '@angular/core'; import { MatMenuTrigger } from '@angular/material/menu'; -import { ContextMenuOpener } from '../../../../../common/context-menu-opener'; import { Logger } from '../../../../../common/logger'; -import { MouseSelectionWatcher } from '../../../../../common/mouse-selection-watcher'; -import { Strings } from '../../../../../common/strings'; +import { StringUtils } from '../../../../../common/utils/string-utils'; import { PlaylistFolderModel } from '../../../../../services/playlist-folder/playlist-folder-model'; import { PlaylistFoldersPersister } from '../playlist-folders-persister'; import { AppearanceServiceBase } from '../../../../../services/appearance/appearance.service.base'; @@ -12,6 +10,8 @@ import { PlaylistServiceBase } from '../../../../../services/playlist/playlist.s import { PlaybackServiceBase } from '../../../../../services/playback/playback.service.base'; import { DialogServiceBase } from '../../../../../services/dialog/dialog.service.base'; import { TranslatorServiceBase } from '../../../../../services/translator/translator.service.base'; +import { MouseSelectionWatcher } from '../../../mouse-selection-watcher'; +import { ContextMenuOpener } from '../../../context-menu-opener'; @Component({ selector: 'app-playlist-folder-browser', @@ -100,7 +100,7 @@ export class PlaylistFolderBrowserComponent { playlistFolder.name, ); - if (!Strings.isNullOrWhiteSpace(newPlaylistFolderName)) { + if (!StringUtils.isNullOrWhiteSpace(newPlaylistFolderName)) { try { this.playlistFolderService.renamePlaylistFolder(playlistFolder, newPlaylistFolderName); } catch (e: unknown) { @@ -120,7 +120,7 @@ export class PlaylistFolderBrowserComponent { ); try { - if (!Strings.isNullOrWhiteSpace(playlistFolderName)) { + if (!StringUtils.isNullOrWhiteSpace(playlistFolderName)) { this.playlistFolderService.createPlaylistFolder(playlistFolderName); } } catch (e: unknown) { diff --git a/src/app/ui/components/collection/collection-playlists/playlist-folders-persister.ts b/src/app/ui/components/collection/collection-playlists/playlist-folders-persister.ts index b8e7ec4f6..20f852c46 100644 --- a/src/app/ui/components/collection/collection-playlists/playlist-folders-persister.ts +++ b/src/app/ui/components/collection/collection-playlists/playlist-folders-persister.ts @@ -1,7 +1,7 @@ import { Injectable } from '@angular/core'; import { Observable, Subject } from 'rxjs'; import { Logger } from '../../../../common/logger'; -import { Strings } from '../../../../common/strings'; +import { StringUtils } from '../../../../common/utils/string-utils'; import { PlaylistFolderModel } from '../../../../services/playlist-folder/playlist-folder-model'; import { SettingsBase } from '../../../../common/settings/settings.base'; @@ -58,7 +58,7 @@ export class PlaylistFoldersPersister { } private initializeFromSettings(): void { - if (!Strings.isNullOrWhiteSpace(this.getSelectedPlaylistFolderFromSettings())) { + if (!StringUtils.isNullOrWhiteSpace(this.getSelectedPlaylistFolderFromSettings())) { this.selectedPlaylistFolderNames = [this.getSelectedPlaylistFolderFromSettings()]; } } diff --git a/src/app/ui/components/collection/collection-playlists/playlist-track-browser/playlist-track-browser.component.ts b/src/app/ui/components/collection/collection-playlists/playlist-track-browser/playlist-track-browser.component.ts index c84c87ea2..d88313874 100644 --- a/src/app/ui/components/collection/collection-playlists/playlist-track-browser/playlist-track-browser.component.ts +++ b/src/app/ui/components/collection/collection-playlists/playlist-track-browser/playlist-track-browser.component.ts @@ -2,9 +2,7 @@ import { CdkDragDrop, moveItemInArray } from '@angular/cdk/drag-drop'; import { Component, Input, OnDestroy, OnInit, ViewChild } from '@angular/core'; import { MatMenuTrigger } from '@angular/material/menu'; import { Subscription } from 'rxjs'; -import { ContextMenuOpener } from '../../../../../common/context-menu-opener'; import { Logger } from '../../../../../common/logger'; -import { MouseSelectionWatcher } from '../../../../../common/mouse-selection-watcher'; import { PlaybackStarted } from '../../../../../services/playback/playback-started'; import { TrackModel } from '../../../../../services/track/track-model'; import { TrackModels } from '../../../../../services/track/track-models'; @@ -15,6 +13,8 @@ import { DialogServiceBase } from '../../../../../services/dialog/dialog.service import { TranslatorServiceBase } from '../../../../../services/translator/translator.service.base'; import { PlaybackIndicationServiceBase } from '../../../../../services/playback-indication/playback-indication.service.base'; import { DesktopBase } from '../../../../../common/io/desktop.base'; +import { MouseSelectionWatcher } from '../../../mouse-selection-watcher'; +import { ContextMenuOpener } from '../../../context-menu-opener'; @Component({ selector: 'app-playlist-track-browser', diff --git a/src/app/ui/components/collection/collection-playlists/playlists-persister.ts b/src/app/ui/components/collection/collection-playlists/playlists-persister.ts index 85db576f2..4edf931d6 100644 --- a/src/app/ui/components/collection/collection-playlists/playlists-persister.ts +++ b/src/app/ui/components/collection/collection-playlists/playlists-persister.ts @@ -1,7 +1,7 @@ import { Injectable } from '@angular/core'; import { Observable, Subject } from 'rxjs'; import { Logger } from '../../../../common/logger'; -import { Strings } from '../../../../common/strings'; +import { StringUtils } from '../../../../common/utils/string-utils'; import { PlaylistModel } from '../../../../services/playlist/playlist-model'; import { PlaylistOrder } from './playlist-order'; import { SettingsBase } from '../../../../common/settings/settings.base'; @@ -98,11 +98,11 @@ export class PlaylistsPersister { } private initializeFromSettings(): void { - if (!Strings.isNullOrWhiteSpace(this.getSelectedPlaylistFromSettings())) { + if (!StringUtils.isNullOrWhiteSpace(this.getSelectedPlaylistFromSettings())) { this.selectedPlaylistNames = [this.getSelectedPlaylistFromSettings()]; } - if (!Strings.isNullOrWhiteSpace(this.getSelectedPlaylistOrderFromSettings())) { + if (!StringUtils.isNullOrWhiteSpace(this.getSelectedPlaylistOrderFromSettings())) { this.selectedPlaylistOrder = PlaylistOrder[this.getSelectedPlaylistOrderFromSettings()] as PlaylistOrder; } } diff --git a/src/app/ui/components/collection/collection-tracks/collection-tracks-table/collection-tracks-table.component.ts b/src/app/ui/components/collection/collection-tracks/collection-tracks-table/collection-tracks-table.component.ts index 55d7fad43..94623a05c 100644 --- a/src/app/ui/components/collection/collection-tracks/collection-tracks-table/collection-tracks-table.component.ts +++ b/src/app/ui/components/collection/collection-tracks/collection-tracks-table/collection-tracks-table.component.ts @@ -1,8 +1,6 @@ import { Component, Input, OnDestroy, OnInit, ViewEncapsulation } from '@angular/core'; import { Subscription } from 'rxjs'; -import { ContextMenuOpener } from '../../../../../common/context-menu-opener'; import { Logger } from '../../../../../common/logger'; -import { MouseSelectionWatcher } from '../../../../../common/mouse-selection-watcher'; import { PlaybackStarted } from '../../../../../services/playback/playback-started'; import { TracksColumnsOrder } from '../../../../../services/track-columns/tracks-columns-order'; import { TracksColumnsOrderColumn } from '../../../../../services/track-columns/tracks-columns-order-column'; @@ -21,6 +19,8 @@ import { CollectionServiceBase } from '../../../../../services/collection/collec import { DialogServiceBase } from '../../../../../services/dialog/dialog.service.base'; import { TranslatorServiceBase } from '../../../../../services/translator/translator.service.base'; import { DesktopBase } from '../../../../../common/io/desktop.base'; +import { MouseSelectionWatcher } from '../../../mouse-selection-watcher'; +import { ContextMenuOpener } from '../../../context-menu-opener'; @Component({ selector: 'app-collection-tracks-table', diff --git a/src/app/ui/components/collection/collection-tracks/collection-tracks.component.ts b/src/app/ui/components/collection/collection-tracks/collection-tracks.component.ts index 7ae12b7e1..e77ae4c51 100644 --- a/src/app/ui/components/collection/collection-tracks/collection-tracks.component.ts +++ b/src/app/ui/components/collection/collection-tracks/collection-tracks.component.ts @@ -2,7 +2,6 @@ import { Component, OnDestroy, OnInit } from '@angular/core'; import { Subscription } from 'rxjs'; import { Constants } from '../../../../common/application/constants'; import { Logger } from '../../../../common/logger'; -import { MouseSelectionWatcher } from '../../../../common/mouse-selection-watcher'; import { Scheduler } from '../../../../common/scheduling/scheduler'; import { PromiseUtils } from '../../../../common/utils/promise-utils'; import { TrackModels } from '../../../../services/track/track-models'; @@ -10,6 +9,7 @@ import { CollectionPersister } from '../collection-persister'; import { SearchServiceBase } from '../../../../services/search/search.service.base'; import { TrackServiceBase } from '../../../../services/track/track.service.base'; import { CollectionServiceBase } from '../../../../services/collection/collection.service.base'; +import { MouseSelectionWatcher } from '../../mouse-selection-watcher'; @Component({ selector: 'app-collection-tracks', diff --git a/src/app/ui/components/collection/tab-selection-getter.ts b/src/app/ui/components/collection/tab-selection-getter.ts index 3a97b820d..369a87a2e 100644 --- a/src/app/ui/components/collection/tab-selection-getter.ts +++ b/src/app/ui/components/collection/tab-selection-getter.ts @@ -1,6 +1,6 @@ import { Injectable } from '@angular/core'; import { Constants } from '../../../common/application/constants'; -import { Strings } from '../../../common/strings'; +import { StringUtils } from '../../../common/utils/string-utils'; import { SettingsBase } from '../../../common/settings/settings.base'; @Injectable() @@ -16,7 +16,7 @@ export class TabSelectionGetter { const selectedTabLabel: string = this.tabLabels[tabIndex]; - if (!Strings.isNullOrWhiteSpace(selectedTabLabel)) { + if (!StringUtils.isNullOrWhiteSpace(selectedTabLabel)) { return selectedTabLabel; } @@ -24,7 +24,7 @@ export class TabSelectionGetter { } public getTabIndexForLabel(tabLabel: string | undefined): number { - if (Strings.isNullOrWhiteSpace(tabLabel)) { + if (StringUtils.isNullOrWhiteSpace(tabLabel)) { return 0; } diff --git a/src/app/ui/components/collection/track-browser/track-brower-base.ts b/src/app/ui/components/collection/track-browser/track-brower-base.ts index 426c8d614..db3eec6f1 100644 --- a/src/app/ui/components/collection/track-browser/track-brower-base.ts +++ b/src/app/ui/components/collection/track-browser/track-brower-base.ts @@ -1,8 +1,6 @@ import { Directive, ViewChild } from '@angular/core'; import { MatMenuTrigger } from '@angular/material/menu'; -import { ContextMenuOpener } from '../../../../common/context-menu-opener'; import { Logger } from '../../../../common/logger'; -import { MouseSelectionWatcher } from '../../../../common/mouse-selection-watcher'; import { TrackModel } from '../../../../services/track/track-model'; import { AddToPlaylistMenu } from '../../add-to-playlist-menu'; import { DialogServiceBase } from '../../../../services/dialog/dialog.service.base'; @@ -10,6 +8,8 @@ import { PlaybackServiceBase } from '../../../../services/playback/playback.serv import { CollectionServiceBase } from '../../../../services/collection/collection.service.base'; import { TranslatorServiceBase } from '../../../../services/translator/translator.service.base'; import { DesktopBase } from '../../../../common/io/desktop.base'; +import { MouseSelectionWatcher } from '../../mouse-selection-watcher'; +import {ContextMenuOpener} from "../../context-menu-opener"; @Directive() export class TrackBrowserBase { diff --git a/src/app/ui/components/collection/track-browser/track-browser.component.ts b/src/app/ui/components/collection/track-browser/track-browser.component.ts index 7ae54951c..6cd82b2b0 100644 --- a/src/app/ui/components/collection/track-browser/track-browser.component.ts +++ b/src/app/ui/components/collection/track-browser/track-browser.component.ts @@ -1,10 +1,8 @@ import { Component, Input, OnDestroy, OnInit, ViewChild, ViewEncapsulation } from '@angular/core'; import { MatMenuTrigger } from '@angular/material/menu'; import { Subscription } from 'rxjs'; -import { ContextMenuOpener } from '../../../../common/context-menu-opener'; import { GuidFactory } from '../../../../common/guid.factory'; import { Logger } from '../../../../common/logger'; -import { MouseSelectionWatcher } from '../../../../common/mouse-selection-watcher'; import { TrackOrdering } from '../../../../common/ordering/track-ordering'; import { PlaybackStarted } from '../../../../services/playback/playback-started'; import { TrackModel } from '../../../../services/track/track-model'; @@ -20,6 +18,8 @@ import { CollectionServiceBase } from '../../../../services/collection/collectio import { TranslatorServiceBase } from '../../../../services/translator/translator.service.base'; import { DialogServiceBase } from '../../../../services/dialog/dialog.service.base'; import {DesktopBase} from "../../../../common/io/desktop.base"; +import {MouseSelectionWatcher} from "../../mouse-selection-watcher"; +import {ContextMenuOpener} from "../../context-menu-opener"; @Component({ selector: 'app-track-browser', diff --git a/src/app/common/context-menu-opener.ts b/src/app/ui/components/context-menu-opener.ts similarity index 90% rename from src/app/common/context-menu-opener.ts rename to src/app/ui/components/context-menu-opener.ts index f5d5d893d..436fd8539 100644 --- a/src/app/common/context-menu-opener.ts +++ b/src/app/ui/components/context-menu-opener.ts @@ -1,6 +1,6 @@ import { Injectable } from '@angular/core'; import { MatMenuTrigger } from '@angular/material/menu'; -import { ISelectable } from '../ui/interfaces/i-selectable'; +import { ISelectable } from '../interfaces/i-selectable'; @Injectable() export class ContextMenuOpener { diff --git a/src/app/ui/components/dialogs/edit-playlist-dialog/edit-playlist-dialog.component.ts b/src/app/ui/components/dialogs/edit-playlist-dialog/edit-playlist-dialog.component.ts index 785db06b0..151c4fbb1 100644 --- a/src/app/ui/components/dialogs/edit-playlist-dialog/edit-playlist-dialog.component.ts +++ b/src/app/ui/components/dialogs/edit-playlist-dialog/edit-playlist-dialog.component.ts @@ -1,7 +1,7 @@ import { Component, Inject, OnInit } from '@angular/core'; import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog'; import { Constants } from '../../../../common/application/constants'; -import { Strings } from '../../../../common/strings'; +import { StringUtils } from '../../../../common/utils/string-utils'; import { PromiseUtils } from '../../../../common/utils/promise-utils'; import { PlaylistData } from '../../../../services/dialog/playlist-data'; import { PlaylistServiceBase } from '../../../../services/playlist/playlist.service.base'; @@ -36,7 +36,7 @@ export class EditPlaylistDialogComponent implements OnInit { } public get hasPlaylistName(): boolean { - return !Strings.isNullOrWhiteSpace(this.playlistName); + return !StringUtils.isNullOrWhiteSpace(this.playlistName); } public get hasPlaylistImagePath(): boolean { @@ -63,7 +63,7 @@ export class EditPlaylistDialogComponent implements OnInit { public async changeImageAsync(): Promise { const selectedFile: string = await this.desktop.showSelectFileDialogAsync(this.translatorService.get('choose-image')); - if (!Strings.isNullOrWhiteSpace(selectedFile)) { + if (!StringUtils.isNullOrWhiteSpace(selectedFile)) { this.playlistImagePath = selectedFile; } } diff --git a/src/app/ui/components/dialogs/input-dialog/input-dialog.component.ts b/src/app/ui/components/dialogs/input-dialog/input-dialog.component.ts index 2638f44ae..7e6c48afb 100644 --- a/src/app/ui/components/dialogs/input-dialog/input-dialog.component.ts +++ b/src/app/ui/components/dialogs/input-dialog/input-dialog.component.ts @@ -1,6 +1,6 @@ import { Component, Inject, ViewEncapsulation } from '@angular/core'; import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog'; -import { Strings } from '../../../../common/strings'; +import { StringUtils } from '../../../../common/utils/string-utils'; import { InputData } from '../../../../services/dialog/input-data'; @Component({ @@ -18,7 +18,7 @@ export class InputDialogComponent { } public get hasInputText(): boolean { - return !Strings.isNullOrWhiteSpace(this.data.inputText); + return !StringUtils.isNullOrWhiteSpace(this.data.inputText); } public closeDialog(): void { diff --git a/src/app/common/mouse-selection-watcher.spec.ts b/src/app/ui/components/mouse-selection-watcher.spec.ts similarity index 100% rename from src/app/common/mouse-selection-watcher.spec.ts rename to src/app/ui/components/mouse-selection-watcher.spec.ts diff --git a/src/app/common/mouse-selection-watcher.ts b/src/app/ui/components/mouse-selection-watcher.ts similarity index 97% rename from src/app/common/mouse-selection-watcher.ts rename to src/app/ui/components/mouse-selection-watcher.ts index c60d406e6..8241a38f3 100644 --- a/src/app/common/mouse-selection-watcher.ts +++ b/src/app/ui/components/mouse-selection-watcher.ts @@ -1,5 +1,5 @@ import { Injectable } from '@angular/core'; -import { ISelectable } from '../ui/interfaces/i-selectable'; +import { ISelectable } from '../interfaces/i-selectable'; @Injectable() export class MouseSelectionWatcher { diff --git a/src/app/ui/components/now-playing/now-playing-artist-info/now-playing-artist-info.component.ts b/src/app/ui/components/now-playing/now-playing-artist-info/now-playing-artist-info.component.ts index fc7a32cb6..92a404230 100644 --- a/src/app/ui/components/now-playing/now-playing-artist-info/now-playing-artist-info.component.ts +++ b/src/app/ui/components/now-playing/now-playing-artist-info/now-playing-artist-info.component.ts @@ -2,7 +2,7 @@ import { animate, state, style, transition, trigger } from '@angular/animations' import { Component, OnDestroy, OnInit, ViewEncapsulation } from '@angular/core'; import { Subscription } from 'rxjs'; import { Scheduler } from '../../../../common/scheduling/scheduler'; -import { Strings } from '../../../../common/strings'; +import { StringUtils } from '../../../../common/utils/string-utils'; import { PromiseUtils } from '../../../../common/utils/promise-utils'; import { ArtistInformation } from '../../../../services/artist-information/artist-information'; import { PlaybackStarted } from '../../../../services/playback/playback-started'; @@ -86,7 +86,7 @@ export class NowPlayingArtistInfoComponent implements OnInit, OnDestroy { this._artist = await this.artistInformationService.getArtistInformationAsync(track); - if (Strings.isNullOrWhiteSpace(this.artist.imageUrl)) { + if (StringUtils.isNullOrWhiteSpace(this.artist.imageUrl)) { // Makes sure that the content is shown when there is no image this._contentAnimation = 'fade-in'; await this.scheduler.sleepAsync(250); diff --git a/src/app/ui/components/playback-queue/playback-queue.component.ts b/src/app/ui/components/playback-queue/playback-queue.component.ts index 2f26535cd..03876775b 100644 --- a/src/app/ui/components/playback-queue/playback-queue.component.ts +++ b/src/app/ui/components/playback-queue/playback-queue.component.ts @@ -1,13 +1,13 @@ import { Component, OnDestroy, OnInit, ViewChild, ViewEncapsulation } from '@angular/core'; import { MatMenuTrigger } from '@angular/material/menu'; import { Subscription } from 'rxjs'; -import { ContextMenuOpener } from '../../../common/context-menu-opener'; -import { MouseSelectionWatcher } from '../../../common/mouse-selection-watcher'; import { PlaybackStarted } from '../../../services/playback/playback-started'; import { TrackModel } from '../../../services/track/track-model'; import { PlaybackServiceBase } from '../../../services/playback/playback.service.base'; import { PlaybackIndicationServiceBase } from '../../../services/playback-indication/playback-indication.service.base'; import { NavigationServiceBase } from '../../../services/navigation/navigation.service.base'; +import { MouseSelectionWatcher } from '../mouse-selection-watcher'; +import {ContextMenuOpener} from "../context-menu-opener"; @Component({ selector: 'app-playback-queue', diff --git a/src/app/ui/pipes/albums-filter.pipe.ts b/src/app/ui/pipes/albums-filter.pipe.ts index 8f0534cb3..0fbae4142 100644 --- a/src/app/ui/pipes/albums-filter.pipe.ts +++ b/src/app/ui/pipes/albums-filter.pipe.ts @@ -1,14 +1,14 @@ import { Pipe, PipeTransform } from '@angular/core'; -import {Strings} from "../../common/strings"; -import {AlbumModel} from "../../services/album/album-model"; -import {SearchServiceBase} from "../../services/search/search.service.base"; +import { StringUtils } from '../../common/utils/string-utils'; +import { AlbumModel } from '../../services/album/album-model'; +import { SearchServiceBase } from '../../services/search/search.service.base'; @Pipe({ name: 'albumsFilter' }) export class AlbumsFilterPipe implements PipeTransform { public constructor(private searchService: SearchServiceBase) {} public transform(albums: AlbumModel[], textToContain: string | undefined): AlbumModel[] { - if (Strings.isNullOrWhiteSpace(textToContain)) { + if (StringUtils.isNullOrWhiteSpace(textToContain)) { return albums; } diff --git a/src/app/ui/pipes/artists-filter.pipe.ts b/src/app/ui/pipes/artists-filter.pipe.ts index 1543b9c46..eaedbba63 100644 --- a/src/app/ui/pipes/artists-filter.pipe.ts +++ b/src/app/ui/pipes/artists-filter.pipe.ts @@ -1,14 +1,14 @@ import { Pipe, PipeTransform } from '@angular/core'; import { SearchServiceBase } from '../../services/search/search.service.base'; import { ArtistModel } from '../../services/artist/artist-model'; -import { Strings } from '../../common/strings'; +import { StringUtils } from '../../common/utils/string-utils'; @Pipe({ name: 'artistsFilter' }) export class ArtistsFilterPipe implements PipeTransform { public constructor(private searchService: SearchServiceBase) {} public transform(artists: ArtistModel[], textToContain: string | undefined): ArtistModel[] { - if (Strings.isNullOrWhiteSpace(textToContain)) { + if (StringUtils.isNullOrWhiteSpace(textToContain)) { return artists; } diff --git a/src/app/ui/pipes/folder-name.pipe.ts b/src/app/ui/pipes/folder-name.pipe.ts index 4fe29936f..366e850f2 100644 --- a/src/app/ui/pipes/folder-name.pipe.ts +++ b/src/app/ui/pipes/folder-name.pipe.ts @@ -1,6 +1,6 @@ import { Pipe, PipeTransform } from '@angular/core'; import { FolderModel } from '../../services/folder/folder-model'; -import { Strings } from '../../common/strings'; +import { StringUtils } from '../../common/utils/string-utils'; import { FileAccessBase } from '../../common/io/file-access.base'; @Pipe({ name: 'folderName' }) @@ -12,7 +12,7 @@ export class FolderNamePipe implements PipeTransform { return ''; } - if (Strings.isNullOrWhiteSpace(folder.path)) { + if (StringUtils.isNullOrWhiteSpace(folder.path)) { return ''; } diff --git a/src/app/ui/pipes/genres-filter.pipe.ts b/src/app/ui/pipes/genres-filter.pipe.ts index eb7d504c7..efd5ad698 100644 --- a/src/app/ui/pipes/genres-filter.pipe.ts +++ b/src/app/ui/pipes/genres-filter.pipe.ts @@ -1,5 +1,5 @@ import { Pipe, PipeTransform } from '@angular/core'; -import { Strings } from '../../common/strings'; +import { StringUtils } from '../../common/utils/string-utils'; import { GenreModel } from '../../services/genre/genre-model'; import { SearchServiceBase } from '../../services/search/search.service.base'; @@ -8,7 +8,7 @@ export class GenresFilterPipe implements PipeTransform { public constructor(private searchService: SearchServiceBase) {} public transform(genres: GenreModel[], textToContain: string | undefined): GenreModel[] { - if (Strings.isNullOrWhiteSpace(textToContain)) { + if (StringUtils.isNullOrWhiteSpace(textToContain)) { return genres; } diff --git a/src/app/ui/pipes/playlists-filter.ts b/src/app/ui/pipes/playlists-filter.ts index f51512870..353e2229e 100644 --- a/src/app/ui/pipes/playlists-filter.ts +++ b/src/app/ui/pipes/playlists-filter.ts @@ -1,5 +1,5 @@ import { Pipe, PipeTransform } from '@angular/core'; -import { Strings } from '../../common/strings'; +import { StringUtils } from '../../common/utils/string-utils'; import { SearchServiceBase } from '../../services/search/search.service.base'; import { PlaylistModel } from '../../services/playlist/playlist-model'; @@ -8,7 +8,7 @@ export class PlaylistsFilterPipe implements PipeTransform { public constructor(private searchService: SearchServiceBase) {} public transform(playlists: PlaylistModel[], textToContain: string | undefined): PlaylistModel[] { - if (Strings.isNullOrWhiteSpace(textToContain)) { + if (StringUtils.isNullOrWhiteSpace(textToContain)) { return playlists; } diff --git a/src/app/ui/pipes/subfolder-name.pipe.ts b/src/app/ui/pipes/subfolder-name.pipe.ts index 33c83605f..83d23d812 100644 --- a/src/app/ui/pipes/subfolder-name.pipe.ts +++ b/src/app/ui/pipes/subfolder-name.pipe.ts @@ -1,5 +1,5 @@ import { Pipe, PipeTransform } from '@angular/core'; -import { Strings } from '../../common/strings'; +import { StringUtils } from '../../common/utils/string-utils'; import { SubfolderModel } from '../../services/folder/subfolder-model'; import { FileAccessBase } from '../../common/io/file-access.base'; @@ -16,7 +16,7 @@ export class SubfolderNamePipe implements PipeTransform { return '..'; } - if (Strings.isNullOrWhiteSpace(subfolder.path)) { + if (StringUtils.isNullOrWhiteSpace(subfolder.path)) { return ''; } diff --git a/src/app/ui/pipes/subfolders-filter.pipe.ts b/src/app/ui/pipes/subfolders-filter.pipe.ts index 64595a404..084f6aafe 100644 --- a/src/app/ui/pipes/subfolders-filter.pipe.ts +++ b/src/app/ui/pipes/subfolders-filter.pipe.ts @@ -1,14 +1,14 @@ import { Pipe, PipeTransform } from '@angular/core'; -import {Strings} from "../../common/strings"; -import {SubfolderModel} from "../../services/folder/subfolder-model"; -import {SearchServiceBase} from "../../services/search/search.service.base"; +import { StringUtils } from '../../common/utils/string-utils'; +import { SubfolderModel } from '../../services/folder/subfolder-model'; +import { SearchServiceBase } from '../../services/search/search.service.base'; @Pipe({ name: 'subfoldersFilter' }) export class SubfoldersFilterPipe implements PipeTransform { public constructor(private searchService: SearchServiceBase) {} public transform(subfolders: SubfolderModel[], textToContain: string | undefined): SubfolderModel[] { - if (Strings.isNullOrWhiteSpace(textToContain)) { + if (StringUtils.isNullOrWhiteSpace(textToContain)) { return subfolders; } diff --git a/src/app/ui/pipes/tracks-filter.pipe.ts b/src/app/ui/pipes/tracks-filter.pipe.ts index 0337b355c..f19eb2750 100644 --- a/src/app/ui/pipes/tracks-filter.pipe.ts +++ b/src/app/ui/pipes/tracks-filter.pipe.ts @@ -1,6 +1,6 @@ import { Pipe, PipeTransform } from '@angular/core'; import { TrackModels } from '../../services/track/track-models'; -import { Strings } from '../../common/strings'; +import { StringUtils } from '../../common/utils/string-utils'; import { SearchServiceBase } from '../../services/search/search.service.base'; @Pipe({ name: 'tracksFilter' }) @@ -8,7 +8,7 @@ export class TracksFilterPipe implements PipeTransform { public constructor(private searchService: SearchServiceBase) {} public transform(tracks: TrackModels, textToContain: string | undefined): TrackModels { - if (Strings.isNullOrWhiteSpace(textToContain)) { + if (StringUtils.isNullOrWhiteSpace(textToContain)) { return tracks; }