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

Update to ASDK v6.10.0 #86

Merged
merged 1 commit into from
Mar 26, 2024
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
7 changes: 4 additions & 3 deletions compose/app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ android {

buildFeatures {
compose = true
buildConfig = true
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Solves a Gradle warning

}

composeOptions {
Expand All @@ -82,18 +83,18 @@ dependencies {
implementation("androidx.core:core-ktx:1.12.0")
implementation("androidx.lifecycle:lifecycle-runtime-ktx:2.7.0")
implementation("androidx.activity:activity-compose:1.8.2")
implementation("androidx.compose.material:material:1.6.1")
implementation("androidx.compose.material:material:1.6.4")

// compose
implementation(platform("androidx.compose:compose-bom:2024.01.00"))
implementation(platform("androidx.compose:compose-bom:2024.03.00"))
implementation("androidx.compose.ui:ui")
implementation("androidx.compose.ui:ui-graphics")
implementation("androidx.compose.ui:ui-tooling-preview")
implementation("androidx.compose.material3:material3")
debugImplementation("androidx.compose.ui:ui-tooling")
debugImplementation("androidx.compose.ui:ui-test-manifest")

val fireworkBomVersion = "2024.02.16"
val fireworkBomVersion = "2024.03.26"
implementation(platform("com.firework:firework-bom:$fireworkBomVersion"))
implementation("com.firework:sdk")
implementation("com.firework.external.imageloading:glide") // Glide (optional image loader)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ class ExampleApplication : Application() {
// build Firework Android SDK v6 configuration
val config =
FireworkSdkConfig.Builder(this)
.checksumRequired(false)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deprecated

.clientId(FW_CLIENT_ID) // Client OAUTH Id
.userId("example app user ID") // User Id in your eco-system
.imageLoader(GlideImageLoaderFactory.createInstance(context = this)) // glide, picasso, or your ImageLoader implementation
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,15 @@ import android.util.TypedValue
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.material.MaterialTheme
import androidx.compose.material.Surface
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Surface
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.viewinterop.AndroidView
import com.firework.common.PlayerMode
import com.firework.common.feed.FeedLayout
import com.firework.common.feed.FeedResource
import com.firework.common.feed.FeedTitlePosition
import com.firework.example.compose.ui.theme.FireworkComposeTheme
import com.firework.videofeed.fwVideoFeedView
import com.firework.videofeed.viewOptions
import com.firework.viewoptions.baseOptions
Expand All @@ -27,10 +26,10 @@ class MainActivity : ComponentActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContent {
FireworkComposeTheme {
MaterialTheme {
Surface(
modifier = Modifier.fillMaxSize(),
color = MaterialTheme.colors.background,
color = MaterialTheme.colorScheme.background,
) {
VideoFeed()
}
Expand All @@ -42,9 +41,9 @@ class MainActivity : ComponentActivity() {
@Suppress("MagicNumber")
@Composable
private fun VideoFeed() {
val feedTitleTextColor = MaterialTheme.colors.onPrimary.hashCode()
val feedTitleBackgroundColor = MaterialTheme.colors.primary.hashCode()
val backgroundColor = MaterialTheme.colors.background.hashCode()
val feedTitleTextColor = MaterialTheme.colorScheme.onPrimary.hashCode()
val feedTitleBackgroundColor = MaterialTheme.colorScheme.primary.hashCode()
val backgroundColor = MaterialTheme.colorScheme.background.hashCode()

AndroidView(factory = { context ->
fwVideoFeedView(context) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@ package com.firework.example.compose.ui.theme

import androidx.compose.ui.graphics.Color

val Purple200 = Color(0xFFBB86FC)
val Purple500 = Color(0xFF6200EE)
val Purple700 = Color(0xFF3700B3)
val Teal200 = Color(0xFF03DAC5)
val White = Color(0xFFFFFFFF)
val Purple80 = Color(0xFFD0BCFF)
val PurpleGrey80 = Color(0xFFCCC2DC)
val Pink80 = Color(0xFFEFB8C8)

val Purple40 = Color(0xFF6650a4)
val PurpleGrey40 = Color(0xFF625b71)
val Pink40 = Color(0xFF7D5260)

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,42 +1,72 @@
package com.firework.example.compose.ui.theme

import android.app.Activity
import android.os.Build
import androidx.compose.foundation.isSystemInDarkTheme
import androidx.compose.material.MaterialTheme
import androidx.compose.material.darkColors
import androidx.compose.material.lightColors
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.darkColorScheme
import androidx.compose.material3.dynamicDarkColorScheme
import androidx.compose.material3.dynamicLightColorScheme
import androidx.compose.material3.lightColorScheme
import androidx.compose.runtime.Composable
import androidx.compose.runtime.SideEffect
import androidx.compose.ui.graphics.toArgb
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.platform.LocalView
import androidx.core.view.WindowCompat

private val DarkColorPalette =
darkColors(
primary = Purple200,
primaryVariant = Purple700,
secondary = Teal200,
private val DarkColorScheme =
darkColorScheme(
primary = Purple80,
secondary = PurpleGrey80,
tertiary = Pink80,
)

private val LightColorPalette =
lightColors(
primary = Purple500,
primaryVariant = Purple700,
secondary = Teal200,
background = White,
private val LightColorScheme =
lightColorScheme(
primary = Purple40,
secondary = PurpleGrey40,
tertiary = Pink40,
/* Other default colors to override
background = Color(0xFFFFFBFE),
surface = Color(0xFFFFFBFE),
onPrimary = Color.White,
onSecondary = Color.White,
onTertiary = Color.White,
onBackground = Color(0xFF1C1B1F),
onSurface = Color(0xFF1C1B1F),
*/
)

@Composable
fun FireworkComposeTheme(
fun MyApplicationTheme(
darkTheme: Boolean = isSystemInDarkTheme(),
// Dynamic color is available on Android 12+
dynamicColor: Boolean = true,
content: @Composable () -> Unit,
) {
val colors =
if (darkTheme) {
DarkColorPalette
} else {
LightColorPalette
val colorScheme =
when {
dynamicColor && Build.VERSION.SDK_INT >= Build.VERSION_CODES.S -> {
val context = LocalContext.current
if (darkTheme) dynamicDarkColorScheme(context) else dynamicLightColorScheme(context)
}

darkTheme -> DarkColorScheme
else -> LightColorScheme
}
val view = LocalView.current
if (!view.isInEditMode) {
SideEffect {
val window = (view.context as Activity).window
window.statusBarColor = colorScheme.primary.toArgb()
WindowCompat.getInsetsController(window, view).isAppearanceLightStatusBars = darkTheme
}
}

MaterialTheme(
colors = colors,
colorScheme = colorScheme,
typography = Typography,
shapes = Shapes,
content = content,
)
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.firework.example.compose.ui.theme

import androidx.compose.material.Typography
import androidx.compose.material3.Typography
import androidx.compose.ui.text.TextStyle
import androidx.compose.ui.text.font.FontFamily
import androidx.compose.ui.text.font.FontWeight
Expand All @@ -9,22 +9,28 @@ import androidx.compose.ui.unit.sp
// Set of Material typography styles to start with
val Typography =
Typography(
body1 =
bodyLarge =
TextStyle(
fontFamily = FontFamily.Default,
fontWeight = FontWeight.Normal,
fontSize = 16.sp,
lineHeight = 24.sp,
letterSpacing = 0.5.sp,
),
/* Other default text styles to override
button = TextStyle(
/* Other default text styles to override
titleLarge = TextStyle(
fontFamily = FontFamily.Default,
fontWeight = FontWeight.W500,
fontSize = 14.sp
fontWeight = FontWeight.Normal,
fontSize = 22.sp,
lineHeight = 28.sp,
letterSpacing = 0.sp
),
caption = TextStyle(
labelSmall = TextStyle(
fontFamily = FontFamily.Default,
fontWeight = FontWeight.Normal,
fontSize = 12.sp
fontWeight = FontWeight.Medium,
fontSize = 11.sp,
lineHeight = 16.sp,
letterSpacing = 0.5.sp
)
*/
*/
)
5 changes: 2 additions & 3 deletions compose/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
plugins {
id("com.android.application") version "8.2.2" apply false
id("com.android.library") version "8.2.2" apply false
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not needed

id("com.android.application") version "8.3.1" apply false
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated to the latest

id("org.jetbrains.kotlin.android") version "1.9.22" apply false
id("org.jlleitschuh.gradle.ktlint") version "12.0.3" apply false
id("io.gitlab.arturbosch.detekt") version "1.23.4" apply false
}

task<Delete>("clean") {
delete = setOf(rootProject.buildDir)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deprecated

delete = setOf(rootProject.layout.buildDirectory)
}
1 change: 0 additions & 1 deletion compose/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,4 @@ kotlin.code.style=official
# resources declared in the library itself and none from the library's dependencies,
# thereby reducing the size of the R class for that library
android.nonTransitiveRClass=true
android.defaults.buildfeatures.buildconfig=true
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deprecated and causes a warning

android.nonFinalResIds=false
Binary file modified compose/gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion compose/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated by AGP

networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
17 changes: 9 additions & 8 deletions compose/gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,8 @@ done
# This is normally unused
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit

# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
Expand Down Expand Up @@ -144,15 +145,15 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #(
max*)
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
# shellcheck disable=SC2039,SC3045
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
case $MAX_FD in #(
'' | soft) :;; #(
*)
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
# shellcheck disable=SC2039,SC3045
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
Expand Down Expand Up @@ -201,11 +202,11 @@ fi
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'

# Collect all arguments for the java command;
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
# shell script including quotes and variable substitutions, so put them in
# double quotes to make sure that they get re-expanded; and
# * put everything else in single quotes, so that it's not re-expanded.
# Collect all arguments for the java command:
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
# and any embedded shellness will be escaped.
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
# treated as '${Hostname}' itself on the command line.

set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \
Expand Down
1 change: 1 addition & 0 deletions compose/settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ dependencyResolutionManagement {
repositories {
google()
mavenCentral()
mavenLocal()
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice to have for testing before release

// SNAPSHOTS repo is for the test purpose, and should not be used in production
maven {
setUrl("https://s01.oss.sonatype.org/content/repositories/snapshots/")
Expand Down
5 changes: 3 additions & 2 deletions feed_integration/app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ android {

buildFeatures {
viewBinding = true
buildConfig = true
}
}

Expand All @@ -73,14 +74,14 @@ dependencies {

implementation("com.google.android.material:material:1.11.0")

implementation(platform("org.jetbrains.kotlin:kotlin-bom:1.6.10"))
implementation(platform("org.jetbrains.kotlin:kotlin-bom:1.8.22"))
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8")

// Glide
implementation("com.github.bumptech.glide:glide:4.16.0")

// Firework SDK
val fireworkBomVersion = "2024.02.16"
val fireworkBomVersion = "2024.03.26"
implementation(platform("com.firework:firework-bom:$fireworkBomVersion"))
implementation("com.firework:sdk")
implementation("com.firework.external.imageloading:glide") // Glide (optional image loader)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ class ExampleApplication : Application() {
// build Firework Android SDK v6 configuration
val config =
FireworkSdkConfig.Builder(this)
.checksumRequired(false)
.clientId(FW_CLIENT_ID) // Client OAUTH Id
.userId("example app user ID") // User Id in your eco-system
.imageLoader(GlideImageLoaderFactory.createInstance(context = this)) // glide, picasso, or your implementation
Expand Down
5 changes: 2 additions & 3 deletions feed_integration/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
plugins {
id("com.android.application") version "8.2.2" apply false
id("com.android.library") version "8.2.2" apply false
id("com.android.application") version "8.3.1" apply false
id("org.jetbrains.kotlin.android") version "1.9.21" apply false
id("org.jlleitschuh.gradle.ktlint") version "12.0.3" apply false
id("io.gitlab.arturbosch.detekt") version "1.23.4" apply false
}

task<Delete>("clean") {
delete = setOf(rootProject.buildDir)
delete = setOf(rootProject.layout.buildDirectory)
}
1 change: 0 additions & 1 deletion feed_integration/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,4 @@ kotlin.code.style=official
# resources declared in the library itself and none from the library's dependencies,
# thereby reducing the size of the R class for that library
android.nonTransitiveRClass=true
android.defaults.buildfeatures.buildconfig=true
android.nonFinalResIds=false
Binary file modified feed_integration/gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion feed_integration/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
Loading
Loading