Skip to content
This repository was archived by the owner on Feb 17, 2020. It is now read-only.

Commit 899a68b

Browse files
authored
Merge pull request #554 from squanchy-dev/add_rxlint
SQ-549/Add RxLint, fix all outstanding issues
2 parents afdfc99 + 760a0f4 commit 899a68b

11 files changed

Lines changed: 92 additions & 70 deletions

File tree

app/build.gradle

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -125,10 +125,11 @@ project.afterEvaluate {
125125
dependencies {
126126
implementation project(':renderthread')
127127

128+
implementation libraries.app.algolia
128129
implementation libraries.app.androidKtx
129130
implementation libraries.app.arrowCore
130-
131131
implementation libraries.app.crashlytics
132+
implementation libraries.app.dagger
132133
implementation(libraries.app.firebase) {
133134
exclude group: 'com.android.support'
134135
}
@@ -143,33 +144,26 @@ dependencies {
143144
exclude group: 'com.android.support'
144145
exclude group: 'com.google.firebase'
145146
}
146-
147147
implementation libraries.app.flexbox
148-
149-
kapt libraries.app.glideCompiler
150148
implementation libraries.app.glide
151149
implementation libraries.app.glideOkHttp3
152-
153150
implementation libraries.app.jodaTimeAndroid
154151
implementation libraries.app.kotlin
155152
implementation libraries.app.kotlinReflect
156-
153+
implementation libraries.app.moshi
154+
implementation libraries.app.moshiKotlin
157155
implementation libraries.app.playServicesAuth
158-
implementation libraries.app.rxJava
159156
implementation libraries.app.rxAndroid
157+
implementation libraries.app.rxJava
158+
implementation libraries.app.rxLint
160159
implementation libraries.app.supportAppCompat
161160
implementation libraries.app.supportConstraint
162161
implementation libraries.app.supportDesign
163162
implementation libraries.app.timber
164163
implementation libraries.app.viewPagerAdapter
165164

166-
implementation libraries.app.moshi
167-
implementation libraries.app.moshiKotlin
168-
169165
kapt libraries.app.daggerCompiler
170-
implementation libraries.app.dagger
171-
172-
implementation libraries.app.algolia
166+
kapt libraries.app.glideCompiler
173167

174168
testImplementation libraries.test.truth
175169
testImplementation libraries.test.jodaTime

app/src/main/java/net/squanchy/about/licenses/Libraries.kt

Lines changed: 28 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -3,32 +3,33 @@ package net.squanchy.about.licenses
33
internal object Libraries {
44

55
val LIBRARIES = listOf(
6-
Library("Squanchy", "the Squanchy Authors", License.APACHE_2),
7-
Library("Android", "Google Inc. and the Open Handset Alliance", License.APACHE_2),
8-
Library("Android Support Library", "Google Inc. and the Open Handset Alliance", License.APACHE_2),
9-
Library("Λrrow", "The Arrow Authors", License.APACHE_2),
10-
Library("Dagger", "the Dagger Authors", License.APACHE_2),
11-
Library("Detekt", "the Detekt Authors", License.APACHE_2),
12-
Library("Firebase-UI", "Google Inc.", License.APACHE_2),
13-
Library("Flexbox-layout", "Google Inc.", License.APACHE_2),
14-
Library("Glide", "Google Inc.", License.GLIDE),
15-
Library("Gradle Build Properties plugin", "Novoda, Ltd.", License.APACHE_2),
16-
Library("Gradle Play Publisher plugin", "Christian Becker and Björn Hurling", License.MIT),
17-
Library("Gradle Static Analysis plugin", "Novoda, Ltd.", License.APACHE_2),
18-
Library("Joda-Time", "the Joda-Time Authors", License.APACHE_2),
19-
Library("Joda-Time Android", "Daniel Lew", License.APACHE_2),
20-
Library("JUnit 4", "JUnit.org", License.ECLIPSE_PUBLIC_LICENSE),
21-
Library("Kotlin", "JetBrains s.r.o. and the Kotlin Authors", License.APACHE_2),
22-
Library("KtLint", "the KtLint Authors", License.MIT),
23-
Library("Mockito", "the Mockito Authors", License.MIT),
24-
Library("Moshi", "Square, Inc.", License.APACHE_2),
25-
Library("RxJava", "the RxJava Authors", License.APACHE_2),
26-
Library("RxAndroid", "the RxAndroid Authors", License.APACHE_2),
27-
Library("Timber", "Jake Wharton", License.APACHE_2),
28-
Library("Truth", "the Truth Authors", License.APACHE_2),
29-
Library("ViewPagerAdapter", "Novoda Ltd.", License.APACHE_2),
30-
Library("League Spartan", "Micah Rich, Caroline Hadilaksono, and Tyler Finck", License.OPEN_FONT_LICENSE),
31-
Library("Quicksand", "the Quicksand Project Authors", License.OPEN_FONT_LICENSE),
32-
Library("VT323", "the VT323 Project Authors", License.OPEN_FONT_LICENSE)
6+
Library("Squanchy", "the Squanchy Authors", License.APACHE_2),
7+
Library("Android", "Google Inc. and the Open Handset Alliance", License.APACHE_2),
8+
Library("Android Support Library", "Google Inc. and the Open Handset Alliance", License.APACHE_2),
9+
Library("Λrrow", "The Arrow Authors", License.APACHE_2),
10+
Library("Dagger", "the Dagger Authors", License.APACHE_2),
11+
Library("Detekt", "the Detekt Authors", License.APACHE_2),
12+
Library("Firebase-UI", "Google Inc.", License.APACHE_2),
13+
Library("Flexbox-layout", "Google Inc.", License.APACHE_2),
14+
Library("Glide", "Google Inc.", License.GLIDE),
15+
Library("Gradle Build Properties plugin", "Novoda, Ltd.", License.APACHE_2),
16+
Library("Gradle Play Publisher plugin", "Christian Becker and Björn Hurling", License.MIT),
17+
Library("Gradle Static Analysis plugin", "Novoda, Ltd.", License.APACHE_2),
18+
Library("Joda-Time", "the Joda-Time Authors", License.APACHE_2),
19+
Library("Joda-Time Android", "Daniel Lew", License.APACHE_2),
20+
Library("JUnit 4", "JUnit.org", License.ECLIPSE_PUBLIC_LICENSE),
21+
Library("Kotlin", "JetBrains s.r.o. and the Kotlin Authors", License.APACHE_2),
22+
Library("KtLint", "the KtLint Authors", License.MIT),
23+
Library("Mockito", "the Mockito Authors", License.MIT),
24+
Library("Moshi", "Square, Inc.", License.APACHE_2),
25+
Library("RxAndroid", "the RxAndroid Authors", License.APACHE_2),
26+
Library("RxJava", "the RxJava Authors", License.APACHE_2),
27+
Library("RxLint", "Little Robot", License.APACHE_2),
28+
Library("Timber", "Jake Wharton", License.APACHE_2),
29+
Library("Truth", "the Truth Authors", License.APACHE_2),
30+
Library("ViewPagerAdapter", "Novoda Ltd.", License.APACHE_2),
31+
Library("League Spartan", "Micah Rich, Caroline Hadilaksono, and Tyler Finck", License.OPEN_FONT_LICENSE),
32+
Library("Quicksand", "the Quicksand Project Authors", License.OPEN_FONT_LICENSE),
33+
Library("VT323", "the VT323 Project Authors", License.OPEN_FONT_LICENSE)
3334
)
3435
}

app/src/main/java/net/squanchy/eventdetails/EventDetailsActivity.kt

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import net.squanchy.notification.NotificationsIntentService
1616
import net.squanchy.schedule.domain.view.Event
1717
import net.squanchy.signin.SignInOrigin
1818
import net.squanchy.speaker.domain.view.Speaker
19+
import timber.log.Timber
1920

2021
class EventDetailsActivity : AppCompatActivity() {
2122

@@ -65,7 +66,10 @@ class EventDetailsActivity : AppCompatActivity() {
6566
subscriptions.add(
6667
service.event(eventId)
6768
.observeOn(AndroidSchedulers.mainThread())
68-
.subscribe { event -> eventDetailsRoot.updateWith(event, onEventDetailsClickListener(event)) }
69+
.subscribe(
70+
{ event -> eventDetailsRoot.updateWith(event, onEventDetailsClickListener(event)) },
71+
Timber::e
72+
)
6973
)
7074
}
7175

@@ -78,17 +82,19 @@ class EventDetailsActivity : AppCompatActivity() {
7882
override fun onFavoriteClick() {
7983
subscriptions.add(
8084
service.toggleFavorite(event)
81-
.subscribe { result ->
82-
if (result === EventDetailsService.FavoriteResult.MUST_AUTHENTICATE) {
83-
requestSignIn()
84-
} else {
85-
triggerNotificationService()
86-
}
87-
}
85+
.subscribe(::onFavouriteStateChange, Timber::e)
8886
)
8987
}
9088
}
9189

90+
private fun onFavouriteStateChange(result: EventDetailsService.FavoriteResult) {
91+
if (result === EventDetailsService.FavoriteResult.MUST_AUTHENTICATE) {
92+
requestSignIn()
93+
} else {
94+
triggerNotificationService()
95+
}
96+
}
97+
9298
private fun requestSignIn() {
9399
navigator.toSignInForResult(REQUEST_CODE_SIGNIN, SignInOrigin.EVENT_DETAILS)
94100
unsubscribeFromUpdates()

app/src/main/java/net/squanchy/favorites/FavoritesPageView.kt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import io.reactivex.Observable
99
import io.reactivex.android.schedulers.AndroidSchedulers
1010
import io.reactivex.disposables.CompositeDisposable
1111
import io.reactivex.functions.BiFunction
12+
import io.reactivex.schedulers.Schedulers
1213
import kotlinx.android.synthetic.main.view_page_favorites.view.*
1314
import net.squanchy.R
1415
import net.squanchy.analytics.Analytics
@@ -19,6 +20,7 @@ import net.squanchy.home.Loadable
1920
import net.squanchy.navigation.Navigator
2021
import net.squanchy.schedule.domain.view.Event
2122
import net.squanchy.support.unwrapToActivityContext
23+
import timber.log.Timber
2224

2325
class FavoritesPageView @JvmOverloads constructor(
2426
context: Context?,
@@ -63,8 +65,9 @@ class FavoritesPageView @JvmOverloads constructor(
6365
favoritesService.currentUserIsSignedIn(),
6466
BiFunction<List<FavoritesItem>, Boolean, LoadResult>(::LoadResult)
6567
)
68+
.subscribeOn(Schedulers.io())
6669
.observeOn(AndroidSchedulers.mainThread())
67-
.subscribe(::handleLoadSchedule)
70+
.subscribe(::handleLoadSchedule, Timber::e)
6871
)
6972
}
7073

app/src/main/java/net/squanchy/onboarding/account/AccountOnboardingActivity.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import android.os.Bundle
66
import android.support.v7.app.AppCompatActivity
77
import io.reactivex.android.schedulers.AndroidSchedulers
88
import io.reactivex.disposables.Disposable
9+
import io.reactivex.schedulers.Schedulers
910
import kotlinx.android.synthetic.main.activity_onboarding_account.*
1011
import net.squanchy.R
1112
import net.squanchy.navigation.Navigator
@@ -47,7 +48,8 @@ class AccountOnboardingActivity : AppCompatActivity() {
4748
disableUi()
4849
subscription = signInService.isSignedInToGoogle()
4950
.observeOn(AndroidSchedulers.mainThread())
50-
.timeout(SIGNIN_STATE_CHECK_TIMEOUT_SECONDS, TimeUnit.SECONDS)
51+
.timeout(SIGNIN_STATE_CHECK_TIMEOUT_SECONDS, TimeUnit.SECONDS, Schedulers.computation())
52+
.subscribeOn(Schedulers.io())
5153
.subscribe(
5254
{ signedIn ->
5355
if (signedIn) {

app/src/main/java/net/squanchy/schedule/tracksfilter/ScheduleTracksFilter.kt

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import net.squanchy.schedule.domain.view.Track
2424
import net.squanchy.service.repository.TracksRepository
2525
import net.squanchy.support.view.setAdapterIfNone
2626
import net.squanchy.support.widget.OriginCoordinates
27+
import timber.log.Timber
2728
import kotlin.math.hypot
2829

2930
class ScheduleTracksFilterActivity : AppCompatActivity() {
@@ -118,11 +119,14 @@ class ScheduleTracksFilterActivity : AppCompatActivity() {
118119
.distinctUntilChanged()
119120
.subscribeOn(Schedulers.computation())
120121
.observeOn(AndroidSchedulers.mainThread())
121-
.subscribe { checkableTracks ->
122-
trackFiltersList.setAdapterIfNone(trackAdapter)
123-
this.checkableTracks = checkableTracks
124-
trackAdapter.submitList(checkableTracks)
125-
}
122+
.subscribe(
123+
{ checkableTracks ->
124+
trackFiltersList.setAdapterIfNone(trackAdapter)
125+
this.checkableTracks = checkableTracks
126+
trackAdapter.submitList(checkableTracks)
127+
},
128+
Timber::e
129+
)
126130
}
127131

128132
private fun prepareAppearAnimation() {

app/src/main/java/net/squanchy/search/SearchActivity.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ class SearchActivity : AppCompatActivity(), SearchRecyclerView.OnSearchResultCli
7676
searchTextWatcher = SearchTextWatcher(querySubject)
7777
searchField.addTextChangedListener(searchTextWatcher)
7878

79-
val searchSubscription = querySubject.throttleLast(QUERY_DEBOUNCE_TIMEOUT, TimeUnit.MILLISECONDS)
79+
val searchSubscription = querySubject.throttleLast(QUERY_DEBOUNCE_TIMEOUT, TimeUnit.MILLISECONDS, Schedulers.computation())
8080
.doOnNext(::updateSearchActionIcon)
8181
.startWith(query)
8282
.doOnNext { query = it }

app/src/main/java/net/squanchy/settings/SettingsFragment.kt

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import net.squanchy.signin.SignInService
2424
import net.squanchy.support.lang.getOrThrow
2525
import net.squanchy.wificonfig.WifiConfigOrigin
2626
import net.squanchy.wificonfig.WifiConfigService
27+
import timber.log.Timber
2728

2829
class SettingsFragment : PreferenceFragment() {
2930

@@ -131,7 +132,7 @@ class SettingsFragment : PreferenceFragment() {
131132
subscriptions.add(
132133
signInService.currentUser()
133134
.observeOn(AndroidSchedulers.mainThread())
134-
.subscribe(::onUserChanged)
135+
.subscribe(::onUserChanged, Timber::e)
135136
)
136137
}
137138

@@ -155,12 +156,17 @@ class SettingsFragment : PreferenceFragment() {
155156

156157
accountSignInSignOutPreference.setTitle(R.string.sign_out_title)
157158
accountSignInSignOutPreference.setOnPreferenceClickListener {
158-
signInService.signOut()
159-
.subscribe {
160-
Snackbar.make(viewOrThrow, R.string.settings_message_signed_out, Snackbar.LENGTH_SHORT).show()
161-
analytics.trackUserNotLoggedIn()
162-
}
163-
true
159+
subscriptions.add(
160+
signInService.signOut()
161+
.subscribe(
162+
{
163+
Snackbar.make(viewOrThrow, R.string.settings_message_signed_out, Snackbar.LENGTH_SHORT).show()
164+
analytics.trackUserNotLoggedIn()
165+
},
166+
Timber::e
167+
)
168+
)
169+
return@setOnPreferenceClickListener true
164170
}
165171
}
166172

app/src/main/java/net/squanchy/signin/SignInActivity.kt

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import net.squanchy.R
1919
import net.squanchy.analytics.Analytics
2020
import net.squanchy.google.GoogleClientId
2121
import net.squanchy.support.config.DialogLayoutParameters
22+
import timber.log.Timber
2223

2324
class SignInActivity : AppCompatActivity() {
2425

@@ -111,11 +112,14 @@ class SignInActivity : AppCompatActivity() {
111112

112113
subscription = service.signInWithGoogle(account)
113114
.subscribeOn(AndroidSchedulers.mainThread())
114-
.subscribe {
115-
analytics.trackUserLoggedInFrom(getSignInOrigin())
116-
setResult(RESULT_OK)
117-
finish()
118-
}
115+
.subscribe(
116+
{
117+
analytics.trackUserLoggedInFrom(getSignInOrigin())
118+
setResult(RESULT_OK)
119+
finish()
120+
},
121+
Timber::e
122+
)
119123
}
120124

121125
private fun getSignInOrigin() = intent.getSerializableExtra(EXTRA_SIGN_IN_ORIGIN) as SignInOrigin

app/src/main/java/net/squanchy/venue/VenueInfoPageView.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import net.squanchy.navigation.Navigator
1616
import net.squanchy.support.text.parseHtml
1717
import net.squanchy.support.unwrapToActivityContext
1818
import net.squanchy.venue.domain.view.Venue
19+
import timber.log.Timber
1920

2021
class VenueInfoPageView @JvmOverloads constructor(
2122
context: Context,
@@ -66,7 +67,7 @@ class VenueInfoPageView @JvmOverloads constructor(
6667
override fun startLoading() {
6768
subscription = service.venue()
6869
.observeOn(AndroidSchedulers.mainThread())
69-
.subscribe(::updateWith)
70+
.subscribe(::updateWith, Timber::e)
7071
}
7172

7273
private fun updateWith(venue: Venue) {

0 commit comments

Comments
 (0)