Skip to content

Commit

Permalink
Merge pull request #523 from Kyusung4698/develop
Browse files Browse the repository at this point in the history
0.6.16 (2020-03-31)
  • Loading branch information
Kyusung4698 authored Mar 31, 2020
2 parents bffa589 + 06f8853 commit 089dc73
Show file tree
Hide file tree
Showing 39 changed files with 266 additions and 87 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Changelog

## 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)

- fix an error occured while fetching poe.ninja (#468)
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
![GitHub Release Date](https://img.shields.io/github/release-date/Kyusung4698/PoE-Overlay)
<a href="https://www.patreon.com/bePatron?u=30666721"><img src="https://c5.patreon.com/external/logo/become_a_patron_button.png" alt="Become a Patron" width="85px" height="20px"></a>

# 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.

Expand Down Expand Up @@ -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
Expand Down
53 changes: 53 additions & 0 deletions overlay.babel
Original file line number Diff line number Diff line change
Expand Up @@ -1421,6 +1421,59 @@
</translation>
</translations>
</concept_node>
<concept_node>
<name>fetch-count</name>
<definition_loaded>false</definition_loaded>
<description></description>
<comment></comment>
<default_text></default_text>
<translations>
<translation>
<language>de-DE</language>
<approved>false</approved>
</translation>
<translation>
<language>en-US</language>
<approved>false</approved>
</translation>
<translation>
<language>es-ES</language>
<approved>false</approved>
</translation>
<translation>
<language>fr-FR</language>
<approved>false</approved>
</translation>
<translation>
<language>ko-KR</language>
<approved>false</approved>
</translation>
<translation>
<language>pl-PL</language>
<approved>false</approved>
</translation>
<translation>
<language>pt-BR</language>
<approved>false</approved>
</translation>
<translation>
<language>ru-RU</language>
<approved>false</approved>
</translation>
<translation>
<language>th-TH</language>
<approved>false</approved>
</translation>
<translation>
<language>zh-CHS</language>
<approved>false</approved>
</translation>
<translation>
<language>zh-CHT</language>
<approved>false</approved>
</translation>
</translations>
</concept_node>
<concept_node>
<name>listings</name>
<definition_loaded>false</definition_loaded>
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
1 change: 1 addition & 0 deletions src/app/core/service/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';

64 changes: 64 additions & 0 deletions src/app/core/service/session.service.ts
Original file line number Diff line number Diff line change
@@ -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<void> {
const tasks = [
this.clearCache(),
this.clearHostResolverCache()
];

return forkJoin(tasks).pipe(
map(() => null)
);
}

public clearCache(): Observable<void> {
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<void> {
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;
}
}
Original file line number Diff line number Diff line change
@@ -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';
Expand Down Expand Up @@ -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`;
}
Expand All @@ -37,8 +38,7 @@ export class CurrencyOverviewHttpService {
fromObject: {
league: leagueId,
type,
language: 'en',
t: `${Date.now()}`
language: 'en'
}
});
return this.httpClient.get<CurrencyOverviewResponse>(this.apiUrl, {
Expand Down Expand Up @@ -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));
}
}
}
8 changes: 4 additions & 4 deletions src/app/data/poe-ninja/service/item-overview-http.service.ts
Original file line number Diff line number Diff line change
@@ -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';
Expand Down Expand Up @@ -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`;
}
Expand All @@ -65,8 +66,7 @@ export class ItemOverviewHttpService {
fromObject: {
league: leagueId,
type,
language: 'en',
t: `${Date.now()}`
language: 'en'
}
});
return this.httpClient.get<ItemOverviewResponse>(this.apiUrl, {
Expand Down Expand Up @@ -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));
}
}
}
7 changes: 4 additions & 3 deletions src/app/data/poe/service/trade-http.service.ts
Original file line number Diff line number Diff line change
@@ -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';
Expand All @@ -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<TradeResponse<TradeItemsResult>> {
const url = this.getApiUrl('data/items', language);
Expand Down Expand Up @@ -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));
}
}

Expand Down
4 changes: 3 additions & 1 deletion src/app/layout/page/overlay/overlay.component.ts
Original file line number Diff line number Diff line change
@@ -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';
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -92,6 +93,7 @@ export class OverlayComponent implements OnInit, OnDestroy {
}
});
this.app.registerEvents(settings.autoDownload);
this.session.registerEvents();
}

private registerVisibleChange(): void {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
</ng-container>
<ng-template #listing>
<div class="clickable" (click)="onSearchCancelClick()">
{{'evaluate.listings' | translate:{total: search.total | number} }}&nbsp;<span
{{'evaluate.listings' | translate:{total: search.total | number, count: (count$ | async) | number} }}&nbsp;<span
class="delayed">{{ 'evaluate.cancel' | translate }}</span>
</div>
<mat-progress-bar mode="indeterminate"></mat-progress-bar>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -22,6 +22,7 @@ export class EvaluateSearchComponent implements OnInit {
public graph: boolean;

public search$ = new BehaviorSubject<ItemSearchResult>(null);
public count$ = new BehaviorSubject<number>(0);
public listings$ = new BehaviorSubject<ItemSearchListing[]>(null);
public result$ = new BehaviorSubject<ItemSearchAnalyzeResult>(null);
public error$ = new BehaviorSubject<boolean>(false);
Expand Down Expand Up @@ -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;
Expand All @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,22 @@
</mat-option>
</mat-select>
</mat-form-field>
<div class="time">
<div class="value-range">
<label class="label"> {{'evaluate.debounce-time' | translate}}:
{{displayWithTime(settings.evaluateQueryDebounceTime)}}
</label>
<mat-slider min="5" max="100" step="5" tickInterval="2" [displayWith]="displayWithTime"
<mat-slider min="5" [max]="debounceTimeMax" step="5" tickInterval="2" [displayWith]="displayWithTime"
[(value)]="settings.evaluateQueryDebounceTime">
</mat-slider>
</div>
<div class="value-range">
<label class="label"> {{'evaluate.fetch-count' | translate}}:
{{displayWithCount(settings.evaluateQueryFetchCount)}}
</label>
<mat-slider min="10" [max]="fetchCountMax" step="10" tickInterval="1" [displayWith]="displayWithCount"
[(value)]="settings.evaluateQueryFetchCount">
</mat-slider>
</div>

<app-accelerator [label]="'evaluate.name' | translate" [(value)]="settings.evaluateKeybinding">
</app-accelerator>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ label {
}
}

.time {
.value-range {
.mat-slider {
width: 100%;
}
Expand Down
Loading

0 comments on commit 089dc73

Please sign in to comment.