-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'trunk' into media-upload/track-failed-editor
- Loading branch information
Showing
141 changed files
with
888 additions
and
281 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
...ain/java/org/wordpress/android/ui/debug/preferences/DebugSharedPreferenceFlagsActivity.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() }, | ||
) | ||
} | ||
} | ||
} | ||
} |
95 changes: 95 additions & 0 deletions
95
.../main/java/org/wordpress/android/ui/debug/preferences/DebugSharedPreferenceFlagsScreen.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 = { _, _ -> }, | ||
) | ||
} | ||
} |
28 changes: 28 additions & 0 deletions
28
...in/java/org/wordpress/android/ui/debug/preferences/DebugSharedPreferenceFlagsViewModel.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 } | ||
} | ||
} |
Oops, something went wrong.