forked from nickbutcher/plaid
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implementing a SearchFactoryProvider for Dribbble as well. Now search…
… uses both dibbble and designer news
- Loading branch information
1 parent
9d01634
commit 8951a60
Showing
6 changed files
with
129 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
dribbble/src/main/java/io/plaidapp/dribbble/dagger/DribbbleSearchComponent.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/* | ||
* Copyright 2019 Google, Inc. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package io.plaidapp.dribbble.dagger | ||
|
||
import dagger.Component | ||
import io.plaidapp.core.dagger.dribbble.DribbbleDataModule | ||
import io.plaidapp.core.dagger.scope.FeatureScope | ||
import io.plaidapp.core.interfaces.SearchDataSourceFactory | ||
|
||
@Component( | ||
modules = [ | ||
DribbbleDataModule::class, | ||
SearchDataModule::class | ||
], | ||
dependencies = [io.plaidapp.core.dagger.CoreComponent::class] | ||
) | ||
@FeatureScope | ||
interface DribbbleSearchComponent { | ||
|
||
@FeatureScope | ||
fun factory(): SearchDataSourceFactory | ||
} |
36 changes: 36 additions & 0 deletions
36
dribbble/src/main/java/io/plaidapp/dribbble/dagger/SearchDataModule.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/* | ||
* Copyright 2019 Google, Inc. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package io.plaidapp.dribbble.dagger | ||
|
||
import dagger.Module | ||
import dagger.Provides | ||
import io.plaidapp.core.dagger.scope.FeatureScope | ||
import io.plaidapp.core.dribbble.data.ShotsRepository | ||
import io.plaidapp.core.interfaces.SearchDataSourceFactory | ||
import io.plaidapp.dribbble.domain.search.DribbbleSearchDataSourceFactory | ||
|
||
@Module | ||
class SearchDataModule { | ||
|
||
@Provides | ||
@FeatureScope | ||
fun searchDataSourceFactory( | ||
repository: ShotsRepository | ||
): SearchDataSourceFactory { | ||
return DribbbleSearchDataSourceFactory(repository) | ||
} | ||
} |
32 changes: 32 additions & 0 deletions
32
dribbble/src/main/java/io/plaidapp/dribbble/domain/search/DribbbleSearchFactoryProvider.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/* | ||
* Copyright 2019 Google, Inc. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package io.plaidapp.dribbble.domain.search | ||
|
||
import android.content.Context | ||
import io.plaidapp.core.interfaces.SearchDataSourceFactory | ||
import io.plaidapp.core.interfaces.SearchFactoryProvider | ||
import io.plaidapp.dribbble.dagger.DaggerDribbbleSearchComponent | ||
import io.plaidapp.ui.PlaidApplication.Companion.coreComponent | ||
|
||
object DribbbleSearchFactoryProvider : SearchFactoryProvider { | ||
|
||
override fun getFactory(context: Context): SearchDataSourceFactory { | ||
return DaggerDribbbleSearchComponent.builder() | ||
.coreComponent(coreComponent(context)) | ||
.build().factory() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters