Skip to content

Commit d4e2294

Browse files
committed
chore: remove deprecated SnackBarOpts#additionalOpts usages
1 parent 19c33d8 commit d4e2294

9 files changed

Lines changed: 14 additions & 27 deletions

File tree

src/app/app.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ export class AppComponent implements OnInit {
158158
this.auth.logOut().then((res) => {
159159
const snackbarRef = this.shared.openSnackBar({
160160
msg: 'Signed out',
161-
additionalOpts: {
161+
config: {
162162
duration: 4000,
163163
horizontalPosition: 'start'
164164
}

src/app/dialogs/new-project-dialog/new-project-dialog.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ export class NewProjectDialogComponent {
9797
}, error => {
9898
this.shared.openSnackBar({
9999
msg: `An error occurred: ${error.message}`,
100-
additionalOpts: {
100+
config: {
101101
duration: 6000
102102
}
103103
});

src/app/dialogs/todo-dialog/todo-dialog.component.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ export class TodoDialogComponent implements OnInit {
232232
}, error => {
233233
this.shared.openSnackBar({
234234
msg: `An error occurred: ${error.message}`,
235-
additionalOpts: {
235+
config: {
236236
duration: 6000
237237
}
238238
});
@@ -250,7 +250,7 @@ export class TodoDialogComponent implements OnInit {
250250
}, error => {
251251
this.shared.openSnackBar({
252252
msg: `An error occurred: ${error.message}`,
253-
additionalOpts: { duration: 6000 }
253+
config: { duration: 6000 }
254254
});
255255
console.error(`An error occurred: ${error.message}`);
256256
});

src/app/pages/auth/login/login.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ export class LoginComponent implements OnDestroy {
7575
this.auth.resetPassword(result).then(_ => {
7676
this.shared.openSnackBar({
7777
msg: 'Your password has successfully been reset! An email will shortly be sent your way to update your password.',
78-
additionalOpts: { duration: 6000 }
78+
config: { duration: 6000 }
7979
});
8080
}).catch(error => {
8181
this.shared.openSnackBar({ msg: `Error: ${error.message}` });

src/app/pages/auth/register/register.component.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,7 @@ export class RegisterComponent implements OnDestroy, OnInit {
4242
{
4343
msg: 'You\'re already logged in! Redirecting in 2 seconds...',
4444
action: 'Log out',
45-
additionalOpts:
46-
{
47-
duration: 5000
48-
}
45+
config: { duration: 5000 }
4946
}
5047
);
5148
snackBarRef.onAction().subscribe(() => {

src/app/pages/develop/shared-service/shared-service.component.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ export class DevelopSharedServiceComponent {
6666
openSnackBar() {
6767
this.shared.openSnackBar({
6868
msg: this.getValOrReturnDefault(this.snackbar.snackBarMsg, 'I\'m a snackbar!'),
69-
additionalOpts: {
69+
config: {
7070
horizontalPosition: this.snackbar.horizontalPosition,
7171
verticalPosition: this.snackbar.verticalPosition,
7272
panelClass: this.snackbar.panelClass
@@ -78,7 +78,7 @@ export class DevelopSharedServiceComponent {
7878
openErrorSnackBar() {
7979
this.shared.openSnackBar({
8080
msg: this.getValOrReturnDefault(this.snackbar.snackBarMsg, 'Error: Something happened'),
81-
additionalOpts: {
81+
config: {
8282
duration: 5000
8383
}
8484
});
@@ -87,7 +87,7 @@ export class DevelopSharedServiceComponent {
8787
openDurationSnackBar() {
8888
this.shared.openSnackBar({
8989
msg: this.getValOrReturnDefault(this.snackbar.snackBarMsg, 'I\'m a duration snackbar!'),
90-
additionalOpts: {
90+
config: {
9191
duration: this.snackbar.duration ? this.snackbar.duration : 5000,
9292
horizontalPosition: this.snackbar.horizontalPosition,
9393
verticalPosition: this.snackbar.verticalPosition,
@@ -101,8 +101,7 @@ export class DevelopSharedServiceComponent {
101101
const snackBarRef = this.shared.openSnackBar({
102102
msg: this.getValOrReturnDefault(this.snackbar.snackBarMsg, 'I\'m a snackbar with an action!'),
103103
action: this.snackbar.action,
104-
additionalOpts:
105-
{
104+
config: {
106105
horizontalPosition: this.snackbar.horizontalPosition,
107106
verticalPosition: this.snackbar.verticalPosition,
108107
panelClass: this.snackbar.panelClass

src/app/shared.service.ts

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,6 @@ export interface SnackBarOpts<D = any> {
1818
component?: ComponentType<any>;
1919
/** Configuration for the snackbar. */
2020
config?: MatSnackBarConfig<D>;
21-
/**
22-
* Additional options for the snackbar.
23-
* @deprecated Use {@link SnackBarOpts#config} instead
24-
*/
25-
additionalOpts?: MatSnackBarConfig<D>;
2621
}
2722

2823
// Shared service
@@ -112,15 +107,11 @@ export class SharedService {
112107
}
113108

114109
private handleSnackBar(opts: SnackBarOpts): MatSnackBarRef<SimpleSnackBar> {
115-
// eslint-disable-next-line import/no-deprecated
116-
const config = opts.config ? opts.config : opts.additionalOpts;
117-
return this.snackBar.open(opts.msg, opts.action ? opts.action : undefined, config);
110+
return this.snackBar.open(opts.msg, opts.action ? opts.action : undefined, opts.config);
118111
}
119112

120113
private handleSnackBarWithComponent(opts: SnackBarOpts): MatSnackBarRef<any> {
121-
// eslint-disable-next-line import/no-deprecated
122-
const config = opts.config ? opts.config : opts.additionalOpts;
123-
return this.snackBar.openFromComponent(opts.component, config);
114+
return this.snackBar.openFromComponent(opts.component, opts.config);
124115
}
125116

126117
/** Closes the current snackbar. */

src/app/tips/tips.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ export class TipsComponent implements OnInit {
5757
this.hideProgress();
5858
this.shared.openSnackBar({
5959
msg: `Error: ${error.message}`,
60-
additionalOpts: { duration: 6000 }
60+
config: { duration: 6000 }
6161
});
6262
console.error('Error: ', error.message);
6363
}

src/app/todo/todo-home/todo-home.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ export class TodoHomeComponent implements OnInit, AfterViewInit, OnDestroy {
206206
this.shared.openSnackBar({
207207
msg: `An error occurred while attempting to archive the todo: ${error.message}`,
208208
action: 'Retry',
209-
additionalOpts: {
209+
config: {
210210
duration: 8000
211211
}
212212
})

0 commit comments

Comments
 (0)