@@ -89,17 +89,11 @@ export function loginFromSavedState(saved_state: any) {
89
89
} ) ;
90
90
91
91
// This try/catch might be able to detect invalid saved state, as
92
- // firebase will probably throw an error
92
+ // it will probably throw an error
93
93
try {
94
- const user = new notion . api . firebase . app . firebase_ . User (
95
- saved_state ,
96
- saved_state . stsTokenManager ,
97
- saved_state
98
- ) ;
99
-
100
- notion . api . firebase . app
94
+ notion
101
95
. auth ( )
102
- . updateCurrentUser ( user )
96
+ . updateCurrentUser ( saved_state )
103
97
. then ( ( ) => {
104
98
logged_in = true ;
105
99
if ( login_callback ) login_callback ( ) ;
@@ -165,23 +159,29 @@ function getOrPrompt(
165
159
* @param sections - 2d array, where each item is an array of params passed to getOrPrompt()
166
160
*/
167
161
function ensureConfigValues ( sections : string [ ] [ ] ) {
168
- return new Promise < ( string | undefined ) [ ] > ( async ( resolve , reject ) => {
169
- let values : ( string | undefined ) [ ] = [ ] ;
170
-
171
- for ( let i = 0 ; i < sections . length ; i ++ ) {
172
- let params = sections [ i ] ;
173
-
174
- try {
175
- let value = await getOrPrompt ( params [ 0 ] , params [ 1 ] , params [ 2 ] ) ;
176
- values . push ( value ) ;
177
- } catch ( error ) {
178
- reject ( error ) ;
179
- return ;
162
+ return new Promise < ( string | undefined ) [ ] > (
163
+ async ( resolve , reject ) => {
164
+ let values : ( string | undefined ) [ ] = [ ] ;
165
+
166
+ for ( let i = 0 ; i < sections . length ; i ++ ) {
167
+ let params = sections [ i ] ;
168
+
169
+ try {
170
+ let value = await getOrPrompt (
171
+ params [ 0 ] ,
172
+ params [ 1 ] ,
173
+ params [ 2 ]
174
+ ) ;
175
+ values . push ( value ) ;
176
+ } catch ( error ) {
177
+ reject ( error ) ;
178
+ return ;
179
+ }
180
180
}
181
- }
182
181
183
- resolve ( values ) ;
184
- } ) ;
182
+ resolve ( values ) ;
183
+ }
184
+ ) ;
185
185
}
186
186
187
187
function handleLogin ( method : vscode . QuickPickItem | undefined ) {
@@ -192,7 +192,6 @@ function handleLogin(method: vscode.QuickPickItem | undefined) {
192
192
193
193
// Login with email
194
194
if ( method . label == email_label ) {
195
- // See: https://firebase.google.com/docs/auth/web/email-link-auth
196
195
ensureConfigValues ( [
197
196
[ "email" , email_prompt , email_placeholder ] ,
198
197
[ "deviceId" , deviceid_prompt , deviceid_placeholder ]
@@ -232,7 +231,7 @@ function sendLoginEmail() {
232
231
deviceId
233
232
} ) ;
234
233
235
- notion . api . firebase . app
234
+ notion
236
235
. auth ( )
237
236
. sendSignInLinkToEmail ( email , {
238
237
url : "https://console.neurosity.co/vscode" ,
@@ -266,16 +265,16 @@ function loginWithEmailCred() {
266
265
deviceId
267
266
} ) ;
268
267
269
- // This is very hacky, should clean up firebase API usage
268
+ // This is very hacky, should clean up API usage
270
269
try {
271
- let credential = notion . api . firebase . app . firebase_ . auth . EmailAuthProvider . credentialWithLink (
270
+ let credential = Notion . credentialWithLink (
272
271
email ,
273
272
"https://console.neurosity.co/account-manager?apiKey=none&mode=signIn&oobCode=" +
274
273
code +
275
274
"&continueUrl=https://console.neurosity.co/vscode&lang=en"
276
275
) ;
277
276
278
- notion . api . firebase . app
277
+ notion
279
278
. auth ( )
280
279
. signInWithCredential ( credential )
281
280
. then (
0 commit comments