Stubs.swift 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. /*
  2. * Copyright 2017 Google
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. /// This file contains a collection of stub functions to verify the Swift syntax of Firebase Auth
  17. /// APIs in Swift for those that are not already covered by other parts of the app.
  18. /// These functions are never executed, but just for passing compilation.
  19. import FirebaseAuth
  20. func actionCodeSettingsStubs() {
  21. let actionCodeSettings = ActionCodeSettings()
  22. actionCodeSettings.url = URL(string: "http://some.url/path/")
  23. actionCodeSettings.setIOSBundleID("some.bundle.id")
  24. actionCodeSettings.setAndroidPackageName("some.package.name", installIfNotAvailable: true,
  25. minimumVersion: nil)
  26. let _: String? = actionCodeSettings.iOSBundleID
  27. let _: String? = actionCodeSettings.androidPackageName
  28. let _: Bool = actionCodeSettings.androidInstallIfNotAvailable
  29. let _: String? = actionCodeSettings.androidMinimumVersion
  30. Auth.auth().sendPasswordReset(withEmail: "nobody@nowhere.com",
  31. actionCodeSettings: actionCodeSettings) { (error: Error?) -> () in
  32. }
  33. Auth.auth().currentUser?.sendEmailVerification(with: actionCodeSettings) {
  34. (error: Error?) -> () in
  35. }
  36. }
  37. func languageStubs() {
  38. let _: String? = Auth.auth().languageCode
  39. Auth.auth().languageCode = "asdf"
  40. Auth.auth().useAppLanguage()
  41. }
  42. func metadataStubs() {
  43. let credential = OAuthProvider.credential(withProviderID: "fake", accessToken: "none")
  44. Auth.auth().signInAndRetrieveData(with: credential) { result, error in
  45. let _: Bool? = result!.additionalUserInfo!.isNewUser
  46. let metadata: UserMetadata = result!.user.metadata
  47. let _: Date? = metadata.lastSignInDate
  48. let _: Date? = metadata.creationDate
  49. }
  50. }