-
Notifications
You must be signed in to change notification settings - Fork 137
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Nullability Annotations to Java Classes] Use Updated and Null Proof MediaModel
Class (breaking
)
#10078
[Nullability Annotations to Java Classes] Use Updated and Null Proof MediaModel
Class (breaking
)
#10078
Conversation
This 'FluxC' PR hash updates the library to that branch version where the 'MediaModel' is updated to its new null proof version. FluxC PR: https://github.com/wordpress-mobile/ WordPress-FluxC-Android/pull/2886 This step is required in order to check that these 'FluxC' related changes work as expected for WCAndroid.
Warning: "'constructor MediaModel()' is deprecated. Deprecated in Java"
FYI: This change changes the logic to only checking for not blank instead.
FYI: This change propagates to 'UploadStatus.Failed' as well. PS: This change is not in order to avoid using an empty deprecated 'MediaModel' for no particular reason.
📲 You can test the changes from this Pull Request in WooCommerce Android by scanning the QR code below to install the corresponding build.
|
val channelResult = if (event.media?.url != null) { | ||
WooLog.i(T.MEDIA, "MediaFilesRepository > uploaded media ${event.media?.id}") | ||
val media = event.media | ||
val channelResult = if (media != null && media.url.isNotBlank()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Warning (
if (media != null && media.url.isNotBlank()) { UploadSuccess(media) }
Or another version of it, which just checks for a nullable media
, before marking this as upload success, but without checking for a blank URL:
if (media != null) { UploadSuccess(media) }
FYI: Mind the fact media.url
can no longer be nullable with the updated media
model.
Let me know your thoughts on this as I fear this has the potential to change the behavior somehow, on cases that we think a media
is still valid even with a blank URL, thank YOU for helping! 🙏
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wasn't sure either so I checked for the usage of MediaModel.url
and it seems like we don't use/check for the empty value anywhere, so the the 1st option should be fine. Besides, uploading an empty URL doesn't make sense anyway :).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome, thanks for checking, verifying and clarifying this @0nko , much appreciated! 🙇 🙏
FYI: I'll then stick with the version we have here then. 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've checked the code and tested both REST and XML-RPC variants and everything seems to be working fine. However, before we proceed with the merge, we'll need to also update the MediaPicker library.
Nice work @ParaskP7! 🥇
Thanks you so much for review, testing and approving this and the FluxC PR @0nko , you rock! 🙇 ❤️
Oh, I wasn't sure about that, thinking that MediaPicker will compile/work anyway (for now), just because it will be pointing to a previous version of FluxC. And also, that only when we'll need to update FluxC there that we would also need to deal with the But if you say so, I'll try to create another PR on the MediaPicker side, deal with the Would you be willing to go through another round of testing afterwards? 🙏 |
👋 @0nko !
A quick update on that! 👀 I just checked the MediaPicker library and noticed that the As such, I think it is better for me to NOT go through that change and let someone else deal with the |
@ParaskP7 Absolutely 👍. Thanks for handling it! |
Just saw your comment. OK, let's get these changes merged and I can take a look at the library afterwards. |
Great, thanks for agreeing to that @0nko and I am sorry to delegate that to you, that's wasn't my intention here. 🙏 Btw, I quickly searched for But, I do indeed worry about the FluxC library that is used there, which is 3 year old, and thus don't want to update that, as part of this work, just to deal with the |
FYI: I'll resolve the |
…to analysis/use-updated-and-null-proof-media-model-class # Conflicts: # build.gradle
This 'FluxC' PR hash updates the library to that branch version where the 'MediaModel' is updated to its new null proof version. FluxC PR: https://github.com/wordpress-mobile/ WordPress-FluxC-Android/pull/2886 This step is required in order to check that these 'FluxC' related changes work as expected for WCAndroid. ------------------------------------------------------------------------ FYI: This change is an addition to faf148b. This change is necessary in order to overcome and resolve new merge conflicts.
…to analysis/use-updated-and-null-proof-media-model-class # Conflicts: # build.gradle
This 'FluxC' hash updates the library to that 'trunk' version where the 'Media' model classes are updated to their new null proof version. FluxC PR: https://github.com/wordpress-mobile/ WordPress-FluxC-Android/pull/2886
…to analysis/use-updated-and-null-proof-media-model-class
This 'FluxC' hash updates the library to that 'trunk' version where the 'Media' model classes are updated to their new null proof version. FluxC PR: https://github.com/wordpress-mobile/ WordPress-FluxC-Android/pull/2886 ------------------------------------------------------------------------ FYI: This change is an addition to 2a44866. This change is necessary in order to overcome and resolve new merge conflicts.
Found 1 violations: The PR caused the following dependency changes:expand
-+--- org.wordpress:fluxc:2890-5ca88c9aa82b96dfc9c9cb83a71eb19045437225
-| +--- org.wordpress:wellsql:2.0.0
-| | +--- androidx.annotation:annotation:1.2.0 -> 1.6.0 (*)
-| | \--- org.wordpress.wellsql:wellsql-annotations:2.0.0
-| +--- org.wordpress.fluxc:fluxc-annotations:2890-5ca88c9aa82b96dfc9c9cb83a71eb19045437225
-| +--- org.greenrobot:eventbus:3.3.1 (*)
-| +--- com.squareup.okhttp3:okhttp:4.9.0 -> 4.11.0 (*)
-| +--- com.android.volley:volley:1.1.1 -> 1.2.0
-| +--- androidx.paging:paging-runtime:2.1.2
-| | +--- androidx.paging:paging-common:2.1.2
-| | | +--- androidx.annotation:annotation:1.0.0 -> 1.6.0 (*)
-| | | \--- androidx.arch.core:core-common:2.0.0 -> 2.2.0 (*)
-| | +--- androidx.arch.core:core-runtime:2.0.0 -> 2.2.0 (*)
-| | +--- androidx.lifecycle:lifecycle-runtime:2.0.0 -> 2.6.2 (*)
-| | +--- androidx.lifecycle:lifecycle-livedata:2.0.0 -> 2.6.2 (*)
-| | \--- androidx.recyclerview:recyclerview:1.0.0 -> 1.2.1 (*)
-| +--- com.goterl:lazysodium-android:5.0.2
-| +--- net.java.dev.jna:jna:5.5.0
-| +--- org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.6.20 -> 1.8.21 (*)
-| +--- org.jetbrains.kotlin:kotlin-android-extensions-runtime:1.6.20 -> 1.8.21
-| | \--- org.jetbrains.kotlin:kotlin-stdlib:1.8.21 -> 1.8.22 (*)
-| +--- androidx.appcompat:appcompat:1.0.2 -> 1.4.2 (*)
-| +--- androidx.recyclerview:recyclerview:1.0.0 -> 1.2.1 (*)
-| +--- androidx.exifinterface:exifinterface:1.0.0 -> 1.3.3
-| | \--- androidx.annotation:annotation:1.2.0 -> 1.6.0 (*)
-| +--- androidx.security:security-crypto:1.0.0 -> 1.1.0-alpha03
-| | +--- androidx.annotation:annotation:1.1.0 -> 1.6.0 (*)
-| | +--- com.google.crypto.tink:tink-android:1.5.0
-| | \--- androidx.collection:collection:1.1.0 -> 1.2.0 (*)
-| +--- com.squareup.okhttp3:okhttp-urlconnection:4.9.0
-| | +--- com.squareup.okhttp3:okhttp:4.9.0 -> 4.11.0 (*)
-| | \--- org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.4.10 -> 1.8.21 (*)
-| +--- com.google.code.gson:gson:2.8.5 -> 2.10.1
-| +--- org.apache.commons:commons-text:1.10.0 (*)
-| +--- androidx.room:room-runtime:2.4.2 -> 2.5.1 (*)
-| +--- androidx.room:room-ktx:2.4.2 -> 2.5.1
-| | +--- androidx.room:room-common:2.5.1 (*)
-| | +--- androidx.room:room-runtime:2.5.1 (*)
-| | +--- org.jetbrains.kotlin:kotlin-stdlib:1.7.20 -> 1.8.22 (*)
-| | \--- org.jetbrains.kotlinx:kotlinx-coroutines-android:1.6.4 (*)
-| +--- com.google.dagger:dagger:2.42 -> 2.46.1
-| | \--- javax.inject:javax.inject:1
-| +--- org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.9 -> 1.6.4 (*)
-| \--- org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.9 -> 1.6.4 (*)
++--- org.wordpress:fluxc:trunk-7ea7465680431fa4df5f0433d4c8b8395055b997
+| +--- org.wordpress:wellsql:2.0.0
+| | +--- androidx.annotation:annotation:1.2.0 -> 1.6.0 (*)
+| | \--- org.wordpress.wellsql:wellsql-annotations:2.0.0
+| +--- org.wordpress.fluxc:fluxc-annotations:trunk-7ea7465680431fa4df5f0433d4c8b8395055b997
+| +--- org.greenrobot:eventbus:3.3.1 (*)
+| +--- com.squareup.okhttp3:okhttp:4.9.0 -> 4.11.0 (*)
+| +--- com.android.volley:volley:1.1.1 -> 1.2.0
+| +--- androidx.paging:paging-runtime:2.1.2
+| | +--- androidx.paging:paging-common:2.1.2
+| | | +--- androidx.annotation:annotation:1.0.0 -> 1.6.0 (*)
+| | | \--- androidx.arch.core:core-common:2.0.0 -> 2.2.0 (*)
+| | +--- androidx.arch.core:core-runtime:2.0.0 -> 2.2.0 (*)
+| | +--- androidx.lifecycle:lifecycle-runtime:2.0.0 -> 2.6.2 (*)
+| | +--- androidx.lifecycle:lifecycle-livedata:2.0.0 -> 2.6.2 (*)
+| | \--- androidx.recyclerview:recyclerview:1.0.0 -> 1.2.1 (*)
+| +--- com.goterl:lazysodium-android:5.0.2
+| +--- net.java.dev.jna:jna:5.5.0
+| +--- org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.6.20 -> 1.8.21 (*)
+| +--- org.jetbrains.kotlin:kotlin-android-extensions-runtime:1.6.20 -> 1.8.21
+| | \--- org.jetbrains.kotlin:kotlin-stdlib:1.8.21 -> 1.8.22 (*)
+| +--- androidx.appcompat:appcompat:1.0.2 -> 1.4.2 (*)
+| +--- androidx.recyclerview:recyclerview:1.0.0 -> 1.2.1 (*)
+| +--- androidx.exifinterface:exifinterface:1.0.0 -> 1.3.3
+| | \--- androidx.annotation:annotation:1.2.0 -> 1.6.0 (*)
+| +--- androidx.security:security-crypto:1.0.0 -> 1.1.0-alpha03
+| | +--- androidx.annotation:annotation:1.1.0 -> 1.6.0 (*)
+| | +--- com.google.crypto.tink:tink-android:1.5.0
+| | \--- androidx.collection:collection:1.1.0 -> 1.2.0 (*)
+| +--- com.squareup.okhttp3:okhttp-urlconnection:4.9.0
+| | +--- com.squareup.okhttp3:okhttp:4.9.0 -> 4.11.0 (*)
+| | \--- org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.4.10 -> 1.8.21 (*)
+| +--- com.google.code.gson:gson:2.8.5 -> 2.10.1
+| +--- org.apache.commons:commons-text:1.10.0 (*)
+| +--- androidx.room:room-runtime:2.4.2 -> 2.5.1 (*)
+| +--- androidx.room:room-ktx:2.4.2 -> 2.5.1
+| | +--- androidx.room:room-common:2.5.1 (*)
+| | +--- androidx.room:room-runtime:2.5.1 (*)
+| | +--- org.jetbrains.kotlin:kotlin-stdlib:1.7.20 -> 1.8.22 (*)
+| | \--- org.jetbrains.kotlinx:kotlinx-coroutines-android:1.6.4 (*)
+| +--- com.google.dagger:dagger:2.42 -> 2.46.1
+| | \--- javax.inject:javax.inject:1
+| +--- org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.9 -> 1.6.4 (*)
+| \--- org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.9 -> 1.6.4 (*)
-\--- org.wordpress.fluxc.plugins:woocommerce:2890-5ca88c9aa82b96dfc9c9cb83a71eb19045437225
- +--- org.wordpress:wellsql:2.0.0 (*)
- +--- org.wordpress.fluxc:fluxc-annotations:2890-5ca88c9aa82b96dfc9c9cb83a71eb19045437225
- +--- androidx.room:room-ktx:2.4.2 -> 2.5.1 (*)
- +--- org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.6.20 -> 1.8.21 (*)
- +--- org.wordpress:fluxc:2890-5ca88c9aa82b96dfc9c9cb83a71eb19045437225 (*)
- +--- com.google.code.gson:gson:2.8.5 -> 2.10.1
- +--- com.google.dagger:dagger:2.42 -> 2.46.1 (*)
- +--- org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.9 -> 1.6.4 (*)
- +--- org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.9 -> 1.6.4 (*)
- \--- androidx.room:room-runtime:2.4.2 -> 2.5.1 (*)
+\--- org.wordpress.fluxc.plugins:woocommerce:trunk-7ea7465680431fa4df5f0433d4c8b8395055b997
+ +--- org.wordpress:wellsql:2.0.0 (*)
+ +--- org.wordpress.fluxc:fluxc-annotations:trunk-7ea7465680431fa4df5f0433d4c8b8395055b997
+ +--- androidx.room:room-ktx:2.4.2 -> 2.5.1 (*)
+ +--- org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.6.20 -> 1.8.21 (*)
+ +--- org.wordpress:fluxc:trunk-7ea7465680431fa4df5f0433d4c8b8395055b997 (*)
+ +--- com.google.code.gson:gson:2.8.5 -> 2.10.1
+ +--- com.google.dagger:dagger:2.42 -> 2.46.1 (*)
+ +--- org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.9 -> 1.6.4 (*)
+ +--- org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.9 -> 1.6.4 (*)
+ \--- androidx.room:room-runtime:2.4.2 -> 2.5.1 (*)
Please review and act accordingly
|
@ParaskP7 I tried to update the FluxC reference and get it merged but I can't build the project. I'm getting a useless |
👋 @0nko and thanks for trying to find the correct FluxC reference and then do the merge yourself. 🙇
FYI: This was most like related to this Let me know if that makes sense. 🙏
🎉 🚀 |
Parent FluxC#2799
Accompanying FluxC#2886
Description
This PR accompanying the above FluxC PR, and uses an updated and null-proof MediaModel.java class.
FYI: This change is
breaking
, meaning that any client that depended on the MediaModel.java model should update to the new APIs (non-default constructors
) as the existing API (default constructor
) are now deprecated. As such, this change is inherentlyrisky
, meaning that there are compile-time changes associated with this change and thus needs testing to verify correctness, both on the library's and client's side.@0nko I added you as the main reviewer, not so randomly (it being a continuation of FluxC#2878), since I just wanted someone from the WooCommerce mobile team to be aware of and sign-off on that change. Feel free to merge this PR directly yourself if you deem so.
FluxC Update List:
Deprecation Resolution List (
breaking
):Nullability Checks List:
Testing instructions
(
REST
):(
XMLRPC
):Photos Screens [ProductDetailFragment.java + ProductImagesFragment.kt + ProductImageViewerFragment.kt]
Products
tab and tap on any product.Photos
screen is shown and functioning as expected.Photo Preview
screen is shown and functioning as expected.Merge instructions:
fluxCVersion
to point to thetrunk
hash that includes the above solution.status: do not merge
label.RELEASE-NOTES.txt
if necessary.