-
Notifications
You must be signed in to change notification settings - Fork 990
[MBL-789] ProjectPageViewModel.kt to Jetpack ViewModel and RxJava2.2 #1890
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
Conversation
app/src/test/java/com/kickstarter/viewmodels/ProjectPageViewModelTest.kt
Outdated
Show resolved
Hide resolved
Codecov Report
@@ Coverage Diff @@
## master #1890 +/- ##
============================================
- Coverage 73.93% 73.89% -0.04%
- Complexity 1945 1950 +5
============================================
Files 339 339
Lines 19486 19501 +15
Branches 2698 2707 +9
============================================
+ Hits 14407 14411 +4
- Misses 3526 3528 +2
- Partials 1553 1562 +9
... and 1 file with indirect coverage changes 📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
|
||
binding.backIcon.setOnClickListener { | ||
(this as BaseActivity<*>).back() | ||
onBackPressedDispatcher.onBackPressed() |
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.
💖
} | ||
|
||
public override fun onPause() { | ||
super.onPause() | ||
binding.mediaHeader.inputs.releasePlayer() | ||
} | ||
|
||
override fun back() { | ||
override fun onBackPressed() { |
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.
Can be removed, is deprecated and the back navigation can be handled by adding:
this.onBackPressedDispatcher.addCallback {
finishWithAnimation()
}
|
||
binding.backIcon.setOnClickListener { | ||
(this as BaseActivity<*>).back() | ||
onBackPressedDispatcher.onBackPressed() | ||
finishWithAnimation() |
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.
This finishWithAnimation()
can be removed, on the previous line you are calling any of the callbacks registered for the back navigation.
Asumming of course that the callback is defined like:
this.onBackPressedDispatcher.addCallback {
finishWithAnimation()
}
*/ | ||
fun refTag(intent: Intent): Observable<RefTag?> { | ||
return Observable.just(intent.getParcelableExtra(IntentKey.REF_TAG)) | ||
fun refTag(intent: Intent): io.reactivex.Observable<KsOptional<RefTag?>> { |
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.
love it!
app/src/main/java/com/kickstarter/viewmodels/usecases/SendThirdPartyEventUseCase.kt
Outdated
Show resolved
Hide resolved
|
||
intent() |
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.
just an fyi, your approach works perfectly, but in order reduce amount of code changes, take a look for example at MessagesActivity
The intent can be passed to the viewmodelProvider factory, and then have a private method
private fun intent() = intent?.let { Observable.just(it) } ?: Observable.empty()
in that way you don't need to create the new input fun configureWith(intent: Intent)
app/src/main/java/com/kickstarter/viewmodels/projectpage/ProjectPageViewModel.kt
Outdated
Show resolved
Hide resolved
…s test is triggering `saveProject:517` + `toggleProjectSave:475` resulting on the 3 emissions
b79c7be
to
b9b465e
Compare
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.
Wonderful job 💖
📲 What
Migrate project page viewmodel to rxjava 2.2 and jetpacks viewmodel
🤔 Why
Technical Details
👀 See
No user facing changes
📋 QA
Test project page loading correctly from all access points (discovery, search, profile, etc), all tabs, watching/unwatching project while logged in and out, and back a project. This will require additional QA time.
Story 📖
MBL-789: ProjectPageViewModel.kt to Jetpack ViewModel and RxJava2.2