Skip to content
Open
Show file tree
Hide file tree
Changes from 4 commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
190c006
Restore datastore-proto module and decouple via SettingsDataSource
temcguir Jun 29, 2026
2b21350
chore: split proto generation into standalone modules
temcguir Jun 29, 2026
97f9e98
Address review comments regarding datastore factory and imports
temcguir Jun 29, 2026
5f8d322
Add missing KDoc to SettingsMappers.kt
temcguir Jun 29, 2026
4a780d8
chore: align proto enums with proto3 zero-value best practices
temcguir Jun 29, 2026
39e86b3
style: address gemini-code-assist review feedback
temcguir Jun 29, 2026
cfd5396
fix: use TARGET_FPS_AUTO constant instead of 0 for target frame rate …
temcguir Jun 29, 2026
2a373d2
refactor: rename toDomain() to toModel() in proto mappers
temcguir Jun 29, 2026
05d2227
refactor: inject ioDispatcher into DataStore and construct CoroutineS…
temcguir Jun 30, 2026
8ee6a46
Merge branch 'main' into temcguir/restore-proto-datastore-module
temcguir Jul 7, 2026
d3cdb94
Merge branch 'main' into temcguir/restore-proto-datastore-module
temcguir Jul 8, 2026
8d13a8b
Merge branch 'main' into temcguir/restore-proto-datastore-module
temcguir Jul 9, 2026
ac1c553
Merge branch 'main' into temcguir/restore-proto-datastore-module
temcguir Jul 14, 2026
2aea300
Fix merge conflicts: remove StreamConfig and add missing CameraEffect…
Jul 15, 2026
f826a42
Fix spotless formatting issues
Jul 15, 2026
5ec5667
Remove accidentally committed diff file
Jul 15, 2026
d0ff9a5
Fix ProtoDataStoreSettingsDataSourceTest compilation issue
Jul 15, 2026
0de19f4
Fix spotless issues in test file
Jul 15, 2026
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
3 changes: 1 addition & 2 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -153,10 +153,9 @@ dependencies {

// Access settings & model data
implementation(project(":data:settings"))
implementation(project(":core:settings:datastore-prefs"))
implementation(project(":core:settings:datastore-proto"))
implementation(project(":core:settings"))
implementation(project(":core:model"))
implementation(libs.androidx.datastore.preferences)

// Camera Preview
implementation(project(":feature:preview"))
Expand Down
18 changes: 3 additions & 15 deletions app/src/main/java/com/google/jetpackcamera/AppSettingsModule.kt
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,9 @@
package com.google.jetpackcamera

import android.content.Context
import androidx.datastore.core.DataStore
import androidx.datastore.preferences.core.PreferenceDataStoreFactory
import androidx.datastore.preferences.core.Preferences
import androidx.datastore.preferences.preferencesDataStoreFile
import com.google.jetpackcamera.core.common.DefaultCaptureModeOverride
import com.google.jetpackcamera.core.settings.datastoreprefs.PrefsDataStoreSettingsDataSource
import com.google.jetpackcamera.model.CaptureMode
import com.google.jetpackcamera.settings.ProtoDataStoreSettingsDataSource
import com.google.jetpackcamera.settings.SettingsDataSource
import dagger.Module
import dagger.Provides
Expand All @@ -35,20 +31,12 @@ import javax.inject.Singleton
@InstallIn(SingletonComponent::class)
object AppSettingsModule {

@Provides
@Singleton
fun providePreferencesDataStore(@ApplicationContext context: Context): DataStore<Preferences> {
return PreferenceDataStoreFactory.create(
produceFile = { context.preferencesDataStoreFile("app_settings.preferences_pb") }
)
}

@Provides
@Singleton
fun provideSettingsDataSource(
dataStore: DataStore<Preferences>,
@ApplicationContext context: Context,
@DefaultCaptureModeOverride defaultCaptureMode: CaptureMode
): SettingsDataSource {
return PrefsDataStoreSettingsDataSource(dataStore, defaultCaptureMode)
return ProtoDataStoreSettingsDataSource.create(context)
}
}
76 changes: 76 additions & 0 deletions core/model-proto/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
/*
* Copyright (C) 2026 The Android Open Source Project
*
* 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 {
alias(libs.plugins.android.library)
alias(libs.plugins.kotlin.android)
alias(libs.plugins.protobuf)
}

android {
namespace = "com.google.jetpackcamera.model.proto"
compileSdk = libs.versions.compileSdk.get().toInt()

defaultConfig {
minSdk = libs.versions.minSdk.get().toInt()
testOptions.targetSdk = libs.versions.targetSdk.get().toInt()
lint.targetSdk = libs.versions.targetSdk.get().toInt()
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
}

flavorDimensions += "flavor"
productFlavors {
create("stable") {
dimension = "flavor"
isDefault = true
}
}

compileOptions {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
kotlin {
jvmToolchain(17)
}
}

protobuf {
protoc {
artifact = "com.google.protobuf:protoc:3.21.12"
}
generateProtoTasks {
all().forEach { task ->
task.builtins {
create("java") {
option("lite")
}
create("kotlin") {
option("lite")
}
}
}
}
}

dependencies {
api(project(":core:model"))
api(libs.protobuf.kotlin.lite)

// Testing
testImplementation(libs.junit)
testImplementation(libs.truth)
testImplementation(libs.kotlinx.coroutines.test)
}
Loading
Loading