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

Commit 4fba4ae

Browse files
authored
Merge pull request #516 from squanchy-dev/feature_search
Feature search
2 parents b9c4372 + 998c51c commit 4fba4ae

87 files changed

Lines changed: 1789 additions & 1481 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.circleci/config.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ jobs:
1111
ANDROID_HOME: /opt/android/sdk
1212
APPLICATION_ID: net.squanchy.example
1313
FABRIC_API_KEY: 0000000000000000000000000000000000000000
14-
TWITTER_API_KEY: DUMMY_TWITTER_API_KEY
15-
TWITTER_SECRET: DUMMY_TWITTER_SECRET
14+
ALGOLIA_APPLICATION_ID: ABCDEFGH12
15+
ALGOLIA_API_KEY: 00000000000000000000000000000000
1616

1717
steps:
1818
- checkout

app/build.gradle

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@ android {
4646

4747
resValueString 'app_name', applicationProps['applicationName'].or("Squanchy")
4848

49-
resValueString 'api_value_twitter_api_key', secretsProps['twitterApiKey'].or(envVars['TWITTER_API_KEY'])
50-
resValueString 'api_value_twitter_secret', secretsProps['twitterSecret'].or(envVars['TWITTER_SECRET'])
49+
resValueString 'algolia_application_id', applicationProps['algoliaId'].or(envVars['ALGOLIA_APPLICATION_ID'])
50+
resValueString 'algolia_api_key', secretsProps['algoliaApiKey'].or(envVars['ALGOLIA_API_KEY'])
5151

5252
resValueString 'social_query', applicationProps['socialQuery'].or("#AndroidDev")
5353
resValueString 'deeplink_scheme', applicationProps['deeplinkScheme'].or("squanchy")
@@ -167,10 +167,15 @@ dependencies {
167167
implementation libraries.app.timber
168168
implementation libraries.app.viewPagerAdapter
169169

170+
implementation libraries.app.moshi
171+
implementation libraries.app.moshiKotlin
172+
170173
annotationProcessor libraries.app.daggerCompiler
171174
kapt libraries.app.daggerCompiler
172175
implementation libraries.app.dagger
173176

177+
implementation libraries.app.algolia
178+
174179
testImplementation libraries.test.truth
175180
testImplementation libraries.test.jodaTime
176181
testImplementation libraries.test.jUnit4
Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,15 @@
11
package net.squanchy.eventdetails
22

3-
import net.squanchy.service.firebase.FirebaseAuthService
4-
53
import dagger.Module
64
import dagger.Provides
5+
import net.squanchy.service.repository.AuthService
76
import net.squanchy.service.repository.EventRepository
87

98
@Module
109
internal class EventDetailsModule {
1110

1211
@Provides
13-
fun eventDetailsService(eventRepository: EventRepository, authService: FirebaseAuthService): EventDetailsService {
12+
fun eventDetailsService(eventRepository: EventRepository, authService: AuthService): EventDetailsService {
1413
return EventDetailsService(eventRepository, authService)
1514
}
1615
}

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
package net.squanchy.eventdetails
22

3-
import com.google.firebase.auth.FirebaseUser
43
import io.reactivex.Completable
54
import io.reactivex.Observable
65
import io.reactivex.Single
76
import net.squanchy.schedule.domain.view.Event
8-
import net.squanchy.service.firebase.FirebaseAuthService
7+
import net.squanchy.service.repository.AuthService
98
import net.squanchy.service.repository.EventRepository
9+
import net.squanchy.service.repository.User
1010
import net.squanchy.support.lang.Optional
1111

1212
internal class EventDetailsService(
1313
private val eventRepository: EventRepository,
14-
private val authService: FirebaseAuthService
14+
private val authService: AuthService
1515
) {
1616

1717
fun event(eventId: String): Observable<Event> {
@@ -49,7 +49,7 @@ internal class EventDetailsService(
4949
return authService.ifUserSignedInThenCompletableFrom { userId -> eventRepository.addFavorite(eventId, userId) }
5050
}
5151

52-
private fun currentUser(): Single<Optional<FirebaseUser>> = authService.currentUser().firstOrError()
52+
private fun currentUser(): Single<Optional<User>> = authService.currentUser().firstOrError()
5353

5454
internal enum class FavoriteResult {
5555
SUCCESS,

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@ import dagger.Module
44
import dagger.Provides
55
import net.squanchy.schedule.ScheduleModule
66
import net.squanchy.schedule.ScheduleService
7-
import net.squanchy.service.firebase.FirebaseAuthService
7+
import net.squanchy.service.repository.AuthService
88

99
@Module(includes = [ScheduleModule::class])
1010
class FavoritesModule {
1111

1212
@Provides
1313
internal fun favoritesService(
14-
authService: FirebaseAuthService,
14+
authService: AuthService,
1515
scheduleService: ScheduleService
1616
): FavoritesService = FirestoreFavoritesService(authService, scheduleService)
1717
}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import io.reactivex.Observable
44
import net.squanchy.favorites.view.FavoritesItem
55
import net.squanchy.schedule.ScheduleService
66
import net.squanchy.schedule.domain.view.Event
7-
import net.squanchy.service.firebase.FirebaseAuthService
7+
import net.squanchy.service.repository.AuthService
88

99
interface FavoritesService {
1010

@@ -14,7 +14,7 @@ interface FavoritesService {
1414
}
1515

1616
internal class FirestoreFavoritesService(
17-
private val authService: FirebaseAuthService,
17+
private val authService: AuthService,
1818
private val scheduleService: ScheduleService
1919
) : FavoritesService {
2020

app/src/main/java/net/squanchy/injection/ApplicationComponent.kt

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,11 @@ import net.squanchy.remoteconfig.RemoteConfig
88
import net.squanchy.remoteconfig.RemoteConfigModule
99
import net.squanchy.schedule.tracksfilter.TracksFilter
1010
import net.squanchy.schedule.tracksfilter.TracksFilterModule
11-
import net.squanchy.service.firebase.FirebaseAuthService
11+
import net.squanchy.search.algolia.AlgoliaModule
12+
import net.squanchy.search.algolia.AlgoliaSearchEngine
1213
import net.squanchy.service.firebase.FirestoreDbService
1314
import net.squanchy.service.firebase.injection.FirestoreModule
15+
import net.squanchy.service.repository.AuthService
1416
import net.squanchy.service.repository.EventRepository
1517
import net.squanchy.service.repository.SpeakerRepository
1618
import net.squanchy.service.repository.TracksRepository
@@ -24,6 +26,7 @@ fun createApplicationComponent(application: Application): ApplicationComponent {
2426
.repositoryModule(RepositoryModule())
2527
.checksumModule(ChecksumModule())
2628
.applicationContextModule(ApplicationContextModule(application))
29+
.algoliaModule(AlgoliaModule())
2730
.analyticsModule(AnalyticsModule(application))
2831
.remoteConfigModule(RemoteConfigModule())
2932
.tracksFilterModule(TracksFilterModule())
@@ -33,6 +36,7 @@ fun createApplicationComponent(application: Application): ApplicationComponent {
3336
@ApplicationLifecycle
3437
@Component(
3538
modules = [
39+
AlgoliaModule::class,
3640
ApplicationContextModule::class,
3741
FirestoreModule::class,
3842
ChecksumModule::class,
@@ -47,7 +51,7 @@ interface ApplicationComponent {
4751

4852
fun firestoreDbService(): FirestoreDbService
4953

50-
fun firebaseAuthService(): FirebaseAuthService
54+
fun firebaseAuthService(): AuthService
5155

5256
fun eventRepository(): EventRepository
5357

@@ -62,4 +66,6 @@ interface ApplicationComponent {
6266
fun remoteConfig(): RemoteConfig
6367

6468
fun application(): Application
69+
70+
fun algoliaSearchEngine(): AlgoliaSearchEngine
6571
}

app/src/main/java/net/squanchy/notification/NotificationModule.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@ import android.support.v4.app.NotificationManagerCompat
55
import dagger.Module
66
import dagger.Provides
77
import net.squanchy.injection.ServiceContextModule
8-
import net.squanchy.service.firebase.FirebaseAuthService
8+
import net.squanchy.service.repository.AuthService
99
import net.squanchy.service.repository.EventRepository
1010

1111
@Module(includes = [ServiceContextModule::class])
1212
internal class NotificationModule {
1313

1414
@Provides
15-
fun favoritesService(authService: FirebaseAuthService, eventRepository: EventRepository): NotificationService {
15+
fun favoritesService(authService: AuthService, eventRepository: EventRepository): NotificationService {
1616
return NotificationService(authService, eventRepository)
1717
}
1818

app/src/main/java/net/squanchy/notification/NotificationService.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@ package net.squanchy.notification
33
import io.reactivex.Observable
44
import io.reactivex.schedulers.Schedulers
55
import net.squanchy.schedule.domain.view.Event
6-
import net.squanchy.service.firebase.FirebaseAuthService
6+
import net.squanchy.service.repository.AuthService
77
import net.squanchy.service.repository.EventRepository
88

9-
internal class NotificationService(private val authService: FirebaseAuthService, private val eventRepository: EventRepository) {
9+
internal class NotificationService(private val authService: AuthService, private val eventRepository: EventRepository) {
1010

1111
fun sortedFavourites(): Observable<List<Event>> {
1212
return authService.ifUserSignedInThenObservableFrom { userId ->

app/src/main/java/net/squanchy/schedule/ScheduleModule.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ package net.squanchy.schedule
33
import dagger.Module
44
import dagger.Provides
55
import net.squanchy.schedule.tracksfilter.TracksFilter
6-
import net.squanchy.service.firebase.FirebaseAuthService
76
import net.squanchy.service.firebase.FirestoreDbService
7+
import net.squanchy.service.repository.AuthService
88
import net.squanchy.support.checksum.ChecksumModule
99
import net.squanchy.support.checksum.Checksum
1010

@@ -13,7 +13,7 @@ class ScheduleModule {
1313

1414
@Provides
1515
internal fun scheduleService(
16-
authService: FirebaseAuthService,
16+
authService: AuthService,
1717
dbService: FirestoreDbService,
1818
tracksFilter: TracksFilter,
1919
checksum: Checksum

0 commit comments

Comments
 (0)