Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
mustafaozhan committed Jul 18, 2023
2 parents f0ef488 + 7542404 commit 8e53f66
Show file tree
Hide file tree
Showing 68 changed files with 730 additions and 674 deletions.
24 changes: 12 additions & 12 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -83,14 +83,14 @@ jobs:
echo "${{ secrets.AG_CONNECT_SERVICES_JSON_ASC }}" > agconnect-services.json.asc
gpg -d --passphrase "${{ secrets.SECRET_PASSWORD }}" --batch agconnect-services.json.asc > android/app/src/release/agconnect-services.json
- name: Set up JDK 11
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: 11
java-version: 17
distribution: 'temurin'

- name: Assemble
uses: gradle/gradle-build-action@v2
uses: gradle/gradle-build-action@v2.6.0
with:
arguments: assemble

Expand Down Expand Up @@ -183,14 +183,14 @@ jobs:
echo "${{ secrets.IOS_GPG_RELEASE_XCCONFIG }}" > Release.xcconfig.asc
gpg -d --passphrase "${{ secrets.SECRET_PASSWORD }}" --batch Release.xcconfig.asc > ios/CCC/Resources/Release/Config.xcconfig
- name: Set up JDK 11
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: 11
java-version: 17
distribution: 'temurin'

- name: Generate Pods
uses: gradle/gradle-build-action@v2
uses: gradle/gradle-build-action@v2.6.0
with:
arguments: :ios:provider:podGenIOS :client:core:res:podGenIOS --parallel

Expand Down Expand Up @@ -259,14 +259,14 @@ jobs:
with:
submodules: 'recursive'

- name: Set up JDK 11
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: 11
java-version: 17
distribution: 'temurin'

- name: Run Quality Jobs
uses: gradle/gradle-build-action@v2
uses: gradle/gradle-build-action@v2.6.0
with:
arguments: check koverMergedXmlReport --parallel

Expand Down Expand Up @@ -342,14 +342,14 @@ jobs:
with:
submodules: 'recursive'

- name: Set up JDK 11
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: 11
java-version: 17
distribution: 'temurin'

- name: Detekt
uses: gradle/gradle-build-action@v2
uses: gradle/gradle-build-action@v2.6.0
with:
arguments: detektAll

Expand Down
14 changes: 7 additions & 7 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,14 +78,14 @@ jobs:
echo "${{ secrets.AG_CONNECT_SERVICES_JSON_ASC }}" > agconnect-services.json.asc
gpg -d --passphrase "${{ secrets.SECRET_PASSWORD }}" --batch agconnect-services.json.asc > android/app/src/release/agconnect-services.json
- name: Set up JDK 11
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: 11
java-version: 17
distribution: 'temurin'

- name: Generate Artifacts
uses: gradle/gradle-build-action@v2
uses: gradle/gradle-build-action@v2.6.0
with:
arguments: :android:app:bundleRelease :backend:app:jar --parallel

Expand Down Expand Up @@ -163,7 +163,7 @@ jobs:
with:
client-id: ${{secrets.HUAWEI_CLIENT_ID}}
client-key: ${{secrets.HUAWEI_CLIENT_KEY}}
app-id: ${{secrets.HUAWEI_APP_ID}}
app-id: "com.oztechan.ccc.huawei"
file-extension: "aab"
file-path: "app-huawei-release.aab"
file-name: "app-huawei-release"
Expand Down Expand Up @@ -219,10 +219,10 @@ jobs:
submodules: 'recursive'
fetch-depth: 0

- name: Set up JDK 11
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: 11
java-version: 17
distribution: 'temurin'

- name: Adding secret files
Expand All @@ -235,7 +235,7 @@ jobs:
gpg -d --passphrase "${{ secrets.SECRET_PASSWORD }}" --batch Release.xcconfig.asc > ios/CCC/Resources/Release/Config.xcconfig
- name: Generate Pods
uses: gradle/gradle-build-action@v2
uses: gradle/gradle-build-action@v2.6.0
with:
arguments: :ios:provider:podGenIOS :client:core:res:podGenIOS --parallel

Expand Down
2 changes: 1 addition & 1 deletion CCC.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ allprojects {
buildUponDefaultConfig = true
allRules = true
parallel = true
config = files("${rootProject.projectDir}/detekt.yml")
config.from("${rootProject.projectDir}/detekt.yml")
}
tasks.withType<Detekt> {
setSource(files(project.projectDir))
Expand Down
6 changes: 4 additions & 2 deletions android/app/android-app.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ android {
}
}

buildFeatures.buildConfig = true

signingConfigs {
create(BuildType.release) {
storeFile = file(secret(Key.ANDROID_KEY_STORE_PATH))
Expand Down Expand Up @@ -155,7 +157,7 @@ dependencies {
implementation(project(widget))
}

Modules.Submodules.apply {
implementation(project(logmob))
Submodules.apply {
implementation(logmob)
}
}
4 changes: 2 additions & 2 deletions android/core/billing/android-core-billing.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ dependencies {
}
}

Modules.Submodules.apply {
implementation(project(scopemob))
Submodules.apply {
implementation(scopemob)
}
}
7 changes: 4 additions & 3 deletions android/ui/mobile/android-ui-mobile.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ android {
buildFeatures {
viewBinding = true
compose = true
buildConfig = true
}

composeOptions {
Expand Down Expand Up @@ -98,8 +99,8 @@ dependencies {
implementation(project(premium))
}

Modules.Submodules.apply {
implementation(project(scopemob))
implementation(project(basemob))
Submodules.apply {
implementation(scopemob)
implementation(basemob)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import org.koin.android.ext.android.inject
import org.koin.androidx.viewmodel.ext.android.viewModel

class MainActivity : BaseActivity() {
override var containerId: Int = R.id.content

private val adManager: AdManager by inject()
private val mainViewModel: MainViewModel by viewModel()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ import com.oztechan.ccc.client.core.analytics.AnalyticsManager
import com.oztechan.ccc.client.core.analytics.model.ScreenName
import com.oztechan.ccc.client.core.shared.model.AppTheme
import com.oztechan.ccc.client.core.shared.util.MAXIMUM_FLOATING_POINT
import com.oztechan.ccc.client.core.shared.util.numberToIndex
import com.oztechan.ccc.client.viewmodel.settings.SettingsEffect
import com.oztechan.ccc.client.viewmodel.settings.SettingsViewModel
import com.oztechan.ccc.client.viewmodel.settings.model.PremiumStatus
import com.oztechan.ccc.client.viewmodel.settings.util.numberToIndex
import kotlinx.coroutines.flow.launchIn
import kotlinx.coroutines.flow.onEach
import org.koin.android.ext.android.inject
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import com.oztechan.ccc.android.ui.mobile.util.toColor
import com.oztechan.ccc.android.ui.mobile.util.toPainter
import com.oztechan.ccc.android.ui.mobile.util.toText
import com.oztechan.ccc.client.viewmodel.watchers.WatchersEffect
import com.oztechan.ccc.client.viewmodel.watchers.WatchersEvent
import com.oztechan.ccc.client.viewmodel.watchers.WatchersState
import com.oztechan.ccc.client.viewmodel.watchers.WatchersViewModel
import com.oztechan.ccc.common.core.model.Watcher
Expand Down Expand Up @@ -61,21 +62,15 @@ fun NavHostController.WatchersView(
SnackViewHost(snackbarHostState) {
WatchersViewContent(
state = vm.state.collectAsState(),
onAddClick = vm.event::onAddClick,
onRateChange = vm.event::onRateChange,
onBaseClick = vm.event::onBaseClick,
onTargetClick = vm.event::onTargetClick
event = vm.event
)
}
}

@Composable
fun WatchersViewContent(
state: State<WatchersState>,
onAddClick: () -> Unit,
onRateChange: (watcher: Watcher, rate: String) -> String,
onBaseClick: (watcher: Watcher) -> Unit,
onTargetClick: (watcher: Watcher) -> Unit,
event: WatchersEvent
) {
Column(
horizontalAlignment = Alignment.CenterHorizontally,
Expand All @@ -96,13 +91,13 @@ fun WatchersViewContent(
WatcherItem(
watcher = it,
onRateChange = { rate ->
onRateChange(it, rate)
event.onRateChange(it, rate)
},
onBaseClick = {
onBaseClick(it)
event.onBaseClick(it)
},
onTargetClick = {
onTargetClick(it)
event.onTargetClick(it)
}
)
}
Expand All @@ -116,7 +111,7 @@ fun WatchersViewContent(
contentAlignment = Alignment.Center
) {
TextButton(
onClick = onAddClick,
onClick = event::onAddClick,
) {
ImageView(
painter = R.drawable.ic_plus.toPainter(),
Expand Down Expand Up @@ -146,9 +141,16 @@ fun WatchersViewContentPreview() = Preview {
)
)
),
onAddClick = {},
onRateChange = { _, _ -> "" },
onBaseClick = {},
onTargetClick = {}
event = object : WatchersEvent {
override fun onBackClick() = Unit
override fun onBaseClick(watcher: Watcher) = Unit
override fun onTargetClick(watcher: Watcher) = Unit
override fun onBaseChanged(watcher: Watcher, newBase: String) = Unit
override fun onTargetChanged(watcher: Watcher, newTarget: String) = Unit
override fun onAddClick() = Unit
override fun onDeleteClick(watcher: Watcher) = Unit
override fun onRelationChange(watcher: Watcher, isGreater: Boolean) = Unit
override fun onRateChange(watcher: Watcher, rate: String) = ""
}
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import androidx.core.view.isVisible
import androidx.fragment.app.Fragment
import androidx.navigation.fragment.findNavController
import com.github.submob.scopemob.castTo
import com.github.submob.scopemob.whether
import com.oztechan.ccc.android.core.ad.AdManager
import com.oztechan.ccc.android.core.ad.BannerAdView
import com.oztechan.ccc.android.ui.mobile.R
Expand Down Expand Up @@ -76,8 +77,8 @@ fun <T> Fragment.getNavigationResult(
key: String,
destinationId: Int
) = findNavController()
.backQueue
.lastOrNull { it.destination.id == destinationId }
.currentBackStackEntry
?.whether { it.destination.id == destinationId }
?.savedStateHandle
?.getLiveData<T>(key)

Expand All @@ -86,10 +87,9 @@ fun <T> Fragment.setNavigationResult(
result: T,
key: String
) = findNavController()
.backQueue
.lastOrNull { it.destination.id == destinationId }
?.savedStateHandle
?.set(key, result)
.previousBackStackEntry
?.whether { it.destination.id == destinationId }
?.savedStateHandle?.set(key, result)

fun View?.visibleIf(visible: Boolean, bringFront: Boolean = false) = this?.apply {
if (visible) {
Expand Down
4 changes: 3 additions & 1 deletion android/ui/widget/android-ui-widget.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,12 @@ dependencies {
libs.apply {
android.apply {
implementation(glance)
implementation(lifecycleViewmodel)
}

common.apply {
implementation(koinCore)
testImplementation(test)
implementation(kermit)
}
}

Expand All @@ -45,6 +46,7 @@ dependencies {
implementation(project(Modules.Common.Core.model))

Modules.Client.Core.apply {
implementation(project(viewModel))
implementation(project(res))
implementation(project(analytics))
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
package com.oztechan.ccc.android.ui.widget

import androidx.compose.runtime.Composable
import android.content.Context
import android.content.Intent
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.collectAsState
import androidx.glance.GlanceId
import androidx.glance.appwidget.GlanceAppWidget
import androidx.glance.appwidget.provideContent
import co.touchlab.kermit.Logger
import com.oztechan.ccc.android.ui.widget.content.WidgetView
import com.oztechan.ccc.android.viewmodel.widget.WidgetEffect
import com.oztechan.ccc.android.viewmodel.widget.WidgetViewModel
import org.koin.core.component.KoinComponent
import org.koin.core.component.inject
Expand All @@ -11,8 +18,31 @@ class AppWidget : GlanceAppWidget(), KoinComponent {

private val viewModel: WidgetViewModel by inject()

@Composable
override fun Content() {
WidgetView(state = viewModel.state)
override suspend fun provideGlance(context: Context, id: GlanceId) {
provideContent {
LaunchedEffect(key1 = viewModel.effect) {
viewModel.effect.collect {
Logger.i { "AppWidget observeEffects ${it::class.simpleName}" }

when (it) {
WidgetEffect.OpenApp ->
context.packageManager
.getLaunchIntentForPackage(context.packageName)
?.apply {
addFlags(
Intent.FLAG_ACTIVITY_CLEAR_TASK or
Intent.FLAG_ACTIVITY_CLEAR_TOP or
Intent.FLAG_ACTIVITY_NEW_TASK
)
}?.let { intent -> context.startActivity(intent) }
}
}
}

WidgetView(
state = viewModel.state.collectAsState().value,
event = viewModel.event
)
}
}
}
Loading

0 comments on commit 8e53f66

Please sign in to comment.