Skip to content

Commit 747fb7a

Browse files
authored
Merge pull request #135 from solrudev/develop
0.15.0
2 parents 60441e2 + ad791e1 commit 747fb7a

50 files changed

Lines changed: 1302 additions & 187 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ jobs:
5050

5151
- name: Publish
5252
run: |
53-
./gradlew publishAndReleaseToMavenCentral --no-configuration-cache
53+
./gradlew publishAndReleaseToMavenCentral
5454
env:
5555
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.OSSRH_USERNAME }}
5656
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.OSSRH_PASSWORD }}

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ Ackpine depends on Jetpack libraries, so it's also necessary to add the `google(
3535

3636
```toml
3737
[versions]
38-
ackpine = "0.14.0"
38+
ackpine = "0.15.0"
3939

4040
[libraries]
4141
ackpine-core = { module = "ru.solrudev.ackpine:ackpine-core", version.ref = "ackpine" }
@@ -76,7 +76,7 @@ ackpine = [
7676

7777
```kotlin
7878
dependencies {
79-
val ackpineVersion = "0.14.0"
79+
val ackpineVersion = "0.15.0"
8080
implementation("ru.solrudev.ackpine:ackpine-core:$ackpineVersion")
8181

8282
// optional - Kotlin extensions and Coroutines support

ackpine-api/api-main/api/api-main.api

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -313,8 +313,9 @@ public final class ru/solrudev/ackpine/installer/parameters/InstallParameters$Bu
313313
public final class ru/solrudev/ackpine/installer/parameters/InstallPreapproval {
314314
public static final field Companion Lru/solrudev/ackpine/installer/parameters/InstallPreapproval$Companion;
315315
public static final field NONE Lru/solrudev/ackpine/installer/parameters/InstallPreapproval;
316-
public synthetic fun <init> (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Landroid/net/Uri;Lkotlin/jvm/internal/DefaultConstructorMarker;)V
316+
public synthetic fun <init> (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Landroid/net/Uri;ZLkotlin/jvm/internal/DefaultConstructorMarker;)V
317317
public fun equals (Ljava/lang/Object;)Z
318+
public final fun getFallbackToOnDemandApproval ()Z
318319
public final fun getIcon ()Landroid/net/Uri;
319320
public final fun getLabel ()Ljava/lang/String;
320321
public final fun getLanguageTag ()Ljava/lang/String;
@@ -328,7 +329,9 @@ public final class ru/solrudev/ackpine/installer/parameters/InstallPreapproval$B
328329
public fun <init> (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V
329330
public fun <init> (Ljava/lang/String;Ljava/lang/String;Ljava/util/Locale;)V
330331
public final fun build ()Lru/solrudev/ackpine/installer/parameters/InstallPreapproval;
332+
public final fun getFallbackToOnDemandApproval ()Z
331333
public final fun getIcon ()Landroid/net/Uri;
334+
public final fun setFallbackToOnDemandApproval (Z)Lru/solrudev/ackpine/installer/parameters/InstallPreapproval$Builder;
332335
public final fun setIcon (Landroid/net/Uri;)Lru/solrudev/ackpine/installer/parameters/InstallPreapproval$Builder;
333336
}
334337

ackpine-api/api-main/build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ ackpine {
3131
}
3232

3333
dependencies {
34-
api(libs.listenablefuture)
34+
api(libs.listenableFuture)
3535
api(androidx.annotation)
3636
api(projects.ackpineResources)
3737
compileOnly(projects.ackpineApi.apiStubs)

ackpine-api/api-main/src/main/kotlin/ru/solrudev/ackpine/installer/parameters/InstallParameters.kt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,11 @@ public class InstallParameters private constructor(
141141
/**
142142
* [Plugins][AckpinePlugin] applied to the install session.
143143
*/
144-
@Deprecated(message = "Renamed to pluginContainer", replaceWith = ReplaceWith(expression = "pluginContainer"))
144+
@Deprecated(
145+
message = "Renamed to pluginContainer",
146+
replaceWith = ReplaceWith(expression = "pluginContainer"),
147+
level = DeprecationLevel.ERROR
148+
)
145149
public val plugins: AckpinePluginContainer
146150
get() = pluginContainer
147151

ackpine-api/api-main/src/main/kotlin/ru/solrudev/ackpine/installer/parameters/InstallPreapproval.kt

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -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
}

ackpine-api/api-main/src/main/kotlin/ru/solrudev/ackpine/installer/parameters/InstallerType.kt

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,4 +66,12 @@ public enum class InstallerType {
6666

6767
@ChecksSdkIntAtLeast(api = Build.VERSION_CODES.LOLLIPOP)
6868
@JvmSynthetic
69-
internal fun areSplitPackagesSupported(): Boolean = Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP
69+
internal fun areSplitPackagesSupported(): Boolean = isPackageInstallerAvailable
70+
71+
// To avoid referencing Build.VERSION.SDK_INT
72+
private val isPackageInstallerAvailable = try {
73+
Class.forName("android.content.pm.PackageInstaller")
74+
true
75+
} catch (_: ClassNotFoundException) {
76+
false
77+
}

0 commit comments

Comments
 (0)