Skip to content

Commit

Permalink
Add hidden apps and possibility of toggling them.
Browse files Browse the repository at this point in the history
  • Loading branch information
carlkuesters committed Dec 21, 2021
1 parent 7496d24 commit 52cd50b
Show file tree
Hide file tree
Showing 13 changed files with 48 additions and 10 deletions.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,8 @@
# launcher
Our cross-game launcher, offering the possibility to login, download, update and start games.

## How to release a new version
- Increase package.json versions (both `/package.json` and `/src/package.json`)
- git push
- npm run deploy
- Manually release the drafted github release
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "destrostudios",
"version": "1.1.6",
"version": "1.2.0",
"description": "destrostudios cross-game launcher, offering the possibility to login, download, update and start games.",
"author": "destrostudios",
"license": "MIT",
Expand Down
2 changes: 1 addition & 1 deletion src/app/core/components/header/header.component.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<header>
<img src="assets/images/logo.png">
<img src="assets/images/logo.png" (auxclick)="onLogoClick($event)">
<nav>
<a routerLink="/home" routerLinkActive="active" translate="HOME"></a>
<a routerLink="/store" routerLinkActive="active" translate="STORE"></a>
Expand Down
14 changes: 12 additions & 2 deletions src/app/core/components/header/header.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import {Component, OnInit} from '@angular/core';

import {Observable} from 'rxjs';

import {AppStoreFacadeService} from '../../services/app-store-facade/app-store-facade.service';
import {UserStoreFacadeService} from '../../services/user-store-facade/user-store-facade.service';

@Component({
Expand All @@ -13,13 +14,22 @@ export class HeaderComponent implements OnInit {

login: Observable<string>;

constructor(private userStoreFacadeService: UserStoreFacadeService) {
}
constructor(
private userStoreFacadeService: UserStoreFacadeService,
private appStoreFacadeService: AppStoreFacadeService,
) { }

ngOnInit(): void {
this.login = this.userStoreFacadeService.getLogin();
}

onLogoClick(event: MouseEvent): void {
// Middle
if (event.button === 1) {
this.appStoreFacadeService.toggleHiddenAppsInStore();
}
}

logout() {
this.userStoreFacadeService.logout();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ import {LocalAppVersion} from '../../../model/local-app-version.enum';
import * as AppActions from '../../../store/actions/app.actions';
import {getFeaturedApp, isSelectedAppOwned_Store} from '../../../store/selectors/aggregation.selectors';
import {
getApps,
getLibrarySearchText,
getSelectedApp_Library,
getSelectedApp_Library_IsStarting,
getSelectedApp_Library_LocalVersion,
getSelectedApp_Library_UpdateProgressText,
getSelectedApp_Store,
getStoreApps,
isSomeLocalAppUpdating
} from '../../../store/selectors/app.selectors';
import {AppState} from '../../../store/state/app-state.model';
Expand All @@ -29,8 +29,8 @@ export class AppStoreFacadeService {
return this.store.select(getFeaturedApp);
}

getApps(): Observable<App[]> {
return this.store.select(getApps);
getStoreApps(): Observable<App[]> {
return this.store.select(getStoreApps);
}

getSelectedApp_Store(): Observable<App> {
Expand Down Expand Up @@ -92,4 +92,8 @@ export class AppStoreFacadeService {
updateApp(appId: number): void {
this.store.dispatch(AppActions.updateApp({ appId }));
}

toggleHiddenAppsInStore(): void {
this.store.dispatch(AppActions.toggleHiddenAppsInStore());
}
}
1 change: 1 addition & 0 deletions src/app/model/app.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@ export interface App {
readonly date: string;
readonly description: string;
readonly executable: string;
readonly hidden: boolean;
}
2 changes: 1 addition & 1 deletion src/app/pages/store/store.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export class StoreComponent implements OnInit, OnDestroy {

ngOnInit(): void {
this.featuredApp = this.appStoreFacadeService.getFeaturedApp();
this.apps = this.appStoreFacadeService.getApps();
this.apps = this.appStoreFacadeService.getStoreApps();
this.selectedApp = this.appStoreFacadeService.getSelectedApp_Store();

this.subscriptions = [
Expand Down
1 change: 1 addition & 0 deletions src/app/store/actions/app.actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,4 @@ export const updateApp = createAction('[App] Update app', props<{ appId: number
export const setUpdateProgress = createAction('[App] Set update progress', props<{ appId: number, updateProgress: number }>());
export const setUpdateError = createAction('[App] Set update error', props<{ appId: number }>());
export const setUpdateFinished = createAction('[App] Set update finished', props<{ appId: number }>());
export const toggleHiddenAppsInStore = createAction('[App] Toggle hidden apps in store');
5 changes: 5 additions & 0 deletions src/app/store/reducers/app.reducers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {AppState} from '../state/app-state.model';
const initialState: AppState = {
apps: null,
localApps: null,
displayHiddenAppsInStore: false,
selectedAppId_Store: null,
selectedAppId_Library: null,
librarySearchText: '',
Expand Down Expand Up @@ -147,6 +148,10 @@ const reducer = createReducer(
updateProgress: null
}))
})),
on(AppActions.toggleHiddenAppsInStore, state => ({
...state,
displayHiddenAppsInStore: !state.displayHiddenAppsInStore,
})),
);

// @ts-ignore
Expand Down
10 changes: 10 additions & 0 deletions src/app/store/selectors/app.selectors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,16 @@ export const isSomeLocalAppUpdating = createSelector(
getLocalApps, localApps => localApps ? localApps.some(localApp => localApp.version === LocalAppVersion.UPDATING) : null
);

export const isDisplayHiddenAppsInStore = createSelector(
getUserState, state => state.displayHiddenAppsInStore
);

export const getStoreApps = createSelector(
getApps, isDisplayHiddenAppsInStore, (apps, displayHiddenAppsInStore) => {
return (displayHiddenAppsInStore ? apps : apps.filter(app => !app.hidden));
}
);

export const getSelectedApp_Store = createSelector(
getUserState, state => (state.apps && state.apps.data) ? getApp(state.apps.data, state.selectedAppId_Store) : null
);
Expand Down
1 change: 1 addition & 0 deletions src/app/store/state/app-state.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {HttpData} from './http-data.model';
export interface AppState {
readonly apps: HttpData<App[]>;
readonly localApps: LocalApp[];
readonly displayHiddenAppsInStore: boolean;
readonly selectedAppId_Store: number;
readonly selectedAppId_Library: number;
readonly librarySearchText: string;
Expand Down
2 changes: 1 addition & 1 deletion src/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "destrostudios",
"version": "1.1.6",
"version": "1.2.0",
"description": "Destrostudios cross-game launcher, offering the possibility to login, download, update and start games.",
"author": "destrostudios",
"main": "electron-main.js",
Expand Down

0 comments on commit 52cd50b

Please sign in to comment.