Skip to content

Commit a40b686

Browse files
committed
Merge branch 'trunk' into feat/CMM-886-create-logs-sharing-with-HE
# Conflicts: # WordPress/src/main/java/org/wordpress/android/support/he/ui/HESupportViewModel.kt
2 parents 4081ef0 + f42f392 commit a40b686

File tree

46 files changed

+1826
-1269
lines changed

Some content is hidden

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

46 files changed

+1826
-1269
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)

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.

WordPress/src/main/java/org/wordpress/android/support/aibot/ui/AIBotSupportActivity.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ class AIBotSupportActivity : AppCompatActivity() {
9393
val message = when (errorType) {
9494
ConversationsSupportViewModel.ErrorType.GENERAL -> getString(R.string.ai_bot_generic_error)
9595
ConversationsSupportViewModel.ErrorType.FORBIDDEN -> getString(R.string.he_support_forbidden_error)
96+
ConversationsSupportViewModel.ErrorType.OFFLINE -> getString(R.string.no_network_title)
9697
}
9798
scope.launch {
9899
snackbarHostState.showSnackbar(

WordPress/src/main/java/org/wordpress/android/support/common/ui/ConversationsSupportViewModel.kt

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import org.wordpress.android.util.NetworkUtilsWrapper
1919
abstract class ConversationsSupportViewModel<ConversationType: Conversation>(
2020
protected val accountStore: AccountStore,
2121
protected val appLogWrapper: AppLogWrapper,
22-
private val networkUtilsWrapper: NetworkUtilsWrapper,
22+
protected val networkUtilsWrapper: NetworkUtilsWrapper,
2323
) : ViewModel() {
2424
sealed class NavigationEvent {
2525
data object NavigateToConversationDetail : NavigationEvent()
@@ -140,6 +140,11 @@ abstract class ConversationsSupportViewModel<ConversationType: Conversation>(
140140
fun onConversationClick(conversation: ConversationType) {
141141
viewModelScope.launch {
142142
try {
143+
if (!networkUtilsWrapper.isNetworkAvailable()) {
144+
_errorMessage.value = ErrorType.OFFLINE
145+
return@launch
146+
}
147+
143148
_isLoadingConversation.value = true
144149
_selectedConversation.value = conversation
145150
_navigationEvents.emit(NavigationEvent.NavigateToConversationDetail)
@@ -173,6 +178,10 @@ abstract class ConversationsSupportViewModel<ConversationType: Conversation>(
173178

174179
fun onCreateNewConversationClick() {
175180
viewModelScope.launch {
181+
if (!networkUtilsWrapper.isNetworkAvailable()) {
182+
_errorMessage.value = ErrorType.OFFLINE
183+
return@launch
184+
}
176185
_navigationEvents.emit(NavigationEvent.NavigateToNewConversation)
177186
}
178187
}
@@ -182,5 +191,6 @@ abstract class ConversationsSupportViewModel<ConversationType: Conversation>(
182191
enum class ErrorType {
183192
GENERAL,
184193
FORBIDDEN,
194+
OFFLINE,
185195
}
186196
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
package org.wordpress.android.support.he.model
2+
3+
import android.net.Uri
4+
5+
data class AttachmentState(
6+
val acceptedUris: List<Uri> = emptyList(),
7+
val rejectedUris: List<Uri> = emptyList(),
8+
val currentTotalSizeBytes: Long = 0L,
9+
val rejectedTotalSizeBytes: Long = 0L
10+
)
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
package org.wordpress.android.support.he.model
2+
3+
enum class ConversationStatus {
4+
WAITING_FOR_SUPPORT,
5+
WAITING_FOR_USER,
6+
CLOSED,
7+
SOLVED,
8+
UNKNOWN;
9+
10+
companion object {
11+
fun fromStatus(status: String): ConversationStatus {
12+
return when (status.lowercase()) {
13+
"open", "new", "hold" -> WAITING_FOR_SUPPORT
14+
"closed" -> CLOSED
15+
"pending" -> WAITING_FOR_USER
16+
"solved" -> SOLVED
17+
else -> UNKNOWN
18+
}
19+
}
20+
}
21+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
package org.wordpress.android.support.he.model
2+
3+
sealed class MessageSendResult {
4+
data object Success : MessageSendResult()
5+
data object Failure : MessageSendResult()
6+
}

WordPress/src/main/java/org/wordpress/android/support/he/model/SupportConversation.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ data class SupportConversation(
88
val title: String,
99
val description: String,
1010
val lastMessageSentAt: Date,
11+
val status: String,
1112
val messages: List<SupportMessage>
1213
): Conversation {
1314
override fun getConversationId(): Long = id
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
package org.wordpress.android.support.he.model
2+
3+
import java.io.File
4+
5+
sealed class VideoDownloadState {
6+
object Idle : VideoDownloadState()
7+
object Downloading : VideoDownloadState()
8+
object Error : VideoDownloadState()
9+
data class Success(val file: File) : VideoDownloadState()
10+
}

0 commit comments

Comments
 (0)