Skip to content

Commit

Permalink
refactor DI into inject() methods (#3954)
Browse files Browse the repository at this point in the history
  • Loading branch information
dominikiwanekhyland authored and swapnil-verma-gl committed Oct 14, 2024
1 parent 4894fb1 commit 6412bc9
Show file tree
Hide file tree
Showing 7 changed files with 49 additions and 49 deletions.
7 changes: 4 additions & 3 deletions projects/aca-content/ms-office/src/effects/aos.effects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,17 @@
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
*/

import { Injectable } from '@angular/core';
import { Actions, ofType, createEffect } from '@ngrx/effects';
import { inject, Injectable } from '@angular/core';
import { Actions, createEffect, ofType } from '@ngrx/effects';
import { map } from 'rxjs/operators';

import { AOS_ACTION, AosAction } from '../actions/aos.actions';
import { AosEditOnlineService } from '../aos-extension.service';

@Injectable()
export class AosEffects {
constructor(private actions$: Actions, private aosEditOnlineService: AosEditOnlineService) {}
private actions$ = inject(Actions);
private aosEditOnlineService = inject(AosEditOnlineService);

openOffice$ = createEffect(
() =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
*/

import { ContextMenuActionTypes, ContextMenu } from '@alfresco/aca-shared/store';
import { Injectable } from '@angular/core';
import { Actions, ofType, createEffect } from '@ngrx/effects';
import { ContextMenu, ContextMenuActionTypes } from '@alfresco/aca-shared/store';
import { inject, Injectable } from '@angular/core';
import { Actions, createEffect, ofType } from '@ngrx/effects';
import { map } from 'rxjs/operators';
import { ContextMenuOverlayRef } from '../../components/context-menu/context-menu-overlay';
import { ContextMenuService } from '../../components/context-menu/context-menu.service';
Expand All @@ -33,7 +33,8 @@ import { ContextMenuService } from '../../components/context-menu/context-menu.s
export class ContextMenuEffects {
private overlayRef: ContextMenuOverlayRef = null;

constructor(private contextMenuService: ContextMenuService, private actions$: Actions) {}
contextMenuService = inject(ContextMenuService);
actions$ = inject(Actions);

contextMenu$ = createEffect(
() =>
Expand Down
18 changes: 8 additions & 10 deletions projects/aca-content/src/lib/store/effects/download.effects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,26 +22,24 @@
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
*/

import { AppStore, DownloadNodesAction, NodeActionTypes, NodeInfo, getAppSelection, getCurrentVersion } from '@alfresco/aca-shared/store';
import { AppStore, DownloadNodesAction, getAppSelection, getCurrentVersion, NodeActionTypes, NodeInfo } from '@alfresco/aca-shared/store';
import { DownloadZipDialogComponent } from '@alfresco/adf-content-services';
import { NodeEntry, Version } from '@alfresco/js-api';
import { Injectable } from '@angular/core';
import { inject, Injectable } from '@angular/core';
import { MatDialog } from '@angular/material/dialog';
import { Actions, ofType, createEffect } from '@ngrx/effects';
import { Actions, createEffect, ofType } from '@ngrx/effects';
import { Store } from '@ngrx/store';
import { map, take } from 'rxjs/operators';
import { ContentApiService } from '@alfresco/aca-shared';
import { ContentUrlService } from '../../services/content-url.service';

@Injectable()
export class DownloadEffects {
constructor(
private store: Store<AppStore>,
private actions$: Actions,
private contentApi: ContentApiService,
private dialog: MatDialog,
private contentUrlService: ContentUrlService
) {}
private store = inject(Store<AppStore>);
private actions$ = inject(Actions);
private contentApi = inject(ContentApiService);
private dialog = inject(MatDialog);
private contentUrlService = inject(ContentUrlService);

downloadNode$ = createEffect(
() =>
Expand Down
10 changes: 6 additions & 4 deletions projects/aca-content/src/lib/store/effects/favorite.effects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,18 @@
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
*/

import { Actions, ofType, createEffect } from '@ngrx/effects';
import { Injectable } from '@angular/core';
import { Actions, createEffect, ofType } from '@ngrx/effects';
import { inject, Injectable } from '@angular/core';
import { map, take } from 'rxjs/operators';
import { AppStore, NodeActionTypes, AddFavoriteAction, RemoveFavoriteAction, getAppSelection } from '@alfresco/aca-shared/store';
import { AddFavoriteAction, AppStore, getAppSelection, NodeActionTypes, RemoveFavoriteAction } from '@alfresco/aca-shared/store';
import { Store } from '@ngrx/store';
import { ContentManagementService } from '../../services/content-management.service';

@Injectable()
export class FavoriteEffects {
constructor(private store: Store<AppStore>, private actions$: Actions, private content: ContentManagementService) {}
private store = inject(Store<AppStore>);
private actions$ = inject(Actions);
private content = inject(ContentManagementService);

addFavorite$ = createEffect(
() =>
Expand Down
8 changes: 5 additions & 3 deletions projects/aca-content/src/lib/store/effects/search.effects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,18 @@
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
*/

import { Actions, ofType, createEffect } from '@ngrx/effects';
import { Injectable } from '@angular/core';
import { Actions, createEffect, ofType } from '@ngrx/effects';
import { inject, Injectable } from '@angular/core';
import { map } from 'rxjs/operators';
import { SearchAction, SearchActionTypes, SearchByTermAction, SearchOptionIds } from '@alfresco/aca-shared/store';
import { Router } from '@angular/router';
import { SearchNavigationService } from '../../components/search/search-navigation.service';

@Injectable()
export class SearchEffects {
constructor(private actions$: Actions, private router: Router, private searchNavigationService: SearchNavigationService) {}
private actions$ = inject(Actions);
private router = inject(Router);
private searchNavigationService = inject(SearchNavigationService);

search$ = createEffect(
() =>
Expand Down
30 changes: 14 additions & 16 deletions projects/aca-content/src/lib/store/effects/viewer.effects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,22 +22,22 @@
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
*/

import { Actions, ofType, createEffect } from '@ngrx/effects';
import { Injectable } from '@angular/core';
import { Actions, createEffect, ofType } from '@ngrx/effects';
import { inject, Injectable } from '@angular/core';
import { map, take, tap } from 'rxjs/operators';
import {
AppStore,
FullscreenViewerAction,
getAppSelection,
getCurrentFolder,
PluginPreviewAction,
ViewerActionTypes,
ViewFileAction,
ViewNodeAction,
getCurrentFolder,
getAppSelection,
FullscreenViewerAction,
ViewNodeVersionAction,
PluginPreviewAction
ViewNodeVersionAction
} from '@alfresco/aca-shared/store';
import { Router, UrlTree, UrlSegmentGroup, PRIMARY_OUTLET, UrlSegment } from '@angular/router';
import { Store, createSelector } from '@ngrx/store';
import { PRIMARY_OUTLET, Router, UrlSegment, UrlSegmentGroup, UrlTree } from '@angular/router';
import { createSelector, Store } from '@ngrx/store';
import { AppExtensionService } from '@alfresco/aca-shared';
import { MatDialog } from '@angular/material/dialog';

Expand All @@ -48,13 +48,11 @@ export const fileToPreview = createSelector(getAppSelection, getCurrentFolder, (

@Injectable()
export class ViewerEffects {
constructor(
private store: Store<AppStore>,
private actions$: Actions,
private router: Router,
private extensions: AppExtensionService,
private dialog: MatDialog
) {}
private store = inject(Store<AppStore>);
private actions$ = inject(Actions);
private router = inject(Router);
private extensions = inject(AppExtensionService);
private dialog = inject(MatDialog);

fullscreenViewer$ = createEffect(
() =>
Expand Down
16 changes: 7 additions & 9 deletions projects/aca-shared/store/src/effects/snackbar.effects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,22 +23,20 @@
*/

import { SnackbarContentComponent, SnackBarData, TranslationService } from '@alfresco/adf-core';
import { Injectable } from '@angular/core';
import { inject, Injectable } from '@angular/core';
import { MatSnackBar } from '@angular/material/snack-bar';
import { Actions, ofType, createEffect } from '@ngrx/effects';
import { Actions, createEffect, ofType } from '@ngrx/effects';
import { Store } from '@ngrx/store';
import { map } from 'rxjs/operators';
import { AppStore } from '../states/app.state';
import { SnackbarInfoAction, SnackbarActionTypes, SnackbarWarningAction, SnackbarErrorAction, SnackbarAction } from '../actions/snackbar.actions';
import { SnackbarAction, SnackbarActionTypes, SnackbarErrorAction, SnackbarInfoAction, SnackbarWarningAction } from '../actions/snackbar.actions';

@Injectable()
export class SnackbarEffects {
constructor(
private store: Store<AppStore>,
private actions$: Actions,
private snackBar: MatSnackBar,
private translationService: TranslationService
) {}
private store = inject(Store<AppStore>);
private actions$ = inject(Actions);
private snackBar = inject(MatSnackBar);
private translationService = inject(TranslationService);

infoEffect = createEffect(
() =>
Expand Down

0 comments on commit 6412bc9

Please sign in to comment.