Add first EnterpriseService.
This commit is contained in:
parent
bc6724923c
commit
d43a8c8bea
11 changed files with 158 additions and 3 deletions
|
|
@ -17,6 +17,7 @@
|
||||||
@file:Suppress("UnstableApiUsage")
|
@file:Suppress("UnstableApiUsage")
|
||||||
|
|
||||||
import com.android.build.api.variant.FilterConfiguration.FilterType.ABI
|
import com.android.build.api.variant.FilterConfiguration.FilterType.ABI
|
||||||
|
import extension.allEnterpriseImpl
|
||||||
import extension.allFeaturesImpl
|
import extension.allFeaturesImpl
|
||||||
import extension.allLibrariesImpl
|
import extension.allLibrariesImpl
|
||||||
import extension.allServicesImpl
|
import extension.allServicesImpl
|
||||||
|
|
@ -46,7 +47,11 @@ android {
|
||||||
namespace = "io.element.android.x"
|
namespace = "io.element.android.x"
|
||||||
|
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
applicationId = "io.element.android.x"
|
if (isEnterpriseBuild) {
|
||||||
|
applicationId = "io.element.enterprise"
|
||||||
|
} else {
|
||||||
|
applicationId = "io.element.android.x"
|
||||||
|
}
|
||||||
targetSdk = Versions.targetSdk
|
targetSdk = Versions.targetSdk
|
||||||
versionCode = Versions.versionCode
|
versionCode = Versions.versionCode
|
||||||
versionName = Versions.versionName
|
versionName = Versions.versionName
|
||||||
|
|
@ -170,6 +175,20 @@ android {
|
||||||
buildConfigField("String", "FLAVOR_DESCRIPTION", "\"FDroid\"")
|
buildConfigField("String", "FLAVOR_DESCRIPTION", "\"FDroid\"")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
packaging {
|
||||||
|
resources.pickFirsts.addAll(
|
||||||
|
listOf(
|
||||||
|
"kotlin/annotation/annotation.kotlin_builtins",
|
||||||
|
"kotlin/collections/collections.kotlin_builtins",
|
||||||
|
"kotlin/coroutines/coroutines.kotlin_builtins",
|
||||||
|
"kotlin/internal/internal.kotlin_builtins",
|
||||||
|
"kotlin/kotlin.kotlin_builtins",
|
||||||
|
"kotlin/ranges/ranges.kotlin_builtins",
|
||||||
|
"kotlin/reflect/reflect.kotlin_builtins",
|
||||||
|
)
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
androidComponents {
|
androidComponents {
|
||||||
|
|
@ -222,6 +241,7 @@ knit {
|
||||||
dependencies {
|
dependencies {
|
||||||
allLibrariesImpl()
|
allLibrariesImpl()
|
||||||
allServicesImpl()
|
allServicesImpl()
|
||||||
|
allEnterpriseImpl(rootDir, logger)
|
||||||
allFeaturesImpl(rootDir, logger)
|
allFeaturesImpl(rootDir, logger)
|
||||||
implementation(projects.features.migration.api)
|
implementation(projects.features.migration.api)
|
||||||
implementation(projects.anvilannotations)
|
implementation(projects.anvilannotations)
|
||||||
|
|
|
||||||
|
|
@ -1 +1 @@
|
||||||
Subproject commit 1ae9686f0e4b40e5f78d4b21a6fd898325409f73
|
Subproject commit 2e9be1745035ee60a3e9f32f5a65be363ea24a92
|
||||||
27
features/enterprise/api/build.gradle.kts
Normal file
27
features/enterprise/api/build.gradle.kts
Normal file
|
|
@ -0,0 +1,27 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2024 New Vector Ltd
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
plugins {
|
||||||
|
id("io.element.android-library")
|
||||||
|
}
|
||||||
|
|
||||||
|
android {
|
||||||
|
namespace = "io.element.android.features.enterprise.api"
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
implementation(projects.libraries.architecture)
|
||||||
|
implementation(projects.libraries.matrix.api)
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,21 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2024 New Vector Ltd
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package io.element.android.features.enterprise.api
|
||||||
|
|
||||||
|
interface EnterpriseService {
|
||||||
|
suspend fun isEnterpriseUser(): Boolean
|
||||||
|
}
|
||||||
30
features/enterprise/impl/build.gradle.kts
Normal file
30
features/enterprise/impl/build.gradle.kts
Normal file
|
|
@ -0,0 +1,30 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2024 New Vector Ltd
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
plugins {
|
||||||
|
id("io.element.android-library")
|
||||||
|
alias(libs.plugins.anvil)
|
||||||
|
}
|
||||||
|
|
||||||
|
android {
|
||||||
|
namespace = "io.element.android.features.enterprise.impl"
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
implementation(projects.anvilannotations)
|
||||||
|
api(libs.anvil.compiler.api)
|
||||||
|
api(projects.features.enterprise.api)
|
||||||
|
implementation(projects.libraries.architecture)
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,28 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2024 New Vector Ltd
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package io.element.android.features.enterprise.impl
|
||||||
|
|
||||||
|
import com.squareup.anvil.annotations.ContributesBinding
|
||||||
|
import io.element.android.features.enterprise.api.EnterpriseService
|
||||||
|
import io.element.android.libraries.di.SessionScope
|
||||||
|
import javax.inject.Inject
|
||||||
|
|
||||||
|
@ContributesBinding(SessionScope::class)
|
||||||
|
class DefaultEnterpriseService @Inject constructor(
|
||||||
|
) : EnterpriseService {
|
||||||
|
override suspend fun isEnterpriseUser(): Boolean = false
|
||||||
|
}
|
||||||
22
plugins/src/main/kotlin/Enterprise.kt
Normal file
22
plugins/src/main/kotlin/Enterprise.kt
Normal file
|
|
@ -0,0 +1,22 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2024 New Vector Ltd
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
import java.io.File
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Are we building with the enterprise sources?
|
||||||
|
*/
|
||||||
|
val isEnterpriseBuild = File("enterprise/README.md").exists()
|
||||||
|
|
@ -64,7 +64,7 @@ object Versions {
|
||||||
const val compileSdk = 34
|
const val compileSdk = 34
|
||||||
const val targetSdk = 33
|
const val targetSdk = 33
|
||||||
// When updating the `minSdk`, make sure to update the value of `minSdkVersion` in the file `tools/release/release.sh`
|
// When updating the `minSdk`, make sure to update the value of `minSdkVersion` in the file `tools/release/release.sh`
|
||||||
const val minSdk = 24
|
val minSdk = if (isEnterpriseBuild) 26 else 24
|
||||||
val javaCompileVersion = JavaVersion.VERSION_17
|
val javaCompileVersion = JavaVersion.VERSION_17
|
||||||
val javaLanguageVersion: JavaLanguageVersion = JavaLanguageVersion.of(11)
|
val javaLanguageVersion: JavaLanguageVersion = JavaLanguageVersion.of(11)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -130,6 +130,11 @@ fun DependencyHandlerScope.allServicesImpl() {
|
||||||
implementation(project(":services:toolbox:impl"))
|
implementation(project(":services:toolbox:impl"))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun DependencyHandlerScope.allEnterpriseImpl(rootDir: File, logger: Logger) {
|
||||||
|
val enterpriseDir = File(rootDir, "enterprise")
|
||||||
|
addImplementationProjects(enterpriseDir, ":enterprise", "impl", logger)
|
||||||
|
}
|
||||||
|
|
||||||
fun DependencyHandlerScope.allFeaturesApi(rootDir: File, logger: Logger) {
|
fun DependencyHandlerScope.allFeaturesApi(rootDir: File, logger: Logger) {
|
||||||
val featuresDir = File(rootDir, "features")
|
val featuresDir = File(rootDir, "features")
|
||||||
addImplementationProjects(featuresDir, ":features", "api", logger)
|
addImplementationProjects(featuresDir, ":features", "api", logger)
|
||||||
|
|
|
||||||
|
|
@ -87,6 +87,7 @@ fun includeProjects(directory: File, path: String, maxDepth: Int = 1) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
includeProjects(File(rootDir, "enterprise"), ":enterprise", maxDepth = 2)
|
||||||
includeProjects(File(rootDir, "features"), ":features")
|
includeProjects(File(rootDir, "features"), ":features")
|
||||||
includeProjects(File(rootDir, "libraries"), ":libraries")
|
includeProjects(File(rootDir, "libraries"), ":libraries")
|
||||||
includeProjects(File(rootDir, "services"), ":services")
|
includeProjects(File(rootDir, "services"), ":services")
|
||||||
|
|
|
||||||
|
|
@ -112,6 +112,7 @@ class KonsistClassNameTest {
|
||||||
"DBov",
|
"DBov",
|
||||||
"Default",
|
"Default",
|
||||||
"DataStore",
|
"DataStore",
|
||||||
|
"Enterprise",
|
||||||
"FileExtensionExtractor",
|
"FileExtensionExtractor",
|
||||||
"KeyStore",
|
"KeyStore",
|
||||||
"Matrix",
|
"Matrix",
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue