ActionCodeSettings.swift 3.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. // Copyright 2023 Google LLC
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. import Foundation
  15. /// Used to set and retrieve settings related to handling action codes.
  16. @objc(FIRActionCodeSettings) open class ActionCodeSettings: NSObject {
  17. /// This URL represents the state/Continue URL in the form of a universal link.
  18. ///
  19. /// This URL can should be constructed as a universal link that would either directly open
  20. /// the app where the action code would be handled or continue to the app after the action code
  21. /// is handled by Firebase.
  22. @objc(URL) open var url: URL?
  23. /// Indicates whether the action code link will open the app directly or after being
  24. /// redirected from a Firebase owned web widget.
  25. @objc open var handleCodeInApp: Bool = false
  26. /// The iOS bundle ID, if available. The default value is the current app's bundle ID.
  27. @objc open var iOSBundleID: String?
  28. /// The Android package name, if available.
  29. @objc open var androidPackageName: String?
  30. /// The minimum Android version supported, if available.
  31. @objc open var androidMinimumVersion: String?
  32. /// Indicates whether the Android app should be installed on a device where it is not available.
  33. @objc open var androidInstallIfNotAvailable: Bool = false
  34. /// The Firebase Dynamic Link domain used for out of band code flow.
  35. #if !FIREBASE_CI
  36. @available(
  37. *,
  38. deprecated,
  39. message: "Firebase Dynamic Links is deprecated. Migrate to use Firebase Hosting link and use `linkDomain` to set a custom domain instead."
  40. )
  41. #endif // !FIREBASE_CI
  42. @objc open var dynamicLinkDomain: String?
  43. /// The out of band custom domain for handling code in app.
  44. @objc public var linkDomain: String?
  45. /// Sets the iOS bundle ID.
  46. @objc override public init() {
  47. iOSBundleID = Bundle.main.bundleIdentifier
  48. }
  49. /// Sets the Android package name, the flag to indicate whether or not to install the app,
  50. /// and the minimum Android version supported.
  51. ///
  52. /// If `installIfNotAvailable` is set to `true` and the link is opened on an android device, it
  53. /// will try to install the app if not already available. Otherwise the web URL is used.
  54. /// - Parameters:
  55. /// - androidPackageName: The Android package name.
  56. /// - installIfNotAvailable: Indicates whether or not the app should be installed if not
  57. /// available.
  58. /// - minimumVersion: The minimum version of Android supported.
  59. @objc open func setAndroidPackageName(_ androidPackageName: String,
  60. installIfNotAvailable: Bool,
  61. minimumVersion: String?) {
  62. self.androidPackageName = androidPackageName
  63. androidInstallIfNotAvailable = installIfNotAvailable
  64. androidMinimumVersion = minimumVersion
  65. }
  66. /// Sets the iOS bundle ID.
  67. open func setIOSBundleID(_ bundleID: String) {
  68. iOSBundleID = bundleID
  69. }
  70. }