Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integrate gutenberg-mobile release 1.78.1 #16762

Closed
wants to merge 29 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
44c3307
Stats Revamp Feature Announcement
ravishanker Jun 3, 2022
9c9377e
Update image
ravishanker Jun 7, 2022
add7824
Adds PreferenceFragmentLifeCycleOwner class to support lifecycleowner…
SowmiaS Jun 13, 2022
cf5193f
Merge pull request #16370 from SowmiaS/issue/12372_implement_lifecycl…
AjeshRPai Jun 14, 2022
3d786c5
Merge branch 'trunk' into merge/release-20.1-into-trunk
spencertransier Jun 14, 2022
771b76b
Build: Remove unused analytics specific gradle properties example file
ParaskP7 Jun 14, 2022
c3ade3c
Build: Remove unnecessary git ignore file from analytics module
ParaskP7 Jun 14, 2022
4ebe98e
Build: Remove sub-root related gradle files from analytics module
ParaskP7 Jun 14, 2022
6e421a8
Docs: Update readme for analytics module
ParaskP7 Jun 14, 2022
206995f
Build: Remove unnecessary wordpress analytics module level
ParaskP7 Jun 14, 2022
9b20599
Merge pull request #16741 from wordpress-mobile/merge/release-20.1-in…
spencertransier Jun 14, 2022
427319b
Migrate StatsNewFeaturesIntroDialogFragment to Hilt
irfano Jun 14, 2022
65600eb
Merge branch 'trunk' into Stats-Revamp-v2-New-Features-Announcement
ravishanker Jun 15, 2022
b652d82
Merge pull request #16703 from wordpress-mobile/Stats-Revamp-v2-New-F…
ravishanker Jun 15, 2022
af667ac
Docs: Update library with module on analytics module readme description
ParaskP7 Jun 15, 2022
039001f
Merge branch 'trunk' of github.com:wordpress-mobile/WordPress-Android…
ParaskP7 Jun 15, 2022
7b878c7
Merge pull request #16750 from wordpress-mobile/release/20.1
AliSoftware Jun 15, 2022
1db2504
Build: Remove unused networking specific gradle properties example file
ParaskP7 Jun 15, 2022
916931c
Build: Remove unnecessary git ignore file from networking module
ParaskP7 Jun 15, 2022
dadf4f0
Build: Remove sub-root related gradle files from networking module
ParaskP7 Jun 15, 2022
3e790e3
Docs: Add readme for networking module
ParaskP7 Jun 15, 2022
743d067
Build: Remove unnecessary wordpress networking module level
ParaskP7 Jun 15, 2022
975f451
Fix date problem on stats line chart
irfano Jun 15, 2022
a3aaa79
Merge pull request #16754 from wordpress-mobile/fix/stats-revamp-v2-l…
ravishanker Jun 16, 2022
3af2fc7
Merge pull request #16744 from wordpress-mobile/build/restructure-ana…
ParaskP7 Jun 16, 2022
6f2c174
Merge branch 'trunk' into build/restructure-networking-module
ParaskP7 Jun 16, 2022
7cb0558
Merge pull request #16752 from wordpress-mobile/build/restructure-net…
ParaskP7 Jun 16, 2022
8b8ec5b
Merge pull request #16761 from wordpress-mobile/release/20.1
AliSoftware Jun 16, 2022
aa402fa
Release script: Update build.gradle gutenbergMobileVersion to ref
Jun 16, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions WordPress/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -463,11 +463,11 @@ dependencies {
}
}

implementation (project(path:':libs:networking:WordPressNetworking')) {
implementation (project(path:':libs:networking')) {
exclude group: "com.android.volley"
exclude group: 'org.wordpress', module: 'utils'
}
implementation (project(path:':libs:analytics:WordPressAnalytics')) {
implementation (project(path:':libs:analytics')) {
exclude group: 'org.wordpress', module: 'utils'
}
implementation (project(path:':libs:editor:WordPressEditor')) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@
import org.wordpress.android.ui.reader.tracker.ReaderTracker;
import org.wordpress.android.ui.sitecreation.misc.SiteCreationSource;
import org.wordpress.android.ui.stats.StatsTimeframe;
import org.wordpress.android.ui.stats.intro.StatsNewFeaturesIntroDialogFragment;
import org.wordpress.android.ui.stories.intro.StoriesIntroDialogFragment;
import org.wordpress.android.ui.uploads.UploadActionUseCase;
import org.wordpress.android.ui.uploads.UploadUtils;
Expand All @@ -143,6 +144,7 @@
import org.wordpress.android.util.analytics.service.InstallationReferrerServiceStarter;
import org.wordpress.android.util.config.BloggingPromptsFeatureConfig;
import org.wordpress.android.util.config.MySiteDashboardTodaysStatsCardFeatureConfig;
import org.wordpress.android.util.config.StatsRevampV2FeatureConfig;
import org.wordpress.android.util.extensions.ViewExtensionsKt;
import org.wordpress.android.viewmodel.main.WPMainActivityViewModel;
import org.wordpress.android.viewmodel.main.WPMainActivityViewModel.FocusPointInfo;
Expand All @@ -164,9 +166,12 @@
import static org.wordpress.android.push.NotificationsProcessingService.ARG_NOTIFICATION_TYPE;
import static org.wordpress.android.ui.JetpackConnectionSource.NOTIFICATIONS;

import dagger.hilt.android.AndroidEntryPoint;

/**
* Main activity which hosts sites, reader, me and notifications pages
*/
@AndroidEntryPoint
public class WPMainActivity extends LocaleAwareActivity implements
OnPageListener,
BottomNavController,
Expand Down Expand Up @@ -250,6 +255,7 @@ public class WPMainActivity extends LocaleAwareActivity implements
@Inject WeeklyRoundupScheduler mWeeklyRoundupScheduler;
@Inject MySiteDashboardTodaysStatsCardFeatureConfig mTodaysStatsCardFeatureConfig;
@Inject QuickStartTracker mQuickStartTracker;
@Inject StatsRevampV2FeatureConfig mStatsRevampV2FeatureConfig;
@Inject BloggingPromptsFeatureConfig mBloggingPromptsFeatureConfig;

@Inject BuildConfigWrapper mBuildConfigWrapper;
Expand Down Expand Up @@ -449,6 +455,13 @@ && getIntent().getExtras().getBoolean(ARG_CONTINUE_JETPACK_CONNECT, false)) {
if (getIntent().getBooleanExtra(ARG_OPEN_BLOGGING_REMINDERS, false)) {
onSetPromptReminderClick(getIntent().getIntExtra(ARG_OPEN_BLOGGING_REMINDERS, 0));
}

// TODO: Confirm what would invoke this and what should happen when remind me later
if (mStatsRevampV2FeatureConfig.isEnabled()) {
StatsNewFeaturesIntroDialogFragment.newInstance().show(
getSupportFragmentManager(), StatsNewFeaturesIntroDialogFragment.TAG
);
}
}

private void showBloggingPromptsOnboarding() {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
package org.wordpress.android.ui.prefs

import android.os.Bundle
import android.preference.PreferenceFragment
import androidx.lifecycle.Lifecycle
import androidx.lifecycle.Lifecycle.Event.ON_CREATE
import androidx.lifecycle.Lifecycle.Event.ON_DESTROY
import androidx.lifecycle.Lifecycle.Event.ON_PAUSE
import androidx.lifecycle.Lifecycle.Event.ON_START
import androidx.lifecycle.Lifecycle.Event.ON_STOP
import androidx.lifecycle.LifecycleCoroutineScope
import androidx.lifecycle.LifecycleOwner
import androidx.lifecycle.LifecycleRegistry
import androidx.lifecycle.coroutineScope

/**
* LifecycleOwner is a single method interface that denotes that the class has a Lifecycle.
* android.preference.PreferenceFragment doesn't implement android.app.Fragment.LifecycleOwner interface.
* Fragments and Activities in Support Library 26.1.0 and later already implement the LifecycleOwner interface.
* Until we migrate to androidx Preference Library, we can use this class instead of deprecated PreferenceFragment,
* which supports the use of lifecycleCoroutineScope for observing Live data or Flows.
* https://developer.android.com/topic/libraries/architecture/lifecycle#implementing-lco
*/
@SuppressWarnings("deprecation")
open class PreferenceFragmentLifeCycleOwner : PreferenceFragment(), LifecycleOwner {
private lateinit var lifecycleRegistry: LifecycleRegistry

val lifecycleScope: LifecycleCoroutineScope
get() = lifecycle.coroutineScope

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
lifecycleRegistry = LifecycleRegistry(this)
lifecycleRegistry.handleLifecycleEvent(ON_CREATE)
}

override fun onStart() {
super.onStart()
lifecycleRegistry.handleLifecycleEvent(ON_START)
}

override fun onPause() {
super.onPause()
lifecycleRegistry.handleLifecycleEvent(ON_PAUSE)
}

override fun onStop() {
super.onStop()
lifecycleRegistry.handleLifecycleEvent(ON_STOP)
}

override fun onDestroy() {
super.onDestroy()
lifecycleRegistry.handleLifecycleEvent(ON_DESTROY)
}

override fun getLifecycle(): Lifecycle {
return lifecycleRegistry
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
package org.wordpress.android.ui.stats.intro

import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData
import dagger.hilt.android.lifecycle.HiltViewModel
import kotlinx.coroutines.CoroutineDispatcher
import org.wordpress.android.analytics.AnalyticsTracker.Stat
import org.wordpress.android.modules.UI_THREAD
import org.wordpress.android.ui.stats.intro.StatsNewFeaturesIntroAction.DismissDialog
import org.wordpress.android.ui.stats.intro.StatsNewFeaturesIntroAction.OpenStats
import org.wordpress.android.ui.stats.refresh.utils.StatsSiteProvider
import org.wordpress.android.util.analytics.AnalyticsTrackerWrapper
import org.wordpress.android.viewmodel.ScopedViewModel
import javax.inject.Inject
import javax.inject.Named

@HiltViewModel
class StatsNewFeatureIntroViewModel @Inject constructor(
@Named(UI_THREAD) mainDispatcher: CoroutineDispatcher,
private val statsSiteProvider: StatsSiteProvider,
private val analyticsTracker: AnalyticsTrackerWrapper
) : ScopedViewModel(mainDispatcher) {
private val _action = MutableLiveData<StatsNewFeaturesIntroAction>()
val action: LiveData<StatsNewFeaturesIntroAction> = _action

fun onPrimaryButtonClick() = launch {
analyticsTracker.track(Stat.STATS_REVAMP_V2_INTRO_TRY_IT_NOW_CLICKED)
_action.postValue(OpenStats(statsSiteProvider.siteModel))
}

fun onSecondaryButtonClick() {
analyticsTracker.track(Stat.STATS_REVAMP_V2_INTRO_REMIND_ME_CLICKED)
_action.value = DismissDialog
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package org.wordpress.android.ui.stats.intro

import org.wordpress.android.fluxc.model.SiteModel

sealed class StatsNewFeaturesIntroAction {
data class OpenStats(val site: SiteModel) : StatsNewFeaturesIntroAction()
object DismissDialog : StatsNewFeaturesIntroAction()
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
package org.wordpress.android.ui.stats.intro

import android.os.Bundle
import android.view.View
import androidx.fragment.app.viewModels
import dagger.hilt.android.AndroidEntryPoint
import org.wordpress.android.R
import org.wordpress.android.databinding.StatsRevampV2FeaturesIntroContentViewBinding
import org.wordpress.android.ui.ActivityLauncher
import org.wordpress.android.ui.featureintroduction.FeatureIntroductionDialogFragment
import org.wordpress.android.ui.stats.intro.StatsNewFeaturesIntroAction.DismissDialog
import org.wordpress.android.ui.stats.intro.StatsNewFeaturesIntroAction.OpenStats
import org.wordpress.android.util.extensions.exhaustive

@AndroidEntryPoint
class StatsNewFeaturesIntroDialogFragment : FeatureIntroductionDialogFragment() {
private val viewModel: StatsNewFeatureIntroViewModel by viewModels()

override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
initializeViews()
setupObservers()
}

private fun initializeViews() {
setHeaderIcon(R.drawable.ic_outline_lightbulb_orange_gradient_40dp)
setHeaderTitle(R.string.stats_revamp_v2_intro_header_title)

val contentBinding = StatsRevampV2FeaturesIntroContentViewBinding.inflate(layoutInflater)
setContent(contentBinding.root)

setPrimaryButtonText(R.string.stats_revamp_v2_intro_primary_button_text)
setPrimaryButtonListener { viewModel.onPrimaryButtonClick() }

setSecondaryButtonText(R.string.stats_revamp_v2_intro_secondary_button_text)
setSecondaryButtonListener { viewModel.onSecondaryButtonClick() }
}

private fun setupObservers() {
viewModel.action.observe(viewLifecycleOwner) { action ->
when (action) {
is OpenStats -> {
activity?.let {
ActivityLauncher.viewBlogStats(it, action.site)
}
}
is DismissDialog -> {
dismiss()
}
}.exhaustive
}
}

companion object {
const val TAG = "STATS_NEW_FEATURES_INTRO_DIALOG_FRAGMENT"

@JvmStatic
fun newInstance(): StatsNewFeaturesIntroDialogFragment =
StatsNewFeaturesIntroDialogFragment()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,9 @@ class ViewsAndVisitorsMapper
Visitors -> it.visitors
else -> 0L
}
val date = statsDateFormatter.parseStatsDate(statsGranularity, it.period)
Line(
statsDateFormatter.printGranularDate(it.period, statsGranularity),
statsDateFormatter.printDayWithoutYear(date),
it.period,
value.toInt()
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,6 @@ package org.wordpress.android.ui.stats.refresh.utils
import com.github.mikephil.charting.components.AxisBase
import com.github.mikephil.charting.formatter.ValueFormatter
import org.wordpress.android.ui.stats.refresh.lists.sections.BlockListItem.LineChartItem.Line
import java.text.ParseException
import java.text.SimpleDateFormat
import java.util.Date
import java.util.Locale
import javax.inject.Inject

class LineChartLabelFormatter @Inject constructor(
Expand All @@ -15,27 +11,9 @@ class LineChartLabelFormatter @Inject constructor(
override fun getAxisLabel(value: Float, axis: AxisBase?): String {
val index = value.toInt()
return if (index < entries.size) {
formatLabelDate(parseLabelDate(entries[index].label))
entries[index].label
} else {
""
}
}

// 12 Apr 2022
private fun parseLabelDate(label: String): Date? {
var labelDate: Date? = null
val labelParser = SimpleDateFormat("dd MMM yyyy", Locale.getDefault())
try {
labelDate = labelParser.parse(label)
} catch (e: ParseException) {
e.printStackTrace()
}
return labelDate
}

// Apr 12
private fun formatLabelDate(date: Date?): String {
val labelFormatter = SimpleDateFormat("MMM d", Locale.getDefault())
return date?.let { labelFormatter.format(it) }.toString()
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">

<com.google.android.material.imageview.ShapeableImageView
android:id="@+id/cover_image"
android:src="@drawable/stats_feature_intro"
android:scaleType="center"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/margin_extra_medium_large"
android:layout_marginStart="@dimen/margin_extra_medium_large"
android:layout_marginEnd="@dimen/margin_extra_medium_large"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toTopOf="@+id/content_bottom"
app:layout_constraintVertical_chainStyle="packed"/>

<com.google.android.material.textview.MaterialTextView
android:id="@+id/content_bottom"
android:text="@string/stats_revamp_v2_intro_content"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/margin_extra_medium_large"
android:layout_marginStart="@dimen/margin_extra_extra_medium_large"
android:layout_marginEnd="@dimen/margin_extra_extra_medium_large"
android:gravity="center"
android:maxEms="70"
android:textAppearance="?attr/textAppearanceBody1"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/cover_image"
app:layout_constraintBottom_toTopOf="@+id/content_note" />

<com.google.android.material.textview.MaterialTextView
android:id="@+id/content_note"
android:text="@string/stats_revamp_v2_intro_content_note"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/margin_extra_medium_large"
android:background="@drawable/bg_rectangle_black_60_radius_2dp"
android:gravity="start"
android:padding="@dimen/margin_large"
android:textAppearance="?attr/textAppearanceCaption"
android:textSize="@dimen/text_sz_small"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/content_bottom" />

</androidx.constraintlayout.widget.ConstraintLayout>
8 changes: 8 additions & 0 deletions WordPress/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1373,6 +1373,14 @@
<string name="stats_insights_comments_guide_card">💡See your top contributors by tapping VIEW MORE.</string>
<string name="stats_insights_followers_guide_card">💡You can try leaving a comment as a gesture to encourage blog engagement in return to gain more followers.</string>

<!-- Stats Revamp v2 Feature Introduction -->
<string name="stats_revamp_v2_intro_header_title">Insights update</string>
<string name="stats_revamp_v2_intro_content">Insights help you understand how your content resonates with your audience with an overview of how it is performing and guidance to your next steps.</string>
<string name="stats_revamp_v2_intro_content_note">Note: You can learn more about Insights at any time in My Site > Stats > Insights</string>
<string name="stats_revamp_v2_intro_primary_button_text">Try it now</string>
<string name="stats_revamp_v2_intro_secondary_button_text">Remind me later</string>


<!-- Stats refreshed widgets -->
<string name="stats_widget_log_in_message">Please log in to the WordPress app to add a widget.</string>
<string name="stats_widget_weekly_views_name">Views this week</string>
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ plugins {
ext {
wordPressUtilsVersion = '2.5.0'
wordPressLoginVersion = '0.14.0'
gutenbergMobileVersion = 'v1.78.0'
gutenbergMobileVersion = '4961-db8bfd958151567f30f451f1cfc9482885dbeaaf'
storiesVersion = '1.3.0'
aboutAutomatticVersion = '0.0.5'

Expand Down
25 changes: 0 additions & 25 deletions libs/analytics/.gitignore

This file was deleted.

Loading