Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# This file is pre-built and need not be formatted
packages/auth
packages/firebase/firebase*
packages/firestore/scripts
dist
3 changes: 1 addition & 2 deletions packages/auth/demo/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ import {
logAtLevel_
} from './logging';

/**
/**
* Constants that are used when connecting to the Auth Emulator.
*/
const USE_AUTH_EMULATOR = false;
Expand Down Expand Up @@ -1658,7 +1658,6 @@ function initApp() {
if (USE_AUTH_EMULATOR) {
connectAuthEmulator(auth, AUTH_EMULATOR_URL);
}


tempApp = initializeApp(
{
Expand Down
46 changes: 21 additions & 25 deletions packages/auth/demo/src/worker/service-worker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,18 +76,16 @@ function getOriginFromUrl(url: string): string {

self.addEventListener('install', (event: ExtendableEvent) => {
// Perform install steps.
event.waitUntil(
async (): Promise<void> => {
const cache = await caches.open(CACHE_NAME);
// Add all URLs of resources we want to cache.
try {
await cache.addAll(urlsToCache);
} catch {
// Suppress error as some of the files may not be available for the
// current page.
}
event.waitUntil(async (): Promise<void> => {
const cache = await caches.open(CACHE_NAME);
// Add all URLs of resources we want to cache.
try {
await cache.addAll(urlsToCache);
} catch {
// Suppress error as some of the files may not be available for the
// current page.
}
);
});
});

// As this is a test app, let's only return cached data when offline.
Expand Down Expand Up @@ -160,18 +158,16 @@ self.addEventListener('fetch', (event: FetchEvent) => {
self.addEventListener('activate', (event: ExtendableEvent) => {
// Update this list with all caches that need to remain cached.
const cacheWhitelist = ['cache-v1'];
event.waitUntil(
async (): Promise<void> => {
const cacheNames = await caches.keys();
await Promise.all(
cacheNames.map(cacheName => {
// Check if cache is not whitelisted above.
if (cacheWhitelist.indexOf(cacheName) === -1) {
// If not whitelisted, delete it.
return caches.delete(cacheName);
}
})
);
}
);
event.waitUntil(async (): Promise<void> => {
const cacheNames = await caches.keys();
await Promise.all(
cacheNames.map(cacheName => {
// Check if cache is not whitelisted above.
if (cacheWhitelist.indexOf(cacheName) === -1) {
// If not whitelisted, delete it.
return caches.delete(cacheName);
}
})
);
});
});
5 changes: 2 additions & 3 deletions packages/auth/demo/src/worker/web-worker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,8 @@ async function runWorkerTests(googleIdToken: string): Promise<void> {
if (!userCredential.user || !userCredential.user.uid) {
throw new Error('signInWithCredential unexpectedly failed!');
}
const googleCredential = GoogleAuthProvider.credentialFromResult(
userCredential
);
const googleCredential =
GoogleAuthProvider.credentialFromResult(userCredential);
if (!googleCredential) {
throw new Error('signInWithCredential unexpectedly failed!');
}
Expand Down
5 changes: 4 additions & 1 deletion packages/auth/index.doc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,7 @@
export * from './index';

export { cordovaPopupRedirectResolver } from './index.cordova';
export { reactNativeLocalPersistence, getReactNativePersistence } from './index.rn';
export {
reactNativeLocalPersistence,
getReactNativePersistence
} from './index.rn';
4 changes: 2 additions & 2 deletions packages/auth/index.rn.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,10 @@ export const reactNativeLocalPersistence: Persistence =
removeItem(...args) {
// Called inline to avoid deprecation warnings on startup.
return ReactNative.AsyncStorage.removeItem(...args);
},
}
});

export {getReactNativePersistence};
export { getReactNativePersistence };

export function getAuth(app: FirebaseApp = getApp()): Auth {
const provider = _getProvider(app, 'auth');
Expand Down
Loading