Skip to content

Commit bafccda

Browse files
author
Pawan Jenu
committed
adding asserts and manifest
1 parent e1bce60 commit bafccda

File tree

16 files changed

+27
-21
lines changed

16 files changed

+27
-21
lines changed

src/app/app.component.ts

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import {
22
ChangeDetectorRef,
33
Component,
44
EventEmitter,
5+
NgZone,
56
Output,
67
} from '@angular/core';
78
import { FormBuilder } from '@angular/forms';
@@ -37,7 +38,8 @@ export class AppComponent {
3738
private formBuilder: FormBuilder,
3839
private _appService: SrcService,
3940
private cdRef: ChangeDetectorRef,
40-
private _snackBarService: SnackbarService
41+
private _snackBarService: SnackbarService,
42+
private ngZone: NgZone
4143
) {
4244
chrome.storage.local.get('sessions', async (data2) => {
4345
console.debug('reading local sessions', data2.sessions);
@@ -97,14 +99,7 @@ export class AppComponent {
9799

98100
if (!Array.isArray(sessions) || !sessions.length) {
99101
console.debug('unable to get sessions');
100-
this._snackBarService.show(
101-
AppStringLiterals.LEETCODE_SESSION_ERROR,
102-
'failure',
103-
undefined,
104-
{
105-
duration: 3000,
106-
}
107-
);
102+
this.showSessionError();
108103
} else {
109104
this.isLoading = false;
110105
console.debug('Fetched sessions: ', sessions);
@@ -116,17 +111,9 @@ export class AppComponent {
116111
} catch (err) {
117112
this.isLoading = false;
118113
console.debug('unable to get sessions:', err);
119-
this._snackBarService.show(
120-
AppStringLiterals.LEETCODE_SESSION_ERROR,
121-
'failure',
122-
undefined,
123-
{
124-
duration: 2000,
125-
}
126-
);
114+
this.showSessionError();
127115
}
128116
this.isLoading = false;
129-
this.cdRef.detectChanges();
130117
}
131118

132119
/**
@@ -139,4 +126,19 @@ export class AppComponent {
139126
// refresh leetcode sessions
140127
await this.refreshLeetcodeSessions();
141128
}
129+
130+
showSessionError(){
131+
this.ngZone.run(() => {
132+
setTimeout(() => {
133+
this._snackBarService.show(
134+
AppStringLiterals.LEETCODE_SESSION_ERROR,
135+
'failure',
136+
undefined,
137+
{
138+
duration: 1000,
139+
}
140+
);
141+
}, 0);
142+
});
143+
}
142144
}

src/assets/PageLogo.png

44.7 KB
Loading

src/assets/extension/authorize.png

149 KB
Loading

src/assets/extension/hook.jpg

75.9 KB
Loading

src/assets/extension/leetcode.png

244 KB
Loading

src/assets/extension/logo_128.png

9.66 KB
Loading
4.82 KB
Loading

src/assets/extension/output.gif

6.43 MB
Loading

src/assets/extension/popup.png

31.7 KB
Loading
442 KB
Loading

0 commit comments

Comments
 (0)