diff --git a/WordPress/src/main/AndroidManifest.xml b/WordPress/src/main/AndroidManifest.xml
index ebce3220aa18..edba81e6e442 100644
--- a/WordPress/src/main/AndroidManifest.xml
+++ b/WordPress/src/main/AndroidManifest.xml
@@ -1123,6 +1123,11 @@
android:label="@string/stats"
android:theme="@style/WordPress.NoActionBar"/>
+
+
diff --git a/WordPress/src/main/java/org/wordpress/android/ui/ActivityNavigator.kt b/WordPress/src/main/java/org/wordpress/android/ui/ActivityNavigator.kt
index 505f0db65752..b37b30457c37 100644
--- a/WordPress/src/main/java/org/wordpress/android/ui/ActivityNavigator.kt
+++ b/WordPress/src/main/java/org/wordpress/android/ui/ActivityNavigator.kt
@@ -27,6 +27,7 @@ import org.wordpress.android.ui.mysite.menu.KEY_QUICK_START_EVENT
import org.wordpress.android.ui.mysite.menu.MenuActivity
import org.wordpress.android.ui.mysite.personalization.PersonalizationActivity
import org.wordpress.android.ui.quickstart.QuickStartEvent
+import org.wordpress.android.ui.sitemonitor.SiteMonitorParentActivity
import org.wordpress.android.util.ToastUtils
import org.wordpress.android.util.analytics.AnalyticsUtils
import javax.inject.Inject
@@ -158,9 +159,9 @@ class ActivityNavigator @Inject constructor() {
}
fun navigateToSiteMonitoring(context: Context, site: SiteModel) {
- // todo: Implement this method after the SiteMonitorActivity is available and remove the lines below
- site.name
- context.packageName
+ val intent = Intent(context, SiteMonitorParentActivity::class.java)
+ intent.putExtra(WordPress.SITE, site)
+ context.startActivity(intent)
}
}
diff --git a/WordPress/src/main/java/org/wordpress/android/ui/sitemonitor/SiteMonitorParentActivity.kt b/WordPress/src/main/java/org/wordpress/android/ui/sitemonitor/SiteMonitorParentActivity.kt
new file mode 100644
index 000000000000..96087a86b48e
--- /dev/null
+++ b/WordPress/src/main/java/org/wordpress/android/ui/sitemonitor/SiteMonitorParentActivity.kt
@@ -0,0 +1,102 @@
+package org.wordpress.android.ui.sitemonitor
+
+import android.annotation.SuppressLint
+import android.os.Bundle
+import androidx.activity.compose.setContent
+import androidx.activity.viewModels
+import androidx.appcompat.app.AppCompatActivity
+import androidx.compose.foundation.layout.Column
+import androidx.compose.foundation.layout.fillMaxWidth
+import androidx.compose.material.MaterialTheme
+import androidx.compose.material.Scaffold
+import androidx.compose.material.TabRow
+import androidx.compose.material.Text
+import androidx.compose.material3.Tab
+import androidx.compose.runtime.Composable
+import androidx.compose.runtime.getValue
+import androidx.compose.runtime.mutableStateOf
+import androidx.compose.runtime.remember
+import androidx.compose.runtime.setValue
+import androidx.compose.ui.Modifier
+import androidx.compose.ui.res.stringResource
+import dagger.hilt.android.AndroidEntryPoint
+import org.wordpress.android.R
+import org.wordpress.android.WordPress
+import org.wordpress.android.fluxc.model.SiteModel
+import org.wordpress.android.ui.compose.components.MainTopAppBar
+import org.wordpress.android.ui.compose.components.NavigationIcons
+import org.wordpress.android.ui.compose.theme.AppTheme
+import org.wordpress.android.util.extensions.getSerializableExtraCompat
+
+@AndroidEntryPoint
+class SiteMonitorParentActivity: AppCompatActivity() {
+ val viewModel:SiteMonitorParentViewModel by viewModels()
+
+ override fun onCreate(savedInstanceState: Bundle?) {
+ super.onCreate(savedInstanceState)
+ setContent {
+ AppTheme {
+ viewModel.start(getSite())
+ SiteMonitorScreen()
+ }
+ }
+ }
+
+ private fun getSite(): SiteModel {
+ return requireNotNull(intent.getSerializableExtraCompat(WordPress.SITE)) as SiteModel
+ }
+
+ @Composable
+ @SuppressLint("UnusedMaterialScaffoldPaddingParameter")
+ fun SiteMonitorScreen(modifier: Modifier = Modifier) {
+ Scaffold(
+ topBar = {
+ MainTopAppBar(
+ title = stringResource(id = R.string.site_monitoring),
+ navigationIcon = NavigationIcons.BackIcon,
+ onNavigationIconClick = onBackPressedDispatcher::onBackPressed,
+ )
+ },
+ content = {
+ TabScreen(modifier = modifier)
+ }
+ )
+ }
+
+ @Composable
+ @SuppressLint("UnusedMaterialScaffoldPaddingParameter")
+ fun TabScreen(modifier: Modifier = Modifier) {
+ var tabIndex by remember { mutableStateOf(0) }
+
+ val tabs = listOf(
+ R.string.site_monitoring_tab_title_metrics,
+ R.string.site_monitoring_tab_title_php_logs,
+ R.string.site_monitoring_tab_title_web_server_logs
+ )
+
+ Column(modifier = modifier.fillMaxWidth()) {
+ TabRow(
+ selectedTabIndex = tabIndex,
+ backgroundColor = MaterialTheme.colors.surface,
+ contentColor = MaterialTheme.colors.onSurface,
+ ) {
+ tabs.forEachIndexed { index, title ->
+ Tab(text = { Text(stringResource(id = title)) },
+ selected = tabIndex == index,
+ onClick = { tabIndex = index }
+ )
+ }
+ }
+ when (tabIndex) {
+ 0 -> SiteMonitoringWebView()
+ 1 -> SiteMonitoringWebView()
+ 2 -> SiteMonitoringWebView()
+ }
+ }
+ }
+
+ @Composable
+ fun SiteMonitoringWebView(){
+ Text(text = "SiteMonitoringWebView")
+ }
+}
diff --git a/WordPress/src/main/java/org/wordpress/android/ui/sitemonitor/SiteMonitorParentViewModel.kt b/WordPress/src/main/java/org/wordpress/android/ui/sitemonitor/SiteMonitorParentViewModel.kt
new file mode 100644
index 000000000000..00c337746eed
--- /dev/null
+++ b/WordPress/src/main/java/org/wordpress/android/ui/sitemonitor/SiteMonitorParentViewModel.kt
@@ -0,0 +1,28 @@
+package org.wordpress.android.ui.sitemonitor
+
+import dagger.hilt.android.lifecycle.HiltViewModel
+import kotlinx.coroutines.CoroutineDispatcher
+import org.wordpress.android.analytics.AnalyticsTracker
+import org.wordpress.android.fluxc.model.SiteModel
+import org.wordpress.android.modules.BG_THREAD
+import org.wordpress.android.util.analytics.AnalyticsTrackerWrapper
+import org.wordpress.android.viewmodel.ScopedViewModel
+import javax.inject.Inject
+import javax.inject.Named
+
+@HiltViewModel
+class SiteMonitorParentViewModel @Inject constructor(
+ @param:Named(BG_THREAD) private val bgDispatcher: CoroutineDispatcher,
+ private val analyticsTrackerWrapper: AnalyticsTrackerWrapper
+) : ScopedViewModel(bgDispatcher) {
+ private lateinit var site: SiteModel
+
+ fun start(site: SiteModel) {
+ this.site = site
+ trackActivityLaunched()
+ }
+
+ private fun trackActivityLaunched() {
+ analyticsTrackerWrapper.track(AnalyticsTracker.Stat.SITE_MONITORING_SCREEN_SHOWN)
+ }
+}
diff --git a/WordPress/src/main/res/values/strings.xml b/WordPress/src/main/res/values/strings.xml
index ae6ac289d922..a52ebbf5804e 100644
--- a/WordPress/src/main/res/values/strings.xml
+++ b/WordPress/src/main/res/values/strings.xml
@@ -4856,4 +4856,7 @@ translators: %s: Select control option value e.g: "Auto, 25%". -->
Site Monitoring
+ Metrics
+ PHP Logs
+ Web Server Logs
diff --git a/WordPress/src/test/java/org/wordpress/android/ui/sitemonitor/SiteMonitorParentViewModelTest.kt b/WordPress/src/test/java/org/wordpress/android/ui/sitemonitor/SiteMonitorParentViewModelTest.kt
new file mode 100644
index 000000000000..7f2031d8b1c5
--- /dev/null
+++ b/WordPress/src/test/java/org/wordpress/android/ui/sitemonitor/SiteMonitorParentViewModelTest.kt
@@ -0,0 +1,36 @@
+package org.wordpress.android.ui.sitemonitor
+
+import kotlinx.coroutines.ExperimentalCoroutinesApi
+import org.junit.Before
+import org.junit.Test
+import org.junit.runner.RunWith
+import org.mockito.Mock
+import org.mockito.junit.MockitoJUnitRunner
+import org.mockito.kotlin.mock
+import org.mockito.kotlin.verify
+import org.wordpress.android.BaseUnitTest
+import org.wordpress.android.analytics.AnalyticsTracker
+import org.wordpress.android.fluxc.model.SiteModel
+import org.wordpress.android.util.analytics.AnalyticsTrackerWrapper
+
+@ExperimentalCoroutinesApi
+@RunWith(MockitoJUnitRunner::class)
+class SiteMonitorParentViewModelTest: BaseUnitTest(){
+ @Mock
+ private lateinit var analyticsTrackerWrapper: AnalyticsTrackerWrapper
+
+ private lateinit var viewModel: SiteMonitorParentViewModel
+
+ @Before
+ fun setUp() {
+ viewModel = SiteMonitorParentViewModel(testDispatcher(), analyticsTrackerWrapper)
+ }
+
+ @Test
+ fun `when viewmodel is started, then screen shown tracking is done`() {
+ val site = mock()
+ viewModel.start(site)
+
+ verify(analyticsTrackerWrapper).track(AnalyticsTracker.Stat.SITE_MONITORING_SCREEN_SHOWN)
+ }
+}
diff --git a/libs/analytics/src/main/java/org/wordpress/android/analytics/AnalyticsTracker.java b/libs/analytics/src/main/java/org/wordpress/android/analytics/AnalyticsTracker.java
index fbc2df7a413e..b00de495bc70 100644
--- a/libs/analytics/src/main/java/org/wordpress/android/analytics/AnalyticsTracker.java
+++ b/libs/analytics/src/main/java/org/wordpress/android/analytics/AnalyticsTracker.java
@@ -1101,7 +1101,8 @@ public enum Stat {
DYNAMIC_DASHBOARD_CARD_TAPPED,
DYNAMIC_DASHBOARD_CARD_CTA_TAPPED,
DYNAMIC_DASHBOARD_CARD_HIDE_TAPPED,
- DEEP_LINK_FAILED
+ DEEP_LINK_FAILED,
+ SITE_MONITORING_SCREEN_SHOWN
}
private static final List TRACKERS = new ArrayList<>();
diff --git a/libs/analytics/src/main/java/org/wordpress/android/analytics/AnalyticsTrackerNosara.java b/libs/analytics/src/main/java/org/wordpress/android/analytics/AnalyticsTrackerNosara.java
index 1ea594ddff90..b6a994767f9c 100644
--- a/libs/analytics/src/main/java/org/wordpress/android/analytics/AnalyticsTrackerNosara.java
+++ b/libs/analytics/src/main/java/org/wordpress/android/analytics/AnalyticsTrackerNosara.java
@@ -2697,6 +2697,8 @@ public static String getEventNameForStat(AnalyticsTracker.Stat stat) {
return "dynamic_dashboard_card_hide_tapped";
case DEEP_LINK_FAILED:
return "deep_link_failed";
+ case SITE_MONITORING_SCREEN_SHOWN:
+ return "site_monitoring_screen_shown";
}
return null;
}