Skip to content
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
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ import kotlinx.coroutines.flow.map
import kotlinx.coroutines.tasks.await
import kotlinx.coroutines.withContext
import org.groundplatform.android.BuildConfig.USE_EMULATORS
import org.groundplatform.android.coroutines.IoDispatcher
import org.groundplatform.android.data.remote.RemoteDataStore
import org.groundplatform.android.data.remote.firebase.schema.GroundFirestore
import org.groundplatform.android.di.coroutines.IoDispatcher
import org.groundplatform.android.model.Survey
import org.groundplatform.android.model.SurveyListItem
import org.groundplatform.android.model.TermsOfService
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ import dagger.assisted.Assisted
import dagger.assisted.AssistedInject
import kotlinx.coroutines.CoroutineDispatcher
import kotlinx.coroutines.withContext
import org.groundplatform.android.coroutines.IoDispatcher
import org.groundplatform.android.data.remote.RemoteDataStore
import org.groundplatform.android.di.coroutines.IoDispatcher
import org.groundplatform.android.model.mutation.Mutation
import org.groundplatform.android.repository.MutationRepository
import org.groundplatform.android.util.priority
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ import dagger.assisted.AssistedInject
import java.io.FileNotFoundException
import kotlinx.coroutines.CoroutineDispatcher
import kotlinx.coroutines.withContext
import org.groundplatform.android.coroutines.IoDispatcher
import org.groundplatform.android.data.remote.RemoteStorageManager
import org.groundplatform.android.di.coroutines.IoDispatcher
import org.groundplatform.android.model.mutation.SubmissionMutation
import org.groundplatform.android.model.submission.PhotoTaskData
import org.groundplatform.android.repository.MutationRepository
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import dagger.assisted.Assisted
import dagger.assisted.AssistedInject
import kotlinx.coroutines.CoroutineDispatcher
import kotlinx.coroutines.withContext
import org.groundplatform.android.coroutines.IoDispatcher
import org.groundplatform.android.di.coroutines.IoDispatcher
import org.groundplatform.android.usecases.survey.SyncSurveyUseCase
import timber.log.Timber

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,18 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.groundplatform.android.system.auth
package org.groundplatform.android.di

import com.google.firebase.auth.FirebaseAuth
import dagger.Module
import dagger.Provides
import dagger.hilt.InstallIn
import dagger.hilt.components.SingletonComponent
import javax.inject.Singleton
import org.groundplatform.android.BuildConfig.AUTH_EMULATOR_PORT
import org.groundplatform.android.BuildConfig.EMULATOR_HOST
import org.groundplatform.android.BuildConfig.USE_EMULATORS
import org.groundplatform.android.BuildConfig
import org.groundplatform.android.system.auth.AnonymousAuthenticationManager
import org.groundplatform.android.system.auth.AuthenticationManager
import org.groundplatform.android.system.auth.GoogleAuthenticationManager

@InstallIn(SingletonComponent::class)
@Module
Expand All @@ -35,14 +36,14 @@ class AuthenticationModule {
anonymousAuthenticationManager: AnonymousAuthenticationManager,
googleAuthenticationManager: GoogleAuthenticationManager,
): AuthenticationManager =
if (USE_EMULATORS) anonymousAuthenticationManager else googleAuthenticationManager
if (BuildConfig.USE_EMULATORS) anonymousAuthenticationManager else googleAuthenticationManager

@Provides
fun firebaseAuth(): FirebaseAuth {
val auth = FirebaseAuth.getInstance()
if (USE_EMULATORS) {
if (BuildConfig.USE_EMULATORS) {
// Use the auth emulator so we can sign-in anonymously during dev.
auth.useEmulator(EMULATOR_HOST, AUTH_EMULATOR_PORT)
auth.useEmulator(BuildConfig.EMULATOR_HOST, BuildConfig.AUTH_EMULATOR_PORT)
}
return auth
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.groundplatform.android.util
package org.groundplatform.android.di

import android.content.Context
import com.google.firebase.Firebase
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.groundplatform.android
package org.groundplatform.android.di

import android.content.Context
import android.content.res.Resources
Expand All @@ -26,7 +26,6 @@ import dagger.hilt.android.qualifiers.ApplicationContext
import dagger.hilt.components.SingletonComponent
import java.util.Locale
import javax.inject.Singleton
import org.groundplatform.android.ui.common.ViewModelModule

@InstallIn(SingletonComponent::class)
@Module(includes = [ViewModelModule::class])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.groundplatform.android.data.local
package org.groundplatform.android.di

import dagger.Binds
import dagger.Module
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.groundplatform.android
package org.groundplatform.android.di

import android.content.Context
import androidx.room.Room
Expand All @@ -27,10 +27,10 @@ import javax.inject.Singleton
import kotlinx.coroutines.CoroutineDispatcher
import kotlinx.coroutines.asExecutor
import org.groundplatform.android.common.Constants
import org.groundplatform.android.coroutines.IoDispatcher
import org.groundplatform.android.data.local.room.LocalDatabase
import org.groundplatform.android.data.local.room.migration.Migration_124_125
import org.groundplatform.android.data.local.room.migration.Migration_125_126
import org.groundplatform.android.di.coroutines.IoDispatcher

@InstallIn(SingletonComponent::class)
@Module
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,13 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.groundplatform.android.ui.map
package org.groundplatform.android.di

import dagger.Module
import dagger.Provides
import dagger.hilt.InstallIn
import dagger.hilt.components.SingletonComponent
import org.groundplatform.android.ui.map.MapFragment
import org.groundplatform.android.ui.map.gms.GoogleMapsFragment

@InstallIn(SingletonComponent::class)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,19 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.groundplatform.android.ui.map.gms.mog
package org.groundplatform.android.di

import dagger.Module
import dagger.Provides
import dagger.hilt.InstallIn
import dagger.hilt.components.SingletonComponent
import kotlinx.coroutines.CoroutineDispatcher
import org.groundplatform.android.coroutines.IoDispatcher
import org.groundplatform.android.data.remote.RemoteStorageManager
import org.groundplatform.android.di.coroutines.IoDispatcher
import org.groundplatform.android.ui.map.gms.mog.MogClient
import org.groundplatform.android.ui.map.gms.mog.MogCollection
import org.groundplatform.android.ui.map.gms.mog.MogSourceProvider
import org.groundplatform.android.ui.map.gms.mog.MogTileProvider

@InstallIn(SingletonComponent::class)
@Module
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.groundplatform.android.data.remote
package org.groundplatform.android.di

import com.google.firebase.firestore.FirebaseFirestoreSettings
import com.google.firebase.functions.FirebaseFunctions
Expand All @@ -30,6 +30,8 @@ import javax.inject.Singleton
import org.groundplatform.android.BuildConfig.EMULATOR_HOST
import org.groundplatform.android.BuildConfig.FIRESTORE_EMULATOR_PORT
import org.groundplatform.android.BuildConfig.USE_EMULATORS
import org.groundplatform.android.data.remote.RemoteDataStore
import org.groundplatform.android.data.remote.RemoteStorageManager
import org.groundplatform.android.data.remote.firebase.FirebaseStorageManager
import org.groundplatform.android.data.remote.firebase.FirestoreDataStore
import org.groundplatform.android.data.remote.firebase.FirestoreUuidGenerator
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.groundplatform.android.data.local
package org.groundplatform.android.di

import android.content.Context
import android.content.SharedPreferences
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package org.groundplatform.android.system
package org.groundplatform.android.di

import android.content.Context
import android.location.Geocoder
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.groundplatform.android.ui.common
package org.groundplatform.android.di

import androidx.lifecycle.ViewModel
import androidx.lifecycle.ViewModelProvider
Expand All @@ -22,6 +22,9 @@ import dagger.Module
import dagger.hilt.InstallIn
import dagger.hilt.components.SingletonComponent
import dagger.multibindings.IntoMap
import org.groundplatform.android.ui.common.BaseMapViewModel
import org.groundplatform.android.ui.common.ViewModelFactory
import org.groundplatform.android.ui.common.ViewModelKey
import org.groundplatform.android.ui.datacollection.tasks.date.DateTaskViewModel
import org.groundplatform.android.ui.datacollection.tasks.instruction.InstructionTaskViewModel
import org.groundplatform.android.ui.datacollection.tasks.location.CaptureLocationTaskViewModel
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.groundplatform.android.coroutines
package org.groundplatform.android.di.coroutines

import dagger.Module
import dagger.Provides
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

package org.groundplatform.android.coroutines
package org.groundplatform.android.di.coroutines

import dagger.Module
import dagger.Provides
Expand All @@ -24,6 +24,7 @@ import javax.inject.Qualifier
import javax.inject.Singleton
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.MainScope
import kotlinx.coroutines.SupervisorJob

@InstallIn(SingletonComponent::class)
Expand All @@ -36,9 +37,7 @@ object CoroutinesScopesModule {
return CoroutineScope(SupervisorJob() + Dispatchers.Default)
}

@MainScope
@Provides
fun provideMainCoroutineScope(): CoroutineScope = kotlinx.coroutines.MainScope()
@MainScope @Provides fun provideMainCoroutineScope(): CoroutineScope = MainScope()
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@ import kotlinx.coroutines.flow.stateIn
import kotlinx.coroutines.flow.update
import kotlinx.coroutines.withTimeout
import org.groundplatform.android.FirebaseCrashLogger
import org.groundplatform.android.coroutines.ApplicationScope
import org.groundplatform.android.data.local.LocalValueStore
import org.groundplatform.android.data.local.stores.LocalSurveyStore
import org.groundplatform.android.data.remote.RemoteDataStore
import org.groundplatform.android.di.coroutines.ApplicationScope
import org.groundplatform.android.model.Survey
import org.groundplatform.android.model.SurveyListItem
import org.groundplatform.android.model.User
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import kotlinx.coroutines.flow.asSharedFlow
import kotlinx.coroutines.flow.filter
import kotlinx.coroutines.flow.first
import kotlinx.coroutines.launch
import org.groundplatform.android.coroutines.ApplicationScope
import org.groundplatform.android.di.coroutines.ApplicationScope

/** Bridge between the [Activity] and various `Manager` classes. */
@Singleton
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import javax.inject.Singleton
import kotlinx.coroutines.CoroutineDispatcher
import kotlinx.coroutines.withContext
import org.groundplatform.android.R
import org.groundplatform.android.coroutines.IoDispatcher
import org.groundplatform.android.di.coroutines.IoDispatcher
import org.groundplatform.android.model.geometry.Coordinates
import org.groundplatform.android.model.map.Bounds
import org.groundplatform.android.ui.map.gms.GmsExt.center
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import javax.inject.Singleton
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.flow.MutableSharedFlow
import kotlinx.coroutines.flow.SharedFlow
import org.groundplatform.android.coroutines.ApplicationScope
import org.groundplatform.android.di.coroutines.ApplicationScope
import org.groundplatform.android.system.channel.LocationSharedFlowCallback

private const val UPDATE_INTERVAL: Long = 1000 /* 1 sec */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import kotlinx.coroutines.flow.filterNotNull
import kotlinx.coroutines.flow.update
import kotlinx.coroutines.launch
import kotlinx.coroutines.tasks.await
import org.groundplatform.android.coroutines.ApplicationScope
import org.groundplatform.android.di.coroutines.ApplicationScope
import org.groundplatform.android.model.User

private val anonymousUser = User("nobody", "nobody", "Anonymous user ", null, true)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ import kotlinx.coroutines.flow.filterNotNull
import kotlinx.coroutines.flow.update
import kotlinx.coroutines.launch
import org.groundplatform.android.R
import org.groundplatform.android.coroutines.ApplicationScope
import org.groundplatform.android.di.coroutines.ApplicationScope
import org.groundplatform.android.model.User
import org.groundplatform.android.system.ActivityResult
import org.groundplatform.android.system.ActivityStreams
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.StateFlow
import kotlinx.coroutines.flow.update
import kotlinx.coroutines.launch
import org.groundplatform.android.coroutines.ApplicationScope
import org.groundplatform.android.coroutines.IoDispatcher
import org.groundplatform.android.data.local.room.converter.SubmissionDeltasConverter
import org.groundplatform.android.data.uuid.OfflineUuidGenerator
import org.groundplatform.android.di.coroutines.ApplicationScope
import org.groundplatform.android.di.coroutines.IoDispatcher
import org.groundplatform.android.model.job.Job
import org.groundplatform.android.model.submission.TaskData
import org.groundplatform.android.model.submission.ValueDelta
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ import kotlinx.coroutines.CoroutineDispatcher
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.launch
import org.groundplatform.android.R
import org.groundplatform.android.coroutines.ApplicationScope
import org.groundplatform.android.coroutines.IoDispatcher
import org.groundplatform.android.coroutines.MainScope
import org.groundplatform.android.databinding.PhotoTaskFragBinding
import org.groundplatform.android.di.coroutines.ApplicationScope
import org.groundplatform.android.di.coroutines.IoDispatcher
import org.groundplatform.android.di.coroutines.MainScope
import org.groundplatform.android.repository.UserMediaRepository
import org.groundplatform.android.system.PermissionDeniedException
import org.groundplatform.android.system.PermissionsManager
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
import org.groundplatform.android.BuildConfig
import org.groundplatform.android.common.Constants.SURVEY_PATH_SEGMENT
import org.groundplatform.android.coroutines.IoDispatcher
import org.groundplatform.android.di.coroutines.IoDispatcher
import org.groundplatform.android.model.User
import org.groundplatform.android.repository.TermsOfServiceRepository
import org.groundplatform.android.repository.UserRepository
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.flow.MutableSharedFlow
import kotlinx.coroutines.flow.asSharedFlow
import kotlinx.coroutines.launch
import org.groundplatform.android.coroutines.MainScope
import org.groundplatform.android.di.coroutines.MainScope
import org.groundplatform.android.ui.map.Feature
import timber.log.Timber

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import kotlinx.coroutines.flow.asSharedFlow
import kotlinx.coroutines.flow.catch
import kotlinx.coroutines.launch
import org.groundplatform.android.R
import org.groundplatform.android.coroutines.IoDispatcher
import org.groundplatform.android.di.coroutines.IoDispatcher
import org.groundplatform.android.model.imagery.RemoteMogTileSource
import org.groundplatform.android.model.imagery.TileSource
import org.groundplatform.android.model.map.Bounds
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import kotlinx.coroutines.CoroutineDispatcher
import kotlinx.coroutines.flow.MutableSharedFlow
import kotlinx.coroutines.flow.asSharedFlow
import kotlinx.coroutines.launch
import org.groundplatform.android.coroutines.IoDispatcher
import org.groundplatform.android.di.coroutines.IoDispatcher
import org.groundplatform.android.model.imagery.OfflineArea
import org.groundplatform.android.repository.LocationOfInterestRepository
import org.groundplatform.android.repository.MapStateRepository
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ import kotlinx.coroutines.flow.asStateFlow
import kotlinx.coroutines.flow.distinctUntilChanged
import kotlinx.coroutines.flow.map
import kotlinx.coroutines.launch
import org.groundplatform.android.coroutines.ApplicationScope
import org.groundplatform.android.coroutines.IoDispatcher
import org.groundplatform.android.di.coroutines.ApplicationScope
import org.groundplatform.android.di.coroutines.IoDispatcher
import org.groundplatform.android.model.SurveyListItem
import org.groundplatform.android.proto.Survey
import org.groundplatform.android.repository.UserRepository
Expand Down
Loading
Loading