@@ -87,17 +87,11 @@ export function loginFromSavedState(saved_state: any) {
87
87
} ) ;
88
88
89
89
// This try/catch might be able to detect invalid saved state, as
90
- // firebase will probably throw an error
90
+ // it will probably throw an error
91
91
try {
92
- const user = new notion . api . firebase . app . firebase_ . User (
93
- saved_state ,
94
- saved_state . stsTokenManager ,
95
- saved_state
96
- ) ;
97
-
98
- notion . api . firebase . app
92
+ notion
99
93
. auth ( )
100
- . updateCurrentUser ( user )
94
+ . updateCurrentUser ( saved_state )
101
95
. then ( ( ) => {
102
96
logged_in = true ;
103
97
if ( login_callback ) login_callback ( ) ;
@@ -159,23 +153,29 @@ function getOrPrompt(section: string, prompt: string, placeHolder?: string) {
159
153
* @param sections - 2d array, where each item is an array of params passed to getOrPrompt()
160
154
*/
161
155
function ensureConfigValues ( sections : string [ ] [ ] ) {
162
- return new Promise < ( string | undefined ) [ ] > ( async ( resolve , reject ) => {
163
- let values : ( string | undefined ) [ ] = [ ] ;
164
-
165
- for ( let i = 0 ; i < sections . length ; i ++ ) {
166
- let params = sections [ i ] ;
167
-
168
- try {
169
- let value = await getOrPrompt ( params [ 0 ] , params [ 1 ] , params [ 2 ] ) ;
170
- values . push ( value ) ;
171
- } catch ( error ) {
172
- reject ( error ) ;
173
- return ;
156
+ return new Promise < ( string | undefined ) [ ] > (
157
+ async ( resolve , reject ) => {
158
+ let values : ( string | undefined ) [ ] = [ ] ;
159
+
160
+ for ( let i = 0 ; i < sections . length ; i ++ ) {
161
+ let params = sections [ i ] ;
162
+
163
+ try {
164
+ let value = await getOrPrompt (
165
+ params [ 0 ] ,
166
+ params [ 1 ] ,
167
+ params [ 2 ]
168
+ ) ;
169
+ values . push ( value ) ;
170
+ } catch ( error ) {
171
+ reject ( error ) ;
172
+ return ;
173
+ }
174
174
}
175
- }
176
175
177
- resolve ( values ) ;
178
- } ) ;
176
+ resolve ( values ) ;
177
+ }
178
+ ) ;
179
179
}
180
180
181
181
function handleLogin ( method : vscode . QuickPickItem | undefined ) {
@@ -186,7 +186,6 @@ function handleLogin(method: vscode.QuickPickItem | undefined) {
186
186
187
187
// Login with email
188
188
if ( method . label == email_label ) {
189
- // See: https://firebase.google.com/docs/auth/web/email-link-auth
190
189
ensureConfigValues ( [
191
190
[ "email" , email_prompt , email_placeholder ] ,
192
191
[ "deviceId" , deviceid_prompt , deviceid_placeholder ]
@@ -225,7 +224,7 @@ function sendLoginEmail() {
225
224
deviceId
226
225
} ) ;
227
226
228
- notion . api . firebase . app
227
+ notion
229
228
. auth ( )
230
229
. sendSignInLinkToEmail ( email , {
231
230
url : "https://console.neurosity.co/vscode" ,
@@ -256,16 +255,16 @@ function loginWithEmailCred() {
256
255
deviceId
257
256
} ) ;
258
257
259
- // This is very hacky, should clean up firebase API usage
258
+ // This is very hacky, should clean up API usage
260
259
try {
261
- let credential = notion . api . firebase . app . firebase_ . auth . EmailAuthProvider . credentialWithLink (
260
+ let credential = Notion . credentialWithLink (
262
261
email ,
263
262
"https://console.neurosity.co/account-manager?apiKey=none&mode=signIn&oobCode=" +
264
263
code +
265
264
"&continueUrl=https://console.neurosity.co/vscode&lang=en"
266
265
) ;
267
266
268
- notion . api . firebase . app
267
+ notion
269
268
. auth ( )
270
269
. signInWithCredential ( credential )
271
270
. then (
0 commit comments