Skip to content

Commit 1038f4c

Browse files
authored
Merge pull request #545 from JetBrains/remove-news
Remove news feature
2 parents 3e8511e + b2ae14b commit 1038f4c

File tree

23 files changed

+176
-391
lines changed

23 files changed

+176
-391
lines changed

.github/workflows/build-all.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ jobs:
2323
java-version: 21
2424
- name: Assemble desktop jar
2525
run: ./gradlew :shared:jvmJar
26+
- name: Run JVM tests
27+
run: ./gradlew jvmTest
2628

2729
build-android:
2830
name: Build Android

gradle/libs.versions.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ koin-ktor = { module = "io.insert-koin:koin-ktor", version.ref = "koin" }
6565
koin-slf4j = { module = "io.insert-koin:koin-logger-slf4j", version.ref = "koin" }
6666
kotlinx-coroutines-core = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", version.ref = "coroutines" }
6767
kotlinx-coroutines-swing = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-swing", version.ref = "coroutines" }
68+
kotlinx-coroutines-test = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-test", version.ref = "coroutines" }
6869
kotlinx-datetime = { module = "org.jetbrains.kotlinx:kotlinx-datetime", version.ref = "kotlinx-datetime" }
6970
kotlinx-serialization-core = { module = "org.jetbrains.kotlinx:kotlinx-serialization-core", version.ref = "kotlinxSerializationCore" }
7071
kotlinx-serialization-json = { module = "org.jetbrains.kotlinx:kotlinx-serialization-json", version.ref = "kotlinxSerializationCore" }
@@ -99,6 +100,7 @@ settings = { module = "com.russhwolf:multiplatform-settings", version.ref = "mul
99100
settings-coroutines = { module = "com.russhwolf:multiplatform-settings-coroutines", version.ref = "multiplatform-settings" }
100101
settings-observable = { module = "com.russhwolf:multiplatform-settings-make-observable", version.ref = "multiplatform-settings" }
101102
settings-serialization = { module = "com.russhwolf:multiplatform-settings-serialization", version.ref = "multiplatform-settings" }
103+
settings-test = { module = "com.russhwolf:multiplatform-settings-test", version.ref = "multiplatform-settings" }
102104
slf4j-nop = { module = "org.slf4j:slf4j-nop", version.ref = "slf4jNop" }
103105

104106
[plugins]

shared/build.gradle.kts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,8 @@ kotlin {
105105

106106
commonTest.dependencies {
107107
implementation(kotlin("test"))
108+
implementation(libs.settings.test)
109+
implementation(libs.kotlinx.coroutines.test)
108110
}
109111

110112
val nonAndroidMain by creating {

shared/src/commonMain/composeResources/values-de/strings.xml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ Für den Quellcode und weitere technische Details besuchen Sie das GitHub-Reposi
2626
<string name="info_link_about_app">Über die App</string>
2727
<string name="info_link_partners">Unsere Partner</string>
2828
<string name="info_link_code_of_conduct">Verhaltenskodex</string>
29-
<string name="info_link_news_feed">Newsfeed</string>
3029
<string name="info_link_settings">Einstellungen</string>
3130
<string name="info_link_description_twitter">Twitter</string>
3231
<string name="info_link_description_slack">Slack</string>
@@ -79,10 +78,6 @@ Wir verarbeiten Ihre Daten gemäß dem Datenschutzhinweis der App. Sie können I
7978
<string name="notifications_session_reminders_description">Erhalten Sie Erinnerungen für Sitzungen, die Sie im Zeitplan mit einem Lesezeichen versehen haben, damit Sie sie nicht verpassen.</string>
8079
<string name="notifications_schedule_update_title">Zeitplan-Updates</string>
8180
<string name="notifications_schedule_update_description">Bleiben Sie über wichtige Änderungen informiert! Erhalten Sie eine Benachrichtigung, wenn es eine bedeutende Aktualisierung des Veranstaltungszeitplans gibt.</string>
82-
<string name="notifications_kotlinconf_news_title">KotlinConf-Neuigkeiten</string>
83-
<string name="notifications_kotlinconf_news_description">Erhalten Sie Neuigkeiten zwischen KotlinConf-Veranstaltungen, einschließlich Benachrichtigungen über Ticketverkäufe, neue Videos, Wettbewerbe, Zeitplanankündigungen und mehr.</string>
84-
<string name="notifications_jetbrains_news_title">JetBrains-Neuigkeiten</string>
85-
<string name="notifications_jetbrains_news_description">Erhalten Sie Neuigkeiten über JetBrains-Produkte.</string>
8681
<string name="notifications_lets_get_started">Lass uns anfangen!</string>
8782

8883
<string name="code_of_conduct">Verhaltenskodex</string>
@@ -135,9 +130,6 @@ Wir verarbeiten Ihre Daten gemäß dem Datenschutzhinweis der App. Sie können I
135130
<string name="map_ground_floor">Erdgeschoss</string>
136131
<string name="map_first_floor">Erster Stock</string>
137132

138-
<string name="news_feed_title">Neuigkeiten</string>
139-
<string name="news_feed_empty">Keine Neuigkeiten... ist das eine gute Nachricht?</string>
140-
141133
<string name="speakers_title">Sprecher</string>
142134
<string name="speakers_error_no_results">Keine Ergebnisse</string>
143135
<string name="speakers_error_no_data">Unsere Sprecher spielen Verstecken. Geben Sie uns einen Moment, um sie zu finden!</string>

shared/src/commonMain/composeResources/values/strings.xml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ For the source code and more technical details, visit the GitHub repository.</st
2626
<string name="info_link_about_app">About the app</string>
2727
<string name="info_link_partners">Our partners</string>
2828
<string name="info_link_code_of_conduct">Code of conduct</string>
29-
<string name="info_link_news_feed">News feed</string>
3029
<string name="info_link_settings">Settings</string>
3130
<string name="info_link_description_twitter">Twitter</string>
3231
<string name="info_link_description_slack">Slack</string>
@@ -79,10 +78,6 @@ We will process your data in accordance with the App Privacy Notice. You can adj
7978
<string name="notifications_session_reminders_description">Get reminders for sessions that you’ve bookmarked in the schedule to make sure you don’t miss them.</string>
8079
<string name="notifications_schedule_update_title">Schedule updates</string>
8180
<string name="notifications_schedule_update_description">Stay informed about crucial changes! Get an alert if there's a significant update to the event schedule.</string>
82-
<string name="notifications_kotlinconf_news_title">KotlinConf News</string>
83-
<string name="notifications_kotlinconf_news_description">Receive news in between KotlinConf events, including notifications about ticket sales, new videos, contests, schedule announcements, and more.</string>
84-
<string name="notifications_jetbrains_news_title">JetBrains News</string>
85-
<string name="notifications_jetbrains_news_description">Get news about JetBrains products.</string>
8681
<string name="notifications_lets_get_started">Let’s get started!</string>
8782

8883
<string name="code_of_conduct">Code of Conduct</string>
@@ -135,9 +130,6 @@ We will process your data in accordance with the App Privacy Notice. You can adj
135130
<string name="map_ground_floor">Ground floor</string>
136131
<string name="map_first_floor">First floor</string>
137132

138-
<string name="news_feed_title">News</string>
139-
<string name="news_feed_empty">No news… is good news?</string>
140-
141133
<string name="speakers_title">Speakers</string>
142134
<string name="speakers_error_no_results">No results</string>
143135
<string name="speakers_error_no_data">Our speakers are playing hide and seek. Give us a moment to find them!</string>

shared/src/commonMain/kotlin/org/jetbrains/kotlinconf/APIClient.kt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -142,9 +142,6 @@ class APIClient(
142142
}
143143
}
144144

145-
suspend fun getNews(): List<NewsItem>? {
146-
return safeApiCall { client.get("news").body<NewsListResponse>().items }
147-
}
148145

149146
/**
150147
* Runs the [call], returning its result or `null` if exceptions occurred.

shared/src/commonMain/kotlin/org/jetbrains/kotlinconf/AppInit.kt

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,9 @@ import com.mmk.kmpnotifier.notification.configuration.NotificationPlatformConfig
77
import kotlinx.coroutines.CoroutineScope
88
import kotlinx.coroutines.Dispatchers
99
import kotlinx.coroutines.SupervisorJob
10-
import org.jetbrains.kotlinconf.navigation.navigateToNews
1110
import org.jetbrains.kotlinconf.navigation.navigateToSession
1211
import org.jetbrains.kotlinconf.screens.AboutConferenceViewModel
1312
import org.jetbrains.kotlinconf.screens.LicensesViewModel
14-
import org.jetbrains.kotlinconf.screens.NewsDetailViewModel
15-
import org.jetbrains.kotlinconf.screens.NewsListViewModel
1613
import org.jetbrains.kotlinconf.screens.PrivacyNoticeViewModel
1714
import org.jetbrains.kotlinconf.screens.ScheduleViewModel
1815
import org.jetbrains.kotlinconf.screens.SessionViewModel
@@ -81,8 +78,6 @@ private fun initKoin(
8178
val viewModelModule = module {
8279
viewModelOf(::AboutConferenceViewModel)
8380
viewModelOf(::LicensesViewModel)
84-
viewModelOf(::NewsDetailViewModel)
85-
viewModelOf(::NewsListViewModel)
8681
viewModelOf(::PrivacyNoticeViewModel)
8782
viewModelOf(::ScheduleViewModel)
8883
viewModelOf(::SessionViewModel)
@@ -104,31 +99,24 @@ private fun initNotifier(
10499
) {
105100
NotifierManager.initialize(configuration)
106101
NotifierManager.addListener(object : Listener {
107-
var taggedLogger: TaggedLogger? = logger.tagged("KMPNotifier")
102+
var taggedLogger: TaggedLogger = logger.tagged("KMPNotifier")
108103

109104
override fun onNotificationClicked(data: PayloadData) {
110105
super.onNotificationClicked(data)
111-
taggedLogger?.log { "Notification clicked with $data" }
112-
113-
val newsId = data[PushNotificationConstants.KEY_NEWS_ID] as? String
114-
if (newsId != null) {
115-
taggedLogger?.log { "Navigating to news: $newsId" }
116-
navigateToNews(newsId)
117-
return
118-
}
106+
taggedLogger.log { "Notification clicked with $data" }
119107

120108
val sessionId = data[PushNotificationConstants.KEY_SESSION_ID] as? String
121109
if (sessionId != null) {
122-
taggedLogger?.log { "Navigating to session: $sessionId" }
110+
taggedLogger.log { "Navigating to session: $sessionId" }
123111
navigateToSession(SessionId(sessionId))
124112
return
125113
}
126114

127-
taggedLogger?.log { "No data to navigate with, ignoring notification" }
115+
taggedLogger.log { "No data to navigate with, ignoring notification" }
128116
}
129117

130118
override fun onNewToken(token: String) {
131-
taggedLogger?.log { "New token received: $token" }
119+
taggedLogger.log { "New token received: $token" }
132120
}
133121
})
134122
}

shared/src/commonMain/kotlin/org/jetbrains/kotlinconf/ConferenceService.kt

Lines changed: 0 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,6 @@ class ConferenceService(
5454
// Download fresh conference data
5555
loadConferenceData()
5656

57-
// Load fresh news items
58-
loadNews()
59-
6057
// Wait for user ID to be loaded
6158
userIdLoaded.await()
6259

@@ -76,8 +73,6 @@ class ConferenceService(
7673
val notifier = NotifierManager.getPushNotifier()
7774
listOf(
7875
settings.scheduleUpdates to PushNotificationConstants.TOPIC_SCHEDULE_UPDATES,
79-
settings.kotlinConfNews to PushNotificationConstants.TOPIC_KOTLINCONF_NEWS,
80-
settings.jetBrainsNews to PushNotificationConstants.TOPIC_JETBRAINS_NEWS,
8176
).forEach { (enabled, topic) ->
8277
if (enabled) notifier.subscribeToTopic(topic)
8378
else notifier.unSubscribeFromTopic(topic)
@@ -86,12 +81,6 @@ class ConferenceService(
8681
}
8782
}
8883

89-
val news: Flow<List<NewsDisplayItem>> = storage.getNews()
90-
.map { newsItems ->
91-
val now = timeProvider.now()
92-
newsItems.map { newsItem -> mapNewsItemToDisplayItem(newsItem, now) }
93-
}
94-
.flowOn(Dispatchers.Default)
9584

9685
val agenda: StateFlow<List<Day>> =
9786
combine(
@@ -235,8 +224,6 @@ class ConferenceService(
235224
it ?: NotificationSettings(
236225
sessionReminders = true,
237226
scheduleUpdates = true,
238-
kotlinConfNews = true,
239-
jetBrainsNews = true,
240227
)
241228
}
242229

@@ -284,10 +271,6 @@ class ConferenceService(
284271
fun sessionsForSpeakerFlow(id: SpeakerId): Flow<List<SessionCardView>> =
285272
sessionCards.map { sessions -> sessions.filter { id in it.speakerIds } }
286273

287-
fun newsById(newsId: String): Flow<NewsDisplayItem?> =
288-
news.map { allNews ->
289-
allNews.find { it.id == newsId }
290-
}
291274

292275
fun setFavorite(sessionId: SessionId, favorite: Boolean) {
293276
scope.launch {
@@ -362,32 +345,6 @@ class ConferenceService(
362345
localNotificationService.cancel(LocalNotificationId(Type.SessionEnd, sessionId.id))
363346
}
364347

365-
private fun mapNewsItemToDisplayItem(
366-
item: NewsItem,
367-
now: LocalDateTime,
368-
): NewsDisplayItem {
369-
return NewsDisplayItem(
370-
id = item.id,
371-
photoUrl = item.photoUrl,
372-
date = item.publicationDate.toNewsDisplayTime(now),
373-
title = item.title,
374-
content = item.content,
375-
)
376-
}
377-
378-
private fun LocalDateTime.toNewsDisplayTime(now: LocalDateTime): String {
379-
val isToday = year == now.year && dayOfYear == now.dayOfYear
380-
return when {
381-
isToday -> DateTimeFormatting.time(this)
382-
year == now.year -> DateTimeFormatting.date(this)
383-
else -> DateTimeFormatting.dateWithYear(this)
384-
}
385-
}
386-
387-
suspend fun loadNews() {
388-
val news = client.getNews() ?: return
389-
storage.setNews(news)
390-
}
391348

392349
private suspend fun syncVotes() {
393350
if (!checkUserId()) return

shared/src/commonMain/kotlin/org/jetbrains/kotlinconf/Model.kt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -119,8 +119,6 @@ data class NewsListResponse(
119119
data class NotificationSettings(
120120
val sessionReminders: Boolean,
121121
val scheduleUpdates: Boolean,
122-
val kotlinConfNews: Boolean,
123-
val jetBrainsNews: Boolean,
124122
) {
125-
fun hasAnyEnabled() = sessionReminders || scheduleUpdates || kotlinConfNews || jetBrainsNews
123+
fun hasAnyEnabled() = sessionReminders || scheduleUpdates
126124
}
Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
package org.jetbrains.kotlinconf
22

33
object PushNotificationConstants {
4-
const val TOPIC_JETBRAINS_NEWS = "JetBrainsNews"
5-
const val TOPIC_KOTLINCONF_NEWS = "KotlinConfNews"
64
const val TOPIC_SCHEDULE_UPDATES = "ScheduleUpdates"
75

8-
const val KEY_NEWS_ID = "newsId"
96
const val KEY_SESSION_ID = "sessionId"
107
}

0 commit comments

Comments
 (0)