Skip to content

Commit 172e55e

Browse files
committed
Merge branch 'trunk' of github.com:wordpress-mobile/WordPress-Android into feat/authenticate-private-resource-requests
2 parents 554d6ca + 18dc8f2 commit 172e55e

File tree

136 files changed

+767
-11951
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

136 files changed

+767
-11951
lines changed

WordPress/build.gradle

-34
Original file line numberDiff line numberDiff line change
@@ -84,40 +84,6 @@ sentry {
8484
telemetry = false
8585
}
8686

87-
repositories {
88-
maven {
89-
url "https://a8c-libs.s3.amazonaws.com/android"
90-
content {
91-
includeGroup "org.wordpress"
92-
includeGroup "org.wordpress.aztec"
93-
includeGroup "org.wordpress.wellsql"
94-
includeGroup "org.wordpress.gutenberg-mobile"
95-
includeGroup "org.wordpress.gutenbergkit"
96-
includeGroupByRegex "org.wordpress.react-native-libraries.*"
97-
includeGroup "com.automattic"
98-
includeGroup "com.automattic.tracks"
99-
includeGroup "com.gravatar"
100-
includeGroup "rs.wordpress.api"
101-
}
102-
}
103-
maven {
104-
url "https://a8c-libs.s3.amazonaws.com/android/react-native-mirror"
105-
content {
106-
includeGroup "com.facebook.react"
107-
}
108-
}
109-
maven {
110-
url 'https://zendesk.jfrog.io/zendesk/repo'
111-
content {
112-
includeGroup "com.zendesk"
113-
includeGroup "com.zendesk.belvedere2"
114-
}
115-
}
116-
google()
117-
mavenCentral()
118-
maven { url "https://www.jitpack.io" }
119-
}
120-
12187
allOpen {
12288
// allows mocking for classes w/o directly opening them for release builds
12389
annotation 'org.wordpress.android.testing.OpenClassAnnotation'

WordPress/src/main/java/org/wordpress/android/ui/ActivityLauncher.java

+15-2
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@
9595
import org.wordpress.android.ui.posts.PostsListActivity;
9696
import org.wordpress.android.ui.posts.RemotePreviewLogicHelper.RemotePreviewType;
9797
import org.wordpress.android.ui.prefs.AccountSettingsActivity;
98+
import org.wordpress.android.ui.prefs.AppPrefs;
9899
import org.wordpress.android.ui.prefs.AppSettingsActivity;
99100
import org.wordpress.android.ui.prefs.BlogPreferencesActivity;
100101
import org.wordpress.android.ui.prefs.MyProfileActivity;
@@ -127,6 +128,7 @@
127128
import org.wordpress.android.util.AppLog;
128129
import org.wordpress.android.util.AppLog.T;
129130
import org.wordpress.android.util.ToastUtils;
131+
import org.wordpress.android.util.ToastUtils.Duration;
130132
import org.wordpress.android.util.UriWrapper;
131133
import org.wordpress.android.util.UrlUtils;
132134
import org.wordpress.android.util.WPActivityUtils;
@@ -1311,8 +1313,8 @@ public static void viewHelp(@NonNull Context context, @NonNull Origin origin, @N
13111313
}
13121314

13131315
public static void viewFeedbackForm(@NonNull Context context) {
1314-
// TODO verify tracks event with iOS
1315-
AnalyticsTracker.track(Stat.FEEDBACK_FORM_OPENED);
1316+
warnIfIdentityA8C(context);
1317+
AnalyticsTracker.track(Stat.APP_REVIEWS_FEEDBACK_SCREEN_OPENED);
13161318
Intent intent = new Intent(context, FeedbackFormActivity.class);
13171319
context.startActivity(intent);
13181320
}
@@ -1322,6 +1324,17 @@ public static void viewZendeskTickets(@NonNull Context context,
13221324
viewHelpInNewStack(context, Origin.ZENDESK_NOTIFICATION, selectedSite, null);
13231325
}
13241326

1327+
/**
1328+
* Warn A8C users that they can't create Zendesk tickets
1329+
*/
1330+
@NonNull
1331+
public static void warnIfIdentityA8C(@NonNull Context context) {
1332+
String supportEmail = AppPrefs.getSupportEmail();
1333+
if (supportEmail.contains("@automattic.com") || supportEmail.contains("@a8c.com")) {
1334+
ToastUtils.showToast(context, R.string.support_warn_if_user_a8c, Duration.LONG);
1335+
}
1336+
}
1337+
13251338
public static void viewSSLCerts(Context context, String certificateString) {
13261339
Intent intent = new Intent(context, SSLCertsViewActivity.class);
13271340
intent.putExtra(SSLCertsViewActivity.CERT_DETAILS_KEYS, certificateString.replaceAll("\n", "<br/>"));

WordPress/src/main/java/org/wordpress/android/ui/accounts/HelpActivity.kt

+8-1
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ class HelpActivity : LocaleAwareActivity() {
112112
showContactUs()
113113
}
114114

115-
if(BuildConfig.DEBUG && BuildConfig.ENABLE_DEBUG_SETTINGS) {
115+
if (BuildConfig.DEBUG && BuildConfig.ENABLE_DEBUG_SETTINGS) {
116116
enableDebugSettings()
117117
}
118118

@@ -122,6 +122,10 @@ class HelpActivity : LocaleAwareActivity() {
122122
startActivity(Intent(v.context, AppLogViewerActivity::class.java))
123123
}
124124

125+
feedbackButton.setOnClickListener {
126+
ActivityLauncher.viewFeedbackForm(this@HelpActivity)
127+
}
128+
125129
if (originFromExtras == Origin.JETPACK_MIGRATION_HELP) {
126130
configureForJetpackMigrationHelp()
127131
}
@@ -169,6 +173,7 @@ class HelpActivity : LocaleAwareActivity() {
169173
}
170174

171175
private fun launchSupportWidget() {
176+
ActivityLauncher.warnIfIdentityA8C(this)
172177
val intent = SupportWebViewActivity.createIntent(
173178
this,
174179
originFromExtras,
@@ -179,6 +184,7 @@ class HelpActivity : LocaleAwareActivity() {
179184
}
180185

181186
private fun createNewZendeskTicket() {
187+
ActivityLauncher.warnIfIdentityA8C(this)
182188
zendeskHelper.createNewTicket(
183189
this,
184190
originFromExtras,
@@ -193,6 +199,7 @@ class HelpActivity : LocaleAwareActivity() {
193199
}
194200

195201
private fun showZendeskTickets() {
202+
ActivityLauncher.warnIfIdentityA8C(this)
196203
zendeskHelper.showAllTickets(
197204
this,
198205
originFromExtras,

WordPress/src/main/java/org/wordpress/android/ui/barcodescanner/BarcodeScanner.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@ import androidx.compose.runtime.Composable
1717
import androidx.compose.runtime.remember
1818
import androidx.compose.ui.Modifier
1919
import androidx.compose.ui.platform.LocalContext
20-
import androidx.compose.ui.platform.LocalLifecycleOwner
2120
import androidx.compose.ui.tooling.preview.Preview
2221
import androidx.compose.ui.viewinterop.AndroidView
2322
import androidx.core.content.ContextCompat
23+
import androidx.lifecycle.compose.LocalLifecycleOwner
2424
import org.wordpress.android.ui.compose.theme.AppThemeM2
2525
import androidx.camera.core.Preview as CameraPreview
2626

WordPress/src/main/java/org/wordpress/android/ui/barcodescanner/BarcodeScannerScreen.kt

+9-9
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,18 @@ import android.content.res.Configuration
44
import androidx.activity.compose.rememberLauncherForActivityResult
55
import androidx.activity.result.contract.ActivityResultContracts
66
import androidx.compose.foundation.layout.padding
7-
import androidx.compose.material.AlertDialog
8-
import androidx.compose.material.MaterialTheme
9-
import androidx.compose.material.Text
10-
import androidx.compose.material.TextButton
7+
import androidx.compose.material3.AlertDialog
8+
import androidx.compose.material3.MaterialTheme
9+
import androidx.compose.material3.Text
10+
import androidx.compose.material3.TextButton
1111
import androidx.compose.runtime.Composable
1212
import androidx.compose.runtime.LaunchedEffect
1313
import androidx.compose.ui.Modifier
1414
import androidx.compose.ui.res.stringResource
1515
import androidx.compose.ui.tooling.preview.Preview
1616
import androidx.compose.ui.unit.dp
1717
import org.wordpress.android.R
18-
import org.wordpress.android.ui.compose.theme.AppThemeM2
18+
import org.wordpress.android.ui.compose.theme.AppThemeM3
1919

2020
@Composable
2121
fun BarcodeScannerScreen(
@@ -91,7 +91,7 @@ private fun AlertDialog(
9191
) {
9292
Text(
9393
ctaLabel,
94-
color = MaterialTheme.colors.secondary,
94+
color = MaterialTheme.colorScheme.secondary,
9595
modifier = Modifier.padding(8.dp)
9696
)
9797
}
@@ -104,7 +104,7 @@ private fun AlertDialog(
104104
) {
105105
Text(
106106
dismissCtaLabel,
107-
color = MaterialTheme.colors.secondary,
107+
color = MaterialTheme.colorScheme.secondary,
108108
modifier = Modifier.padding(8.dp)
109109
)
110110
}
@@ -116,7 +116,7 @@ private fun AlertDialog(
116116
@Preview(name = "Dark mode", uiMode = Configuration.UI_MODE_NIGHT_YES)
117117
@Composable
118118
fun DeniedOnceAlertDialog() {
119-
AppThemeM2 {
119+
AppThemeM3 {
120120
AlertDialog(
121121
title = stringResource(id = R.string.barcode_scanning_alert_dialog_title),
122122
message = stringResource(id = R.string.barcode_scanning_alert_dialog_rationale_message),
@@ -132,7 +132,7 @@ fun DeniedOnceAlertDialog() {
132132
@Preview(name = "Dark mode", uiMode = Configuration.UI_MODE_NIGHT_YES)
133133
@Composable
134134
fun DeniedPermanentlyAlertDialog() {
135-
AppThemeM2 {
135+
AppThemeM3 {
136136
AlertDialog(
137137
title = stringResource(id = R.string.barcode_scanning_alert_dialog_title),
138138
message = stringResource(id = R.string.barcode_scanning_alert_dialog_permanently_denied_message),

WordPress/src/main/java/org/wordpress/android/ui/bloganuary/learnmore/BloganuaryNudgeLearnMoreOverlay.kt

+33-32
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package org.wordpress.android.ui.bloganuary.learnmore
33
import android.content.res.Configuration.UI_MODE_NIGHT_YES
44
import androidx.compose.foundation.Image
55
import androidx.compose.foundation.background
6+
import androidx.compose.foundation.isSystemInDarkTheme
67
import androidx.compose.foundation.layout.Arrangement
78
import androidx.compose.foundation.layout.Box
89
import androidx.compose.foundation.layout.Column
@@ -20,17 +21,16 @@ import androidx.compose.foundation.layout.widthIn
2021
import androidx.compose.foundation.rememberScrollState
2122
import androidx.compose.foundation.shape.CircleShape
2223
import androidx.compose.foundation.verticalScroll
23-
import androidx.compose.material.Button
24-
import androidx.compose.material.ButtonDefaults
25-
import androidx.compose.material.ContentAlpha
26-
import androidx.compose.material.Divider
27-
import androidx.compose.material.Icon
28-
import androidx.compose.material.IconButton
29-
import androidx.compose.material.LocalContentColor
30-
import androidx.compose.material.Text
3124
import androidx.compose.material.icons.Icons
3225
import androidx.compose.material.icons.rounded.Close
26+
import androidx.compose.material3.Button
27+
import androidx.compose.material3.ButtonDefaults
28+
import androidx.compose.material3.HorizontalDivider
29+
import androidx.compose.material3.Icon
30+
import androidx.compose.material3.IconButton
31+
import androidx.compose.material3.LocalContentColor
3332
import androidx.compose.material3.MaterialTheme
33+
import androidx.compose.material3.Text
3434
import androidx.compose.runtime.Composable
3535
import androidx.compose.ui.Alignment
3636
import androidx.compose.ui.Modifier
@@ -44,30 +44,32 @@ import androidx.compose.ui.text.style.TextAlign
4444
import androidx.compose.ui.tooling.preview.Preview
4545
import androidx.compose.ui.unit.dp
4646
import org.wordpress.android.R
47-
import org.wordpress.android.ui.compose.components.ContentAlphaProvider
4847
import org.wordpress.android.ui.compose.theme.AppColor
49-
import org.wordpress.android.ui.compose.theme.AppThemeM2
48+
import org.wordpress.android.ui.compose.theme.AppThemeM3
5049
import org.wordpress.android.ui.compose.unit.Margin
5150
import org.wordpress.android.ui.compose.utils.uiStringText
5251
import org.wordpress.android.ui.utils.UiString.UiStringRes
53-
import androidx.compose.material.MaterialTheme as Material2Theme
5452

5553
private val contentIconForegroundColor: Color
5654
get() = AppColor.White
5755

58-
private val contentIconBackgroundColor: Color
59-
@Composable get() = if (Material2Theme.colors.isLight) {
60-
AppColor.Black
61-
} else {
56+
@Composable
57+
private fun contentIconBackgroundColor(isDarkTheme: Boolean = isSystemInDarkTheme()): Color {
58+
return if (isDarkTheme) {
6259
AppColor.White.copy(alpha = 0.18f)
60+
} else {
61+
AppColor.Black
6362
}
63+
}
6464

65-
private val contentTextEmphasis: Float
66-
@Composable get() = if (Material2Theme.colors.isLight) {
67-
1f
65+
@Composable
66+
private fun contentTextEmphasis(isDarkTheme: Boolean = isSystemInDarkTheme()): Float {
67+
return if (isDarkTheme) {
68+
0.6f
6869
} else {
69-
ContentAlpha.medium
70+
1f
7071
}
72+
}
7173

7274
@Composable
7375
fun BloganuaryNudgeLearnMoreOverlay(
@@ -111,7 +113,7 @@ fun BloganuaryNudgeLearnMoreOverlay(
111113
) {
112114
Image(
113115
painter = painterResource(R.drawable.logo_bloganuary),
114-
colorFilter = ColorFilter.tint(Material2Theme.colors.onSurface),
116+
colorFilter = ColorFilter.tint(MaterialTheme.colorScheme.onSurface),
115117
modifier = Modifier.width(180.dp),
116118
contentScale = ContentScale.Inside,
117119
contentDescription = stringResource(
@@ -148,12 +150,12 @@ fun BloganuaryNudgeLearnMoreOverlay(
148150
modifier = Modifier.align(Alignment.CenterHorizontally),
149151
textAlign = TextAlign.Center,
150152
style = MaterialTheme.typography.bodySmall,
151-
color = LocalContentColor.current.copy(alpha = ContentAlpha.medium),
153+
color = LocalContentColor.current.copy(alpha = contentTextEmphasis()),
152154
)
153155
}
154156
}
155157

156-
Divider()
158+
HorizontalDivider()
157159

158160
Button(
159161
onClick = { onActionClick(model.action) },
@@ -163,8 +165,8 @@ fun BloganuaryNudgeLearnMoreOverlay(
163165
elevation = null,
164166
contentPadding = PaddingValues(vertical = Margin.Large.value),
165167
colors = ButtonDefaults.buttonColors(
166-
backgroundColor = Material2Theme.colors.onSurface,
167-
contentColor = Material2Theme.colors.surface,
168+
containerColor = MaterialTheme.colorScheme.onSurface,
169+
contentColor = MaterialTheme.colorScheme.surface,
168170
),
169171
) {
170172
Text(stringResource(model.action.textRes))
@@ -211,7 +213,7 @@ private fun OverlayContentItem(
211213
modifier = Modifier
212214
.size(48.dp)
213215
.background(
214-
color = contentIconBackgroundColor,
216+
color = contentIconBackgroundColor(),
215217
shape = CircleShape,
216218
),
217219
) {
@@ -227,12 +229,11 @@ private fun OverlayContentItem(
227229

228230
Spacer(Modifier.width(Margin.ExtraLarge.value))
229231

230-
ContentAlphaProvider(contentTextEmphasis) {
231-
Text(
232-
stringResource(textRes),
233-
style = MaterialTheme.typography.titleMedium,
234-
)
235-
}
232+
Text(
233+
text = stringResource(textRes),
234+
style = MaterialTheme.typography.titleMedium,
235+
color = LocalContentColor.current.copy(alpha = contentTextEmphasis()),
236+
)
236237
}
237238
}
238239

@@ -241,7 +242,7 @@ private fun OverlayContentItem(
241242
@Preview(name = "Dark Mode", uiMode = UI_MODE_NIGHT_YES)
242243
@Composable
243244
private fun BloganuaryNudgeLearnMoreOverlayPreview() {
244-
AppThemeM2 {
245+
AppThemeM3 {
245246
BloganuaryNudgeLearnMoreOverlay(
246247
model = BloganuaryNudgeLearnMoreOverlayUiState(
247248
noteText = UiStringRes(

WordPress/src/main/java/org/wordpress/android/ui/bloganuary/learnmore/BloganuaryNudgeLearnMoreOverlayFragment.kt

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import androidx.lifecycle.ViewModelProvider
1212
import com.google.android.material.bottomsheet.BottomSheetDialog
1313
import com.google.android.material.bottomsheet.BottomSheetDialogFragment
1414
import dagger.hilt.android.AndroidEntryPoint
15-
import org.wordpress.android.ui.compose.theme.AppThemeM2
15+
import org.wordpress.android.ui.compose.theme.AppThemeM3
1616
import org.wordpress.android.util.extensions.fillScreen
1717
import org.wordpress.android.viewmodel.main.WPMainActivityViewModel
1818
import javax.inject.Inject
@@ -40,7 +40,7 @@ class BloganuaryNudgeLearnMoreOverlayFragment : BottomSheetDialogFragment() {
4040
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View {
4141
return ComposeView(requireContext()).apply {
4242
setContent {
43-
AppThemeM2 {
43+
AppThemeM3 {
4444
BloganuaryNudgeLearnMoreOverlay(
4545
model = viewModel.getUiState(isPromptsEnabled),
4646
onActionClick = viewModel::onActionClick,

WordPress/src/main/java/org/wordpress/android/ui/compose/components/menu/dropdown/MenuColors.kt

-30
This file was deleted.

0 commit comments

Comments
 (0)