Коммит 59d6e45b создал по автору Radch-enko's avatar Radch-enko
Просмотр файлов

Remove outdated files, enhance logging, and update configurations

- Deleted `network_security_config.xml` and removed its reference from `AndroidManifest.xml` to simplify project structure.
- Enhanced logging in `CalendarSubscriptionScheduler` for better debugging of calendar subscriptions.
- Improved resource management in `RootComponent` with `ResourceDisposerUseCase` integration and memory leak prevention.
- Adjusted `docker-compose.yml` configurations for better resilience and dynamic environments.
- Refactored `ResourceDisposerUseCase` to allow reinitialization and prevent unused job persistence.
- Simplified message handling in `ServerMessagingService` to avoid unnecessary data conversion.
владелец aaaf1517
......@@ -81,6 +81,6 @@ calendar:
google-credentials: ${GOOGLE_CREDENTIALS_FILE:classpath:google-credentials.json}
application-url: ${APPLICATION_URL}
test-application-url: ${TEST_APPLICATION_URL}
calendars: ${CALENDARS:}
calendars: ${CALENDARS}
test-calendars: ${TEST_CALENDARS}
firebase-credentials: ${FIREBASE_CREDENTIALS:classpath:firebase-credentials.json}
\ Нет новой строки в конце файла
......@@ -9,7 +9,7 @@ services:
ports:
- "8080:8080"
environment:
- SPRING_DATASOURCE_URL=jdbc:postgresql://db:5432/${POSTGRES_DB}
- SPRING_DATASOURCE_URL=jdbc:postgresql://db:5432/effectiveoffice
- SPRING_DATASOURCE_USERNAME=${POSTGRES_USER}
- SPRING_DATASOURCE_PASSWORD=${POSTGRES_PASSWORD}
depends_on:
......@@ -17,7 +17,7 @@ services:
condition: service_healthy
networks:
- effective-office-network
restart: no
restart: unless-stopped
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8080/api/actuator/health"]
interval: 30s
......@@ -31,15 +31,14 @@ services:
ports:
- "5432:5432"
environment:
POSTGRES_DB: ${POSTGRES_DB}
POSTGRES_USER: ${POSTGRES_USER}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
- POSTGRES_DB=${POSTGRES_DB}
- POSTGRES_USER=${POSTGRES_USER}
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
volumes:
- postgres-data:/var/lib/postgresql/data
- ./init.sql:/docker-entrypoint-initdb.d/init.sql
networks:
- effective-office-network
restart: no
restart: unless-stopped
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres"]
interval: 10s
......
......@@ -298,7 +298,6 @@ class GoogleCalendarProvider(
private fun convertToBooking(event: Event): Booking {
// Get the organizer's email and find the corresponding user
logger.debug("event.organizer?.email: ${event.organizer?.email}")
val organizer = event?.organizer?.email
// Check if the user found by organizer email is a system user
......
......@@ -30,6 +30,8 @@ class CalendarSubscriptionScheduler(
// Subscribe to production calendars
val productionCalendars = config.getCalendars()
logger.debug("productionCalendars: {}", productionCalendars)
logger.debug("applicationUrl: {}", config.applicationUrl)
if (config.applicationUrl.isNotBlank() && productionCalendars.isNotEmpty()) {
googleCalendarService.subscribeToCalendarNotifications(config.applicationUrl, productionCalendars)
} else {
......@@ -38,6 +40,8 @@ class CalendarSubscriptionScheduler(
// Subscribe to test calendars
val testCalendars = config.getTestCalendars()
logger.debug("testCalendars: {}", testCalendars)
logger.debug("testApplicationUrl: {}", config.testApplicationUrl)
if (config.testApplicationUrl.isNotBlank() && testCalendars.isNotEmpty()) {
googleCalendarService.subscribeToCalendarNotifications(config.testApplicationUrl, testCalendars)
} else {
......
......@@ -7,8 +7,7 @@
android:label="Effective Office Tablet"
android:name=".App"
android:theme="@android:style/Theme.Material.NoActionBar"
android:lockTaskMode="if_whitelisted"
android:networkSecurityConfig="@xml/network_security_config">
android:lockTaskMode="if_whitelisted">
<activity
android:name=".AppActivity"
android:configChanges="orientation|screenSize|screenLayout|keyboardHidden"
......
......@@ -12,7 +12,7 @@ class ServerMessagingService() :
private val collector: Collector<String> by inject()
override fun onMessageReceived(message: RemoteMessage) {
Log.i("ReceivedMessage", message.toString())
Log.i("ReceivedMessage", message.data.toString())
collector.emit(message.from?.substringAfter("topics/")?.replace("-test", "") ?: "")
}
}
\ Нет новой строки в конце файла
<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
<domain-config cleartextTrafficPermitted="true">
<domain includeSubdomains="true">109.73.202.144</domain>
</domain-config>
</network-security-config>
\ Нет новой строки в конце файла
......@@ -3,6 +3,7 @@ package band.effective.office.tablet.root
import band.effective.office.tablet.core.domain.model.EventInfo
import band.effective.office.tablet.core.domain.model.RoomInfo
import band.effective.office.tablet.core.domain.model.Slot
import band.effective.office.tablet.core.domain.useCase.ResourceDisposerUseCase
import band.effective.office.tablet.core.ui.common.ModalWindow
import band.effective.office.tablet.feature.bookingEditor.presentation.BookingEditorComponent
import band.effective.office.tablet.feature.fastBooking.presentation.FastBookingComponent
......@@ -21,14 +22,18 @@ import com.arkivanov.decompose.router.stack.push
import com.arkivanov.decompose.router.stack.replaceAll
import com.arkivanov.decompose.value.Value
import kotlinx.serialization.Serializable
import org.koin.core.component.KoinComponent
import org.koin.core.component.inject
class RootComponent(
componentContext: ComponentContext,
) : ComponentContext by componentContext {
) : ComponentContext by componentContext, KoinComponent {
private val navigation = StackNavigation<Config>()
private val modalNavigation = SlotNavigation<ModalWindowsConfig>()
private val resourceDisposerUseCase: ResourceDisposerUseCase by inject()
val modalWindowSlot = childSlot(
source = modalNavigation,
childFactory = ::createModalWindow,
......@@ -43,6 +48,10 @@ class RootComponent(
childFactory = ::createChild,
)
init {
resourceDisposerUseCase()
}
private fun createChild(
config: Config,
componentContext: ComponentContext
......
......@@ -21,9 +21,9 @@ class ResourceDisposerUseCase(
private val refreshDataUseCase: RefreshDataUseCase,
) {
private val scope = CoroutineScope(Dispatchers.IO + SupervisorJob())
private val updateJob: Job
private var updateJob: Job? = null
init {
operator fun invoke() {
updateJob = scope.launch {
networkRoomRepository.subscribeOnUpdates().collect {
refreshDataUseCase()
......@@ -36,7 +36,7 @@ class ResourceDisposerUseCase(
* Should be called when the use case is no longer needed to prevent memory leaks.
*/
fun dispose() {
updateJob.cancel()
updateJob?.cancel()
scope.cancel()
}
}
\ Нет новой строки в конце файла
Поддерживает Markdown
0% или .
You are about to add 0 people to the discussion. Proceed with caution.
Сначала завершите редактирование этого сообщения!
Пожалуйста, зарегистрируйтесь или чтобы прокомментировать