Skip to content

Commit

Permalink
Merge branch 'trunk' of github.com:wordpress-mobile/WordPress-Android…
Browse files Browse the repository at this point in the history
… into feat/authenticate-private-resource-requests
  • Loading branch information
dcalhoun committed Nov 1, 2024
2 parents 554d6ca + 18dc8f2 commit 172e55e
Show file tree
Hide file tree
Showing 136 changed files with 767 additions and 11,951 deletions.
34 changes: 0 additions & 34 deletions WordPress/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -84,40 +84,6 @@ sentry {
telemetry = false
}

repositories {
maven {
url "https://a8c-libs.s3.amazonaws.com/android"
content {
includeGroup "org.wordpress"
includeGroup "org.wordpress.aztec"
includeGroup "org.wordpress.wellsql"
includeGroup "org.wordpress.gutenberg-mobile"
includeGroup "org.wordpress.gutenbergkit"
includeGroupByRegex "org.wordpress.react-native-libraries.*"
includeGroup "com.automattic"
includeGroup "com.automattic.tracks"
includeGroup "com.gravatar"
includeGroup "rs.wordpress.api"
}
}
maven {
url "https://a8c-libs.s3.amazonaws.com/android/react-native-mirror"
content {
includeGroup "com.facebook.react"
}
}
maven {
url 'https://zendesk.jfrog.io/zendesk/repo'
content {
includeGroup "com.zendesk"
includeGroup "com.zendesk.belvedere2"
}
}
google()
mavenCentral()
maven { url "https://www.jitpack.io" }
}

allOpen {
// allows mocking for classes w/o directly opening them for release builds
annotation 'org.wordpress.android.testing.OpenClassAnnotation'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@
import org.wordpress.android.ui.posts.PostsListActivity;
import org.wordpress.android.ui.posts.RemotePreviewLogicHelper.RemotePreviewType;
import org.wordpress.android.ui.prefs.AccountSettingsActivity;
import org.wordpress.android.ui.prefs.AppPrefs;
import org.wordpress.android.ui.prefs.AppSettingsActivity;
import org.wordpress.android.ui.prefs.BlogPreferencesActivity;
import org.wordpress.android.ui.prefs.MyProfileActivity;
Expand Down Expand Up @@ -127,6 +128,7 @@
import org.wordpress.android.util.AppLog;
import org.wordpress.android.util.AppLog.T;
import org.wordpress.android.util.ToastUtils;
import org.wordpress.android.util.ToastUtils.Duration;
import org.wordpress.android.util.UriWrapper;
import org.wordpress.android.util.UrlUtils;
import org.wordpress.android.util.WPActivityUtils;
Expand Down Expand Up @@ -1311,8 +1313,8 @@ public static void viewHelp(@NonNull Context context, @NonNull Origin origin, @N
}

public static void viewFeedbackForm(@NonNull Context context) {
// TODO verify tracks event with iOS
AnalyticsTracker.track(Stat.FEEDBACK_FORM_OPENED);
warnIfIdentityA8C(context);
AnalyticsTracker.track(Stat.APP_REVIEWS_FEEDBACK_SCREEN_OPENED);
Intent intent = new Intent(context, FeedbackFormActivity.class);
context.startActivity(intent);
}
Expand All @@ -1322,6 +1324,17 @@ public static void viewZendeskTickets(@NonNull Context context,
viewHelpInNewStack(context, Origin.ZENDESK_NOTIFICATION, selectedSite, null);
}

/**
* Warn A8C users that they can't create Zendesk tickets
*/
@NonNull
public static void warnIfIdentityA8C(@NonNull Context context) {
String supportEmail = AppPrefs.getSupportEmail();
if (supportEmail.contains("@automattic.com") || supportEmail.contains("@a8c.com")) {
ToastUtils.showToast(context, R.string.support_warn_if_user_a8c, Duration.LONG);
}
}

public static void viewSSLCerts(Context context, String certificateString) {
Intent intent = new Intent(context, SSLCertsViewActivity.class);
intent.putExtra(SSLCertsViewActivity.CERT_DETAILS_KEYS, certificateString.replaceAll("\n", "<br/>"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ class HelpActivity : LocaleAwareActivity() {
showContactUs()
}

if(BuildConfig.DEBUG && BuildConfig.ENABLE_DEBUG_SETTINGS) {
if (BuildConfig.DEBUG && BuildConfig.ENABLE_DEBUG_SETTINGS) {
enableDebugSettings()
}

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

feedbackButton.setOnClickListener {
ActivityLauncher.viewFeedbackForm(this@HelpActivity)
}

if (originFromExtras == Origin.JETPACK_MIGRATION_HELP) {
configureForJetpackMigrationHelp()
}
Expand Down Expand Up @@ -169,6 +173,7 @@ class HelpActivity : LocaleAwareActivity() {
}

private fun launchSupportWidget() {
ActivityLauncher.warnIfIdentityA8C(this)
val intent = SupportWebViewActivity.createIntent(
this,
originFromExtras,
Expand All @@ -179,6 +184,7 @@ class HelpActivity : LocaleAwareActivity() {
}

private fun createNewZendeskTicket() {
ActivityLauncher.warnIfIdentityA8C(this)
zendeskHelper.createNewTicket(
this,
originFromExtras,
Expand All @@ -193,6 +199,7 @@ class HelpActivity : LocaleAwareActivity() {
}

private fun showZendeskTickets() {
ActivityLauncher.warnIfIdentityA8C(this)
zendeskHelper.showAllTickets(
this,
originFromExtras,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ import androidx.compose.runtime.Composable
import androidx.compose.runtime.remember
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.platform.LocalLifecycleOwner
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.viewinterop.AndroidView
import androidx.core.content.ContextCompat
import androidx.lifecycle.compose.LocalLifecycleOwner
import org.wordpress.android.ui.compose.theme.AppThemeM2
import androidx.camera.core.Preview as CameraPreview

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,18 @@ import android.content.res.Configuration
import androidx.activity.compose.rememberLauncherForActivityResult
import androidx.activity.result.contract.ActivityResultContracts
import androidx.compose.foundation.layout.padding
import androidx.compose.material.AlertDialog
import androidx.compose.material.MaterialTheme
import androidx.compose.material.Text
import androidx.compose.material.TextButton
import androidx.compose.material3.AlertDialog
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text
import androidx.compose.material3.TextButton
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
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.theme.AppThemeM2
import org.wordpress.android.ui.compose.theme.AppThemeM3

@Composable
fun BarcodeScannerScreen(
Expand Down Expand Up @@ -91,7 +91,7 @@ private fun AlertDialog(
) {
Text(
ctaLabel,
color = MaterialTheme.colors.secondary,
color = MaterialTheme.colorScheme.secondary,
modifier = Modifier.padding(8.dp)
)
}
Expand All @@ -104,7 +104,7 @@ private fun AlertDialog(
) {
Text(
dismissCtaLabel,
color = MaterialTheme.colors.secondary,
color = MaterialTheme.colorScheme.secondary,
modifier = Modifier.padding(8.dp)
)
}
Expand All @@ -116,7 +116,7 @@ private fun AlertDialog(
@Preview(name = "Dark mode", uiMode = Configuration.UI_MODE_NIGHT_YES)
@Composable
fun DeniedOnceAlertDialog() {
AppThemeM2 {
AppThemeM3 {
AlertDialog(
title = stringResource(id = R.string.barcode_scanning_alert_dialog_title),
message = stringResource(id = R.string.barcode_scanning_alert_dialog_rationale_message),
Expand All @@ -132,7 +132,7 @@ fun DeniedOnceAlertDialog() {
@Preview(name = "Dark mode", uiMode = Configuration.UI_MODE_NIGHT_YES)
@Composable
fun DeniedPermanentlyAlertDialog() {
AppThemeM2 {
AppThemeM3 {
AlertDialog(
title = stringResource(id = R.string.barcode_scanning_alert_dialog_title),
message = stringResource(id = R.string.barcode_scanning_alert_dialog_permanently_denied_message),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package org.wordpress.android.ui.bloganuary.learnmore
import android.content.res.Configuration.UI_MODE_NIGHT_YES
import androidx.compose.foundation.Image
import androidx.compose.foundation.background
import androidx.compose.foundation.isSystemInDarkTheme
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
Expand All @@ -20,17 +21,16 @@ import androidx.compose.foundation.layout.widthIn
import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.shape.CircleShape
import androidx.compose.foundation.verticalScroll
import androidx.compose.material.Button
import androidx.compose.material.ButtonDefaults
import androidx.compose.material.ContentAlpha
import androidx.compose.material.Divider
import androidx.compose.material.Icon
import androidx.compose.material.IconButton
import androidx.compose.material.LocalContentColor
import androidx.compose.material.Text
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.rounded.Close
import androidx.compose.material3.Button
import androidx.compose.material3.ButtonDefaults
import androidx.compose.material3.HorizontalDivider
import androidx.compose.material3.Icon
import androidx.compose.material3.IconButton
import androidx.compose.material3.LocalContentColor
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
Expand All @@ -44,30 +44,32 @@ import androidx.compose.ui.text.style.TextAlign
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.ContentAlphaProvider
import org.wordpress.android.ui.compose.theme.AppColor
import org.wordpress.android.ui.compose.theme.AppThemeM2
import org.wordpress.android.ui.compose.theme.AppThemeM3
import org.wordpress.android.ui.compose.unit.Margin
import org.wordpress.android.ui.compose.utils.uiStringText
import org.wordpress.android.ui.utils.UiString.UiStringRes
import androidx.compose.material.MaterialTheme as Material2Theme

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

private val contentIconBackgroundColor: Color
@Composable get() = if (Material2Theme.colors.isLight) {
AppColor.Black
} else {
@Composable
private fun contentIconBackgroundColor(isDarkTheme: Boolean = isSystemInDarkTheme()): Color {
return if (isDarkTheme) {
AppColor.White.copy(alpha = 0.18f)
} else {
AppColor.Black
}
}

private val contentTextEmphasis: Float
@Composable get() = if (Material2Theme.colors.isLight) {
1f
@Composable
private fun contentTextEmphasis(isDarkTheme: Boolean = isSystemInDarkTheme()): Float {
return if (isDarkTheme) {
0.6f
} else {
ContentAlpha.medium
1f
}
}

@Composable
fun BloganuaryNudgeLearnMoreOverlay(
Expand Down Expand Up @@ -111,7 +113,7 @@ fun BloganuaryNudgeLearnMoreOverlay(
) {
Image(
painter = painterResource(R.drawable.logo_bloganuary),
colorFilter = ColorFilter.tint(Material2Theme.colors.onSurface),
colorFilter = ColorFilter.tint(MaterialTheme.colorScheme.onSurface),
modifier = Modifier.width(180.dp),
contentScale = ContentScale.Inside,
contentDescription = stringResource(
Expand Down Expand Up @@ -148,12 +150,12 @@ fun BloganuaryNudgeLearnMoreOverlay(
modifier = Modifier.align(Alignment.CenterHorizontally),
textAlign = TextAlign.Center,
style = MaterialTheme.typography.bodySmall,
color = LocalContentColor.current.copy(alpha = ContentAlpha.medium),
color = LocalContentColor.current.copy(alpha = contentTextEmphasis()),
)
}
}

Divider()
HorizontalDivider()

Button(
onClick = { onActionClick(model.action) },
Expand All @@ -163,8 +165,8 @@ fun BloganuaryNudgeLearnMoreOverlay(
elevation = null,
contentPadding = PaddingValues(vertical = Margin.Large.value),
colors = ButtonDefaults.buttonColors(
backgroundColor = Material2Theme.colors.onSurface,
contentColor = Material2Theme.colors.surface,
containerColor = MaterialTheme.colorScheme.onSurface,
contentColor = MaterialTheme.colorScheme.surface,
),
) {
Text(stringResource(model.action.textRes))
Expand Down Expand Up @@ -211,7 +213,7 @@ private fun OverlayContentItem(
modifier = Modifier
.size(48.dp)
.background(
color = contentIconBackgroundColor,
color = contentIconBackgroundColor(),
shape = CircleShape,
),
) {
Expand All @@ -227,12 +229,11 @@ private fun OverlayContentItem(

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

ContentAlphaProvider(contentTextEmphasis) {
Text(
stringResource(textRes),
style = MaterialTheme.typography.titleMedium,
)
}
Text(
text = stringResource(textRes),
style = MaterialTheme.typography.titleMedium,
color = LocalContentColor.current.copy(alpha = contentTextEmphasis()),
)
}
}

Expand All @@ -241,7 +242,7 @@ private fun OverlayContentItem(
@Preview(name = "Dark Mode", uiMode = UI_MODE_NIGHT_YES)
@Composable
private fun BloganuaryNudgeLearnMoreOverlayPreview() {
AppThemeM2 {
AppThemeM3 {
BloganuaryNudgeLearnMoreOverlay(
model = BloganuaryNudgeLearnMoreOverlayUiState(
noteText = UiStringRes(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import androidx.lifecycle.ViewModelProvider
import com.google.android.material.bottomsheet.BottomSheetDialog
import com.google.android.material.bottomsheet.BottomSheetDialogFragment
import dagger.hilt.android.AndroidEntryPoint
import org.wordpress.android.ui.compose.theme.AppThemeM2
import org.wordpress.android.ui.compose.theme.AppThemeM3
import org.wordpress.android.util.extensions.fillScreen
import org.wordpress.android.viewmodel.main.WPMainActivityViewModel
import javax.inject.Inject
Expand Down Expand Up @@ -40,7 +40,7 @@ class BloganuaryNudgeLearnMoreOverlayFragment : BottomSheetDialogFragment() {
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View {
return ComposeView(requireContext()).apply {
setContent {
AppThemeM2 {
AppThemeM3 {
BloganuaryNudgeLearnMoreOverlay(
model = viewModel.getUiState(isPromptsEnabled),
onActionClick = viewModel::onActionClick,
Expand Down

This file was deleted.

Loading

0 comments on commit 172e55e

Please sign in to comment.