Skip to content

Commit 1aaee1e

Browse files
committed
Merge branch 'woomob-1020-woo-possettings-add-ff-and-settings-button-to-the-menu' into woomob-1022-woo-possettings-prepare-infrastructure-for-the-settings
2 parents a407739 + 3861c13 commit 1aaee1e

File tree

46 files changed

+1374
-313
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

+1374
-313
lines changed

RELEASE-NOTES.txt

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
*** PLEASE FOLLOW THIS FORMAT: [<priority indicator, more stars = higher priority>] <description> [<PR URL>]
22
*** Use [*****] to indicate smoke tests of all critical flows should be run on the final APK before release (e.g. major library or targetSdk updates).
33
*** For entries which are touching the Android Wear app's, start entry with `[WEAR]` too.
4-
54
23.1
65
-----
6+
- [*] You can now remove background from product images in the app. Just open the product image and click "Remove background" button. [https://github.com/woocommerce/woocommerce-android/pull/14445]
77
- [*] Fixed bug when an order was not selected when navigating from my store screen [https://github.com/woocommerce/woocommerce-android/pull/14436]
8-
8+
- [*] [Shipping labels] Display split shipment instructions only when necessary [https://github.com/woocommerce/woocommerce-android/pull/14450]
9+
- [*] Updated behavior on the POS cash payment screen [https://github.com/woocommerce/woocommerce-android/pull/14449]
10+
- [Internal] Added support for persisting log files in the app's internal storage [https://github.com/woocommerce/woocommerce-android/pull/14425]
11+
- [*] Shipping labels: Fix layout issue with address status indicator [https://github.com/woocommerce/woocommerce-android/pull/14437]
912

1013
23.0
1114
-----

WooCommerce/build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -330,6 +330,7 @@ dependencies {
330330
exclude group: 'com.android.support', module: 'support-annotations'
331331
exclude group: 'com.android.support', module: 'support-core-utils'
332332
}
333+
testImplementation(libs.androidx.lifecycle.runtime.testing)
333334

334335
// Dependencies for Espresso UI tests
335336
androidTestImplementation(libs.androidx.test.ext.junit)

WooCommerce/src/main/kotlin/com/woocommerce/android/AppInitializer.kt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ import com.woocommerce.android.util.WooLog
5656
import com.woocommerce.android.util.WooLog.T
5757
import com.woocommerce.android.util.WooLog.T.DASHBOARD
5858
import com.woocommerce.android.util.WooLog.T.UTILS
59-
import com.woocommerce.android.util.WooLogWrapper
6059
import com.woocommerce.android.util.crashlogging.UploadEncryptedLogs
6160
import com.woocommerce.android.widgets.AppRatingDialog
6261
import dagger.Lazy
@@ -127,7 +126,7 @@ class AppInitializer @Inject constructor() : ApplicationLifecycleListener {
127126

128127
@Inject lateinit var blazeCampaignsObserver: BlazeCampaignsObserver
129128

130-
@Inject lateinit var wooLog: WooLogWrapper
129+
@Inject lateinit var wooLog: WooLog
131130

132131
@Inject lateinit var registerDevice: RegisterDevice
133132

WooCommerce/src/main/kotlin/com/woocommerce/android/di/AppConfigModule.kt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import com.woocommerce.android.AppPrefs
66
import com.woocommerce.android.BuildConfig
77
import com.woocommerce.android.FeedbackPrefs
88
import com.woocommerce.android.util.StringUtils
9+
import com.woocommerce.android.util.WooLog
910
import dagger.Module
1011
import dagger.Provides
1112
import dagger.hilt.InstallIn
@@ -49,4 +50,11 @@ class AppConfigModule {
4950

5051
@Provides
5152
fun provideWebViewCookieManager() = CookieManager.getInstance()
53+
54+
@Provides
55+
@Singleton
56+
fun provideWooLog(context: Context): WooLog {
57+
WooLog.init(context)
58+
return WooLog
59+
}
5260
}

WooCommerce/src/main/kotlin/com/woocommerce/android/notifications/local/LocalNotificationWorker.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ import com.woocommerce.android.notifications.local.LocalNotificationScheduler.Co
1919
import com.woocommerce.android.notifications.local.LocalNotificationScheduler.Companion.LOCAL_NOTIFICATION_TITLE
2020
import com.woocommerce.android.notifications.local.LocalNotificationScheduler.Companion.LOCAL_NOTIFICATION_TYPE
2121
import com.woocommerce.android.ui.main.MainActivity
22+
import com.woocommerce.android.util.WooLog
2223
import com.woocommerce.android.util.WooLog.T
23-
import com.woocommerce.android.util.WooLogWrapper
2424
import dagger.assisted.Assisted
2525
import dagger.assisted.AssistedInject
2626

@@ -31,7 +31,7 @@ class LocalNotificationWorker @AssistedInject constructor(
3131
@Assisted workerParams: WorkerParameters,
3232
private val wooNotificationBuilder: WooNotificationBuilder,
3333
private val appsPrefsWrapper: AppPrefsWrapper,
34-
private val wooLogWrapper: WooLogWrapper
34+
private val wooLog: WooLog
3535
) : CoroutineWorker(appContext, workerParams) {
3636

3737
override suspend fun doWork(): Result {
@@ -59,7 +59,7 @@ class LocalNotificationWorker @AssistedInject constructor(
5959
)
6060
)
6161
} else {
62-
wooLogWrapper.e(T.NOTIFICATIONS, "Scheduled local notification data is invalid")
62+
wooLog.e(T.NOTIFICATIONS, "Scheduled local notification data is invalid")
6363
}
6464
return Result.success()
6565
}

WooCommerce/src/main/kotlin/com/woocommerce/android/notifications/local/PreconditionCheckWorker.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ import com.woocommerce.android.model.DashboardWidget
1212
import com.woocommerce.android.notifications.local.LocalNotificationScheduler.Companion.LOCAL_NOTIFICATION_SITE_ID
1313
import com.woocommerce.android.notifications.local.LocalNotificationScheduler.Companion.LOCAL_NOTIFICATION_TYPE
1414
import com.woocommerce.android.ui.dashboard.data.ObserveBlazeWidgetStatus
15+
import com.woocommerce.android.util.WooLog
1516
import com.woocommerce.android.util.WooLog.T.NOTIFICATIONS
16-
import com.woocommerce.android.util.WooLogWrapper
1717
import com.woocommerce.android.util.WooPermissionUtils
1818
import dagger.assisted.Assisted
1919
import dagger.assisted.AssistedInject
@@ -24,7 +24,7 @@ import org.wordpress.android.fluxc.store.SiteStore
2424
class PreconditionCheckWorker @AssistedInject constructor(
2525
@Assisted private val appContext: Context,
2626
@Assisted workerParams: WorkerParameters,
27-
private val wooLogWrapper: WooLogWrapper,
27+
private val wooLog: WooLog,
2828
private val siteStore: SiteStore,
2929
private val observeBlazeWidgetStatus: ObserveBlazeWidgetStatus,
3030
private val crashLogging: CrashLogging,
@@ -67,7 +67,7 @@ class PreconditionCheckWorker @AssistedInject constructor(
6767
get() = VERSION.SDK_INT < VERSION_CODES.TIRAMISU || WooPermissionUtils.hasNotificationsPermission(appContext)
6868

6969
private fun cancelWork(message: String): Result {
70-
wooLogWrapper.i(NOTIFICATIONS, message)
70+
wooLog.i(NOTIFICATIONS, message)
7171
WorkManager.getInstance(appContext).cancelWorkById(id)
7272
return Result.failure()
7373
}

WooCommerce/src/main/kotlin/com/woocommerce/android/notifications/push/NotificationMessageHandler.kt

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ import com.woocommerce.android.notifications.WooNotificationBuilder
1616
import com.woocommerce.android.notifications.WooNotificationType.NewOrder
1717
import com.woocommerce.android.tools.SelectedSite
1818
import com.woocommerce.android.util.NotificationsParser
19+
import com.woocommerce.android.util.WooLog
1920
import com.woocommerce.android.util.WooLog.T.NOTIFS
20-
import com.woocommerce.android.util.WooLogWrapper
2121
import com.woocommerce.android.viewmodel.ResourceProvider
2222
import org.greenrobot.eventbus.EventBus
2323
import org.wordpress.android.fluxc.Dispatcher
@@ -35,7 +35,7 @@ class NotificationMessageHandler @Inject constructor(
3535
private val analyticsTracker: NotificationAnalyticsTracker,
3636
private val notificationsParser: NotificationsParser,
3737
private val accountStore: AccountStore,
38-
private val wooLogWrapper: WooLogWrapper,
38+
private val wooLog: WooLog,
3939
private val dispatcher: Dispatcher,
4040
private val resourceProvider: ResourceProvider,
4141
private val selectedSite: SelectedSite,
@@ -69,37 +69,37 @@ class NotificationMessageHandler @Inject constructor(
6969
@Suppress("ReturnCount", "ComplexMethod")
7070
fun onNewMessageReceived(messageData: Map<String, String>) {
7171
if (!accountStore.hasAccessToken()) {
72-
wooLogWrapper.e(NOTIFS, "User is not logged in!")
72+
wooLog.e(NOTIFS, "User is not logged in!")
7373
return
7474
}
7575

7676
if (!selectedSite.exists()) {
77-
wooLogWrapper.e(NOTIFS, "User has no site selected!")
77+
wooLog.e(NOTIFS, "User has no site selected!")
7878
return
7979
}
8080

8181
if (messageData.isEmpty()) {
82-
wooLogWrapper.e(NOTIFS, "Push notification received without a valid Bundle!")
82+
wooLog.e(NOTIFS, "Push notification received without a valid Bundle!")
8383
return
8484
}
8585

8686
val pushUserId = messageData[PUSH_ARG_USER]
8787
// pushUserId is always set server side, but better to double check it here.
8888
if (accountStore.account.userId.toString() != pushUserId) {
89-
wooLogWrapper.e(NOTIFS, "WP.com userId found in the app doesn't match with the ID in the PN. Aborting.")
89+
wooLog.e(NOTIFS, "WP.com userId found in the app doesn't match with the ID in the PN. Aborting.")
9090
return
9191
}
9292

9393
val notificationModel = notificationsParser.buildNotificationModelFromPayloadMap(messageData)
9494
if (notificationModel == null) {
95-
wooLogWrapper.e(NOTIFS, "Notification data is empty!")
95+
wooLog.e(NOTIFS, "Notification data is empty!")
9696
return
9797
}
9898

9999
val notification = notificationModel.toAppModel(resourceProvider)
100100
if (notification.remoteNoteId == 0L) {
101101
// At this point 'note_id' is always available in the notification bundle.
102-
wooLogWrapper.e(NOTIFS, "Push notification received without a valid note_id in the payload!")
102+
wooLog.e(NOTIFS, "Push notification received without a valid note_id in the payload!")
103103
return
104104
}
105105

WooCommerce/src/main/kotlin/com/woocommerce/android/support/WooLogViewerActivity.kt

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,34 +4,40 @@ import android.content.Intent
44
import android.os.Bundle
55
import androidx.activity.ComponentActivity
66
import androidx.activity.compose.setContent
7+
import androidx.activity.viewModels
78
import com.woocommerce.android.R
89
import com.woocommerce.android.extensions.copyToClipboard
910
import com.woocommerce.android.ui.compose.theme.WooTheme
1011
import com.woocommerce.android.util.WooLog
1112
import com.woocommerce.android.util.WooLog.T
13+
import dagger.hilt.android.AndroidEntryPoint
1214
import org.wordpress.android.util.ToastUtils
1315

16+
@AndroidEntryPoint
1417
class WooLogViewerActivity : ComponentActivity() {
18+
private val viewModel: WooLogViewerViewModel by viewModels()
19+
1520
override fun onCreate(savedInstanceState: Bundle?) {
1621
super.onCreate(savedInstanceState)
1722

1823
setContent {
1924
WooTheme {
20-
WooLogViewerScreen(
21-
WooLog.logEntries,
22-
onBackPress = onBackPressedDispatcher::onBackPressed,
23-
onCopyButtonClick = ::copyAppLogToClipboard,
24-
onShareButtonClick = ::shareAppLog
25-
)
25+
WooLogViewerScreen(viewModel)
26+
}
27+
}
28+
29+
viewModel.event.observe(this) { event ->
30+
when (event) {
31+
is WooLogViewerViewModel.ShareLogs -> shareAppLog(event.logs)
32+
is WooLogViewerViewModel.CopyLogs -> copyAppLogToClipboard(event.logs)
2633
}
2734
}
2835
}
2936

30-
private fun shareAppLog() {
31-
WooLog.addDeviceInfoEntry(T.DEVICE, WooLog.LogLevel.w)
37+
private fun shareAppLog(logs: String) {
3238
val intent = Intent(Intent.ACTION_SEND)
3339
intent.type = "text/plain"
34-
intent.putExtra(Intent.EXTRA_TEXT, WooLog.toString())
40+
intent.putExtra(Intent.EXTRA_TEXT, logs)
3541
intent.putExtra(Intent.EXTRA_SUBJECT, getString(R.string.app_name) + " " + title)
3642
try {
3743
startActivity(Intent.createChooser(intent, getString(R.string.share)))
@@ -40,10 +46,9 @@ class WooLogViewerActivity : ComponentActivity() {
4046
}
4147
}
4248

43-
private fun copyAppLogToClipboard() {
49+
private fun copyAppLogToClipboard(logs: String) {
4450
try {
45-
WooLog.addDeviceInfoEntry(T.DEVICE, WooLog.LogLevel.w)
46-
copyToClipboard("AppLog", WooLog.toString())
51+
copyToClipboard("AppLog", logs)
4752
ToastUtils.showToast(this, R.string.logviewer_copied_to_clipboard)
4853
} catch (e: Exception) {
4954
WooLog.e(T.UTILS, e)

0 commit comments

Comments
 (0)