-
Notifications
You must be signed in to change notification settings - Fork 130
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'refs/heads/trunk' into issue/12469-campaigns-objectives…
…-endpoint # Conflicts: # build.gradle
- Loading branch information
Showing
57 changed files
with
1,083 additions
and
1,145 deletions.
There are no files selected for viewing
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,18 @@ | ||
#!/bin/bash -u | ||
|
||
echo "--- 🧹 Linting" | ||
cp gradle.properties-example gradle.properties | ||
./gradlew :WooCommerce:lintJalapenoDebug | ||
app_lint_exit_code=$? | ||
|
||
./gradlew :WooCommerce-Wear:lintJalapenoDebug | ||
wear_lint_exit_code=$? | ||
|
||
lint_exit_code=0 | ||
if [ $app_lint_exit_code -ne 0 ] || [ $wear_lint_exit_code -ne 0 ]; then | ||
lint_exit_code=1 | ||
fi | ||
|
||
upload_sarif_to_github 'WooCommerce/build/reports/lint-results-jalapenoDebug.sarif' 'woocommerce' 'woocommerce-android' | ||
|
||
exit $lint_exit_code |
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,7 +1,8 @@ | ||
#!/bin/sh | ||
|
||
# This file is `source`'d before calling `buildkite-agent pipeline upload`, and can be used | ||
# to set up some variables that will be interpolated in the `.yml` pipeline before uploading it. | ||
# This file is `source`'d before calling `buildkite-agent pipeline upload`, and can be used | ||
# to set up some variables that will be interpolated in the `.yml` pipeline before uploading it. | ||
|
||
export CI_TOOLKIT="automattic/a8c-ci-toolkit#3.6.2" | ||
export TEST_COLLECTOR="test-collector#v1.10.1" | ||
|
||
export CI_TOOLKIT="automattic/a8c-ci-toolkit#3.5.1" | ||
export TEST_COLLECTOR="test-collector#v1.10.1" |
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
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
65 changes: 50 additions & 15 deletions
65
WooCommerce/src/main/kotlin/com/woocommerce/android/notifications/WooNotificationType.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 |
---|---|---|
@@ -1,25 +1,60 @@ | ||
package com.woocommerce.android.notifications | ||
|
||
import android.os.Parcelable | ||
import kotlinx.parcelize.IgnoredOnParcel | ||
import kotlinx.parcelize.Parcelize | ||
import org.wordpress.android.fluxc.model.notification.NotificationModel | ||
|
||
enum class WooNotificationType { | ||
NEW_ORDER, | ||
PRODUCT_REVIEW, | ||
LOCAL_REMINDER, | ||
BLAZE_APPROVED_NOTE, | ||
BLAZE_REJECTED_NOTE, | ||
BLAZE_CANCELLED_NOTE, | ||
BLAZE_PERFORMED_NOTE, | ||
sealed interface WooNotificationType : Parcelable { | ||
val trackingValue: String | ||
|
||
@Parcelize | ||
data object NewOrder : WooNotificationType { | ||
@IgnoredOnParcel override val trackingValue: String = "NEW_ORDER" | ||
} | ||
|
||
@Parcelize | ||
data object ProductReview : WooNotificationType { | ||
@IgnoredOnParcel override val trackingValue: String = "PRODUCT_REVIEW" | ||
} | ||
|
||
@Parcelize | ||
data object LocalReminder : WooNotificationType { | ||
@IgnoredOnParcel override val trackingValue: String = "LOCAL_REMINDER" | ||
} | ||
|
||
@Parcelize | ||
sealed interface BlazeStatusUpdate : WooNotificationType, Parcelable { | ||
@Parcelize | ||
data object BlazeApprovedNote : BlazeStatusUpdate { | ||
@IgnoredOnParcel override val trackingValue: String = "blaze_approved_note" | ||
} | ||
|
||
@Parcelize | ||
data object BlazeRejectedNote : BlazeStatusUpdate { | ||
@IgnoredOnParcel override val trackingValue: String = "blaze_rejected_note" | ||
} | ||
|
||
@Parcelize | ||
data object BlazeCancelledNote : BlazeStatusUpdate { | ||
@IgnoredOnParcel override val trackingValue: String = "blaze_cancelled_note" | ||
} | ||
|
||
@Parcelize | ||
data object BlazePerformedNote : BlazeStatusUpdate { | ||
@IgnoredOnParcel override val trackingValue: String = "blaze_performed_note" | ||
} | ||
} | ||
} | ||
|
||
fun NotificationModel.getWooType(): WooNotificationType { | ||
return when (this.type) { | ||
NotificationModel.Kind.STORE_ORDER -> WooNotificationType.NEW_ORDER | ||
NotificationModel.Kind.COMMENT -> WooNotificationType.PRODUCT_REVIEW | ||
NotificationModel.Kind.BLAZE_APPROVED_NOTE -> WooNotificationType.BLAZE_APPROVED_NOTE | ||
NotificationModel.Kind.BLAZE_REJECTED_NOTE -> WooNotificationType.BLAZE_REJECTED_NOTE | ||
NotificationModel.Kind.BLAZE_CANCELLED_NOTE -> WooNotificationType.BLAZE_CANCELLED_NOTE | ||
NotificationModel.Kind.BLAZE_PERFORMED_NOTE -> WooNotificationType.BLAZE_PERFORMED_NOTE | ||
else -> WooNotificationType.LOCAL_REMINDER | ||
NotificationModel.Kind.STORE_ORDER -> WooNotificationType.NewOrder | ||
NotificationModel.Kind.COMMENT -> WooNotificationType.ProductReview | ||
NotificationModel.Kind.BLAZE_APPROVED_NOTE -> WooNotificationType.BlazeStatusUpdate.BlazeApprovedNote | ||
NotificationModel.Kind.BLAZE_REJECTED_NOTE -> WooNotificationType.BlazeStatusUpdate.BlazeRejectedNote | ||
NotificationModel.Kind.BLAZE_CANCELLED_NOTE -> WooNotificationType.BlazeStatusUpdate.BlazeCancelledNote | ||
NotificationModel.Kind.BLAZE_PERFORMED_NOTE -> WooNotificationType.BlazeStatusUpdate.BlazePerformedNote | ||
else -> WooNotificationType.LocalReminder | ||
} | ||
} |
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
21 changes: 18 additions & 3 deletions
21
WooCommerce/src/main/kotlin/com/woocommerce/android/ui/blaze/IsBlazeEnabled.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 |
---|---|---|
@@ -1,17 +1,32 @@ | ||
package com.woocommerce.android.ui.blaze | ||
|
||
import com.woocommerce.android.tools.SelectedSite | ||
import com.woocommerce.android.tools.SiteConnectionType | ||
import com.woocommerce.android.tools.SiteConnectionType.Jetpack | ||
import com.woocommerce.android.util.IsRemoteFeatureFlagEnabled | ||
import com.woocommerce.android.util.RemoteFeatureFlag.WOO_BLAZE | ||
import javax.inject.Inject | ||
|
||
class IsBlazeEnabled @Inject constructor( | ||
private val selectedSite: SelectedSite, | ||
private val isRemoteFeatureFlagEnabled: IsRemoteFeatureFlagEnabled, | ||
private val isRemoteFeatureFlagEnabled: IsRemoteFeatureFlagEnabled | ||
) { | ||
companion object { | ||
private const val BLAZE_FOR_WOOCOMMERCE_PLUGIN_SLUG = "blaze-ads" | ||
} | ||
|
||
suspend operator fun invoke(): Boolean = selectedSite.getIfExists()?.isAdmin ?: false && | ||
selectedSite.connectionType == SiteConnectionType.Jetpack && | ||
hasAValidJetpackConnectionForBlaze() && | ||
selectedSite.getIfExists()?.canBlaze ?: false && | ||
isRemoteFeatureFlagEnabled(WOO_BLAZE) | ||
|
||
/** | ||
* In order for Blaze to work, the site requires the Jetpack Sync module to be enabled. This means not all | ||
* Jetpack connection will work. For now, Blaze will only be enabled for sites with Jetpack plugin installed and | ||
* active, or for sites with Blaze for WooCommerce plugin installed and connected. | ||
*/ | ||
private fun hasAValidJetpackConnectionForBlaze() = | ||
selectedSite.connectionType == Jetpack || isBlazeForWooCommercePluginActive() | ||
|
||
private fun isBlazeForWooCommercePluginActive(): Boolean = | ||
selectedSite.get().activeJetpackConnectionPlugins?.contains(BLAZE_FOR_WOOCOMMERCE_PLUGIN_SLUG) == true | ||
} |
Oops, something went wrong.