From c484df5071bbd71add6381e539a18a9b7d4496b0 Mon Sep 17 00:00:00 2001 From: Kyusung4698 Date: Mon, 30 Mar 2020 11:27:57 +0200 Subject: [PATCH 1/5] - fix rare armour searched with type and name instead of term (#506) --- CHANGELOG.md | 4 +++ .../provider/evaluate-query-item.provider.ts | 8 ++--- .../item-frame-header.component.html | 4 ++- .../item-frame-header.component.scss | 1 + .../item-frame/item-frame.component.html | 2 +- .../query/item-search-filters-type.service.ts | 32 +++++++++++++------ 6 files changed, 35 insertions(+), 16 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6d853395..34836106 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## 0.6.16 + +- fix rare armour searched with type and name instead of term (#506) + ## 0.6.15 (2020-03-27) - fix an error occured while fetching poe.ninja (#468) diff --git a/src/app/modules/evaluate/provider/evaluate-query-item.provider.ts b/src/app/modules/evaluate/provider/evaluate-query-item.provider.ts index cb6b049e..222bc9de 100644 --- a/src/app/modules/evaluate/provider/evaluate-query-item.provider.ts +++ b/src/app/modules/evaluate/provider/evaluate-query-item.provider.ts @@ -55,15 +55,13 @@ export class EvaluateQueryItemProvider { } if (!settings.evaluateQueryDefaultType) { - if (!item.nameId && ( - item.rarity === ItemRarity.Normal || + if (item.rarity === ItemRarity.Normal || item.rarity === ItemRarity.Magic || - item.rarity === ItemRarity.Rare) - ) { + item.rarity === ItemRarity.Rare) { if (item.category.startsWith(ItemCategory.Weapon) || item.category.startsWith(ItemCategory.Armour) || item.category.startsWith(ItemCategory.Accessory)) { - queryItem.typeId = undefined; + queryItem.typeId = queryItem.nameId = undefined; } } } diff --git a/src/app/shared/module/poe/component/item-frame-header/item-frame-header.component.html b/src/app/shared/module/poe/component/item-frame-header/item-frame-header.component.html index 8224fca8..df6c998c 100644 --- a/src/app/shared/module/poe/component/item-frame-header/item-frame-header.component.html +++ b/src/app/shared/module/poe/component/item-frame-header/item-frame-header.component.html @@ -1,6 +1,8 @@
- {{item.nameId | word:language}} + + {{item.nameId | word:language}} +
diff --git a/src/app/shared/module/poe/component/item-frame-header/item-frame-header.component.scss b/src/app/shared/module/poe/component/item-frame-header/item-frame-header.component.scss index bccfad7c..6789e508 100644 --- a/src/app/shared/module/poe/component/item-frame-header/item-frame-header.component.scss +++ b/src/app/shared/module/poe/component/item-frame-header/item-frame-header.component.scss @@ -16,6 +16,7 @@ > .name { padding: 5.18323px 45px 2.59162px 45px; + height: 19px; } } diff --git a/src/app/shared/module/poe/component/item-frame/item-frame.component.html b/src/app/shared/module/poe/component/item-frame/item-frame.component.html index 869de6b4..9880455e 100644 --- a/src/app/shared/module/poe/component/item-frame/item-frame.component.html +++ b/src/app/shared/module/poe/component/item-frame/item-frame.component.html @@ -1,6 +1,6 @@
+ [queryable]="item.rarity === 'normal' || item.rarity === 'magic' || item.rarity === 'rare'" [language]="language">
diff --git a/src/app/shared/module/poe/service/item/query/item-search-filters-type.service.ts b/src/app/shared/module/poe/service/item/query/item-search-filters-type.service.ts index c08774a9..c7512df6 100644 --- a/src/app/shared/module/poe/service/item/query/item-search-filters-type.service.ts +++ b/src/app/shared/module/poe/service/item/query/item-search-filters-type.service.ts @@ -59,15 +59,6 @@ export class ItemSearchFiltersTypeService implements ItemSearchFiltersService { case ItemCategory.AccessoryAmulet: case ItemCategory.AccessoryBelt: case ItemCategory.AccessoryRing: - // jewel - case ItemCategory.Jewel: - case ItemCategory.JewelAbyss: - // flasks - case ItemCategory.Flask: - // map - case ItemCategory.Map: - // monster - case ItemCategory.MonsterBeast: if (item.rarity === ItemRarity.Unique) { query.filters.type_filters.filters.rarity = { option: ItemRarity.Unique @@ -75,12 +66,35 @@ export class ItemSearchFiltersTypeService implements ItemSearchFiltersService { } else { query.filters.type_filters.filters.rarity = { option: ItemRarity.NonUnique + }; + + if (query.name) { + query.term = `${query.name || ''} ${query.type || ''}`.trim(); + query.name = query.type = undefined; } } query.filters.type_filters.filters.category = { option: item.category, }; break; + // jewel + case ItemCategory.Jewel: + case ItemCategory.JewelAbyss: + // flasks + case ItemCategory.Flask: + // map + case ItemCategory.Map: + // monster + case ItemCategory.MonsterBeast: + query.filters.type_filters.filters.rarity = { + option: item.rarity === ItemRarity.Unique + ? ItemRarity.Unique + : ItemRarity.NonUnique + }; + query.filters.type_filters.filters.category = { + option: item.category, + }; + break; // gem case ItemCategory.Gem: case ItemCategory.GemActivegem: From ce98a9f5e6040d3210b9decc7c50b845b846fa25 Mon Sep 17 00:00:00 2001 From: Kyusung4698 Date: Mon, 30 Mar 2020 12:10:34 +0200 Subject: [PATCH 2/5] - update untoggled modifier do now not cancel the search (#512) --- .../item-frame-query/item-frame-query.component.ts | 6 ++++++ .../item-frame-value.component.spec.ts | 3 +-- .../item-frame-value/item-frame-value.component.ts | 13 +++++++------ .../component/item-frame/item-frame.component.ts | 6 ------ 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/app/shared/module/poe/component/item-frame-query/item-frame-query.component.ts b/src/app/shared/module/poe/component/item-frame-query/item-frame-query.component.ts index 93c13cc6..b0b9f3ac 100644 --- a/src/app/shared/module/poe/component/item-frame-query/item-frame-query.component.ts +++ b/src/app/shared/module/poe/component/item-frame-query/item-frame-query.component.ts @@ -53,6 +53,12 @@ export class ItemFrameQueryComponent implements OnInit { this.emitChange(); } + public checkChange(): void { + if (this.property) { + this.emitChange(); + } + } + private emitChange(): void { this.propertyChange.emit(this.property); this.itemFrame.onPropertyChange(); diff --git a/src/app/shared/module/poe/component/item-frame-value/item-frame-value.component.spec.ts b/src/app/shared/module/poe/component/item-frame-value/item-frame-value.component.spec.ts index dd9ded17..7d825098 100644 --- a/src/app/shared/module/poe/component/item-frame-value/item-frame-value.component.spec.ts +++ b/src/app/shared/module/poe/component/item-frame-value/item-frame-value.component.spec.ts @@ -14,8 +14,7 @@ describe('ItemFrameValueComponent', () => { providers: [ { provide: ItemFrameComponent, useValue: { - queryItemChange: new EventEmitter(), - onValueChange: () => { }, + queryItemChange: new EventEmitter() } } ] diff --git a/src/app/shared/module/poe/component/item-frame-value/item-frame-value.component.ts b/src/app/shared/module/poe/component/item-frame-value/item-frame-value.component.ts index 24756646..973c7c74 100644 --- a/src/app/shared/module/poe/component/item-frame-value/item-frame-value.component.ts +++ b/src/app/shared/module/poe/component/item-frame-value/item-frame-value.component.ts @@ -2,6 +2,7 @@ import { DecimalPipe } from '@angular/common'; import { ChangeDetectionStrategy, Component, ElementRef, EventEmitter, Inject, Input, OnInit, Output, ViewChild } from '@angular/core'; import { Subject } from 'rxjs'; import { ItemValue } from '../../type'; +import { ItemFrameQueryComponent } from '../item-frame-query/item-frame-query.component'; import { ItemFrameComponent } from '../item-frame/item-frame.component'; @Component({ @@ -39,15 +40,15 @@ export class ItemFrameValueComponent implements OnInit { constructor( @Inject(ItemFrameComponent) - private readonly itemFrame: ItemFrameComponent, + itemFrame: ItemFrameComponent, + @Inject(ItemFrameQueryComponent) + private readonly query: ItemFrameQueryComponent, private readonly decimal: DecimalPipe) { - this.text$ = this.itemFrame.text$; + this.text$ = itemFrame.text$; + this.disabled = itemFrame.queryItemChange.observers.length <= 0; } public ngOnInit(): void { - if (this.itemFrame.queryItemChange.observers.length <= 0) { - this.disabled = true; - } this.init(); } @@ -274,7 +275,7 @@ export class ItemFrameValueComponent implements OnInit { private emitChange(): void { this.updateView(); this.valueChange.emit(this.value); - this.itemFrame.onValueChange(this.value); + this.query.checkChange(); } private updateView(): void { diff --git a/src/app/shared/module/poe/component/item-frame/item-frame.component.ts b/src/app/shared/module/poe/component/item-frame/item-frame.component.ts index b1d96f40..39f4a701 100644 --- a/src/app/shared/module/poe/component/item-frame/item-frame.component.ts +++ b/src/app/shared/module/poe/component/item-frame/item-frame.component.ts @@ -80,10 +80,4 @@ export class ItemFrameComponent implements OnInit { public onPropertyChange(): void { this.queryItemChange.emit(this.queryItem); } - - public onValueChange(value: any): void { - if (value !== undefined && value !== null) { - this.queryItemChange.emit(this.queryItem); - } - } } From 04dc49002dd2bc51c8aff62a802e18574cb84928 Mon Sep 17 00:00:00 2001 From: Kyusung4698 Date: Tue, 31 Mar 2020 11:50:29 +0200 Subject: [PATCH 3/5] #522, #520 - add disabled debounce time on max value (#522) - add configurable fetch count to ensure the request rate is met (#520) - add clear session on application start and unknown http error (#520) --- CHANGELOG.md | 6 +- overlay.babel | 53 +++++++++++++++ src/app/core/service/index.ts | 1 + src/app/core/service/session.service.ts | 64 +++++++++++++++++++ .../service/currency-overview-http.service.ts | 8 +-- .../service/item-overview-http.service.ts | 8 +-- .../data/poe/service/trade-http.service.ts | 9 +-- .../layout/page/overlay/overlay.component.ts | 4 +- .../evaluate-search.component.html | 2 +- .../evaluate-search.component.ts | 11 +++- .../evaluate-settings.component.html | 12 +++- .../evaluate-settings.component.scss | 2 +- .../evaluate-settings.component.ts | 25 +++++--- src/app/modules/evaluate/evaluate.module.ts | 1 + .../item/item-search-analyze.service.spec.ts | 2 +- .../service/item/item-search.service.spec.ts | 2 +- .../poe/service/item/item-search.service.ts | 9 +-- src/assets/i18n/english.json | 3 +- src/assets/i18n/french.json | 3 +- src/assets/i18n/german.json | 3 +- src/assets/i18n/korean.json | 3 +- src/assets/i18n/polish.json | 19 +++--- src/assets/i18n/portuguese.json | 3 +- src/assets/i18n/russian.json | 3 +- src/assets/i18n/simplified-chinese.json | 3 +- src/assets/i18n/spanish.json | 3 +- src/assets/i18n/thai.json | 3 +- src/assets/i18n/traditional-chinese.json | 3 +- 28 files changed, 214 insertions(+), 54 deletions(-) create mode 100644 src/app/core/service/session.service.ts diff --git a/CHANGELOG.md b/CHANGELOG.md index 34836106..66aa57dd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,11 @@ # Changelog -## 0.6.16 +## 0.6.16 (2020-03-31) +- add disabled debounce time on max value (#522) +- add configurable fetch count to ensure the request rate is met (#520) +- add clear session on application start and unknown http error (#520) +- update untoggled modifier do now not cancel the search (#512) - fix rare armour searched with type and name instead of term (#506) ## 0.6.15 (2020-03-27) diff --git a/overlay.babel b/overlay.babel index b7b8e6ac..e440c1bc 100644 --- a/overlay.babel +++ b/overlay.babel @@ -1421,6 +1421,59 @@ + + fetch-count + false + + + + + + de-DE + false + + + en-US + false + + + es-ES + false + + + fr-FR + false + + + ko-KR + false + + + pl-PL + false + + + pt-BR + false + + + ru-RU + false + + + th-TH + false + + + zh-CHS + false + + + zh-CHT + false + + + listings false diff --git a/src/app/core/service/index.ts b/src/app/core/service/index.ts index b7f07967..623f214f 100644 --- a/src/app/core/service/index.ts +++ b/src/app/core/service/index.ts @@ -4,6 +4,7 @@ export * from './browser.service'; export * from './game.service'; export * from './logger.service'; export * from './renderer.service'; +export * from './session.service'; export * from './storage.service'; export * from './window.service'; diff --git a/src/app/core/service/session.service.ts b/src/app/core/service/session.service.ts new file mode 100644 index 00000000..8b25f096 --- /dev/null +++ b/src/app/core/service/session.service.ts @@ -0,0 +1,64 @@ +import { Injectable, NgZone } from '@angular/core'; +import { ElectronProvider } from '@app/provider'; +import { IpcRenderer, Remote, Session } from 'electron'; +import { forkJoin, from, Observable, of } from 'rxjs'; +import { map } from 'rxjs/operators'; +import { LoggerService } from './logger.service'; + +@Injectable({ + providedIn: 'root' +}) +export class SessionService { + private readonly electron: Remote; + private readonly ipcRenderer: IpcRenderer; + + constructor( + private readonly ngZone: NgZone, + private readonly logger: LoggerService, + electronProvider: ElectronProvider) { + this.electron = electronProvider.provideRemote(); + this.ipcRenderer = electronProvider.provideIpcRenderer(); + } + + public registerEvents(): void { + this.ipcRenderer.on('session-clear', () => { + this.ngZone.run(() => this.clear().subscribe()); + }); + this.clear().subscribe(); + } + + public clear(): Observable { + const tasks = [ + this.clearCache(), + this.clearHostResolverCache() + ]; + + return forkJoin(tasks).pipe( + map(() => null) + ); + } + + public clearCache(): Observable { + const session = this.getSession(); + if (!session) { + this.logger.warn('Could not clear cache because session was null or undefined.'); + return of(null); + } + this.logger.info('Session cache has been cleared.'); + return from(session.clearCache()); + } + + public clearHostResolverCache(): Observable { + const session = this.getSession(); + if (!session) { + this.logger.warn('Could not clear cache because session was null or undefined.'); + return of(null); + } + this.logger.info('Session host resolver cache has been cleared.'); + return from(session.clearHostResolverCache()); + } + + private getSession(): Session { + return this.electron.session?.defaultSession; + } +} \ No newline at end of file diff --git a/src/app/data/poe-ninja/service/currency-overview-http.service.ts b/src/app/data/poe-ninja/service/currency-overview-http.service.ts index 12ffa035..e803c863 100644 --- a/src/app/data/poe-ninja/service/currency-overview-http.service.ts +++ b/src/app/data/poe-ninja/service/currency-overview-http.service.ts @@ -1,6 +1,6 @@ import { HttpClient, HttpErrorResponse, HttpParams } from '@angular/common/http'; import { Injectable } from '@angular/core'; -import { BrowserService, LoggerService } from '@app/service'; +import { BrowserService, LoggerService, SessionService } from '@app/service'; import { environment } from '@env/environment'; import { Observable, of, throwError } from 'rxjs'; import { delay, flatMap, retryWhen } from 'rxjs/operators'; @@ -28,6 +28,7 @@ export class CurrencyOverviewHttpService { constructor( private readonly httpClient: HttpClient, private readonly browser: BrowserService, + private readonly session: SessionService, private readonly logger: LoggerService) { this.apiUrl = `${environment.poeNinja.baseUrl}/api/data/currencyoverview`; } @@ -37,8 +38,7 @@ export class CurrencyOverviewHttpService { fromObject: { league: leagueId, type, - language: 'en', - t: `${Date.now()}` + language: 'en' } }); return this.httpClient.get(this.apiUrl, { @@ -71,7 +71,7 @@ export class CurrencyOverviewHttpService { case 403: return this.browser.retrieve(url); default: - return of(null).pipe(delay(RETRY_DELAY)); + return this.session.clear().pipe(delay(RETRY_DELAY)); } } } diff --git a/src/app/data/poe-ninja/service/item-overview-http.service.ts b/src/app/data/poe-ninja/service/item-overview-http.service.ts index a79b50a4..4ca58818 100644 --- a/src/app/data/poe-ninja/service/item-overview-http.service.ts +++ b/src/app/data/poe-ninja/service/item-overview-http.service.ts @@ -1,6 +1,6 @@ import { HttpClient, HttpErrorResponse, HttpParams } from '@angular/common/http'; import { Injectable } from '@angular/core'; -import { BrowserService, LoggerService } from '@app/service'; +import { BrowserService, LoggerService, SessionService } from '@app/service'; import { environment } from '@env/environment'; import { Observable, of, throwError } from 'rxjs'; import { delay, flatMap, retryWhen } from 'rxjs/operators'; @@ -56,6 +56,7 @@ export class ItemOverviewHttpService { constructor( private readonly httpClient: HttpClient, private readonly browser: BrowserService, + private readonly session: SessionService, private readonly logger: LoggerService) { this.apiUrl = `${environment.poeNinja.baseUrl}/api/data/itemoverview`; } @@ -65,8 +66,7 @@ export class ItemOverviewHttpService { fromObject: { league: leagueId, type, - language: 'en', - t: `${Date.now()}` + language: 'en' } }); return this.httpClient.get(this.apiUrl, { @@ -99,7 +99,7 @@ export class ItemOverviewHttpService { case 403: return this.browser.retrieve(url); default: - return of(null).pipe(delay(RETRY_DELAY)); + return this.session.clear().pipe(delay(RETRY_DELAY)); } } } diff --git a/src/app/data/poe/service/trade-http.service.ts b/src/app/data/poe/service/trade-http.service.ts index 21df74c4..7b81b501 100644 --- a/src/app/data/poe/service/trade-http.service.ts +++ b/src/app/data/poe/service/trade-http.service.ts @@ -1,6 +1,6 @@ import { HttpClient, HttpErrorResponse, HttpParams, HttpResponse } from '@angular/common/http'; import { Injectable } from '@angular/core'; -import { BrowserService } from '@app/service'; +import { BrowserService, SessionService } from '@app/service'; import { environment } from '@env/environment'; import { Language } from '@shared/module/poe/type'; import { Observable, of, throwError } from 'rxjs'; @@ -9,7 +9,7 @@ import { TradeFetchResult, TradeItemsResult, TradeLeaguesResult, TradeResponse, const RETRY_COUNT = 3; const RETRY_DELAY = 100; -const RETRY_LIMIT_DELAY = 300; +const RETRY_LIMIT_DELAY = 1000; @Injectable({ providedIn: 'root' @@ -17,7 +17,8 @@ const RETRY_LIMIT_DELAY = 300; export class TradeHttpService { constructor( private readonly http: HttpClient, - private readonly browser: BrowserService) { } + private readonly browser: BrowserService, + private readonly session: SessionService) { } public getItems(language: Language): Observable> { const url = this.getApiUrl('data/items', language); @@ -148,7 +149,7 @@ export class TradeHttpService { case 429: return of(null).pipe(delay(RETRY_LIMIT_DELAY)); default: - return of(null).pipe(delay(RETRY_DELAY)); + return this.session.clear().pipe(delay(RETRY_DELAY)); } } diff --git a/src/app/layout/page/overlay/overlay.component.ts b/src/app/layout/page/overlay/overlay.component.ts index 87d97a80..3706a004 100644 --- a/src/app/layout/page/overlay/overlay.component.ts +++ b/src/app/layout/page/overlay/overlay.component.ts @@ -1,5 +1,5 @@ import { ChangeDetectionStrategy, Component, HostListener, Inject, OnDestroy, OnInit } from '@angular/core'; -import { AppService, AppTranslateService, GameService, RendererService, WindowService } from '@app/service'; +import { AppService, AppTranslateService, GameService, RendererService, SessionService, WindowService } from '@app/service'; import { DialogRefService } from '@app/service/dialog'; import { ShortcutService } from '@app/service/input'; import { FEATURE_MODULES } from '@app/token'; @@ -30,6 +30,7 @@ export class OverlayComponent implements OnInit, OnDestroy { private readonly userSettingsService: UserSettingsService, private readonly context: ContextService, private readonly app: AppService, + private readonly session: SessionService, private readonly game: GameService, private readonly translate: AppTranslateService, private readonly snackBar: SnackBarService, @@ -92,6 +93,7 @@ export class OverlayComponent implements OnInit, OnDestroy { } }); this.app.registerEvents(settings.autoDownload); + this.session.registerEvents(); } private registerVisibleChange(): void { diff --git a/src/app/modules/evaluate/component/evaluate-search/evaluate-search.component.html b/src/app/modules/evaluate/component/evaluate-search/evaluate-search.component.html index ec67843f..ca22fa16 100644 --- a/src/app/modules/evaluate/component/evaluate-search/evaluate-search.component.html +++ b/src/app/modules/evaluate/component/evaluate-search/evaluate-search.component.html @@ -62,7 +62,7 @@
- {{'evaluate.listings' | translate:{total: search.total | number} }} {{ 'evaluate.cancel' | translate }}
diff --git a/src/app/modules/evaluate/component/evaluate-search/evaluate-search.component.ts b/src/app/modules/evaluate/component/evaluate-search/evaluate-search.component.ts index 8eb5f8cc..c11b24d8 100644 --- a/src/app/modules/evaluate/component/evaluate-search/evaluate-search.component.ts +++ b/src/app/modules/evaluate/component/evaluate-search/evaluate-search.component.ts @@ -8,7 +8,7 @@ import { ItemSearchOptions } from '@shared/module/poe/type/search.type'; import { BehaviorSubject, Subject, Subscription, timer } from 'rxjs'; import { debounceTime, takeUntil } from 'rxjs/operators'; import { EvaluateOptions } from '../evaluate-options/evaluate-options.component'; -import { EvaluateResultView, EvaluateUserSettings } from '../evaluate-settings/evaluate-settings.component'; +import { EvaluateResultView, EvaluateUserSettings, EVALUATE_QUERY_DEBOUNCE_TIME_MAX } from '../evaluate-settings/evaluate-settings.component'; @Component({ selector: 'app-evaluate-search', @@ -22,6 +22,7 @@ export class EvaluateSearchComponent implements OnInit { public graph: boolean; public search$ = new BehaviorSubject(null); + public count$ = new BehaviorSubject(0); public listings$ = new BehaviorSubject(null); public result$ = new BehaviorSubject(null); public error$ = new BehaviorSubject(false); @@ -116,7 +117,9 @@ export class EvaluateSearchComponent implements OnInit { subscription?.unsubscribe(); this.search(item); } else { - this.staleCounter$.next(this.staleCounter$.value - 1) + if (this.settings.evaluateQueryDebounceTime !== EVALUATE_QUERY_DEBOUNCE_TIME_MAX) { + this.staleCounter$.next(this.staleCounter$.value - 1) + } } const counter = this.staleCounter$.value - 2; @@ -138,13 +141,15 @@ export class EvaluateSearchComponent implements OnInit { ).subscribe(search => { this.search$.next(search); if (search.total > 0) { + const count = Math.min(this.settings.evaluateQueryFetchCount, search.total); + this.count$.next(count); this.list(search); } }, error => this.handleError(error)); } private list(search: ItemSearchResult): void { - this.listSubscription = this.itemSearchService.list(search).pipe( + this.listSubscription = this.itemSearchService.list(search, this.settings.evaluateQueryFetchCount).pipe( takeUntil(this.queryItemChange) ).subscribe(listings => { this.listings$.next(listings); diff --git a/src/app/modules/evaluate/component/evaluate-settings/evaluate-settings.component.html b/src/app/modules/evaluate/component/evaluate-settings/evaluate-settings.component.html index 0660b1d6..266f189e 100644 --- a/src/app/modules/evaluate/component/evaluate-settings/evaluate-settings.component.html +++ b/src/app/modules/evaluate/component/evaluate-settings/evaluate-settings.component.html @@ -22,14 +22,22 @@ -
+
-
+
+ + + +
diff --git a/src/app/modules/evaluate/component/evaluate-settings/evaluate-settings.component.scss b/src/app/modules/evaluate/component/evaluate-settings/evaluate-settings.component.scss index 32543fb9..7ba2ff88 100644 --- a/src/app/modules/evaluate/component/evaluate-settings/evaluate-settings.component.scss +++ b/src/app/modules/evaluate/component/evaluate-settings/evaluate-settings.component.scss @@ -61,7 +61,7 @@ label { } } -.time { +.value-range { .mat-slider { width: 100%; } diff --git a/src/app/modules/evaluate/component/evaluate-settings/evaluate-settings.component.ts b/src/app/modules/evaluate/component/evaluate-settings/evaluate-settings.component.ts index c711f1ce..15a7ee9c 100644 --- a/src/app/modules/evaluate/component/evaluate-settings/evaluate-settings.component.ts +++ b/src/app/modules/evaluate/component/evaluate-settings/evaluate-settings.component.ts @@ -35,8 +35,12 @@ export interface EvaluateUserSettings extends UserSettings { evaluateModifierMinRange: number; evaluateModifierMaxRange: number; evaluateQueryDebounceTime: number; + evaluateQueryFetchCount: number; } +export const EVALUATE_QUERY_DEBOUNCE_TIME_MAX = 100; +export const EVALUATE_QUERY_FETCH_COUNT_MAX = 100; + interface StatSelectListItem extends SelectListItem { type: string; } @@ -48,6 +52,13 @@ interface StatSelectListItem extends SelectListItem { changeDetection: ChangeDetectionStrategy.OnPush }) export class EvaluateSettingsComponent implements UserSettingsComponent { + + constructor( + private readonly currencyService: CurrencyService, + private readonly statsProvider: StatsProvider, + private readonly statsService: StatsService, + private readonly clipboard: ClipboardService, + private readonly snackbar: SnackBarService) { } public languages = new EnumValues(Language); public views = new EnumValues(EvaluateResultView); public settings: EvaluateUserSettings; @@ -55,15 +66,13 @@ export class EvaluateSettingsComponent implements UserSettingsComponent { public currencies$ = new BehaviorSubject([]); public stats$ = new BehaviorSubject([]); - public displayWithTime = (value: number) => `${Math.round(value * 10) / 100}s`; - public displayWithStat = (value: number) => value === 50 ? '#' : value; - constructor( - private readonly currencyService: CurrencyService, - private readonly statsProvider: StatsProvider, - private readonly statsService: StatsService, - private readonly clipboard: ClipboardService, - private readonly snackbar: SnackBarService) { } + public debounceTimeMax = EVALUATE_QUERY_DEBOUNCE_TIME_MAX; + public fetchCountMax = EVALUATE_QUERY_FETCH_COUNT_MAX; + + public displayWithTime = (value: number) => value === this.debounceTimeMax ? '∞' : `${Math.round(value * 10) / 100}s`; + public displayWithCount = (value: number) => `${value} items`; + public displayWithStat = (value: number) => value === 50 ? '#' : value; public load(): void { if (this.settings.language) { diff --git a/src/app/modules/evaluate/evaluate.module.ts b/src/app/modules/evaluate/evaluate.module.ts index 4bbeea24..de522b02 100644 --- a/src/app/modules/evaluate/evaluate.module.ts +++ b/src/app/modules/evaluate/evaluate.module.ts @@ -58,6 +58,7 @@ export class EvaluateModule implements FeatureModule { evaluateQueryIndexedRange: ItemSearchIndexed.UpTo3DaysAgo, evaluateQueryOnline: true, evaluateQueryDebounceTime: 10, + evaluateQueryFetchCount: 30, evaluateModifierMinRange: 10, evaluateModifierMaxRange: 50, evaluateKeybinding: 'CmdOrCtrl + D', diff --git a/src/app/shared/module/poe/service/item/item-search-analyze.service.spec.ts b/src/app/shared/module/poe/service/item/item-search-analyze.service.spec.ts index 6823c8cb..f9dd84b9 100644 --- a/src/app/shared/module/poe/service/item/item-search-analyze.service.spec.ts +++ b/src/app/shared/module/poe/service/item/item-search-analyze.service.spec.ts @@ -41,7 +41,7 @@ describe('ItemSearchAnalyzeService', () => { forkJoin([ searchService.search(requestedItem).pipe( - flatMap(result => searchService.list(result)) + flatMap(result => searchService.list(result, 10)) ), currencyService.searchById('chaos') ]).subscribe(results => { diff --git a/src/app/shared/module/poe/service/item/item-search.service.spec.ts b/src/app/shared/module/poe/service/item/item-search.service.spec.ts index b97117cb..aa8e4717 100644 --- a/src/app/shared/module/poe/service/item/item-search.service.spec.ts +++ b/src/app/shared/module/poe/service/item/item-search.service.spec.ts @@ -46,7 +46,7 @@ describe('ItemSearchService', () => { sut.search(requestedItem).subscribe(result => { expect(result.hits.length).toBeGreaterThan(0); - sut.list(result).subscribe(listings => { + sut.list(result, 10).subscribe(listings => { expect(listings.length).toBe(Math.min(result.hits.length, 100)); done(); diff --git a/src/app/shared/module/poe/service/item/item-search.service.ts b/src/app/shared/module/poe/service/item/item-search.service.ts index 7ba7e369..4ef1aeb4 100644 --- a/src/app/shared/module/poe/service/item/item-search.service.ts +++ b/src/app/shared/module/poe/service/item/item-search.service.ts @@ -10,7 +10,7 @@ import { ContextService } from '../context.service'; import { CurrencyService } from '../currency/currency.service'; import { ItemSearchQueryService } from './query/item-search-query.service'; -const MAX_FETCH_COUNT = 10; +const MAX_FETCH_PER_REQUEST_COUNT = 10; const MAX_FETCH_CONCURRENT_COUNT = 5; export interface ItemSearchListing { @@ -87,12 +87,13 @@ export class ItemSearchService { })); } - public list(search: ItemSearchResult): Observable { + public list(search: ItemSearchResult, fetchCount: number): Observable { const { id, language, hits } = search; const hitsChunked: string[][] = []; - for (let i = 0, j = Math.min(100, hits.length); i < j; i += MAX_FETCH_COUNT) { - hitsChunked.push(hits.slice(i, i + MAX_FETCH_COUNT)); + const maxFetchCount = Math.min(fetchCount, hits.length) + for (let i = 0, j = maxFetchCount; i < j; i += MAX_FETCH_PER_REQUEST_COUNT) { + hitsChunked.push(hits.slice(i, i + MAX_FETCH_PER_REQUEST_COUNT)); } return from(hitsChunked).pipe( diff --git a/src/assets/i18n/english.json b/src/assets/i18n/english.json index 990bdc0d..00e47028 100644 --- a/src/assets/i18n/english.json +++ b/src/assets/i18n/english.json @@ -36,7 +36,8 @@ "debounce-time": "Search Debounce Time", "empty": "No results. Open in browser?", "error": "An error occured.", - "listings": "Found {{total}}. Fetching entries...", + "fetch-count": "Search Fetch Count", + "listings": "Found {{total}}. Fetching {{count}} entries...", "loading": "Loading...", "mean": "Mean", "median": "Median", diff --git a/src/assets/i18n/french.json b/src/assets/i18n/french.json index d9954ae6..4418e839 100644 --- a/src/assets/i18n/french.json +++ b/src/assets/i18n/french.json @@ -36,7 +36,8 @@ "debounce-time": "Rechercher le temps de rebond", "empty": "Aucun résultat. Ouvrir dans le navigateur?", "error": "Une erreur s'est produite.", - "listings": " {{total}}trouvé. Récupération des entrées ...", + "fetch-count": "Nombre de recherches", + "listings": " {{total}}trouvé. Récupération de {{count}} entrées ...", "loading": "Chargement...", "mean": "Mean", "median": "Médian", diff --git a/src/assets/i18n/german.json b/src/assets/i18n/german.json index b2427bd1..4739b35d 100644 --- a/src/assets/i18n/german.json +++ b/src/assets/i18n/german.json @@ -36,7 +36,8 @@ "debounce-time": "Such-Entprellzeit", "empty": "Keine Ergebnisse. Im Browser öffnen?", "error": "Es ist ein Fehler aufgetreten.", - "listings": "Gefunden {{total}}. Einträge abrufen ...", + "fetch-count": "Suche Fetch Count", + "listings": "Gefunden {{total}}. {{count}} Einträge abrufen ...", "loading": "Wird geladen...", "mean": "Mean", "median": "Median", diff --git a/src/assets/i18n/korean.json b/src/assets/i18n/korean.json index e4dcf186..f5c13d91 100644 --- a/src/assets/i18n/korean.json +++ b/src/assets/i18n/korean.json @@ -36,7 +36,8 @@ "debounce-time": "검색 디 바운스 시간", "empty": "결과가 없습니다. 브라우저에서 열려?", "error": "오류가 발생했습니다.", - "listings": " {{total}}을 (를) 찾았습니다. 항목을 가져 오는 중 ...", + "fetch-count": "검색 페치 수", + "listings": " {{total}}을 (를) 찾았습니다. {{count}} 항목을 가져 오는 중 ...", "loading": "로드 중 ...", "mean": "Mean", "median": "중앙값", diff --git a/src/assets/i18n/polish.json b/src/assets/i18n/polish.json index 1500e570..2837d6f0 100644 --- a/src/assets/i18n/polish.json +++ b/src/assets/i18n/polish.json @@ -36,7 +36,8 @@ "debounce-time": "Czas oczekiwania na ponowną wycenę przedmiotu.", "empty": "Brak wyników. Otworzyć w przeglądarce?", "error": "Wystąpił błąd.", - "listings": "Znaleziono {{total}}. Pobieranie aukcji ...", + "fetch-count": "Wyszukaj liczbę pobierania", + "listings": "Znaleziono {{total}}. Pobieranie {{count}} wpisów ...", "loading": "Ładuję...", "mean": "Średnia", "median": "Mediana", @@ -63,14 +64,14 @@ "item-sockets": "Gniazda", "item-type": "Typ przedmiotu", "max-age": { - "any": "Kiedykolwiek", - "day": "Ostatni dzień", - "days": "Ostatnie 3 dni", - "month": "Ostatni miesiąc", - "months": "Ostatnie 2 miesiące", - "title": "Data wystawienia", - "week": "Ostatni tydzień", - "weeks": "Ostatnie 2 tygodnie" + "any": "Kiedykolwiek", + "day": "Ostatni dzień", + "days": "Ostatnie 3 dni", + "month": "Ostatni miesiąc", + "months": "Ostatnie 2 miesiące", + "title": "Data wystawienia", + "week": "Ostatni tydzień", + "weeks": "Ostatnie 2 tygodnie" }, "modifier": "Ustawienia wyszukiwania modyfikatora", "modifier-range": "Zakres modyfikatora", diff --git a/src/assets/i18n/portuguese.json b/src/assets/i18n/portuguese.json index 43a76555..84113a74 100644 --- a/src/assets/i18n/portuguese.json +++ b/src/assets/i18n/portuguese.json @@ -36,7 +36,8 @@ "debounce-time": "Tempo de devolução da pesquisa", "empty": "Sem resultados. Abra no navegador?", "error": "Um erro ocorreu.", - "listings": "Encontrado {{total}}. Buscando entradas ...", + "fetch-count": "Contagem de pesquisas", + "listings": "Encontrado {{total}}. Buscando {{count}} entradas ...", "loading": "Carregando...", "mean": "Mean", "median": "Mediana", diff --git a/src/assets/i18n/russian.json b/src/assets/i18n/russian.json index 8ad656a6..6906058b 100644 --- a/src/assets/i18n/russian.json +++ b/src/assets/i18n/russian.json @@ -36,7 +36,8 @@ "debounce-time": "Время поиска", "empty": "Никаких результатов. Открыть в браузере?", "error": "Произошла ошибка.", - "listings": "Найдено {{total}}. Выборка записей ...", + "fetch-count": "Поиск Fetch Count", + "listings": "Найдено {{total}}. Извлечение {{count}} записей ...", "loading": "Загрузка ...", "mean": "Mean", "median": "медиана", diff --git a/src/assets/i18n/simplified-chinese.json b/src/assets/i18n/simplified-chinese.json index 520da8da..4d2bcab5 100644 --- a/src/assets/i18n/simplified-chinese.json +++ b/src/assets/i18n/simplified-chinese.json @@ -36,7 +36,8 @@ "debounce-time": "搜索反跳时间", "empty": "没有结果。在浏览器中打开?", "error": "发生错误。", - "listings": "找到 {{total}}。正在提取条目...", + "fetch-count": "搜索获取计数", + "listings": "找到 {{total}}。正在获取 {{count}} 个条目...", "loading": "载入中...", "mean": "平均值", "median": "中位数", diff --git a/src/assets/i18n/spanish.json b/src/assets/i18n/spanish.json index 1ddd6c91..9f9f9d11 100644 --- a/src/assets/i18n/spanish.json +++ b/src/assets/i18n/spanish.json @@ -36,7 +36,8 @@ "debounce-time": "Tiempo de rebote de búsqueda", "empty": "No hay resultados. ¿Abierta en el navegador?", "error": "Ocurrió un error.", - "listings": "Encontrado {{total}}. Obteniendo entradas ...", + "fetch-count": "Buscar recuento de búsqueda", + "listings": "Encontrado {{total}}. Obteniendo {{count}} entradas ...", "loading": "Cargando...", "mean": "Mean", "median": "Mediana", diff --git a/src/assets/i18n/thai.json b/src/assets/i18n/thai.json index 9cb2dd42..1cfb53c5 100644 --- a/src/assets/i18n/thai.json +++ b/src/assets/i18n/thai.json @@ -36,7 +36,8 @@ "debounce-time": "ค้นหาเวลาดีเลย์", "empty": "ไม่มีผลลัพธ์. เปิดในเบราว์เซอร์?", "error": "เกิดข้อผิดพลาด.", - "listings": "พบ {{total}}กำลังดึงรายการ ...", + "fetch-count": "ค้นหาจำนวนการดึงข้อมูล", + "listings": "พบ {{total}}กำลังดึงรายการ {{count}} ...", "loading": "กำลังโหลด ...", "mean": "Mean", "median": "มัธยฐาน", diff --git a/src/assets/i18n/traditional-chinese.json b/src/assets/i18n/traditional-chinese.json index 72023b6f..1dad9ccb 100644 --- a/src/assets/i18n/traditional-chinese.json +++ b/src/assets/i18n/traditional-chinese.json @@ -36,7 +36,8 @@ "debounce-time": "搜索反跳時間", "empty": "沒有結果。在瀏覽器中打開?", "error": "發生錯誤。", - "listings": "找到 {{total}}。正在提取條目...", + "fetch-count": "搜索獲取計數", + "listings": "找到 {{total}}。正在獲取 {{count}} 個條目...", "loading": "載入中...", "mean": "平均值", "median": "中位數", From 038256b55e2a2384777ed61b30a760cb9923ba55 Mon Sep 17 00:00:00 2001 From: Kyusung4698 Date: Tue, 31 Mar 2020 11:54:07 +0200 Subject: [PATCH 4/5] - 0.6.16 --- README.md | 8 ++++---- package.json | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 6dc27337..08b07d7f 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ ![GitHub Release Date](https://img.shields.io/github/release-date/Kyusung4698/PoE-Overlay) Become a Patron -# PoE Overlay 0.6.15 +# PoE Overlay 0.6.16 An Overlay for Path of Exile. The ***core aspect*** is to blend in with the game. Built with Electron and Angular. @@ -74,11 +74,11 @@ These instructions will set you up to run and enjoy the overlay. #### Installing 1. Head over to [Releases](https://github.com/Kyusung4698/PoE-Overlay/releases) and download one of the following files - 1. `poe-overlay-Setup-0.6.15.exe` to install locally. This supports auto update/ auto launch. - 2. `poe-overlay-0.6.15.exe` portable version. This does not support auto update/ auto launch. + 1. `poe-overlay-Setup-0.6.16.exe` to install locally. This supports auto update/ auto launch. + 2. `poe-overlay-0.6.16.exe` portable version. This does not support auto update/ auto launch. 2. Run either of your downloaded file 3. Start Path of Exile -4. Wait until you can see `PoE Overlay 0.6.15` in the bottom left corner +4. Wait until you can see `PoE Overlay 0.6.16` in the bottom left corner 5. Hit `f7` and set `Language` and `League` to meet your game settings #### Shortcuts diff --git a/package.json b/package.json index 2d9e7093..a1406498 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "poe-overlay", - "version": "0.6.15", + "version": "0.6.16", "private": true, "description": "A Overlay for Path of Exile. Built with Electron and Angular.", "main": "main.js", From 06f885366047e2683b0b49c9ec4dcc8e3c5f637e Mon Sep 17 00:00:00 2001 From: Kyusung4698 Date: Tue, 31 Mar 2020 12:27:09 +0200 Subject: [PATCH 5/5] Update trade-http.service.ts --- src/app/data/poe/service/trade-http.service.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/data/poe/service/trade-http.service.ts b/src/app/data/poe/service/trade-http.service.ts index 7b81b501..9993b3f4 100644 --- a/src/app/data/poe/service/trade-http.service.ts +++ b/src/app/data/poe/service/trade-http.service.ts @@ -9,7 +9,7 @@ import { TradeFetchResult, TradeItemsResult, TradeLeaguesResult, TradeResponse, const RETRY_COUNT = 3; const RETRY_DELAY = 100; -const RETRY_LIMIT_DELAY = 1000; +const RETRY_LIMIT_DELAY = 300; @Injectable({ providedIn: 'root'