Skip to content

Commit

Permalink
Merge branch 'trunk' into media-upload/track-failed-editor
Browse files Browse the repository at this point in the history
  • Loading branch information
jhnstn committed Jan 15, 2024
2 parents 28a517e + 758a87c commit b246b84
Show file tree
Hide file tree
Showing 141 changed files with 888 additions and 281 deletions.
7 changes: 0 additions & 7 deletions .buildkite/commands/danger-pr-check.sh

This file was deleted.

13 changes: 0 additions & 13 deletions .buildkite/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,19 +29,6 @@ steps:
#################
- group: "🕵️‍♂️ Linters"
steps:
- label: "☢️ Danger - PR Check"
command: .buildkite/commands/danger-pr-check.sh
plugins:
- docker#v5.8.0:
image: "public.ecr.aws/docker/library/ruby:3.2.2"
propagate-environment: true
environment:
- "DANGER_GITHUB_API_TOKEN"
if: "build.pull_request.id != null"
retry:
manual:
permit_on_passed: true

- label: "🕵️ checkstyle"
command: |
cp gradle.properties-example gradle.properties
Expand Down
11 changes: 11 additions & 0 deletions .github/workflows/run-danger.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: ☢️ Danger

on:
pull_request:
types: [opened, synchronize, edited, review_requested, review_request_removed, labeled, unlabeled, milestoned, demilestoned]

jobs:
dangermattic:
uses: Automattic/dangermattic/.github/workflows/reusable-run-danger.yml@trunk
secrets:
github-token: ${{ secrets.DANGERMATTIC_GITHUB_TOKEN }}
5 changes: 5 additions & 0 deletions RELEASE-NOTES.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
*** PLEASE FOLLOW THIS FORMAT: [<priority indicator, more stars = higher priority>] <description> [<PR URL>]

24.1
-----
* [**] Block Editor: Image block media uploads display a custom error message when there is no internet connection [https://github.com/wordpress-mobile/WordPress-Android/pull/19878]
* [**] Block Editor: Media uploads that failed due to lack of internet connectivity automatically retry once a connection is re-established [https://github.com/wordpress-mobile/WordPress-Android/pull/19803]

24.0
-----
* [*] Filter media types when sharing files to the editor [https://github.com/wordpress-mobile/WordPress-Android/pull/19754]
Expand Down
2 changes: 2 additions & 0 deletions WordPress/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ plugins {
id "se.bjurr.violations.violation-comments-to-github-gradle-plugin"
id "com.google.gms.google-services"
id 'dagger.hilt.android.plugin'
id "org.jetbrains.kotlinx.kover"
}

sentry {
Expand Down Expand Up @@ -145,6 +146,7 @@ android {
buildConfigField "boolean", "BLOGANUARY_DASHBOARD_NUDGE", "false"
buildConfigField "boolean", "IN_APP_REVIEWS", "false"
buildConfigField "boolean", "DYNAMIC_DASHBOARD_CARDS", "false"
buildConfigField "boolean", "STATS_TRAFFIC_TAB", "false"

// Override these constants in jetpack product flavor to enable/ disable features
buildConfigField "boolean", "ENABLE_SITE_CREATION", "true"
Expand Down
18 changes: 10 additions & 8 deletions WordPress/jetpack_metadata/PlayStoreStrings.po
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,16 @@ msgstr ""
"X-Generator: VsCode\n"
"Project-Id-Version: Jetpack - Apps - Android - Release Notes\n"

msgctxt "release_note_240"
msgid ""
"24.0:\n"
"- Get a WordPress plan with a free domain in the domain dashboard\n"
"- Device keyboard remains when editing text blocks\n"
"- Editor screen auto-scrolls to newly inserted blocks\n"
"- Unselect blocks by pressing device’s back button\n"
"- Share different media types to the app at once without crashing\n"
msgstr ""

msgctxt "release_note_239"
msgid ""
"23.9:\n"
Expand All @@ -19,14 +29,6 @@ msgid ""
"- Santa hasn’t eaten milk and cookies since 2003 because Blitzen always gets there first.\n"
msgstr ""

msgctxt "release_note_238"
msgid ""
"23.8:\n"
"- Block editor only shows the “ungroup” option for nested blocks that support it.\n"
"- Optimize Images setting uses optimal size and quality by default.\n"
"- Themes install properly for sites on Business and Commerce plans.\n"
msgstr ""

#. translators: Release notes for this version to be displayed in the Play Store. Limit to 500 characters including spaces and commas!
#. translators: Title to be displayed in the Play Store. Limit to 30 characters including spaces and commas!
msgctxt "play_store_app_title"
Expand Down
9 changes: 5 additions & 4 deletions WordPress/jetpack_metadata/release_notes.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
No updates this week! Enjoy these reindeer facts:
- Male reindeer shed their antlers in fall and females in spring, so Santa’s reindeer are female.
- Reindeer don’t actually have red noses.
- Santa hasn’t eaten milk and cookies since 2003 because Blitzen always gets there first.
- Get a WordPress plan with a free domain in the domain dashboard
- Device keyboard remains when editing text blocks
- Editor screen auto-scrolls to newly inserted blocks
- Unselect blocks by pressing device’s back button
- Share different media types to the app at once without crashing
18 changes: 10 additions & 8 deletions WordPress/metadata/PlayStoreStrings.po
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,16 @@ msgstr ""
"X-Generator: VsCode\n"
"Project-Id-Version: Release Notes & Play Store Descriptions\n"

msgctxt "release_note_240"
msgid ""
"24.0:\n"
"Block Editor updates:\n"
"- Device keyboard remains when editing text blocks\n"
"- Screen auto-scrolls to newly inserted blocks\n"
"- Unselect blocks by pressing your device’s back button\n"
"- Share different media types to the app at once without crashing\n"
msgstr ""

msgctxt "release_note_239"
msgid ""
"23.9:\n"
Expand All @@ -19,14 +29,6 @@ msgid ""
"- Santa hasn’t eaten milk and cookies since 2003 because Blitzen always gets there first.\n"
msgstr ""

msgctxt "release_note_238"
msgid ""
"23.8:\n"
"- Block editor only shows the “ungroup” option for nested blocks that support it.\n"
"- Optimize Images setting uses optimal size and quality by default.\n"
"- Themes install properly for sites on Business and Commerce plans.\n"
msgstr ""

#. translators: Release notes for this version to be displayed in the Play Store. Limit to 500 characters including spaces and commas!
#. translators: Shorter Release notes for this version to be displayed in the Play Store. Limit to 500 characters including spaces and commas!
msgctxt "sample_post_content"
Expand Down
9 changes: 5 additions & 4 deletions WordPress/metadata/release_notes.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
No updates this week! Enjoy these reindeer facts:
- Male reindeer shed their antlers in fall and females in spring, so Santa’s reindeer are female.
- Reindeer don’t actually have red noses.
- Santa hasn’t eaten milk and cookies since 2003 because Blitzen always gets there first.
Block Editor updates:
- Device keyboard remains when editing text blocks
- Screen auto-scrolls to newly inserted blocks
- Unselect blocks by pressing your device’s back button
- Share different media types to the app at once without crashing
5 changes: 4 additions & 1 deletion WordPress/src/debug/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@
<activity
android:name=".ui.debug.previews.PreviewFragmentActivity"
android:theme="@style/WordPress.NoActionBar" />
<activity
android:name=".ui.debug.preferences.DebugSharedPreferenceFlagsActivity"
android:label="@string/debug_settings_debug_flags_screen"
android:theme="@style/WordPress.NoActionBar" />
</application>

</manifest>
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
import org.wordpress.android.ui.comments.unified.UnifiedCommentsActivity;
import org.wordpress.android.ui.comments.unified.UnifiedCommentsDetailsActivity;
import org.wordpress.android.ui.debug.cookies.DebugCookiesActivity;
import org.wordpress.android.ui.debug.preferences.DebugSharedPreferenceFlagsActivity;
import org.wordpress.android.ui.domains.DomainRegistrationActivity;
import org.wordpress.android.ui.domains.DomainRegistrationActivity.DomainRegistrationPurpose;
import org.wordpress.android.ui.domains.DomainsDashboardActivity;
Expand Down Expand Up @@ -1803,6 +1804,9 @@ public static void viewDebugCookies(@NonNull Context context) {
context.startActivity(new Intent(context, DebugCookiesActivity.class));
}

public static void viewDebugSharedPreferenceFlags(@NonNull Context context) {
context.startActivity(new Intent(context, DebugSharedPreferenceFlagsActivity.class));
}
public static void startQRCodeAuthFlow(@NonNull Context context) {
QRCodeAuthActivity.start(context);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ class DebugSettingsActivity : LocaleAwareActivity() {
is DebugSettingsViewModel.NavigationAction.PreviewFragment -> {
previewFragmentInActivity(it.name)
}
is DebugSettingsViewModel.NavigationAction.DebugFlags ->
ActivityLauncher.viewDebugSharedPreferenceFlags(this@DebugSettingsActivity)
}
}
}
Expand All @@ -68,6 +70,7 @@ class DebugSettingsActivity : LocaleAwareActivity() {
R.id.menu_debug_cookies -> viewModel.onDebugCookiesClick()
R.id.menu_restart_app -> viewModel.onRestartAppClick()
R.id.menu_show_weekly_notifications -> viewModel.onForceShowWeeklyRoundupClick()
R.id.menu_debug_flags -> viewModel.onDebugFlagsClick()
}
return true
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,10 @@ class DebugSettingsViewModel
}
}

fun onDebugFlagsClick() {
_onNavigation.value = Event(NavigationAction.DebugFlags)
}

private fun buildDevelopedFeatures(): List<LocalFeatureFlag> {
return FeaturesInDevelopment.featuresInDevelopment.map { name ->
val value = if (manualFeatureConfig.hasManualSetup(name)) {
Expand Down Expand Up @@ -156,6 +160,7 @@ class DebugSettingsViewModel

sealed class NavigationAction {
object DebugCookies : NavigationAction()
object DebugFlags : NavigationAction()
data class PreviewFragment(val name: String) : NavigationAction()
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package org.wordpress.android.ui.debug.preferences

import android.os.Bundle
import androidx.activity.viewModels
import androidx.appcompat.app.AppCompatActivity
import androidx.compose.runtime.collectAsState
import androidx.compose.runtime.getValue
import dagger.hilt.android.AndroidEntryPoint
import org.wordpress.android.ui.domains.management.M3Theme
import org.wordpress.android.util.extensions.setContent

@AndroidEntryPoint
class DebugSharedPreferenceFlagsActivity : AppCompatActivity() {
private val viewModel: DebugSharedPreferenceFlagsViewModel by viewModels()

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContent {
M3Theme {
val uiState by viewModel.uiStateFlow.collectAsState()
DebugSharedPreferenceFlagsScreen(
flags = uiState,
onFlagChanged = viewModel::setFlag,
onBackTapped = { onBackPressedDispatcher.onBackPressed() },
)
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
package org.wordpress.android.ui.debug.preferences

import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.foundation.lazy.items
import androidx.compose.material3.Checkbox
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Scaffold
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment.Companion.CenterVertically
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import org.wordpress.android.R
import org.wordpress.android.ui.compose.components.MainTopAppBar
import org.wordpress.android.ui.compose.components.NavigationIcons
import org.wordpress.android.ui.domains.management.M3Theme

@Composable
fun DebugSharedPreferenceFlagsScreen(
flags: Map<String, Boolean>,
onBackTapped: () -> Unit,
onFlagChanged: (String, Boolean) -> Unit,
) {
Scaffold(
topBar = {
MainTopAppBar(
title = stringResource(R.string.debug_settings_debug_flags_screen),
navigationIcon = NavigationIcons.BackIcon,
onNavigationIconClick = onBackTapped,
backgroundColor = MaterialTheme.colorScheme.surface,
contentColor = MaterialTheme.colorScheme.onSurface,
)
},
) { paddingValues ->
LazyColumn(modifier = Modifier.padding(paddingValues)) {
items(flags.toList()) { (key, value) ->
DebugFlagRow(
key = key,
value = value,
onFlagChanged = onFlagChanged,
)
}
}
}
}

@Composable
fun DebugFlagRow(
key: String,
value: Boolean,
onFlagChanged: (String, Boolean) -> Unit,
modifier: Modifier = Modifier,
) {
Row(
modifier = modifier
.padding(vertical = 4.dp)
.clickable { onFlagChanged(key, !value) }
) {
Text(
text = key,
modifier = Modifier
.weight(1f)
.align(CenterVertically)
.padding(start = 16.dp)
)
Checkbox(
checked = value,
modifier = Modifier.align(CenterVertically).padding(end = 8.dp),
onCheckedChange = { onFlagChanged(key, it) }
)
}
}

@Preview
@Composable
fun DebugFlagsScreenPreview() {
M3Theme {
DebugSharedPreferenceFlagsScreen(
flags = mapOf(
"EXAMPLE_FEATURE_FLAG" to true,
"RANDOM_FLAG" to false,
"ANOTHER_FLAG" to true,
"YET_ANOTHER_FLAG" to false,

),
onBackTapped = {},
onFlagChanged = { _, _ -> },
)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package org.wordpress.android.ui.debug.preferences

import androidx.lifecycle.ViewModel
import dagger.hilt.android.lifecycle.HiltViewModel
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.asStateFlow
import org.wordpress.android.ui.prefs.AppPrefsWrapper
import javax.inject.Inject

@HiltViewModel
class DebugSharedPreferenceFlagsViewModel @Inject constructor(
private val prefsWrapper: AppPrefsWrapper
) : ViewModel() {
private val _uiStateFlow = MutableStateFlow<Map<String, Boolean>>(emptyMap())
val uiStateFlow = _uiStateFlow.asStateFlow()

init {
val flags = prefsWrapper.getAllPrefs().mapNotNull { (key, value) ->
if (value is Boolean) key to value else null
}.toMap()
_uiStateFlow.value = flags
}

fun setFlag(key: String, value: Boolean) {
prefsWrapper.putBoolean({ key }, value)
_uiStateFlow.value = _uiStateFlow.value.toMutableMap().apply { this[key] = value }
}
}
Loading

0 comments on commit b246b84

Please sign in to comment.