Upgrade to Pro — share decks privately, control downloads, hide ads and more …

What's New in Firebase 2022

What's New in Firebase 2022

Firebase Thailand

June 11, 2022
Tweet

More Decks by Firebase Thailand

Other Decks in Technology

Transcript

  1. CFO

  2. CFO Full text search in 3 steps 1. Setup TypeSense

    Cluster & Add schema 2. Install Extensions to sync data from Firestore 3. Write search UI ✨
  3. Changes and enhancements in Cloud Functions v2 ⚡Concurrency 🌐 Secure

    your callable and HTTP functions with a new CORS 🚨 Firebase Alerts events 🔌 Firebase Extension events ✔ Task Queue functions ⏳ Long-running in HTTP Functions (Up to 1 hour timeout) 🖥 Modern JavaScript (config functions globally, options objects, and modular imports)
  4. Phones Desktops Wearables Thermostats TVs Laptops Tablets React, Angular, Vue,

    Next.js, Nuxt, Astro, Gatsby, Remix, and many more!
  5. recordFlutterFatalError (FlutterErrorDetails flutterErrorDetails ; recordError(dynamic exception, StackTrace? stack, {dynamic reason,

    Iterable<DiagnosticsNode> information = const [], bool? printDetails, bool fatal = false}) async; Firebase Flutter X
  6. struct Review { init?(dictionary: [String : Any]) { guard let

    name = dictionary["name"] as? String, let category = dictionary["category"] as? String, let city = dictionary["city"] as? String, let price = dictionary["price"] as? Int, let ratingCount = dictionary["numRatings"] as? Int, let averageRating = dictionary["avgRating"] as? Float, let photo = (dictionary["photo"] as? String).flatMap(URL.init(string:)) else { return nil } self.init(name: name, category: category, city: city, price: price, ratingCount: ratingCount, averageRating: averageRating, photo: photo) } // ... } // Usage let myReview = Review(dictionary: document.data()) Without Codable struct Review: Codable { // ... } // Usage let myReview = try document.data(as: Review.self) With Codable
  7. func signInAndGetProfile(usingEmail email: String, password: String, completion: @escaping (Result<UserProfile, Error>)

    -> Void) { Auth.auth().signIn(withEmail: email, password: password) { result, error in guard let result = result else { completion(.failure(error!)) return } let path = "\(result.user.uid)/fullProfile" let profileRef = Database.database().reference(withPath: path) profileRef.getData { error, snapshot in if let error = error { completion(.failure(error)) return } do { let profileData = try snapshot.data(as: UserProfile.self) completion(.success(profileData)) } catch { completion(.failure(error)) } } } } Using Callbacks: 20 lines of code func signInAndGetProfile(usingEmail email: String, password: String) async throws -> UserProfile { let result = try await Auth.auth().signIn(withEmail: email, password: password) let path = "\(result.user.uid)/fullProfile" let profileRef = Database.database().reference(withPath: path) return try await profileRef.getData().data(as: UserProfile.self) } async/await version: 4 lines of code