@@ -51,7 +51,12 @@ public class InstallPreapproval private constructor(
5151 /* *
5252 * The icon representing the app to be installed.
5353 */
54- public val icon : Uri
54+ public val icon : Uri ,
55+
56+ /* *
57+ * If `true`, allows to fall back to normal on-demand user approval if preapproval is not available.
58+ */
59+ public val fallbackToOnDemandApproval : Boolean
5560) {
5661
5762 override fun equals (other : Any? ): Boolean {
@@ -62,6 +67,7 @@ public class InstallPreapproval private constructor(
6267 if (label != other.label) return false
6368 if (languageTag != other.languageTag) return false
6469 if (icon != other.icon) return false
70+ if (fallbackToOnDemandApproval != other.fallbackToOnDemandApproval) return false
6571 return true
6672 }
6773
@@ -70,6 +76,7 @@ public class InstallPreapproval private constructor(
7076 result = 31 * result + label.hashCode()
7177 result = 31 * result + languageTag.hashCode()
7278 result = 31 * result + icon.hashCode()
79+ result = 31 * result + fallbackToOnDemandApproval.hashCode()
7380 return result
7481 }
7582
@@ -78,7 +85,8 @@ public class InstallPreapproval private constructor(
7885 " packageName='$packageName ', " +
7986 " label='$label ', " +
8087 " languageTag='$languageTag ', " +
81- " icon=$icon " +
88+ " icon=$icon , " +
89+ " fallbackToOnDemandApproval=$fallbackToOnDemandApproval " +
8290 " )"
8391 }
8492
@@ -111,18 +119,31 @@ public class InstallPreapproval private constructor(
111119 public var icon: Uri = Uri .EMPTY
112120 private set
113121
122+ /* *
123+ * If `true`, allows to fall back to normal on-demand user approval if preapproval is not available.
124+ */
125+ public var fallbackToOnDemandApproval: Boolean = false
126+ private set
127+
114128 /* *
115129 * Sets [InstallPreapproval.icon].
116130 */
117131 public fun setIcon (icon : Uri ): Builder = apply {
118132 this .icon = icon
119133 }
120134
135+ /* *
136+ * Sets [InstallPreapproval.fallbackToOnDemandApproval]
137+ */
138+ public fun setFallbackToOnDemandApproval (value : Boolean ): Builder = apply {
139+ this .fallbackToOnDemandApproval = value
140+ }
141+
121142 /* *
122143 * Constructs a new instance of [InstallPreapproval].
123144 */
124145 public fun build (): InstallPreapproval {
125- return InstallPreapproval (packageName, label, languageTag, icon)
146+ return InstallPreapproval (packageName, label, languageTag, icon, fallbackToOnDemandApproval )
126147 }
127148 }
128149
@@ -136,7 +157,8 @@ public class InstallPreapproval private constructor(
136157 packageName = " " ,
137158 label = " " ,
138159 languageTag = " " ,
139- icon = Uri .EMPTY
160+ icon = Uri .EMPTY ,
161+ fallbackToOnDemandApproval = false
140162 )
141163 }
142164}
0 commit comments