remove redundant modifiers
This commit is contained in:
@@ -80,7 +80,7 @@ class ImageUploadTesting {
|
|||||||
.addInterceptor(DefaultContentTypeInterceptor("Amethyst/${BuildConfig.VERSION_NAME}"))
|
.addInterceptor(DefaultContentTypeInterceptor("Amethyst/${BuildConfig.VERSION_NAME}"))
|
||||||
.build()
|
.build()
|
||||||
|
|
||||||
private suspend fun getBitmap(): ByteArray {
|
private fun getBitmap(): ByteArray {
|
||||||
val bitmap = Bitmap.createBitmap(200, 300, Bitmap.Config.ARGB_8888)
|
val bitmap = Bitmap.createBitmap(200, 300, Bitmap.Config.ARGB_8888)
|
||||||
for (x in 0 until bitmap.width) {
|
for (x in 0 until bitmap.width) {
|
||||||
for (y in 0 until bitmap.height) {
|
for (y in 0 until bitmap.height) {
|
||||||
|
|||||||
+4
-4
@@ -34,9 +34,9 @@ class TorAwareOkHttpOtsResolverBuilder(
|
|||||||
) : OtsResolverBuilder {
|
) : OtsResolverBuilder {
|
||||||
fun getAPI(usingTor: Boolean) =
|
fun getAPI(usingTor: Boolean) =
|
||||||
if (usingTor) {
|
if (usingTor) {
|
||||||
OkHttpBitcoinExplorer.Companion.MEMPOOL_API_URL
|
OkHttpBitcoinExplorer.MEMPOOL_API_URL
|
||||||
} else {
|
} else {
|
||||||
OkHttpBitcoinExplorer.Companion.BLOCKSTREAM_API_URL
|
OkHttpBitcoinExplorer.BLOCKSTREAM_API_URL
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun build(): OtsResolver =
|
override fun build(): OtsResolver =
|
||||||
@@ -44,9 +44,9 @@ class TorAwareOkHttpOtsResolverBuilder(
|
|||||||
explorer =
|
explorer =
|
||||||
OkHttpBitcoinExplorer(
|
OkHttpBitcoinExplorer(
|
||||||
baseUrl = {
|
baseUrl = {
|
||||||
getAPI(usingTor = isTorActive(OkHttpBitcoinExplorer.Companion.MEMPOOL_API_URL))
|
getAPI(usingTor = isTorActive(OkHttpBitcoinExplorer.MEMPOOL_API_URL))
|
||||||
},
|
},
|
||||||
client = okHttpClient(OkHttpBitcoinExplorer.Companion.MEMPOOL_API_URL),
|
client = okHttpClient(OkHttpBitcoinExplorer.MEMPOOL_API_URL),
|
||||||
cache = cache,
|
cache = cache,
|
||||||
),
|
),
|
||||||
calendar = OkHttpCalendar(okHttpClient),
|
calendar = OkHttpCalendar(okHttpClient),
|
||||||
|
|||||||
+1
-1
@@ -62,7 +62,7 @@ class BookmarkListState(
|
|||||||
|
|
||||||
fun getBookmarkList(): BookmarkListEvent? = bookmarkList.event as? BookmarkListEvent
|
fun getBookmarkList(): BookmarkListEvent? = bookmarkList.event as? BookmarkListEvent
|
||||||
|
|
||||||
suspend fun publicBookmarks(note: Note): List<BookmarkIdTag> {
|
fun publicBookmarks(note: Note): List<BookmarkIdTag> {
|
||||||
val noteEvent = note.event as? BookmarkListEvent
|
val noteEvent = note.event as? BookmarkListEvent
|
||||||
return noteEvent?.publicBookmarks() ?: emptyList()
|
return noteEvent?.publicBookmarks() ?: emptyList()
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -47,7 +47,7 @@ class HiddenUsersState(
|
|||||||
) {
|
) {
|
||||||
var transientHiddenUsers: MutableStateFlow<Set<String>> = MutableStateFlow(setOf())
|
var transientHiddenUsers: MutableStateFlow<Set<String>> = MutableStateFlow(setOf())
|
||||||
|
|
||||||
suspend fun assembleLiveHiddenUsers(
|
fun assembleLiveHiddenUsers(
|
||||||
blockList: List<MuteTag>,
|
blockList: List<MuteTag>,
|
||||||
muteList: List<MuteTag>,
|
muteList: List<MuteTag>,
|
||||||
transientHiddenUsers: Set<String>,
|
transientHiddenUsers: Set<String>,
|
||||||
|
|||||||
+2
-2
@@ -51,7 +51,7 @@ class SearchRelayListState(
|
|||||||
// Creates a long-term reference for this note so that the GC doesn't collect the note it self
|
// Creates a long-term reference for this note so that the GC doesn't collect the note it self
|
||||||
val searchListNote = cache.getOrCreateAddressableNote(getSearchRelayListAddress())
|
val searchListNote = cache.getOrCreateAddressableNote(getSearchRelayListAddress())
|
||||||
|
|
||||||
fun getSearchRelayListAddress() = SearchRelayListEvent.Companion.createAddress(signer.pubKey)
|
fun getSearchRelayListAddress() = SearchRelayListEvent.createAddress(signer.pubKey)
|
||||||
|
|
||||||
fun getSearchRelayListFlow(): StateFlow<NoteState> = searchListNote.flow().metadata.stateFlow
|
fun getSearchRelayListFlow(): StateFlow<NoteState> = searchListNote.flow().metadata.stateFlow
|
||||||
|
|
||||||
@@ -70,7 +70,7 @@ class SearchRelayListState(
|
|||||||
.flowOn(Dispatchers.IO)
|
.flowOn(Dispatchers.IO)
|
||||||
.stateIn(
|
.stateIn(
|
||||||
scope,
|
scope,
|
||||||
SharingStarted.Companion.Eagerly,
|
SharingStarted.Eagerly,
|
||||||
emptySet(),
|
emptySet(),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
+3
-3
@@ -68,7 +68,7 @@ class TrustedRelayListState(
|
|||||||
.flowOn(Dispatchers.IO)
|
.flowOn(Dispatchers.IO)
|
||||||
.stateIn(
|
.stateIn(
|
||||||
scope,
|
scope,
|
||||||
SharingStarted.Companion.Eagerly,
|
SharingStarted.Eagerly,
|
||||||
emptySet(),
|
emptySet(),
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -76,13 +76,13 @@ class TrustedRelayListState(
|
|||||||
val relayListForTrusted = getTrustedRelayList()
|
val relayListForTrusted = getTrustedRelayList()
|
||||||
|
|
||||||
return if (relayListForTrusted != null && relayListForTrusted.tags.isNotEmpty()) {
|
return if (relayListForTrusted != null && relayListForTrusted.tags.isNotEmpty()) {
|
||||||
TrustedRelayListEvent.Companion.updateRelayList(
|
TrustedRelayListEvent.updateRelayList(
|
||||||
earlierVersion = relayListForTrusted,
|
earlierVersion = relayListForTrusted,
|
||||||
relays = trustedRelays,
|
relays = trustedRelays,
|
||||||
signer = signer,
|
signer = signer,
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
TrustedRelayListEvent.Companion.create(
|
TrustedRelayListEvent.create(
|
||||||
relays = trustedRelays,
|
relays = trustedRelays,
|
||||||
signer = signer,
|
signer = signer,
|
||||||
)
|
)
|
||||||
|
|||||||
+1
-1
@@ -120,5 +120,5 @@ class BlossomServerListState(
|
|||||||
suspend fun createBlossomDeleteAuth(
|
suspend fun createBlossomDeleteAuth(
|
||||||
hash: HexKey,
|
hash: HexKey,
|
||||||
alt: String,
|
alt: String,
|
||||||
): BlossomAuthorizationEvent? = BlossomAuthorizationEvent.createDeleteAuth(hash, alt, signer)
|
): BlossomAuthorizationEvent = BlossomAuthorizationEvent.createDeleteAuth(hash, alt, signer)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ import kotlinx.coroutines.flow.catch
|
|||||||
import kotlinx.coroutines.flow.map
|
import kotlinx.coroutines.flow.map
|
||||||
import java.io.IOException
|
import java.io.IOException
|
||||||
|
|
||||||
suspend fun <T> DataStore<Preferences>.getProperty(
|
fun <T> DataStore<Preferences>.getProperty(
|
||||||
key: Preferences.Key<String>,
|
key: Preferences.Key<String>,
|
||||||
parser: (String) -> T,
|
parser: (String) -> T,
|
||||||
serializer: (T) -> String,
|
serializer: (T) -> String,
|
||||||
|
|||||||
+1
-1
@@ -67,7 +67,7 @@ class EncryptedDataStore(
|
|||||||
?.get(key)
|
?.get(key)
|
||||||
?.let { decrypt(it) }
|
?.let { decrypt(it) }
|
||||||
|
|
||||||
suspend fun <T> getProperty(
|
fun <T> getProperty(
|
||||||
key: Preferences.Key<String>,
|
key: Preferences.Key<String>,
|
||||||
parser: (String) -> T,
|
parser: (String) -> T,
|
||||||
serializer: (T) -> String,
|
serializer: (T) -> String,
|
||||||
|
|||||||
+1
-1
@@ -48,7 +48,7 @@ class OutboxLoaderState(
|
|||||||
}.flowOn(Dispatchers.IO)
|
}.flowOn(Dispatchers.IO)
|
||||||
.stateIn(
|
.stateIn(
|
||||||
scope,
|
scope,
|
||||||
SharingStarted.Companion.Eagerly,
|
SharingStarted.Eagerly,
|
||||||
UnknownTopNavPerRelayFilterSet,
|
UnknownTopNavPerRelayFilterSet,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -52,8 +52,8 @@ class AllFollowsByOutboxTopNavFilter(
|
|||||||
val defaultRelays: StateFlow<Set<NormalizedRelayUrl>>,
|
val defaultRelays: StateFlow<Set<NormalizedRelayUrl>>,
|
||||||
val blockedRelays: StateFlow<Set<NormalizedRelayUrl>>,
|
val blockedRelays: StateFlow<Set<NormalizedRelayUrl>>,
|
||||||
) : IFeedTopNavFilter {
|
) : IFeedTopNavFilter {
|
||||||
val geotagScopes: Set<String>? = geotags?.mapTo(mutableSetOf<String>()) { GeohashId.Companion.toScope(it) }
|
val geotagScopes: Set<String>? = geotags?.mapTo(mutableSetOf<String>()) { GeohashId.toScope(it) }
|
||||||
val hashtagScopes: Set<String>? = hashtags?.mapTo(mutableSetOf<String>()) { HashtagId.Companion.toScope(it) }
|
val hashtagScopes: Set<String>? = hashtags?.mapTo(mutableSetOf<String>()) { HashtagId.toScope(it) }
|
||||||
|
|
||||||
override fun matchAuthor(pubkey: HexKey): Boolean = authors == null || pubkey in authors
|
override fun matchAuthor(pubkey: HexKey): Boolean = authors == null || pubkey in authors
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -47,8 +47,8 @@ class AllFollowsByProxyTopNavFilter(
|
|||||||
val communities: Set<String>? = null,
|
val communities: Set<String>? = null,
|
||||||
val proxyRelays: Set<NormalizedRelayUrl>,
|
val proxyRelays: Set<NormalizedRelayUrl>,
|
||||||
) : IFeedTopNavFilter {
|
) : IFeedTopNavFilter {
|
||||||
val geotagScopes: Set<String>? = geotags?.mapTo(mutableSetOf<String>()) { GeohashId.Companion.toScope(it) }
|
val geotagScopes: Set<String>? = geotags?.mapTo(mutableSetOf()) { GeohashId.toScope(it) }
|
||||||
val hashtagScopes: Set<String>? = hashtags?.mapTo(mutableSetOf<String>()) { HashtagId.Companion.toScope(it) }
|
val hashtagScopes: Set<String>? = hashtags?.mapTo(mutableSetOf()) { HashtagId.toScope(it) }
|
||||||
|
|
||||||
override fun matchAuthor(pubkey: HexKey): Boolean = authors == null || pubkey in authors
|
override fun matchAuthor(pubkey: HexKey): Boolean = authors == null || pubkey in authors
|
||||||
|
|
||||||
|
|||||||
+5
-5
@@ -62,7 +62,7 @@ class NoteFeedFlow(
|
|||||||
): IFeedTopNavFilter =
|
): IFeedTopNavFilter =
|
||||||
when (noteEvent) {
|
when (noteEvent) {
|
||||||
is PeopleListEvent -> {
|
is PeopleListEvent -> {
|
||||||
if (noteEvent.dTag() == PeopleListEvent.Companion.BLOCK_LIST_D_TAG) {
|
if (noteEvent.dTag() == PeopleListEvent.BLOCK_LIST_D_TAG) {
|
||||||
MutedAuthorsByOutboxTopNavFilter(caches.peopleListCache.cachedUserIdSet(noteEvent), blockedRelays)
|
MutedAuthorsByOutboxTopNavFilter(caches.peopleListCache.cachedUserIdSet(noteEvent), blockedRelays)
|
||||||
} else {
|
} else {
|
||||||
AuthorsByOutboxTopNavFilter(caches.peopleListCache.cachedUserIdSet(noteEvent), blockedRelays)
|
AuthorsByOutboxTopNavFilter(caches.peopleListCache.cachedUserIdSet(noteEvent), blockedRelays)
|
||||||
@@ -109,7 +109,7 @@ class NoteFeedFlow(
|
|||||||
) {
|
) {
|
||||||
when (noteEvent) {
|
when (noteEvent) {
|
||||||
is PeopleListEvent -> {
|
is PeopleListEvent -> {
|
||||||
if (noteEvent.dTag() == PeopleListEvent.Companion.BLOCK_LIST_D_TAG) {
|
if (noteEvent.dTag() == PeopleListEvent.BLOCK_LIST_D_TAG) {
|
||||||
emit(MutedAuthorsByOutboxTopNavFilter(caches.peopleListCache.userIdSet(noteEvent), blockedRelays))
|
emit(MutedAuthorsByOutboxTopNavFilter(caches.peopleListCache.userIdSet(noteEvent), blockedRelays))
|
||||||
} else {
|
} else {
|
||||||
emit(AuthorsByOutboxTopNavFilter(caches.peopleListCache.userIdSet(noteEvent), blockedRelays))
|
emit(AuthorsByOutboxTopNavFilter(caches.peopleListCache.userIdSet(noteEvent), blockedRelays))
|
||||||
@@ -161,7 +161,7 @@ class NoteFeedFlow(
|
|||||||
): IFeedTopNavFilter =
|
): IFeedTopNavFilter =
|
||||||
when (noteEvent) {
|
when (noteEvent) {
|
||||||
is PeopleListEvent -> {
|
is PeopleListEvent -> {
|
||||||
if (noteEvent.dTag() == PeopleListEvent.Companion.BLOCK_LIST_D_TAG) {
|
if (noteEvent.dTag() == PeopleListEvent.BLOCK_LIST_D_TAG) {
|
||||||
MutedAuthorsByProxyTopNavFilter(caches.peopleListCache.cachedUserIdSet(noteEvent), proxyRelays)
|
MutedAuthorsByProxyTopNavFilter(caches.peopleListCache.cachedUserIdSet(noteEvent), proxyRelays)
|
||||||
} else {
|
} else {
|
||||||
AuthorsByProxyTopNavFilter(caches.peopleListCache.cachedUserIdSet(noteEvent), proxyRelays)
|
AuthorsByProxyTopNavFilter(caches.peopleListCache.cachedUserIdSet(noteEvent), proxyRelays)
|
||||||
@@ -208,7 +208,7 @@ class NoteFeedFlow(
|
|||||||
) {
|
) {
|
||||||
when (noteEvent) {
|
when (noteEvent) {
|
||||||
is PeopleListEvent -> {
|
is PeopleListEvent -> {
|
||||||
if (noteEvent.dTag() == PeopleListEvent.Companion.BLOCK_LIST_D_TAG) {
|
if (noteEvent.dTag() == PeopleListEvent.BLOCK_LIST_D_TAG) {
|
||||||
emit(MutedAuthorsByProxyTopNavFilter(caches.peopleListCache.userIdSet(noteEvent), proxyRelays))
|
emit(MutedAuthorsByProxyTopNavFilter(caches.peopleListCache.userIdSet(noteEvent), proxyRelays))
|
||||||
} else {
|
} else {
|
||||||
emit(AuthorsByProxyTopNavFilter(caches.peopleListCache.userIdSet(noteEvent), proxyRelays))
|
emit(AuthorsByProxyTopNavFilter(caches.peopleListCache.userIdSet(noteEvent), proxyRelays))
|
||||||
@@ -272,7 +272,7 @@ class NoteFeedFlow(
|
|||||||
override fun startValue(): IFeedTopNavFilter {
|
override fun startValue(): IFeedTopNavFilter {
|
||||||
val noteEvent = metadataFlow.value?.note?.event
|
val noteEvent = metadataFlow.value?.note?.event
|
||||||
return if (noteEvent == null) {
|
return if (noteEvent == null) {
|
||||||
return AuthorsByOutboxTopNavFilter(emptySet(), blockedRelays)
|
AuthorsByOutboxTopNavFilter(emptySet(), blockedRelays)
|
||||||
} else {
|
} else {
|
||||||
if (proxyRelays.value.isEmpty()) {
|
if (proxyRelays.value.isEmpty()) {
|
||||||
processByOutbox(noteEvent, outboxRelays.value)
|
processByOutbox(noteEvent, outboxRelays.value)
|
||||||
|
|||||||
+1
-1
@@ -83,7 +83,7 @@ class MeltProcessor {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
suspend fun melt(
|
fun melt(
|
||||||
token: CashuToken,
|
token: CashuToken,
|
||||||
lud16: String,
|
lud16: String,
|
||||||
okHttpClient: (String) -> OkHttpClient,
|
okHttpClient: (String) -> OkHttpClient,
|
||||||
|
|||||||
+1
-1
@@ -32,7 +32,7 @@ class MemoryTrimmingService(
|
|||||||
) {
|
) {
|
||||||
var isTrimmingMemoryMutex = AtomicBoolean(false)
|
var isTrimmingMemoryMutex = AtomicBoolean(false)
|
||||||
|
|
||||||
private suspend fun doTrim(
|
private fun doTrim(
|
||||||
account: Collection<Account>,
|
account: Collection<Account>,
|
||||||
otherAccounts: List<AccountInfo>,
|
otherAccounts: List<AccountInfo>,
|
||||||
) {
|
) {
|
||||||
|
|||||||
+1
-1
@@ -30,7 +30,7 @@ import com.vitorpamplona.amethyst.service.playback.composable.mainVideo.VideoPla
|
|||||||
import com.vitorpamplona.amethyst.service.playback.composable.mediaitem.GetMediaItem
|
import com.vitorpamplona.amethyst.service.playback.composable.mediaitem.GetMediaItem
|
||||||
import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel
|
import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel
|
||||||
|
|
||||||
public val DEFAULT_MUTED_SETTING = mutableStateOf(true)
|
val DEFAULT_MUTED_SETTING = mutableStateOf(true)
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun VideoViewInner(
|
fun VideoViewInner(
|
||||||
|
|||||||
+1
-1
@@ -77,7 +77,7 @@ class IntentExtras {
|
|||||||
data.mimeType?.let { putString("mimeType", it) }
|
data.mimeType?.let { putString("mimeType", it) }
|
||||||
data.aspectRatio?.let { putFloat("aspectRatio", it) }
|
data.aspectRatio?.let { putFloat("aspectRatio", it) }
|
||||||
data.proxyPort?.let { putInt("proxyPort", it) }
|
data.proxyPort?.let { putInt("proxyPort", it) }
|
||||||
data.keepPlaying.let { putBoolean("keepPlaying", it) }
|
putBoolean("keepPlaying", data.keepPlaying)
|
||||||
data.waveformData?.let { putFloatArray("wavefrontData", it.wave.toFloatArray()) }
|
data.waveformData?.let { putFloatArray("wavefrontData", it.wave.toFloatArray()) }
|
||||||
|
|
||||||
bounds?.let { putInt("boundLeft", it.left) }
|
bounds?.let { putInt("boundLeft", it.left) }
|
||||||
|
|||||||
+1
-1
@@ -49,7 +49,7 @@ class AccountNotificationsEoseFromInboxRelaysManager(
|
|||||||
override fun updateFilter(
|
override fun updateFilter(
|
||||||
key: AccountQueryState,
|
key: AccountQueryState,
|
||||||
since: SincePerRelayMap?,
|
since: SincePerRelayMap?,
|
||||||
): List<RelayBasedFilter>? =
|
): List<RelayBasedFilter> =
|
||||||
key.account.notificationRelays.flow.value.flatMap {
|
key.account.notificationRelays.flow.value.flatMap {
|
||||||
filterSummaryNotificationsToPubkey(
|
filterSummaryNotificationsToPubkey(
|
||||||
relay = it,
|
relay = it,
|
||||||
|
|||||||
+1
-1
@@ -50,7 +50,7 @@ class AccountNotificationsEoseFromRandomRelaysManager(
|
|||||||
override fun updateFilter(
|
override fun updateFilter(
|
||||||
key: AccountQueryState,
|
key: AccountQueryState,
|
||||||
since: SincePerRelayMap?,
|
since: SincePerRelayMap?,
|
||||||
): List<RelayBasedFilter>? {
|
): List<RelayBasedFilter> {
|
||||||
// only loads this after the feed is built
|
// only loads this after the feed is built
|
||||||
val defaultSince = key.feedContentStates.notifications.lastNoteCreatedAtIfFilled() ?: TimeUtils.oneWeekAgo()
|
val defaultSince = key.feedContentStates.notifications.lastNoteCreatedAtIfFilled() ?: TimeUtils.oneWeekAgo()
|
||||||
return (key.account.followsPerRelay.value.keys - key.account.notificationRelays.flow.value).flatMap {
|
return (key.account.followsPerRelay.value.keys - key.account.notificationRelays.flow.value).flatMap {
|
||||||
|
|||||||
+1
-1
@@ -38,7 +38,7 @@ class ChannelLoaderSubAssembler(
|
|||||||
client: INostrClient,
|
client: INostrClient,
|
||||||
allKeys: () -> Set<ChannelFinderQueryState>,
|
allKeys: () -> Set<ChannelFinderQueryState>,
|
||||||
) : SingleSubNoEoseCacheEoseManager<ChannelFinderQueryState>(client, allKeys, invalidateAfterEose = true) {
|
) : SingleSubNoEoseCacheEoseManager<ChannelFinderQueryState>(client, allKeys, invalidateAfterEose = true) {
|
||||||
override fun updateFilter(keys: List<ChannelFinderQueryState>): List<RelayBasedFilter>? = filterMissingChannelsById(keys)
|
override fun updateFilter(keys: List<ChannelFinderQueryState>): List<RelayBasedFilter> = filterMissingChannelsById(keys)
|
||||||
|
|
||||||
override fun distinct(key: ChannelFinderQueryState) = key.channel
|
override fun distinct(key: ChannelFinderQueryState) = key.channel
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -71,7 +71,7 @@ fun potentialRelaysToFindAddress(note: AddressableNote): Set<NormalizedRelayUrl>
|
|||||||
return set
|
return set
|
||||||
}
|
}
|
||||||
|
|
||||||
fun filterMissingAddressables(keys: List<EventFinderQueryState>): List<RelayBasedFilter>? {
|
fun filterMissingAddressables(keys: List<EventFinderQueryState>): List<RelayBasedFilter> {
|
||||||
val addressesPerRelay =
|
val addressesPerRelay =
|
||||||
mapOfSet {
|
mapOfSet {
|
||||||
keys.forEach { key ->
|
keys.forEach { key ->
|
||||||
|
|||||||
+1
-1
@@ -67,7 +67,7 @@ fun potentialRelaysToFindEvent(note: Note): Set<NormalizedRelayUrl> {
|
|||||||
return set
|
return set
|
||||||
}
|
}
|
||||||
|
|
||||||
fun filterMissingEvents(keys: List<EventFinderQueryState>): List<RelayBasedFilter>? {
|
fun filterMissingEvents(keys: List<EventFinderQueryState>): List<RelayBasedFilter> {
|
||||||
val eventsPerRelay =
|
val eventsPerRelay =
|
||||||
mapOfSet {
|
mapOfSet {
|
||||||
keys.forEach { key ->
|
keys.forEach { key ->
|
||||||
|
|||||||
+1
-3
@@ -207,6 +207,4 @@ internal fun Iterable<Float>.normalize(
|
|||||||
return values.map { scale * ((it - currentMin) / range) + min }
|
return values.map { scale * ((it - currentMin) / range) + min }
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun Int.safeDiv(value: Int): Float {
|
private fun Int.safeDiv(value: Int): Float = if (value == 0) 0F else this / value.toFloat()
|
||||||
return if (value == 0) return 0F else this / value.toFloat()
|
|
||||||
}
|
|
||||||
|
|||||||
+1
-1
@@ -64,7 +64,7 @@ class ChannelFeedContentState(
|
|||||||
viewModelScope.launch(Dispatchers.IO) { _scrollToTop.emit(_scrollToTop.value + 1) }
|
viewModelScope.launch(Dispatchers.IO) { _scrollToTop.emit(_scrollToTop.value + 1) }
|
||||||
}
|
}
|
||||||
|
|
||||||
suspend fun sentToTop() {
|
fun sentToTop() {
|
||||||
scrolltoTopPending = false
|
scrolltoTopPending = false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -323,7 +323,7 @@ suspend fun routeEditDraftTo(
|
|||||||
is ChatroomKeyable -> {
|
is ChatroomKeyable -> {
|
||||||
val room = draft.chatroomKey(account.userProfile().pubkeyHex)
|
val room = draft.chatroomKey(account.userProfile().pubkeyHex)
|
||||||
account.chatroomList.getOrCreatePrivateChatroom(room)
|
account.chatroomList.getOrCreatePrivateChatroom(room)
|
||||||
return Route.Room(room, draftId = note.idHex)
|
Route.Room(room, draftId = note.idHex)
|
||||||
}
|
}
|
||||||
|
|
||||||
is TextNoteEvent -> {
|
is TextNoteEvent -> {
|
||||||
|
|||||||
@@ -262,7 +262,7 @@ class PollNoteViewModel : ViewModel() {
|
|||||||
valueMinimum?.let { minimum ->
|
valueMinimum?.let { minimum ->
|
||||||
valueMaximum?.let { maximum ->
|
valueMaximum?.let { maximum ->
|
||||||
if (minimum != maximum) {
|
if (minimum != maximum) {
|
||||||
options.add(((minimum + maximum) / 2).toLong())
|
options.add(((minimum + maximum) / 2))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -474,7 +474,7 @@ open class CommentPostViewModel :
|
|||||||
myMultiOrchestrator.upload(
|
myMultiOrchestrator.upload(
|
||||||
alt,
|
alt,
|
||||||
contentWarningReason,
|
contentWarningReason,
|
||||||
MediaCompressor.Companion.intToCompressorQuality(mediaQuality),
|
MediaCompressor.intToCompressorQuality(mediaQuality),
|
||||||
server,
|
server,
|
||||||
account,
|
account,
|
||||||
context,
|
context,
|
||||||
@@ -703,5 +703,5 @@ open class CommentPostViewModel :
|
|||||||
return location!!
|
return location!!
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun locationManager(): LocationState = Amethyst.Companion.instance.locationManager
|
override fun locationManager(): LocationState = Amethyst.instance.locationManager
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ import com.vitorpamplona.quartz.nip30CustomEmoji.pack.EmojiPackEvent
|
|||||||
import com.vitorpamplona.quartz.nip30CustomEmoji.taggedEmojis
|
import com.vitorpamplona.quartz.nip30CustomEmoji.taggedEmojis
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
public fun RenderEmojiPack(
|
fun RenderEmojiPack(
|
||||||
baseNote: Note,
|
baseNote: Note,
|
||||||
actionable: Boolean,
|
actionable: Boolean,
|
||||||
backgroundColor: MutableState<Color>,
|
backgroundColor: MutableState<Color>,
|
||||||
@@ -86,7 +86,7 @@ public fun RenderEmojiPack(
|
|||||||
|
|
||||||
@OptIn(ExperimentalLayoutApi::class)
|
@OptIn(ExperimentalLayoutApi::class)
|
||||||
@Composable
|
@Composable
|
||||||
public fun RenderEmojiPack(
|
fun RenderEmojiPack(
|
||||||
noteEvent: EmojiPackEvent,
|
noteEvent: EmojiPackEvent,
|
||||||
baseNote: Note,
|
baseNote: Note,
|
||||||
actionable: Boolean,
|
actionable: Boolean,
|
||||||
|
|||||||
+1
-1
@@ -118,7 +118,7 @@ class AccountSessionManager(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private suspend fun requestLoginUI() = _accountContent.update { AccountState.LoggedOff }
|
private fun requestLoginUI() = _accountContent.update { AccountState.LoggedOff }
|
||||||
|
|
||||||
suspend fun loginAndStartUI(
|
suspend fun loginAndStartUI(
|
||||||
key: String,
|
key: String,
|
||||||
|
|||||||
+1
-1
@@ -29,7 +29,7 @@ import com.vitorpamplona.quartz.nip28PublicChat.message.ChannelMessageEvent
|
|||||||
fun filterMessagesToPublicChat(
|
fun filterMessagesToPublicChat(
|
||||||
channel: PublicChatChannel,
|
channel: PublicChatChannel,
|
||||||
since: SincePerRelayMap?,
|
since: SincePerRelayMap?,
|
||||||
): List<RelayBasedFilter>? =
|
): List<RelayBasedFilter> =
|
||||||
channel.relays().toSet().map {
|
channel.relays().toSet().map {
|
||||||
RelayBasedFilter(
|
RelayBasedFilter(
|
||||||
relay = it,
|
relay = it,
|
||||||
|
|||||||
+1
-1
@@ -31,7 +31,7 @@ fun filterMyMessagesToLiveActivities(
|
|||||||
channel: LiveActivitiesChannel,
|
channel: LiveActivitiesChannel,
|
||||||
pubKey: HexKey,
|
pubKey: HexKey,
|
||||||
since: SincePerRelayMap?,
|
since: SincePerRelayMap?,
|
||||||
): List<RelayBasedFilter>? =
|
): List<RelayBasedFilter> =
|
||||||
channel.relays().toSet().map {
|
channel.relays().toSet().map {
|
||||||
RelayBasedFilter(
|
RelayBasedFilter(
|
||||||
relay = it,
|
relay = it,
|
||||||
|
|||||||
+1
-1
@@ -40,7 +40,7 @@ class FollowingEphemeralChatSubAssembler(
|
|||||||
override fun updateFilter(
|
override fun updateFilter(
|
||||||
key: ChatroomListState,
|
key: ChatroomListState,
|
||||||
since: SincePerRelayMap?,
|
since: SincePerRelayMap?,
|
||||||
): List<RelayBasedFilter>? =
|
): List<RelayBasedFilter> =
|
||||||
listOfNotNull(
|
listOfNotNull(
|
||||||
filterFollowingEphemeralChats(key.account.ephemeralChatList.liveEphemeralChatList.value, since),
|
filterFollowingEphemeralChats(key.account.ephemeralChatList.liveEphemeralChatList.value, since),
|
||||||
).flatten()
|
).flatten()
|
||||||
|
|||||||
+1
-1
@@ -40,7 +40,7 @@ class FollowingPublicChatSubAssembler(
|
|||||||
override fun updateFilter(
|
override fun updateFilter(
|
||||||
key: ChatroomListState,
|
key: ChatroomListState,
|
||||||
since: SincePerRelayMap?,
|
since: SincePerRelayMap?,
|
||||||
): List<RelayBasedFilter>? =
|
): List<RelayBasedFilter> =
|
||||||
listOfNotNull(
|
listOfNotNull(
|
||||||
filterLastMessageFollowingPublicChats(key.account.publicChatList.flowSet.value, since),
|
filterLastMessageFollowingPublicChats(key.account.publicChatList.flowSet.value, since),
|
||||||
filterFollowingPublicChatsCreationEvent(key.account.publicChatList.flowSet.value, since),
|
filterFollowingPublicChatsCreationEvent(key.account.publicChatList.flowSet.value, since),
|
||||||
|
|||||||
+1
-1
@@ -32,7 +32,7 @@ class GeoHashFeedFilterSubAssembler(
|
|||||||
override fun updateFilter(
|
override fun updateFilter(
|
||||||
key: GeohashQueryState,
|
key: GeohashQueryState,
|
||||||
since: SincePerRelayMap?,
|
since: SincePerRelayMap?,
|
||||||
): List<RelayBasedFilter>? = filterPostsByGeohash(key.geohash, key.relays, since)
|
): List<RelayBasedFilter> = filterPostsByGeohash(key.geohash, key.relays, since)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Only one key per hashtag.
|
* Only one key per hashtag.
|
||||||
|
|||||||
+1
-1
@@ -32,7 +32,7 @@ class UserProfileFollowersFilterSubAssembler(
|
|||||||
override fun updateFilter(
|
override fun updateFilter(
|
||||||
key: UserProfileQueryState,
|
key: UserProfileQueryState,
|
||||||
since: SincePerRelayMap?,
|
since: SincePerRelayMap?,
|
||||||
): List<RelayBasedFilter>? = filterUserProfileFollowers(user(key), since)
|
): List<RelayBasedFilter> = filterUserProfileFollowers(user(key), since)
|
||||||
|
|
||||||
override fun user(key: UserProfileQueryState) = key.user
|
override fun user(key: UserProfileQueryState) = key.user
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -34,7 +34,7 @@ class UserProfileMetadataFilterSubAssembler(
|
|||||||
override fun updateFilter(
|
override fun updateFilter(
|
||||||
keys: List<UserProfileQueryState>,
|
keys: List<UserProfileQueryState>,
|
||||||
since: SincePerRelayMap?,
|
since: SincePerRelayMap?,
|
||||||
): List<RelayBasedFilter>? {
|
): List<RelayBasedFilter> {
|
||||||
val userPerRelay =
|
val userPerRelay =
|
||||||
mapOfSet {
|
mapOfSet {
|
||||||
keys.mapTo(mutableSetOf()) { key -> key.user }.forEach { user ->
|
keys.mapTo(mutableSetOf()) { key -> key.user }.forEach { user ->
|
||||||
|
|||||||
+1
-1
@@ -26,7 +26,7 @@ import com.vitorpamplona.quartz.nip01Core.relay.normalizer.NormalizedRelayUrl
|
|||||||
|
|
||||||
@Stable
|
@Stable
|
||||||
class BlockedRelayListViewModel : BasicRelaySetupInfoModel() {
|
class BlockedRelayListViewModel : BasicRelaySetupInfoModel() {
|
||||||
override fun getRelayList(): List<NormalizedRelayUrl>? =
|
override fun getRelayList(): List<NormalizedRelayUrl> =
|
||||||
account.blockedRelayList.flow.value
|
account.blockedRelayList.flow.value
|
||||||
.toList()
|
.toList()
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -26,7 +26,7 @@ import com.vitorpamplona.quartz.nip01Core.relay.normalizer.NormalizedRelayUrl
|
|||||||
|
|
||||||
@Stable
|
@Stable
|
||||||
class BroadcastRelayListViewModel : BasicRelaySetupInfoModel() {
|
class BroadcastRelayListViewModel : BasicRelaySetupInfoModel() {
|
||||||
override fun getRelayList(): List<NormalizedRelayUrl>? =
|
override fun getRelayList(): List<NormalizedRelayUrl> =
|
||||||
account.broadcastRelayList.flow.value
|
account.broadcastRelayList.flow.value
|
||||||
.toList()
|
.toList()
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -26,7 +26,7 @@ import com.vitorpamplona.quartz.nip01Core.relay.normalizer.NormalizedRelayUrl
|
|||||||
|
|
||||||
@Stable
|
@Stable
|
||||||
class FavoriteRelayListViewModel : BasicRelaySetupInfoModel() {
|
class FavoriteRelayListViewModel : BasicRelaySetupInfoModel() {
|
||||||
override fun getRelayList(): List<NormalizedRelayUrl>? =
|
override fun getRelayList(): List<NormalizedRelayUrl> =
|
||||||
account.favoriteRelayList.flow.value
|
account.favoriteRelayList.flow.value
|
||||||
.toList()
|
.toList()
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -26,7 +26,7 @@ import com.vitorpamplona.quartz.nip01Core.relay.normalizer.NormalizedRelayUrl
|
|||||||
|
|
||||||
@Stable
|
@Stable
|
||||||
class IndexerRelayListViewModel : BasicRelaySetupInfoModel() {
|
class IndexerRelayListViewModel : BasicRelaySetupInfoModel() {
|
||||||
override fun getRelayList(): List<NormalizedRelayUrl>? =
|
override fun getRelayList(): List<NormalizedRelayUrl> =
|
||||||
account.indexerRelayList.flowNoDefaults.value
|
account.indexerRelayList.flowNoDefaults.value
|
||||||
.toList()
|
.toList()
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -26,7 +26,7 @@ import com.vitorpamplona.quartz.nip01Core.relay.normalizer.NormalizedRelayUrl
|
|||||||
|
|
||||||
@Stable
|
@Stable
|
||||||
class PrivateOutboxRelayListViewModel : BasicRelaySetupInfoModel() {
|
class PrivateOutboxRelayListViewModel : BasicRelaySetupInfoModel() {
|
||||||
override fun getRelayList(): List<NormalizedRelayUrl>? =
|
override fun getRelayList(): List<NormalizedRelayUrl> =
|
||||||
account.privateStorageRelayList.flow.value
|
account.privateStorageRelayList.flow.value
|
||||||
.toList()
|
.toList()
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -26,7 +26,7 @@ import com.vitorpamplona.quartz.nip01Core.relay.normalizer.NormalizedRelayUrl
|
|||||||
|
|
||||||
@Stable
|
@Stable
|
||||||
class ProxyRelayListViewModel : BasicRelaySetupInfoModel() {
|
class ProxyRelayListViewModel : BasicRelaySetupInfoModel() {
|
||||||
override fun getRelayList(): List<NormalizedRelayUrl>? =
|
override fun getRelayList(): List<NormalizedRelayUrl> =
|
||||||
account.proxyRelayList.flow.value
|
account.proxyRelayList.flow.value
|
||||||
.toList()
|
.toList()
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -26,7 +26,7 @@ import com.vitorpamplona.quartz.nip01Core.relay.normalizer.NormalizedRelayUrl
|
|||||||
|
|
||||||
@Stable
|
@Stable
|
||||||
class SearchRelayListViewModel : BasicRelaySetupInfoModel() {
|
class SearchRelayListViewModel : BasicRelaySetupInfoModel() {
|
||||||
override fun getRelayList(): List<NormalizedRelayUrl>? =
|
override fun getRelayList(): List<NormalizedRelayUrl> =
|
||||||
account.searchRelayList.flowNoDefaults.value
|
account.searchRelayList.flowNoDefaults.value
|
||||||
.toList()
|
.toList()
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -26,7 +26,7 @@ import com.vitorpamplona.quartz.nip01Core.relay.normalizer.NormalizedRelayUrl
|
|||||||
|
|
||||||
@Stable
|
@Stable
|
||||||
class TrustedRelayListViewModel : BasicRelaySetupInfoModel() {
|
class TrustedRelayListViewModel : BasicRelaySetupInfoModel() {
|
||||||
override fun getRelayList(): List<NormalizedRelayUrl>? =
|
override fun getRelayList(): List<NormalizedRelayUrl> =
|
||||||
account.trustedRelayList.flow.value
|
account.trustedRelayList.flow.value
|
||||||
.toList()
|
.toList()
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -55,7 +55,7 @@ class PushNotificationReceiverService : FirebaseMessagingService() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private suspend fun parseMessage(params: Map<String, String>): GiftWrapEvent? {
|
private fun parseMessage(params: Map<String, String>): GiftWrapEvent? {
|
||||||
params["encryptedEvent"]?.let { eventStr ->
|
params["encryptedEvent"]?.let { eventStr ->
|
||||||
(Event.fromJson(eventStr) as? GiftWrapEvent)?.let {
|
(Event.fromJson(eventStr) as? GiftWrapEvent)?.let {
|
||||||
return it
|
return it
|
||||||
|
|||||||
Reference in New Issue
Block a user