Skip to content

Commit

Permalink
Merge pull request #12 from vipulyaara/develop
Browse files Browse the repository at this point in the history
Merge develop to main
  • Loading branch information
vipulyaara authored Feb 19, 2024
2 parents 7214351 + 8e34d72 commit 42ba282
Show file tree
Hide file tree
Showing 15 changed files with 125 additions and 162 deletions.
85 changes: 85 additions & 0 deletions .github/workflows/build-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
name: Build Signed Release
run-name: Build Signed Release

on:
push:
branches:
- 'main'
permissions:
contents: write
jobs:
release-signing-build:
name: Release Signing Build
runs-on: ubuntu-latest
env:
RELEASE_KEYSTORE_PATH: ${{ secrets.RELEASE_KEYSTORE_PATH }}
RELEASE_SIGNING_PASSWORD: ${{ secrets.RELEASE_SIGNING_PASSWORD }}
RELEASE_SIGNING_USERNAME: ${{ secrets.RELEASE_SIGNING_PASSWORD }}
RELEASE_SIGNING_ALIAS: ${{ secrets.RELEASE_SIGNING_ALIAS }}
GOOGLE_SERVER_CLIENT_ID: ${{ secrets.GOOGLE_SERVER_CLIENT_ID }}
PIPELESS_AUTH_TOKEN: ${{ secrets.PIPELESS_AUTH_TOKEN }}

steps:
- name: Checkout
uses: actions/checkout@v3

- name: Checkout Sarahang
uses: actions/checkout@v3
with:
repository: vipulyaara/sarahang
path: Sarahang
ref: master

- name: Grant execute permission for gradlew
run: chmod +x gradlew

- name: setup JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
cache: gradle

- name: Create Google Services JSON File
env:
GOOGLE_SERVICES_JSON: ${{ secrets.GOOGLE_SERVICES_JSON }}
run: echo $GOOGLE_SERVICES_JSON | base64 -di > ./app/google-services.json

- name: Decode Keystore
env:
ENCODED_KEYSTORE: ${{ secrets.RELEASE_KEYSTORE_BASE64 }}
DECODED_KEYSTORE_PATH: ${{ secrets.RELEASE_KEYSTORE_PATH }}
run: |
echo $ENCODED_KEYSTORE > keystore_base64.txt
base64 -d keystore_base64.txt > $DECODED_KEYSTORE_PATH
- name: Sign and Build Release Bundle
env:
RELEASE_KEYSTORE_PATH: ${{ secrets.RELEASE_KEYSTORE_PATH }}
RELEASE_SIGNING_PASSWORD: ${{ secrets.RELEASE_SIGNING_PASSWORD }}
RELEASE_SIGNING_USERNAME: ${{ secrets.RELEASE_SIGNING_PASSWORD }}
RELEASE_SIGNING_ALIAS: ${{ secrets.RELEASE_SIGNING_ALIAS }}
GOOGLE_SERVER_CLIENT_ID: ${{ secrets.GOOGLE_SERVER_CLIENT_ID }}
PIPELESS_AUTH_TOKEN: ${{ secrets.PIPELESS_AUTH_TOKEN }}
run:
./gradlew assembleRelease

- name: Retrieve Version
run: |
echo "::set-output name=VERSION_NAME::$(${{github.workspace}}/gradlew -q versionname)"
id: android_version

- name: Get version
run: |
echo "version_name=${{steps.android_version.outputs.VERSION_NAME}}" >> $GITHUB_ENV
- name: Create Release on Github
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: v${{env.version_name}}
name: Release - ${{env.version_name}}
generate_release_notes: true
prerelease: true
files: app/build/outputs/apk/release/app-release.apk
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -66,3 +66,4 @@ fastlane/readme.md
/.idea/modules.xml
/.idea/misc.xml

/Sarahang/
1 change: 1 addition & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ Or [Download APK](https://github.com/vipulyaara/Kafka/raw/develop/app/release/ap

## How to run
- Clone the repo
- Clone [Sarahang](https://github.com/vipulyaara/Sarahang) in the same parent folder as Kafka.<br/>Sarahang is the audio player being used in Kafka and not yet provided through maven.
- Clone [Sarahang](https://github.com/vipulyaara/Sarahang) in the root folder (Kafka).<br/>Sarahang is the audio player being used in Kafka and not yet provided through maven.
- Add `google_server_client_id=xxx` and `pipeless_auth_token=xxx` in your `local.properties` file. You can use arbitrary values, these tokens only provide additional functionalities.
- Run project

Expand Down
22 changes: 17 additions & 5 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,13 @@ android {
defaultConfig {
applicationId = "com.kafka.user"
versionCode = 52
versionName = "0.12.0"
versionName = libs.versions.versionname.toString()

val googleServerClientId: String = gradleLocalProperties(rootDir).getProperty("google_server_client_id")
val pipelessAuthToken: String = gradleLocalProperties(rootDir).getProperty("pipeless_auth_token")
val root = gradleLocalProperties(rootDir)
val googleServerClientId: String = (root.getProperty("GOOGLE_SERVER_CLIENT_ID")
?: System.getenv("GOOGLE_SERVER_CLIENT_ID")) as String
val pipelessAuthToken: String = (root.getProperty("PIPELESS_AUTH_TOKEN")
?: System.getenv("PIPELESS_AUTH_TOKEN")) as String

buildConfigField("String", "GOOGLE_SERVER_CLIENT_ID", googleServerClientId)
buildConfigField("String", "PIPELESS_AUTH_TOKEN", pipelessAuthToken)
Expand Down Expand Up @@ -51,6 +54,15 @@ android {
)
}

signingConfigs {
create("release") {
storeFile = file("keystore.jks")
storePassword = System.getenv("RELEASE_SIGNING_PASSWORD")
keyPassword = System.getenv("RELEASE_SIGNING_PASSWORD")
keyAlias = System.getenv("RELEASE_SIGNING_ALIAS")
}
}

buildTypes {
debug {
signingConfig = signingConfigs["debug"]
Expand Down Expand Up @@ -81,7 +93,7 @@ android {
}
}

namespace = "com.kafka.user"
namespace = "com.kafka.user"

lint {
baseline = file("lint-baseline.xml")
Expand All @@ -91,7 +103,7 @@ android {
ignoreTestSources = true
// Make the build fail on any lint errors
abortOnError = true
checkDependencies = true
checkDependencies = true
warning += "AutoboxingStateCreation"
}

Expand Down
Binary file removed app/release/app-release.apk
Binary file not shown.
6 changes: 6 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -141,3 +141,9 @@ fun Project.configureAndroidProject() {
}
}
}

tasks.register("appVersionName") {
doLast {
println(libs.versions.versionname)
}
}
47 changes: 0 additions & 47 deletions domain/src/main/java/org/kafka/domain/Combine.kt

This file was deleted.

47 changes: 0 additions & 47 deletions domain/src/main/java/org/kafka/domain/combine.kt

This file was deleted.

2 changes: 2 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ androidx-baselineprofile = "1.2.3"
profileinstaller = "1.3.1"
review = "2.0.1"

versionname = "0.12.0"

[plugins]
android-application = { id = "com.android.application", version.ref = "agp" }
android-library = { id = "com.android.library", version.ref = "agp" }
Expand Down

This file was deleted.

4 changes: 2 additions & 2 deletions settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -54,5 +54,5 @@ include ':ui:webview'

include ':core-playback'
include ':ui-playback'
project(':core-playback').projectDir = new File(settingsDir, '../Sarahang/core-playback')
project(':ui-playback').projectDir = new File(settingsDir, '../Sarahang/ui-playback')
project(':core-playback').projectDir = new File(settingsDir, '/Sarahang/core-playback')
project(':ui-playback').projectDir = new File(settingsDir, '/Sarahang/ui-playback')
40 changes: 8 additions & 32 deletions ui/common/src/main/java/org/kafka/common/extensions/elevation.kt
Original file line number Diff line number Diff line change
@@ -1,41 +1,17 @@
package org.kafka.common.extensions

import androidx.compose.foundation.ScrollState
import androidx.compose.foundation.lazy.LazyListState
import androidx.compose.foundation.lazy.grid.LazyGridState
import androidx.compose.runtime.derivedStateOf
import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.dp
import ui.common.theme.theme.Dimens

val ScrollState.elevation
get() = derivedStateOf {
this.run { ((value / 100) * 2).coerceAtMost(MaxElevation).dp } ?: 0.dp
}

val LazyListState.elevation: Dp
get() = if (firstVisibleItemIndex == 0) {
// For the first element, use the minimum of scroll offset and default elevation
// i.e. a value between 0 and 4.dp
minOf(firstVisibleItemScrollOffset.toFloat().dp, 24.dp)
} else {
// If not the first element, always set elevation and show the shadow
24.dp
}


val LazyListState?.elevation
get() = derivedStateOf {
if (this?.firstVisibleItemIndex == 0) {
minOf(firstVisibleItemScrollOffset.toFloat().dp, MaxElevation.dp)
object Elevation {
val LazyListState.elevation: Dp
get() = if (firstVisibleItemIndex == 0) {
// For the first element, use the minimum of scroll offset and default elevation
// i.e. a value between 0 and 4.dp
minOf(firstVisibleItemScrollOffset.toFloat().dp, 24.dp)
} else {
Dimens.Spacing20
// If not the first element, always set elevation and show the shadow
24.dp
}
}


fun LazyGridState.elevation(maxElevation: Int = 40) = derivedStateOf {
this.run { firstVisibleItemScrollOffset.coerceAtMost(maxElevation) }.dp
}

private const val MaxElevation = 20
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import androidx.hilt.navigation.compose.hiltViewModel
import androidx.lifecycle.compose.collectAsStateWithLifecycle
import com.kafka.data.entities.RecentItem
import kotlinx.collections.immutable.ImmutableList
import org.kafka.common.extensions.elevation
import org.kafka.common.extensions.Elevation.elevation
import org.kafka.common.widgets.shadowMaterial
import org.kafka.homepage.R
import org.kafka.navigation.LocalNavigator
Expand Down
2 changes: 1 addition & 1 deletion ui/item/src/main/java/org/kafka/item/files/Files.kt
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import androidx.hilt.navigation.compose.hiltViewModel
import androidx.lifecycle.compose.collectAsStateWithLifecycle
import com.kafka.data.entities.File
import kotlinx.coroutines.CoroutineScope
import org.kafka.common.extensions.elevation
import org.kafka.common.extensions.Elevation.elevation
import org.kafka.common.test.testTagUi
import org.kafka.common.widgets.shadowMaterial
import org.kafka.navigation.LocalNavigator
Expand Down

0 comments on commit 42ba282

Please sign in to comment.