-
Notifications
You must be signed in to change notification settings - Fork 136
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 issue/12561-fix-renaming-attribute
- Loading branch information
Showing
22 changed files
with
431 additions
and
35 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
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
45 changes: 45 additions & 0 deletions
45
...rc/main/kotlin/com/woocommerce/android/ui/blaze/creation/ad/ProductImagePickerFragment.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,45 @@ | ||
package com.woocommerce.android.ui.blaze.creation.ad | ||
|
||
import android.os.Bundle | ||
import android.view.LayoutInflater | ||
import android.view.View | ||
import android.view.ViewGroup | ||
import androidx.fragment.app.viewModels | ||
import androidx.navigation.fragment.findNavController | ||
import com.woocommerce.android.extensions.navigateBackWithResult | ||
import com.woocommerce.android.ui.base.BaseFragment | ||
import com.woocommerce.android.ui.blaze.creation.ad.ProductImagePickerViewModel.ImageSelectedResult | ||
import com.woocommerce.android.ui.compose.composeView | ||
import com.woocommerce.android.ui.main.AppBarStatus | ||
import com.woocommerce.android.viewmodel.MultiLiveEvent.Event.Exit | ||
import com.woocommerce.android.viewmodel.MultiLiveEvent.Event.ExitWithResult | ||
import dagger.hilt.android.AndroidEntryPoint | ||
|
||
@AndroidEntryPoint | ||
class ProductImagePickerFragment : BaseFragment() { | ||
companion object { | ||
const val ON_PRODUCT_IMAGE_SELECTED = "on_product_image_selected" | ||
} | ||
|
||
override val activityAppBarStatus: AppBarStatus | ||
get() = AppBarStatus.Hidden | ||
|
||
val viewModel: ProductImagePickerViewModel by viewModels() | ||
|
||
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View { | ||
return composeView { | ||
ProductImagePickerScreen(viewModel = viewModel) | ||
} | ||
} | ||
|
||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) { | ||
viewModel.event.observe(viewLifecycleOwner) { event -> | ||
when (event) { | ||
is Exit -> findNavController().popBackStack() | ||
is ExitWithResult<*> -> { | ||
navigateBackWithResult(ON_PRODUCT_IMAGE_SELECTED, event.data as ImageSelectedResult) | ||
} | ||
} | ||
} | ||
} | ||
} |
61 changes: 61 additions & 0 deletions
61
...c/main/kotlin/com/woocommerce/android/ui/blaze/creation/ad/ProductImagePickerViewModel.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,61 @@ | ||
package com.woocommerce.android.ui.blaze.creation.ad | ||
|
||
import android.os.Parcelable | ||
import androidx.lifecycle.SavedStateHandle | ||
import androidx.lifecycle.asLiveData | ||
import androidx.lifecycle.viewModelScope | ||
import com.woocommerce.android.model.Product | ||
import com.woocommerce.android.ui.products.details.ProductDetailRepository | ||
import com.woocommerce.android.viewmodel.MultiLiveEvent.Event.Exit | ||
import com.woocommerce.android.viewmodel.MultiLiveEvent.Event.ExitWithResult | ||
import com.woocommerce.android.viewmodel.ScopedViewModel | ||
import com.woocommerce.android.viewmodel.getStateFlow | ||
import com.woocommerce.android.viewmodel.navArgs | ||
import dagger.hilt.android.lifecycle.HiltViewModel | ||
import kotlinx.coroutines.flow.update | ||
import kotlinx.coroutines.launch | ||
import kotlinx.parcelize.Parcelize | ||
import javax.inject.Inject | ||
|
||
@HiltViewModel | ||
class ProductImagePickerViewModel @Inject constructor( | ||
savedStateHandle: SavedStateHandle, | ||
private val productRepository: ProductDetailRepository, | ||
) : ScopedViewModel(savedStateHandle) { | ||
private val navArgs: ProductImagePickerFragmentArgs by savedStateHandle.navArgs() | ||
|
||
private val _viewState = savedStateHandle.getStateFlow( | ||
scope = viewModelScope, | ||
initialValue = ViewState(emptyList()) | ||
) | ||
val viewState = _viewState.asLiveData() | ||
|
||
init { | ||
launch { | ||
val product = productRepository.getProduct(navArgs.productId) | ||
product?.let { | ||
_viewState.update { it.copy(productImages = product.images) } | ||
} | ||
} | ||
} | ||
|
||
fun onImageSelected(productImage: Product.Image) { | ||
triggerEvent( | ||
ExitWithResult( | ||
ImageSelectedResult(productImage = productImage) | ||
) | ||
) | ||
} | ||
|
||
fun onBackButtonTapped() { | ||
triggerEvent(Exit) | ||
} | ||
|
||
@Parcelize | ||
data class ViewState( | ||
val productImages: List<Product.Image> | ||
) : Parcelable | ||
|
||
@Parcelize | ||
data class ImageSelectedResult(val productImage: Product.Image) : Parcelable | ||
} |
Oops, something went wrong.