From 0be901fd8071b4e6e3abffc276f5af2c0268b1c4 Mon Sep 17 00:00:00 2001 From: maxnes3 <112558334+maxnes3@users.noreply.github.com> Date: Tue, 26 Dec 2023 19:17:07 +0400 Subject: [PATCH] =?UTF-8?q?=D0=9D=D0=B0=D1=87=D0=B0=D0=BB=D0=BE=20=D0=BA?= =?UTF-8?q?=D1=83=D1=80=D1=81=D0=BE=D0=B2=D0=BE=D0=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../example/mobileapp/MobileAppContainer.kt | 10 ++++++--- .../mobileapp/api/model/ReportRemote.kt | 10 +++++++++ .../api/repository/RestReportRepository.kt | 8 +++++++ .../mobileapp/components/NavigationBar.kt | 6 ++++++ .../database/repositories/ReportRepository.kt | 4 ++++ .../viewmodels/MobileAppViewModelProvider.kt | 3 +++ .../database/viewmodels/ReportViewModel.kt | 7 +++++++ .../example/mobileapp/screens/ReportScreen.kt | 21 +++++++++++++++++++ 8 files changed, 66 insertions(+), 3 deletions(-) create mode 100644 app/src/main/java/com/example/mobileapp/api/model/ReportRemote.kt create mode 100644 app/src/main/java/com/example/mobileapp/api/repository/RestReportRepository.kt create mode 100644 app/src/main/java/com/example/mobileapp/database/repositories/ReportRepository.kt create mode 100644 app/src/main/java/com/example/mobileapp/database/viewmodels/ReportViewModel.kt create mode 100644 app/src/main/java/com/example/mobileapp/screens/ReportScreen.kt diff --git a/app/src/main/java/com/example/mobileapp/MobileAppContainer.kt b/app/src/main/java/com/example/mobileapp/MobileAppContainer.kt index 26ee585..11604d8 100644 --- a/app/src/main/java/com/example/mobileapp/MobileAppContainer.kt +++ b/app/src/main/java/com/example/mobileapp/MobileAppContainer.kt @@ -3,6 +3,7 @@ package com.example.mobileapp import android.content.Context import com.example.mobileapp.api.ServerService import com.example.mobileapp.api.repository.RestMailRepository +import com.example.mobileapp.api.repository.RestReportRepository import com.example.mobileapp.api.repository.RestStoryRepository import com.example.mobileapp.api.repository.RestUserRepository import com.example.mobileapp.database.MobileAppDataBase @@ -11,6 +12,7 @@ import com.example.mobileapp.database.repositories.OfflineMailRepository import com.example.mobileapp.database.repositories.OfflineStoryRepository import com.example.mobileapp.database.repositories.OfflineUserRepository import com.example.mobileapp.database.repositories.RemoteKeysRepositoryImpl +import com.example.mobileapp.database.repositories.ReportRepository import com.example.mobileapp.database.repositories.StoryRepository import com.example.mobileapp.database.repositories.UserRepository @@ -18,6 +20,7 @@ interface MobileAppContainer { val mailRepository: MailRepository val storyRepository: StoryRepository val userRepository: UserRepository + val reportRepository: ReportRepository companion object{ const val TIMEOUT = 5000L @@ -27,12 +30,10 @@ interface MobileAppContainer { class MobileAppDataContainer(private val context: Context): MobileAppContainer { override val mailRepository: MailRepository by lazy { - //OfflineMailRepository(MobileAppDataBase.getInstance(context).mailDao()) RestMailRepository(ServerService.getInstance()) } override val storyRepository: StoryRepository by lazy { - //OfflineStoryRepository(MobileAppDataBase.getInstance(context).storyDao()) RestStoryRepository(ServerService.getInstance(), storyReposLocal, userReposLocal, @@ -41,10 +42,13 @@ class MobileAppDataContainer(private val context: Context): MobileAppContainer { } override val userRepository: UserRepository by lazy { - //OfflineUserRepository(MobileAppDataBase.getInstance(context).userDao()) RestUserRepository(ServerService.getInstance()) } + override val reportRepository: ReportRepository by lazy { + RestReportRepository(ServerService.getInstance()) + } + private val remoteKeyRepository: RemoteKeysRepositoryImpl by lazy{ RemoteKeysRepositoryImpl(MobileAppDataBase.getInstance(context).remoteKeysDao()) } diff --git a/app/src/main/java/com/example/mobileapp/api/model/ReportRemote.kt b/app/src/main/java/com/example/mobileapp/api/model/ReportRemote.kt new file mode 100644 index 0000000..aadcbe9 --- /dev/null +++ b/app/src/main/java/com/example/mobileapp/api/model/ReportRemote.kt @@ -0,0 +1,10 @@ +package com.example.mobileapp.api.model + +import kotlinx.serialization.Serializable + +/* +@Serializable +data class ReportRemote( + +) +*/ diff --git a/app/src/main/java/com/example/mobileapp/api/repository/RestReportRepository.kt b/app/src/main/java/com/example/mobileapp/api/repository/RestReportRepository.kt new file mode 100644 index 0000000..fa53a52 --- /dev/null +++ b/app/src/main/java/com/example/mobileapp/api/repository/RestReportRepository.kt @@ -0,0 +1,8 @@ +package com.example.mobileapp.api.repository + +import com.example.mobileapp.api.ServerService +import com.example.mobileapp.database.repositories.ReportRepository + +class RestReportRepository(private var service: ServerService): ReportRepository { + +} \ No newline at end of file diff --git a/app/src/main/java/com/example/mobileapp/components/NavigationBar.kt b/app/src/main/java/com/example/mobileapp/components/NavigationBar.kt index 268b6ea..095c69a 100644 --- a/app/src/main/java/com/example/mobileapp/components/NavigationBar.kt +++ b/app/src/main/java/com/example/mobileapp/components/NavigationBar.kt @@ -46,6 +46,7 @@ import com.example.mobileapp.screens.ListStoryScreen import com.example.mobileapp.screens.MailViewScreen import com.example.mobileapp.screens.MainScreen import com.example.mobileapp.screens.Registration +import com.example.mobileapp.screens.ReportScreen import com.example.mobileapp.screens.SettingsScreen import com.example.mobileapp.screens.StoryViewScreen @@ -201,6 +202,11 @@ fun NavBar(navController: NavHostController) { MailViewScreen(navController = navController, mailId = it.getInt("id")) } } + composable("report"){ + topBarState.value = false + bottomBarState.value = false + ReportScreen(navController = navController) + } } } } diff --git a/app/src/main/java/com/example/mobileapp/database/repositories/ReportRepository.kt b/app/src/main/java/com/example/mobileapp/database/repositories/ReportRepository.kt new file mode 100644 index 0000000..2362ed6 --- /dev/null +++ b/app/src/main/java/com/example/mobileapp/database/repositories/ReportRepository.kt @@ -0,0 +1,4 @@ +package com.example.mobileapp.database.repositories + +interface ReportRepository { +} \ No newline at end of file diff --git a/app/src/main/java/com/example/mobileapp/database/viewmodels/MobileAppViewModelProvider.kt b/app/src/main/java/com/example/mobileapp/database/viewmodels/MobileAppViewModelProvider.kt index 9d3554d..41cf3f6 100644 --- a/app/src/main/java/com/example/mobileapp/database/viewmodels/MobileAppViewModelProvider.kt +++ b/app/src/main/java/com/example/mobileapp/database/viewmodels/MobileAppViewModelProvider.kt @@ -17,6 +17,9 @@ object MobileAppViewModelProvider { initializer { UserViewModel(app().container.userRepository) } + initializer { + ReportViewModel(app().container.reportRepository) + } } } diff --git a/app/src/main/java/com/example/mobileapp/database/viewmodels/ReportViewModel.kt b/app/src/main/java/com/example/mobileapp/database/viewmodels/ReportViewModel.kt new file mode 100644 index 0000000..938b449 --- /dev/null +++ b/app/src/main/java/com/example/mobileapp/database/viewmodels/ReportViewModel.kt @@ -0,0 +1,7 @@ +package com.example.mobileapp.database.viewmodels + +import androidx.lifecycle.ViewModel +import com.example.mobileapp.database.repositories.ReportRepository + +class ReportViewModel(private val reportRepository: ReportRepository): ViewModel() { +} \ No newline at end of file diff --git a/app/src/main/java/com/example/mobileapp/screens/ReportScreen.kt b/app/src/main/java/com/example/mobileapp/screens/ReportScreen.kt new file mode 100644 index 0000000..499ab70 --- /dev/null +++ b/app/src/main/java/com/example/mobileapp/screens/ReportScreen.kt @@ -0,0 +1,21 @@ +package com.example.mobileapp.screens + +import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.fillMaxWidth +import androidx.compose.runtime.Composable +import androidx.compose.ui.Modifier +import androidx.lifecycle.viewmodel.compose.viewModel +import androidx.navigation.NavController +import com.example.mobileapp.database.viewmodels.MobileAppViewModelProvider +import com.example.mobileapp.database.viewmodels.ReportViewModel + +@Composable +fun ReportScreen(navController: NavController, + reportViewModel: ReportViewModel = viewModel(factory = MobileAppViewModelProvider.Factory)){ + Column( + modifier = Modifier + .fillMaxWidth() + ) { + + } +} \ No newline at end of file