Skip to content

Commit 2b5e6dc

Browse files
authored
Merge branch 'trunk' into fix/reader-video-card-featured-images
2 parents e88cd55 + dc52538 commit 2b5e6dc

File tree

83 files changed

+5973
-2292
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

83 files changed

+5973
-2292
lines changed

CLAUDE.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,11 +87,20 @@ WordPress/src/main/java/org/wordpress/android/
8787
- **Checkstyle**: Java code style enforcement (`config/checkstyle.xml`)
8888
- **Detekt**: Kotlin code analysis (`config/detekt/detekt.yml`)
8989
- **Android Lint**: Built-in Android static analysis
90-
- **Line Length**: 120 characters max
90+
- **Line Length**: 120 characters max - **ALWAYS respect this limit in all code, comments, and strings**
9191
- **No FIXME**: Use TODO instead of FIXME in committed code
9292
- **No Deprecated APIs**: Avoid using deprecated methods and classes in new code
9393
- **No Reflection**: Avoid using reflection in new code; prefer type-safe alternatives
9494

95+
### Code Style Guidelines
96+
- **IMPORTANT**: Always keep lines at or under 120 characters
97+
- Break long lines by:
98+
- Splitting long comments across multiple lines
99+
- Breaking method chains at logical points
100+
- Splitting long strings with string concatenation or multiline strings
101+
- Breaking parameter lists across multiple lines
102+
- Using proper indentation for continuation lines
103+
95104
### Development Workflow
96105
- Default development flavor: `jetpackWasabi` (Jetpack app with beta suffix)
97106
- Remote build cache available for faster builds (requires setup)

RELEASE-NOTES.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
*** PLEASE FOLLOW THIS FORMAT: [<priority indicator, more stars = higher priority>] <description> [<PR URL>]
22

3+
26.5
4+
-----
5+
6+
37
26.4
48
-----
59

WordPress/build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -374,6 +374,7 @@ static def addBuildConfigFieldsFromPrefixedProperties(variant, properties, prefi
374374

375375
dependencies {
376376
implementation(libs.androidx.navigation.compose)
377+
implementation(libs.commonmark)
377378
compileOnly project(path: ':libs:annotations')
378379
ksp project(':libs:processors')
379380
implementation (project(path:':libs:networking')) {
Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
1-
We added file size info to your media library, so you can see exactly what you're working with.
2-
3-
The experimental editor just got smoother, too. Your content stays put when you rotate your device or toggle dark mode, and dialogs now respond properly to the back button. Happy editing!
1+
* [*] Monochrome icon support for the WordPress app [#22321]
2+
* [*] Fixed high-resolution image loading issues [#22235]
Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,2 @@
1-
We added file size info to your media library, so you can see exactly what you're working with.
2-
3-
Increased the timeout for full-screen image loading, so some edge-cases and low connectivity cases have a higher chance to suncceed.
4-
5-
The experimental editor just got smoother, too. Your content stays put when you rotate your device or toggle dark mode, and dialogs now respond properly to the back button. Happy editing!
1+
* [*] Monochrome icon support for the WordPress app [#22321]
2+
* [*] Fixed high-resolution image loading issues [#22235]

WordPress/src/main/AndroidManifest.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,10 @@
151151
android:name=".ui.accounts.login.applicationpassword.ApplicationPasswordRequiredDialogActivity"
152152
android:theme="@style/WordPress.TransparentDialog"
153153
android:exported="false" />
154+
<activity
155+
android:name=".ui.accounts.login.applicationpassword.ApplicationPasswordAutoAuthDialogActivity"
156+
android:theme="@style/WordPress.TransparentDialog"
157+
android:exported="false" />
154158

155159
<activity
156160
android:name=".ui.accounts.LoginMagicLinkInterceptActivity"

WordPress/src/main/java/org/wordpress/android/AppInitializer.kt

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,6 @@ import org.wordpress.android.util.analytics.AnalyticsUtils
110110
import org.wordpress.android.util.config.AppConfig
111111
import org.wordpress.android.util.config.OpenWebLinksWithJetpackFlowFeatureConfig
112112
import org.wordpress.android.util.enqueuePeriodicUploadWorkRequestForAllSites
113-
import org.wordpress.android.util.experiments.ExPlat
114113
import org.wordpress.android.util.image.ImageManager
115114
import org.wordpress.android.widgets.AppReviewManager
116115
import org.wordpress.android.workers.WordPressWorkersFactory
@@ -184,9 +183,6 @@ class AppInitializer @Inject constructor(
184183
@Inject
185184
lateinit var imageEditorFileUtils: ImageEditorFileUtils
186185

187-
@Inject
188-
lateinit var exPlat: ExPlat
189-
190186
@Inject
191187
lateinit var wordPressWorkerFactory: WordPressWorkersFactory
192188

@@ -372,8 +368,6 @@ class AppInitializer @Inject constructor(
372368
systemNotificationsTracker.checkSystemNotificationsState()
373369
ImageEditorInitializer.init(imageManager, imageEditorTracker, imageEditorFileUtils, appScope)
374370

375-
exPlat.forceRefresh()
376-
377371
initDebugCookieManager()
378372

379373
if (!initialized && BuildConfig.DEBUG && Build.VERSION.SDK_INT >= VERSION_CODES.R) {
@@ -662,9 +656,6 @@ class AppInitializer @Inject constructor(
662656
if (accountStore.hasAccessToken()) {
663657
// Make sure the Push Notification token is sent to our servers after a successful login
664658
gcmRegistrationScheduler.scheduleRegistration()
665-
666-
// Force a refresh if user has logged in. This can be removed once we start using an anonymous ID.
667-
exPlat.forceRefresh()
668659
}
669660
}
670661

@@ -727,9 +718,6 @@ class AppInitializer @Inject constructor(
727718

728719
// Clear WordPress.com account cookie cache
729720
wordPressCookieAuthenticator.clearAllCachedCookies()
730-
731-
// Clear cached assignments if user has logged out. This can be removed once we start using an anonymous ID.
732-
exPlat.clear()
733721
}
734722

735723
/*
@@ -934,11 +922,6 @@ class AppInitializer @Inject constructor(
934922

935923
// Let's migrate the old editor preference if available in AppPrefs to the remote backend
936924
SiteUtils.migrateAppWideMobileEditorPreferenceToRemote(accountStore, siteStore, dispatcher)
937-
if (!firstActivityResumed) {
938-
// Since we're force refreshing on app startup, we don't need to try refreshing again when starting
939-
// our first Activity.
940-
exPlat.refreshIfNeeded()
941-
}
942925
if (firstActivityResumed) {
943926
deferredInit()
944927
}

WordPress/src/main/java/org/wordpress/android/modules/ExperimentModule.kt

Lines changed: 0 additions & 17 deletions
This file was deleted.
Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
11
package org.wordpress.android.support.aibot.model
22

3+
import androidx.compose.runtime.Immutable
4+
import androidx.compose.ui.text.AnnotatedString
35
import java.util.Date
46

7+
@Immutable
58
data class BotMessage(
69
val id: Long,
7-
val text: String,
10+
val rawText: String,
11+
val formattedText: AnnotatedString,
812
val date: Date,
913
val isWrittenByUser: Boolean
1014
)

WordPress/src/main/java/org/wordpress/android/support/aibot/repository/AIBotSupportRepository.kt

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,22 @@ import org.wordpress.android.modules.IO_THREAD
77
import org.wordpress.android.networking.restapi.WpComApiClientProvider
88
import org.wordpress.android.support.aibot.model.BotConversation
99
import org.wordpress.android.support.aibot.model.BotMessage
10+
import org.wordpress.android.ui.compose.utils.markdownToAnnotatedString
1011
import org.wordpress.android.util.AppLog
1112
import rs.wordpress.api.kotlin.WpComApiClient
1213
import rs.wordpress.api.kotlin.WpRequestResult
1314
import uniffi.wp_api.AddMessageToBotConversationParams
1415
import uniffi.wp_api.BotConversationSummary
1516
import uniffi.wp_api.CreateBotConversationParams
1617
import uniffi.wp_api.GetBotConversationParams
18+
import uniffi.wp_api.ListBotConversationsParams
19+
import uniffi.wp_api.ListBotConversationsSummaryMethod
20+
import java.util.Date
1721
import javax.inject.Inject
1822
import javax.inject.Named
1923

2024
private const val BOT_ID = "jetpack-chat-mobile"
25+
private const val ITEMS_PER_PAGE = 20
2126

2227
class AIBotSupportRepository @Inject constructor(
2328
private val appLogWrapper: AppLogWrapper,
@@ -51,7 +56,12 @@ class AIBotSupportRepository @Inject constructor(
5156

5257
suspend fun loadConversations(): List<BotConversation> = withContext(ioDispatcher) {
5358
val response = wpComApiClient.request { requestBuilder ->
54-
requestBuilder.supportBots().getBotConverationList(BOT_ID)
59+
requestBuilder.supportBots().getBotConversationList(
60+
botId = BOT_ID,
61+
params = ListBotConversationsParams(
62+
summaryMethod = ListBotConversationsSummaryMethod.LAST_MESSAGE
63+
)
64+
)
5565
}
5666
when (response) {
5767
is WpRequestResult.Success -> {
@@ -66,12 +76,15 @@ class AIBotSupportRepository @Inject constructor(
6676
}
6777
}
6878

69-
suspend fun loadConversation(chatId: Long): BotConversation? = withContext(ioDispatcher) {
79+
suspend fun loadConversation(chatId: Long, pageNumber: Long = 1L): BotConversation? = withContext(ioDispatcher) {
7080
val response = wpComApiClient.request { requestBuilder ->
7181
requestBuilder.supportBots().getBotConversation(
7282
botId = BOT_ID,
7383
chatId = chatId.toULong(),
74-
params = GetBotConversationParams()
84+
params = GetBotConversationParams(
85+
pageNumber = pageNumber.toULong(),
86+
itemsPerPage = ITEMS_PER_PAGE.toULong()
87+
)
7588
)
7689
}
7790
when (response) {
@@ -148,24 +161,25 @@ class AIBotSupportRepository @Inject constructor(
148161
BotConversation (
149162
id = chatId.toLong(),
150163
createdAt = createdAt,
151-
mostRecentMessageDate = lastMessage.createdAt,
152-
lastMessage = lastMessage.content,
164+
mostRecentMessageDate = summaryMessage.createdAt,
165+
lastMessage = summaryMessage.content,
153166
messages = listOf()
154167
)
155168

156169
private fun uniffi.wp_api.BotConversation.toBotConversation(): BotConversation =
157170
BotConversation (
158171
id = chatId.toLong(),
159172
createdAt = createdAt,
160-
mostRecentMessageDate = messages.last().createdAt,
161-
lastMessage = messages.last().content,
173+
mostRecentMessageDate = messages.lastOrNull()?.createdAt ?: Date(),
174+
lastMessage = messages.lastOrNull()?.content.orEmpty(),
162175
messages = messages.map { it.toBotMessage() }
163176
)
164177

165178
private fun uniffi.wp_api.BotMessage.toBotMessage(): BotMessage =
166179
BotMessage(
167180
id = messageId.toLong(),
168-
text = content,
181+
rawText = content,
182+
formattedText = markdownToAnnotatedString(content),
169183
date = createdAt,
170184
isWrittenByUser = role == "user"
171185
)

0 commit comments

Comments
 (0)