Начало курсовой
This commit is contained in:
parent
2fa34f5a82
commit
0be901fd80
@ -3,6 +3,7 @@ package com.example.mobileapp
|
|||||||
import android.content.Context
|
import android.content.Context
|
||||||
import com.example.mobileapp.api.ServerService
|
import com.example.mobileapp.api.ServerService
|
||||||
import com.example.mobileapp.api.repository.RestMailRepository
|
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.RestStoryRepository
|
||||||
import com.example.mobileapp.api.repository.RestUserRepository
|
import com.example.mobileapp.api.repository.RestUserRepository
|
||||||
import com.example.mobileapp.database.MobileAppDataBase
|
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.OfflineStoryRepository
|
||||||
import com.example.mobileapp.database.repositories.OfflineUserRepository
|
import com.example.mobileapp.database.repositories.OfflineUserRepository
|
||||||
import com.example.mobileapp.database.repositories.RemoteKeysRepositoryImpl
|
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.StoryRepository
|
||||||
import com.example.mobileapp.database.repositories.UserRepository
|
import com.example.mobileapp.database.repositories.UserRepository
|
||||||
|
|
||||||
@ -18,6 +20,7 @@ interface MobileAppContainer {
|
|||||||
val mailRepository: MailRepository
|
val mailRepository: MailRepository
|
||||||
val storyRepository: StoryRepository
|
val storyRepository: StoryRepository
|
||||||
val userRepository: UserRepository
|
val userRepository: UserRepository
|
||||||
|
val reportRepository: ReportRepository
|
||||||
|
|
||||||
companion object{
|
companion object{
|
||||||
const val TIMEOUT = 5000L
|
const val TIMEOUT = 5000L
|
||||||
@ -27,12 +30,10 @@ interface MobileAppContainer {
|
|||||||
|
|
||||||
class MobileAppDataContainer(private val context: Context): MobileAppContainer {
|
class MobileAppDataContainer(private val context: Context): MobileAppContainer {
|
||||||
override val mailRepository: MailRepository by lazy {
|
override val mailRepository: MailRepository by lazy {
|
||||||
//OfflineMailRepository(MobileAppDataBase.getInstance(context).mailDao())
|
|
||||||
RestMailRepository(ServerService.getInstance())
|
RestMailRepository(ServerService.getInstance())
|
||||||
}
|
}
|
||||||
|
|
||||||
override val storyRepository: StoryRepository by lazy {
|
override val storyRepository: StoryRepository by lazy {
|
||||||
//OfflineStoryRepository(MobileAppDataBase.getInstance(context).storyDao())
|
|
||||||
RestStoryRepository(ServerService.getInstance(),
|
RestStoryRepository(ServerService.getInstance(),
|
||||||
storyReposLocal,
|
storyReposLocal,
|
||||||
userReposLocal,
|
userReposLocal,
|
||||||
@ -41,10 +42,13 @@ class MobileAppDataContainer(private val context: Context): MobileAppContainer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
override val userRepository: UserRepository by lazy {
|
override val userRepository: UserRepository by lazy {
|
||||||
//OfflineUserRepository(MobileAppDataBase.getInstance(context).userDao())
|
|
||||||
RestUserRepository(ServerService.getInstance())
|
RestUserRepository(ServerService.getInstance())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override val reportRepository: ReportRepository by lazy {
|
||||||
|
RestReportRepository(ServerService.getInstance())
|
||||||
|
}
|
||||||
|
|
||||||
private val remoteKeyRepository: RemoteKeysRepositoryImpl by lazy{
|
private val remoteKeyRepository: RemoteKeysRepositoryImpl by lazy{
|
||||||
RemoteKeysRepositoryImpl(MobileAppDataBase.getInstance(context).remoteKeysDao())
|
RemoteKeysRepositoryImpl(MobileAppDataBase.getInstance(context).remoteKeysDao())
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,10 @@
|
|||||||
|
package com.example.mobileapp.api.model
|
||||||
|
|
||||||
|
import kotlinx.serialization.Serializable
|
||||||
|
|
||||||
|
/*
|
||||||
|
@Serializable
|
||||||
|
data class ReportRemote(
|
||||||
|
|
||||||
|
)
|
||||||
|
*/
|
@ -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 {
|
||||||
|
|
||||||
|
}
|
@ -46,6 +46,7 @@ import com.example.mobileapp.screens.ListStoryScreen
|
|||||||
import com.example.mobileapp.screens.MailViewScreen
|
import com.example.mobileapp.screens.MailViewScreen
|
||||||
import com.example.mobileapp.screens.MainScreen
|
import com.example.mobileapp.screens.MainScreen
|
||||||
import com.example.mobileapp.screens.Registration
|
import com.example.mobileapp.screens.Registration
|
||||||
|
import com.example.mobileapp.screens.ReportScreen
|
||||||
import com.example.mobileapp.screens.SettingsScreen
|
import com.example.mobileapp.screens.SettingsScreen
|
||||||
import com.example.mobileapp.screens.StoryViewScreen
|
import com.example.mobileapp.screens.StoryViewScreen
|
||||||
|
|
||||||
@ -201,6 +202,11 @@ fun NavBar(navController: NavHostController) {
|
|||||||
MailViewScreen(navController = navController, mailId = it.getInt("id"))
|
MailViewScreen(navController = navController, mailId = it.getInt("id"))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
composable("report"){
|
||||||
|
topBarState.value = false
|
||||||
|
bottomBarState.value = false
|
||||||
|
ReportScreen(navController = navController)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,4 @@
|
|||||||
|
package com.example.mobileapp.database.repositories
|
||||||
|
|
||||||
|
interface ReportRepository {
|
||||||
|
}
|
@ -17,6 +17,9 @@ object MobileAppViewModelProvider {
|
|||||||
initializer {
|
initializer {
|
||||||
UserViewModel(app().container.userRepository)
|
UserViewModel(app().container.userRepository)
|
||||||
}
|
}
|
||||||
|
initializer {
|
||||||
|
ReportViewModel(app().container.reportRepository)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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() {
|
||||||
|
}
|
@ -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()
|
||||||
|
) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user