Skip to content

Commit

Permalink
Increased jvm memory and fixed trending indexing bug (#93)
Browse files Browse the repository at this point in the history
  • Loading branch information
devotaaabel committed Mar 8, 2024
1 parent b9e3552 commit 57308fb
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,7 @@ class TrendsRepository internal constructor(
dao.deleteAll()
}

suspend fun insertAll(data: List<HashTag>) {
dao.upsertAll(data.mapIndexed { index, hashtag ->
TrendingHashTag(
hashTagName = hashtag.name,
position = index
)
})
suspend fun insertAll(data: List<TrendingHashTag>) {
dao.upsertAll(data)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import androidx.paging.LoadType
import androidx.paging.PagingState
import androidx.paging.RemoteMediator
import kotlinx.coroutines.delay
import social.firefly.core.database.model.entities.hashtagCollections.TrendingHashTag
import social.firefly.core.database.model.entities.hashtagCollections.TrendingHashTagWrapper
import social.firefly.core.repository.mastodon.DatabaseDelegate
import social.firefly.core.repository.mastodon.HashtagRepository
Expand Down Expand Up @@ -53,7 +54,14 @@ class TrendingHashtagsRemoteMediator(
nextPositionIndex = 0
}
hashtagRepository.insertAll(hashtags)
repository.insertAll(hashtags)
repository.insertAll(
hashtags.mapIndexed { index, hashTag ->
TrendingHashTag(
hashTag.name,
position = nextPositionIndex + index,
)
}
)
}

nextPositionIndex += hashtags.size
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,6 @@ import social.firefly.common.utils.StringFactory
import social.firefly.core.ui.common.hashtag.quickview.HashTagQuickViewUiState
import social.firefly.core.ui.postcard.PostCardUiState

enum class DiscoverTab2(val tabTitle: StringFactory) {
HASHTAGS(StringFactory.resource(R.string.hashtags_tab)),
POSTS(StringFactory.resource(R.string.posts_tab)),
LINKS(StringFactory.resource(R.string.links_tab)),
SUGGESTIONS(StringFactory.resource(R.string.hashtags_tab)),
}

sealed class DiscoverTab(val tabTitle: StringFactory, val index: Int) {
data class Hashtags(val hashtags: Flow<PagingData<HashTagQuickViewUiState>>) :
DiscoverTab(StringFactory.resource(R.string.hashtags_tab), 0)
Expand Down
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# http://www.gradle.org/docs/current/userguide/build_environment.html
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
org.gradle.jvmargs=-Xmx4096m -Dfile.encoding=UTF-8
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
Expand All @@ -20,4 +20,4 @@ kotlin.code.style=official
# Enables namespacing of each library's R class so that its R class includes only the
# resources declared in the library itself and none from the library's dependencies,
# thereby reducing the size of the R class for that library
android.nonTransitiveRClass=true
android.nonTransitiveRClass=true

0 comments on commit 57308fb

Please sign in to comment.