Skip to content

Commit

Permalink
Fixed drawerheader not updating notifications
Browse files Browse the repository at this point in the history
  • Loading branch information
feelfreelinux committed Nov 12, 2017
1 parent 5929a39 commit 55d21d6
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 8 deletions.
6 changes: 4 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ cache:
- "$HOME/.gradle/caches/"
- "$HOME/.gradle/wrapper/"
- "$HOME/.android/build-cache"
before_script:
- echo -e "apiKey=\"$wykopApiKey\"\napiSecret=\"$wykopApiSecret\"" >> credentials.properties
script:
- "./gradlew assembleRelease"
deploy:
Expand All @@ -35,8 +37,8 @@ env:
global:
- secure: teHBCHSeoGRamuHwwfqRVs7xs/oia911ij0oBdVg4Na9KbunnNJRAFwVB3RWCKhbaVAJkOvoKyNuWWIeXedS+Ia9/IBsSlvL0tOXdJZUtzM0tq56VNMncllDyleBUfBvYCsaDtsb54c0G6fgdjpD1C0l8+rGnJn7IbIWChTtblXpcoulCGmmnq/lp2KtHBEr8frZvChQMXmGdroiiJLWVhhVmtsyorc3tsI3CdaHVzztFh9ruzT45Wky0oYWuT16wLYaPiVGBR6S9Ear70TCXSIj6y2Mxu4Yt/Ig4o4zYp/9vVc5Exk+DZ4bZxJ+DaKNji8LSPVzEyVjWkmMuewELUusbV2Vrkg/bBYHeRjB/f5EHS+6lpQL4paRxtRL7UOBzAYsF6ckxKMEyksl4lXT1on8whfDhtWLWl81IboDX6Bsp53p2Nb7BJPENfEsUM5WhhYdFsqIiYrSfM61uxdpYkp/jy70uwMlWbgojvvs0hifC2L7Ve+iacJnDcnMPsvy//2V3PWtcAobiBNH7d5934YIEq3O0ylyyaxqWd1wtKej42woQrXLTTM/F0mXio6CrrEiJ0EYs83fxgyI055hPOecW1Zh0mRMuT/Mo8N/EsDGkpYRzBXPw1nylN0jGyg1y4zTTScKo/Ezk0TvmIpaM5Le0FEYRW9J8Rp6xaUyZds=
- secure: DnMnA8OB7PufQnJE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AFnOt9GndnMaSI+h93UGk4Vbh/Osssrjev1negz9hvhv5h7UITVcOJCzfEF2J9934N4q43dYe1jrcUzl5HbsZhzVtS95oT+8X1MZZUQpijIQD0kYWewcRdN5xtgWgNo2eZupCc/Aahk7oDyhacrUNL1eMjXhjzASi0v7KLC4wTE4WOBows3axuGhY0Y5OXsFoyk+yYfkEbcbr2P8NBEm8tDXVY8vSaHxPcAgaMomvjhF0Cm1rF+cwvEG0QrtkSw2X5XcU8xnCuxyRo=
- secure: 1rvT9iqxBXdv3KgJTdmH2lSl32wtzMLj6t2q4Wb/arJfjo+xMrK08G24o84EMbPQhi00zm+pbUgoeMjFPRF4OWex4ZXlHNaNQTlRUYTddh/DXPUKackxM9F66rse5Yk/xT0e8PgjtSAVZYKsP4sVlB4TW+BikPmUjJJvynobqrW/+OqjeEYJtT/Oc4Hd/CszMcYOyfN3nv+5+Dr1ZMr4ZKcxs0iv6+EzLAA/Ix6eEabTlba+/HQYPwJj4F7cShM4kLok+Cjlc67FMSQfKMnZgVThZLYk/gfbj9+ep5/oJq/9c+zoKWupNvSiwRQ6JjFVRWnbSxMwodVq2bERQDfMxlvavAW/iryYrc/bmUaFCnGm4AglJmi5k5AqeL4MeTyALvpS6j4JmWfKFfFtl9s8El0Qibr6GDiSbaDuS42zjXu1UqyHYPMzZYCr9aek+ImuURT/gTo8QKjGvWu9acIa2k4sHXwN+4Smbj2T4SII5BnZdOSbPqrzA+eWqbW14Mi2FMKWF//0QNUdvwthermEXopcQjA3IEP+vu8QKTib00oSfaEkvVYmi2Rr9KEa6EOYsDxaF3kqqggSRIVsIOXBZavxQfzNVIDTwzHd7QhnIkwSdJddjD5R7pSqPlDS/SuCbonPCUR6h9IFNkx24WvbEXMcfkanSfhPMI1HdKtt5wk=
before_install:
- openssl aes-256-cbc -K $encrypted_110fd07a76f6_key -iv $encrypted_110fd07a76f6_iv
-in ci-release-keystore.jks.enc -out ci-release-keystore.jks -d
- openssl aes-256-cbc -K $encrypted_110fd07a76f6_key -iv $encrypted_110fd07a76f6_iv
-in credentials.properties.enc -out credentials.properties -d
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import io.github.feelfreelinux.wykopmobilny.models.dataclass.Notification
import io.github.feelfreelinux.wykopmobilny.models.mapper.apiv2.NotificationMapper
import io.github.feelfreelinux.wykopmobilny.models.pojo.apiv2.models.NotificationResponse
import io.github.feelfreelinux.wykopmobilny.models.pojo.apiv2.models.NotificationsCountResponse
import io.reactivex.Observable
import io.reactivex.subjects.PublishSubject
import retrofit2.Retrofit

class NotificationsRepository(val retrofit: Retrofit) : NotificationsApi {
Expand All @@ -21,8 +23,8 @@ class NotificationsRepository(val retrofit: Retrofit) : NotificationsApi {
.compose<NotificationsCountResponse>(ErrorHandlerTransformer())

override fun readHashTagNotifications() = mywykopApi.readHashTagsNotifications()
.map { emptyList<Notification>() }

.compose<List<NotificationResponse>>(ErrorHandlerTransformer())
.map { it.map { NotificationMapper.map(it) } }

override fun getHashTagNotifications(page : Int) = mywykopApi.getHashTagsNotifications(page)
.compose<List<NotificationResponse>>(ErrorHandlerTransformer())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import io.github.feelfreelinux.wykopmobilny.ui.modules.pm.conversationslist.Conv
import io.github.feelfreelinux.wykopmobilny.ui.modules.settings.SettingsActivity
import io.github.feelfreelinux.wykopmobilny.utils.SettingsPreferencesApi
import io.github.feelfreelinux.wykopmobilny.utils.isVisible
import io.github.feelfreelinux.wykopmobilny.utils.printout
import kotlinx.android.synthetic.main.activity_navigation.*
import kotlinx.android.synthetic.main.activity_navigation.view.*
import kotlinx.android.synthetic.main.drawer_header_view_layout.view.*
Expand Down Expand Up @@ -137,6 +138,7 @@ class NavigationActivity : BaseActivity(), MainNavigationView, NavigationView.On

override fun onResume() {
super.onResume()
printout("RESUME")
presenter.subscribe(this)
navHeader.view_container.startListeningForUpdates()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package io.github.feelfreelinux.wykopmobilny.ui.widgets.drawerheaderview
import io.github.feelfreelinux.wykopmobilny.api.notifications.NotificationsApi
import io.github.feelfreelinux.wykopmobilny.base.BasePresenter
import io.github.feelfreelinux.wykopmobilny.models.pojo.apiv2.models.NotificationsCountResponse
import io.github.feelfreelinux.wykopmobilny.utils.printout
import io.github.feelfreelinux.wykopmobilny.utils.rx.SubscriptionHelperApi
import io.reactivex.Observable
import io.reactivex.Single
Expand All @@ -11,10 +12,12 @@ import java.util.concurrent.TimeUnit

class DrawerHeaderPresenter(val subscriptionHelper: SubscriptionHelperApi,
private val notificationsApi: NotificationsApi) : BasePresenter<DrawerHeaderView>() {
private val intervalDisposable = CompositeDisposable()
private var intervalDisposable = CompositeDisposable()

fun fetchNotifications() {
intervalDisposable.clear()
intervalDisposable.dispose()
intervalDisposable = CompositeDisposable()
intervalDisposable.add(
Observable.interval(0, 5, TimeUnit.MINUTES)
.map { notificationsApi.getHashTagNotificationCount() }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ class DrawerHeaderWidget : ConstraintLayout, DrawerHeaderView {
}

override fun onDetachedFromWindow() {
printout("Deattached")
presenter.unsubscribe()
super.onDetachedFromWindow()
}
Expand Down
2 changes: 0 additions & 2 deletions credentials.properties.enc

This file was deleted.

0 comments on commit 55d21d6

Please sign in to comment.