Skip to content

Commit

Permalink
Remove author concept from app
Browse files Browse the repository at this point in the history
Change-Id: Icd03c0288ba5f3f23dbcbdbefbbe802db2815793
  • Loading branch information
JolandaVerhoef committed Dec 5, 2022
1 parent 56b3c1d commit 4ba63c0
Show file tree
Hide file tree
Showing 90 changed files with 269 additions and 4,975 deletions.
3 changes: 0 additions & 3 deletions .idea/codeStyles/Project.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ The app is currently in development. The `demoRelease` variant is [available on
**Now in Android** displays content from the
[Now in Android](https://developer.android.com/series/now-in-android) series. Users can browse for
links to recent videos, articles and other content. Users can also follow topics they are interested
in or follow specific authors.
in.

## Screenshots

Expand Down
1 change: 0 additions & 1 deletion app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@ android {
}

dependencies {
implementation(project(":feature:author"))
implementation(project(":feature:interests"))
implementation(project(":feature:foryou"))
implementation(project(":feature:bookmarks"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.navigation.NavHostController
import androidx.navigation.compose.NavHost
import com.google.samples.apps.nowinandroid.feature.author.navigation.authorScreen
import com.google.samples.apps.nowinandroid.feature.author.navigation.navigateToAuthor
import com.google.samples.apps.nowinandroid.feature.bookmarks.navigation.bookmarksScreen
import com.google.samples.apps.nowinandroid.feature.foryou.navigation.forYouNavigationRoute
import com.google.samples.apps.nowinandroid.feature.foryou.navigation.forYouScreen
Expand Down Expand Up @@ -54,12 +52,8 @@ fun NiaNavHost(
navigateToTopic = { topicId ->
navController.navigateToTopic(topicId)
},
navigateToAuthor = { authorId ->
navController.navigateToAuthor(authorId)
},
nestedGraphs = {
topicScreen(onBackClick)
authorScreen(onBackClick)
}
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import androidx.benchmark.macro.junit4.BaselineProfileRule
import androidx.test.uiautomator.By
import com.google.samples.apps.nowinandroid.PACKAGE_NAME
import com.google.samples.apps.nowinandroid.foryou.forYouScrollFeedDownUp
import com.google.samples.apps.nowinandroid.foryou.forYouSelectAuthors
import com.google.samples.apps.nowinandroid.foryou.forYouWaitForContent
import com.google.samples.apps.nowinandroid.interests.interestsScrollPeopleDownUp
import com.google.samples.apps.nowinandroid.interests.interestsScrollTopicsDownUp
Expand All @@ -47,7 +46,6 @@ class BaselineProfileGenerator {

// Scroll the feed critical user journey
forYouWaitForContent()
forYouSelectAuthors(true)
forYouScrollFeedDownUp()

// Navigate to saved screen
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,43 +31,6 @@ fun MacrobenchmarkScope.forYouWaitForContent() {
obj.wait(untilHasChildren(), 30_000)
}

/**
* Selects some authors, which will show the feed content for them.
* [recheckAuthorsIfChecked] Authors may be already checked from the previous iteration.
*/
fun MacrobenchmarkScope.forYouSelectAuthors(recheckAuthorsIfChecked: Boolean = false) {
val authors = device.findObject(By.res("forYou:authors"))

// Set gesture margin from sides not to trigger system gesture navigation
val horizontalMargin = 10 * authors.visibleBounds.width() / 100
authors.setGestureMargins(horizontalMargin, 0, horizontalMargin, 0)

// Select some authors to show some feed content
repeat(3) { index ->
val author = authors.children[index % authors.childCount]

when {
// Author wasn't checked, so just do that
!author.isChecked -> {
author.click()
device.waitForIdle()
}

// The author was checked already and we want to recheck it, so just do it twice
recheckAuthorsIfChecked -> {
repeat(2) {
author.click()
device.waitForIdle()
}
}

else -> {
// The author is checked, but we don't recheck it
}
}
}
}

fun MacrobenchmarkScope.forYouScrollFeedDownUp() {
val feedList = device.findObject(By.res("forYou:feed"))
device.flingElementDownUp(feedList)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ class ScrollForYouFeedBenchmark {
}
) {
forYouWaitForContent()
forYouSelectAuthors()
forYouScrollFeedDownUp()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,9 @@
package com.google.samples.apps.nowinandroid.core.data.test

import com.google.samples.apps.nowinandroid.core.data.di.DataModule
import com.google.samples.apps.nowinandroid.core.data.repository.AuthorsRepository
import com.google.samples.apps.nowinandroid.core.data.repository.NewsRepository
import com.google.samples.apps.nowinandroid.core.data.repository.TopicsRepository
import com.google.samples.apps.nowinandroid.core.data.repository.UserDataRepository
import com.google.samples.apps.nowinandroid.core.data.repository.fake.FakeAuthorsRepository
import com.google.samples.apps.nowinandroid.core.data.repository.fake.FakeNewsRepository
import com.google.samples.apps.nowinandroid.core.data.repository.fake.FakeTopicsRepository
import com.google.samples.apps.nowinandroid.core.data.repository.fake.FakeUserDataRepository
Expand All @@ -42,11 +40,6 @@ interface TestDataModule {
fakeTopicsRepository: FakeTopicsRepository
): TopicsRepository

@Binds
fun bindsAuthorRepository(
fakeAuthorsRepository: FakeAuthorsRepository
): AuthorsRepository

@Binds
fun bindsNewsResourceRepository(
fakeNewsRepository: FakeNewsRepository
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@

package com.google.samples.apps.nowinandroid.core.data.di

import com.google.samples.apps.nowinandroid.core.data.repository.AuthorsRepository
import com.google.samples.apps.nowinandroid.core.data.repository.NewsRepository
import com.google.samples.apps.nowinandroid.core.data.repository.OfflineFirstAuthorsRepository
import com.google.samples.apps.nowinandroid.core.data.repository.OfflineFirstNewsRepository
import com.google.samples.apps.nowinandroid.core.data.repository.OfflineFirstTopicsRepository
import com.google.samples.apps.nowinandroid.core.data.repository.OfflineFirstUserDataRepository
Expand All @@ -40,11 +38,6 @@ interface DataModule {
topicsRepository: OfflineFirstTopicsRepository
): TopicsRepository

@Binds
fun bindsAuthorsRepository(
authorsRepository: OfflineFirstAuthorsRepository
): AuthorsRepository

@Binds
fun bindsNewsResourceRepository(
newsRepository: OfflineFirstNewsRepository
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@

package com.google.samples.apps.nowinandroid.core.data.model

import com.google.samples.apps.nowinandroid.core.database.model.AuthorEntity
import com.google.samples.apps.nowinandroid.core.database.model.NewsResourceAuthorCrossRef
import com.google.samples.apps.nowinandroid.core.database.model.NewsResourceEntity
import com.google.samples.apps.nowinandroid.core.database.model.NewsResourceTopicCrossRef
import com.google.samples.apps.nowinandroid.core.database.model.TopicEntity
Expand All @@ -44,22 +42,6 @@ fun NetworkNewsResourceExpanded.asEntity() = NewsResourceEntity(
type = type,
)

/**
* A shell [AuthorEntity] to fulfill the foreign key constraint when inserting
* a [NewsResourceEntity] into the DB
*/
fun NetworkNewsResource.authorEntityShells() =
authors.map { authorId ->
AuthorEntity(
id = authorId,
name = "",
imageUrl = "",
twitter = "",
mediumPage = "",
bio = "",
)
}

/**
* A shell [TopicEntity] to fulfill the foreign key constraint when inserting
* a [NewsResourceEntity] into the DB
Expand All @@ -83,11 +65,3 @@ fun NetworkNewsResource.topicCrossReferences(): List<NewsResourceTopicCrossRef>
topicId = topicId
)
}

fun NetworkNewsResource.authorCrossReferences(): List<NewsResourceAuthorCrossRef> =
authors.map { authorId ->
NewsResourceAuthorCrossRef(
newsResourceId = id,
authorId = authorId
)
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,9 @@ interface NewsRepository : Syncable {
fun getNewsResources(): Flow<List<NewsResource>>

/**
* Returns available news resources as a stream filtered by authors or topics.
* Returns available news resources as a stream filtered by topics.
*/
fun getNewsResources(
filterAuthorIds: Set<String> = emptySet(),
filterTopicIds: Set<String> = emptySet(),
): Flow<List<NewsResource>>
}

This file was deleted.

Loading

0 comments on commit 4ba63c0

Please sign in to comment.