Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade dependencies and internal architecture #10

Merged
merged 3 commits into from
Oct 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ jobs:

steps:
- uses: actions/checkout@v2
- name: set up JDK 11
- name: set up JDK 17
uses: actions/setup-java@v1
with:
java-version: 11
java-version: 17
- name: Build with Gradle
run: |
./gradlew build -Dorg.gradle.jvmargs=-Xmx1g
Expand Down
17 changes: 7 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,17 @@ configuration which is common for all sessions of your event.

```kotlin
// In your Application class
val config = OpenFeedbackConfig(
context = context,
projectId = "<your-open-feedback-project-id>",
firebaseConfig = OpenFeedback.FirebaseConfig(
projectId = "<your-firebase-open-feedback-project-id>",
applicationId = "<your-firebase-open-feedback-app-id>",
apiKey = "<your-firebase-open-feedback-api-key>",
databaseUrl = "https://<your-firebase-open-feedback-project-id>.firebaseio.com"
)
val firebaseConfig = FirebaseConfig(
projectId = "<your-firebase-open-feedback-project-id>",
applicationId = "<your-firebase-open-feedback-app-id>",
apiKey = "<your-firebase-open-feedback-api-key>",
databaseUrl = "https://<your-firebase-open-feedback-project-id>.firebaseio.com"
)

// In your Compose screen
OpenFeedback(
openFeedbackState = MyApp.config,
config = MyApp.firebaseConfig,
projectId = "<your-open-feedback-project-id>",
sessionId = "<your-open-feedback-session-id>",
language = "<language-code>"
)
Expand Down
1 change: 0 additions & 1 deletion build-logic/settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
enableFeaturePreview("VERSION_CATALOGS")
enableFeaturePreview("TYPESAFE_PROJECT_ACCESSORS")

dependencyResolutionManagement {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
package io.openfeedback.extensions

import com.android.build.api.dsl.CommonExtension
import com.android.build.gradle.LibraryExtension
import org.gradle.api.JavaVersion
import org.gradle.api.Project
import org.gradle.api.artifacts.VersionCatalogsExtension
Expand All @@ -12,24 +11,24 @@ import org.gradle.kotlin.dsl.dependencies
import org.gradle.kotlin.dsl.getByType
import org.jetbrains.kotlin.gradle.dsl.KotlinJvmOptions

internal fun CommonExtension<*, *, *, *>.configureKotlinAndroid() {
compileSdk = 33
internal fun CommonExtension<*, *, *, *, *>.configureKotlinAndroid() {
compileSdk = 34

defaultConfig {
minSdk = 21
}

compileOptions {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}

kotlinOptions {
jvmTarget = JavaVersion.VERSION_11.toString()
jvmTarget = JavaVersion.VERSION_17.toString()
}
}

internal fun CommonExtension<*, *, *, *>.configureAndroidCompose(project: Project) {
internal fun CommonExtension<*, *, *, *, *>.configureAndroidCompose(project: Project) {
val libs = project.extensions.getByType<VersionCatalogsExtension>().named("libs")

buildFeatures {
Expand All @@ -46,6 +45,6 @@ internal fun CommonExtension<*, *, *, *>.configureAndroidCompose(project: Projec
}
}

private fun CommonExtension<*, *, *, *>.kotlinOptions(block: KotlinJvmOptions.() -> Unit) {
private fun CommonExtension<*, *, *, *, *>.kotlinOptions(block: KotlinJvmOptions.() -> Unit) {
(this as ExtensionAware).extensions.configure("kotlinOptions", block)
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

fun TaskContainer.configureKotlinCompiler() = withType<KotlinCompile> {
kotlinOptions {
jvmTarget = JavaVersion.VERSION_11.toString()
jvmTarget = JavaVersion.VERSION_17.toString()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class ComposeLibraryPlugin : Plugin<Project> {
target.extensions.configure<LibraryExtension> {
configureKotlinAndroid()
configureAndroidCompose(target)
defaultConfig.targetSdk = 33
defaultConfig.targetSdk = 34
}
target.tasks.configureKotlinCompiler()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class LibraryPlugin : Plugin<Project> {
target.extensions.create("openfeedback", OpenFeedback::class.java, target)
target.extensions.configure<LibraryExtension> {
configureKotlinAndroid()
defaultConfig.targetSdk = 33
defaultConfig.targetSdk = 34
}
target.tasks.configureKotlinCompiler()
}
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-all.zip
16 changes: 8 additions & 8 deletions libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
[versions]
kotlin_lang = "1.7.20"
kotlin_coroutines = "1.6.4"
androidx_core = "1.7.0"
androidx_compose_bom = "2022.10.00"
androidx_compose_compiler = "1.3.2"
androidx_lifecycle = "2.4.1"
androidx_savedstate = "1.1.0"
kotlin_lang = "1.9.10"
kotlin_coroutines = "1.7.3"
androidx_core = "1.12.0"
androidx_compose_bom = "2023.10.01"
androidx_compose_compiler = "1.5.3"
androidx_lifecycle = "2.6.2"
androidx_savedstate = "1.2.1"
firebase_firestore = "24.0.1"
firebase_auth = "21.0.1"

[libraries]
android-gradle-plugin = "com.android.tools.build:gradle:7.3.1"
android-gradle-plugin = "com.android.tools.build:gradle:8.1.2"
vespene = "net.mbonnin.vespene:vespene-lib:0.5"

kotlin_gradle-plugin = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin", version.ref = "kotlin_lang" }
Expand Down
4 changes: 4 additions & 0 deletions openfeedback-m2/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ plugins {
id("io.openfeedback.plugins.compose.lib")
}

android {
namespace = "io.openfeedback.android.m2"
}

openfeedback {
configurePublishing("feedback-android-sdk-m2")
}
Expand Down
2 changes: 0 additions & 2 deletions openfeedback-m2/src/main/AndroidManifest.xml

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -8,45 +8,29 @@ import androidx.compose.runtime.Composable
import androidx.compose.runtime.collectAsState
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.unit.dp
import androidx.lifecycle.viewmodel.compose.viewModel
import io.openfeedback.android.OpenFeedbackConfig
import io.openfeedback.android.FirebaseConfig
import io.openfeedback.android.viewmodels.OpenFeedbackUiState
import io.openfeedback.android.viewmodels.OpenFeedbackViewModel
import io.openfeedback.android.viewmodels.models.UISessionFeedback
import io.openfeedback.android.viewmodels.models.UIVoteItem

@Deprecated(
message = "Use OpenFeedback component with projectId parameter."
)
@Composable
fun OpenFeedback(
openFeedbackState: OpenFeedbackConfig,
sessionId: String,
language: String,
modifier: Modifier = Modifier,
loading: @Composable () -> Unit = { Loading(modifier = modifier) }
) = OpenFeedback(
config = openFeedbackState,
projectId = openFeedbackState.openFeedbackProjectId,
sessionId = sessionId,
language = language,
modifier = modifier,
loading = loading
)

@Composable
fun OpenFeedback(
config: OpenFeedbackConfig,
config: FirebaseConfig,
projectId: String,
sessionId: String,
language: String,
modifier: Modifier = Modifier,
loading: @Composable () -> Unit = { Loading(modifier = modifier) }
) {
val context = LocalContext.current
val viewModel: OpenFeedbackViewModel = viewModel(
factory = OpenFeedbackViewModel.Factory.create(
openFeedbackConfig = config,
context = context,
firebaseConfig = config,
projectId = projectId,
sessionId = sessionId,
language = language
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import androidx.compose.ui.semantics.semantics
import androidx.compose.ui.text.TextStyle
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import io.openfeedback.android.R as ROF

@Composable
fun PoweredBy(
Expand All @@ -27,9 +28,9 @@ fun PoweredBy(
color: Color = MaterialTheme.colors.onBackground
) {
val logo =
if (MaterialTheme.colors.isLight) R.drawable.openfeedback_light
else R.drawable.openfeedback_dark
val poweredBy = stringResource(id = R.string.powered_by)
if (MaterialTheme.colors.isLight) ROF.drawable.openfeedback_light
else ROF.drawable.openfeedback_dark
val poweredBy = stringResource(id = ROF.string.powered_by)
Row(
modifier = modifier.semantics(mergeDescendants = true) {
contentDescription = "$poweredBy Openfeedback"
Expand Down
4 changes: 4 additions & 0 deletions openfeedback-m3/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ plugins {
id("io.openfeedback.plugins.compose.lib")
}

android {
namespace = "io.openfeedback.android.m3"
}

openfeedback {
configurePublishing("feedback-android-sdk-m3")
}
Expand Down
2 changes: 0 additions & 2 deletions openfeedback-m3/src/main/AndroidManifest.xml

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -9,45 +9,29 @@ import androidx.compose.runtime.Composable
import androidx.compose.runtime.collectAsState
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.unit.dp
import androidx.lifecycle.viewmodel.compose.viewModel
import io.openfeedback.android.OpenFeedbackConfig
import io.openfeedback.android.FirebaseConfig
import io.openfeedback.android.viewmodels.OpenFeedbackUiState
import io.openfeedback.android.viewmodels.OpenFeedbackViewModel
import io.openfeedback.android.viewmodels.models.UISessionFeedback
import io.openfeedback.android.viewmodels.models.UIVoteItem

@Deprecated(
message = "Use OpenFeedback component with projectId parameter."
)
@Composable
fun OpenFeedback(
openFeedbackState: OpenFeedbackConfig,
sessionId: String,
language: String,
modifier: Modifier = Modifier,
loading: @Composable () -> Unit = { Loading(modifier = modifier) }
) = OpenFeedback(
config = openFeedbackState,
projectId = openFeedbackState.openFeedbackProjectId,
sessionId = sessionId,
language = language,
modifier = modifier,
loading = loading
)

@Composable
fun OpenFeedback(
config: OpenFeedbackConfig,
config: FirebaseConfig,
projectId: String,
sessionId: String,
language: String,
modifier: Modifier = Modifier,
loading: @Composable () -> Unit = { Loading(modifier = modifier) }
) {
val context = LocalContext.current
val viewModel: OpenFeedbackViewModel = viewModel(
factory = OpenFeedbackViewModel.Factory.create(
openFeedbackConfig = config,
context = context,
firebaseConfig = config,
projectId = projectId,
sessionId = sessionId,
language = language
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package io.openfeedback.android.m3

import androidx.compose.foundation.Image
import androidx.compose.foundation.isSystemInDarkTheme
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.height
Expand All @@ -18,6 +17,7 @@ import androidx.compose.ui.semantics.contentDescription
import androidx.compose.ui.semantics.semantics
import androidx.compose.ui.text.TextStyle
import androidx.compose.ui.unit.dp
import io.openfeedback.android.R as ROF

@Composable
internal fun PoweredBy(
Expand All @@ -27,9 +27,9 @@ internal fun PoweredBy(
) {

val logo =
if (MaterialTheme.colorScheme.background.luminance() > 0.5) R.drawable.openfeedback_light
else R.drawable.openfeedback_dark
val poweredBy = stringResource(id = R.string.powered_by)
if (MaterialTheme.colorScheme.background.luminance() > 0.5) ROF.drawable.openfeedback_light
else ROF.drawable.openfeedback_dark
val poweredBy = stringResource(id = ROF.string.powered_by)
Row(
modifier = modifier.semantics(mergeDescendants = true) {
contentDescription = "$poweredBy Openfeedback"
Expand Down
20 changes: 0 additions & 20 deletions openfeedback-ui/build.gradle.kts

This file was deleted.

7 changes: 0 additions & 7 deletions openfeedback-ui/src/main/AndroidManifest.xml

This file was deleted.

Loading
Loading