ActionCodeSettings.swift 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  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. @objc open var dynamicLinkDomain: String?
  36. /// Sets the iOS bundle ID.
  37. @objc override public init() {
  38. iOSBundleID = Bundle.main.bundleIdentifier
  39. }
  40. /// Sets the Android package name, the flag to indicate whether or not to install the app,
  41. /// and the minimum Android version supported.
  42. ///
  43. /// If `installIfNotAvailable` is set to `true` and the link is opened on an android device, it
  44. /// will try to install the app if not already available. Otherwise the web URL is used.
  45. /// - Parameters:
  46. /// - androidPackageName: The Android package name.
  47. /// - installIfNotAvailable: Indicates whether or not the app should be installed if not
  48. /// available.
  49. /// - minimumVersion: The minimum version of Android supported.
  50. @objc open func setAndroidPackageName(_ androidPackageName: String,
  51. installIfNotAvailable: Bool,
  52. minimumVersion: String?) {
  53. self.androidPackageName = androidPackageName
  54. androidInstallIfNotAvailable = installIfNotAvailable
  55. androidMinimumVersion = minimumVersion
  56. }
  57. /// Sets the iOS bundle ID.
  58. open func setIOSBundleID(_ bundleID: String) {
  59. iOSBundleID = bundleID
  60. }
  61. }