ActionCodeSettings.swift 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  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. /** @class FIRActionCodeSettings
  16. @brief Used to set and retrieve settings related to handling action codes.
  17. */
  18. @objc(FIRActionCodeSettings) open class ActionCodeSettings: NSObject {
  19. /** @property URL
  20. @brief This URL represents the state/Continue URL in the form of a universal link.
  21. @remarks This URL can should be constructed as a universal link that would either directly open
  22. the app where the action code would be handled or continue to the app after the action code
  23. is handled by Firebase.
  24. */
  25. @objc(URL) open var url: URL?
  26. /** @property handleCodeInApp
  27. @brief Indicates whether the action code link will open the app directly or after being
  28. redirected from a Firebase owned web widget.
  29. */
  30. @objc open var handleCodeInApp: Bool = false
  31. /** @property iOSBundleID
  32. @brief The iOS bundle ID, if available. The default value is the current app's bundle ID.
  33. */
  34. @objc open var iOSBundleID: String?
  35. /** @property androidPackageName
  36. @brief The Android package name, if available.
  37. */
  38. @objc open var androidPackageName: String?
  39. /** @property androidMinimumVersion
  40. @brief The minimum Android version supported, if available.
  41. */
  42. @objc open var androidMinimumVersion: String?
  43. /** @property androidInstallIfNotAvailable
  44. @brief Indicates whether the Android app should be installed on a device where it is not
  45. available.
  46. */
  47. @objc open var androidInstallIfNotAvailable: Bool = false
  48. /** @property dynamicLinkDomain
  49. @brief The Firebase Dynamic Link domain used for out of band code flow.
  50. */
  51. @objc open var dynamicLinkDomain: String?
  52. /** @fn
  53. @brief Sets the iOS bundle Id.
  54. */
  55. @objc override public init() {
  56. iOSBundleID = Bundle.main.bundleIdentifier
  57. }
  58. /** @fn
  59. @brief Sets the Android package name, the flag to indicate whether or not to install the app
  60. and the minimum Android version supported.
  61. @param androidPackageName The Android package name.
  62. @param installIfNotAvailable Indicates whether or not the app should be installed if not
  63. available.
  64. @param minimumVersion The minimum version of Android supported.
  65. @remarks If installIfNotAvailable is set to YES and the link is opened on an android device, it
  66. will try to install the app if not already available. Otherwise the web URL is used.
  67. */
  68. @objc open func setAndroidPackageName(_ androidPackageName: String,
  69. installIfNotAvailable: Bool,
  70. minimumVersion: String?) {
  71. self.androidPackageName = androidPackageName
  72. androidInstallIfNotAvailable = installIfNotAvailable
  73. androidMinimumVersion = minimumVersion
  74. }
  75. open func setIOSBundleID(_ bundleID: String) {
  76. iOSBundleID = bundleID
  77. }
  78. }