mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2026-08-05 06:14:37 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
dbaadb4595 | ||
|
|
231ca44e1c | ||
|
|
ca00c87a6e | ||
|
|
2a28111583 | ||
|
|
4def80c914 | ||
|
|
916ece1edb | ||
|
|
3c1f57fac0 | ||
|
|
e166c36731 | ||
|
|
a636f4a786 | ||
|
|
bb127506c7 | ||
|
|
92c704d227 | ||
|
|
e764ebbcb2 | ||
|
|
68fb34a8ad | ||
|
|
02683ba829 | ||
|
|
754a1b3a87 | ||
|
|
4b58da7be7 | ||
|
|
1ac9c850e4 | ||
|
|
3cc4dc1414 | ||
|
|
62ae43e863 | ||
|
|
8149a93f2f | ||
|
|
5a60c3a595 | ||
|
|
2ef2f0d1a5 | ||
|
|
52fef33662 | ||
|
|
a5c6f86b35 | ||
|
|
b80008d695 | ||
|
|
fa06aefbf1 | ||
|
|
ab9ede1e26 | ||
|
|
479b1ab20a | ||
|
|
8ed3f84cb7 | ||
|
|
c128e43fe5 | ||
|
|
f9ddf76686 | ||
|
|
b6cb839fe7 | ||
|
|
2b6a48f391 | ||
|
|
d1da863d3c | ||
|
|
99b7a8005a | ||
|
|
3f3367258f | ||
|
|
15ab955a7d | ||
|
|
5cf8b5aa12 | ||
|
|
eba6d03b53 | ||
|
|
de85239046 | ||
|
|
9176151971 | ||
|
|
cbd8acbd01 | ||
|
|
19c9bfa819 | ||
|
|
80c369a6ae | ||
|
|
d0190c87a2 | ||
|
|
62a2cba18b | ||
|
|
59b3ff1b94 | ||
|
|
35423e1bb6 | ||
|
|
e125690000 | ||
|
|
eba5ecfd91 | ||
|
|
3e43a75acd | ||
|
|
04bf9c07ac | ||
|
|
ac58f99560 | ||
|
|
df328ff139 | ||
|
|
60ba7786a0 | ||
|
|
1773ad5a88 | ||
|
|
26faa2bc69 |
@@ -15,8 +15,8 @@ android {
|
||||
applicationId "com.vitorpamplona.amethyst"
|
||||
minSdk libs.versions.android.minSdk.get().toInteger()
|
||||
targetSdk libs.versions.android.targetSdk.get().toInteger()
|
||||
versionCode 388
|
||||
versionName "0.89.2"
|
||||
versionCode 393
|
||||
versionName "0.89.7"
|
||||
buildConfigField "String", "RELEASE_NOTES_ID", "\"1130badb252bdf62aaf93cb65bfa2bb09e7600c7d6764894f2954555b3b73018\""
|
||||
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
|
||||
@@ -30,6 +30,7 @@ import android.util.Log
|
||||
import androidx.security.crypto.EncryptedSharedPreferences
|
||||
import coil.ImageLoader
|
||||
import coil.disk.DiskCache
|
||||
import coil.memory.MemoryCache
|
||||
import com.vitorpamplona.amethyst.service.ots.OkHttpBlockstreamExplorer
|
||||
import com.vitorpamplona.amethyst.service.ots.OkHttpCalendarBuilder
|
||||
import com.vitorpamplona.amethyst.service.playback.VideoCache
|
||||
@@ -66,7 +67,14 @@ class Amethyst : Application() {
|
||||
.Builder()
|
||||
.directory(applicationContext.safeCacheDir.resolve("image_cache"))
|
||||
.maxSizePercent(0.2)
|
||||
.maximumMaxSizeBytes(500L * 1024 * 1024) // 250MB
|
||||
.maximumMaxSizeBytes(1024 * 1024 * 1024) // 1GB
|
||||
.build()
|
||||
}
|
||||
|
||||
val coilMemCache: MemoryCache by lazy {
|
||||
MemoryCache
|
||||
.Builder(this)
|
||||
.maxSizePercent(0.40) // memory heavy app due to profile pics and videos.
|
||||
.build()
|
||||
}
|
||||
|
||||
@@ -106,7 +114,7 @@ class Amethyst : Application() {
|
||||
}
|
||||
}
|
||||
|
||||
fun imageLoaderBuilder(): ImageLoader.Builder = ImageLoader.Builder(applicationContext).diskCache { coilCache }
|
||||
fun imageLoaderBuilder(): ImageLoader.Builder = ImageLoader.Builder(this).diskCache { coilCache }.memoryCache { coilMemCache }
|
||||
|
||||
fun encryptedStorage(npub: String? = null): EncryptedSharedPreferences = EncryptedStorage.preferences(instance, npub)
|
||||
|
||||
|
||||
@@ -2251,21 +2251,25 @@ class Account(
|
||||
idHex: String,
|
||||
url: String,
|
||||
relay: String?,
|
||||
blurhash: String?,
|
||||
dim: String?,
|
||||
hash: String?,
|
||||
mimeType: String?,
|
||||
) {
|
||||
if (!isWriteable()) return
|
||||
ProfileGalleryEntryEvent.create(
|
||||
url = url,
|
||||
eventid = idHex,
|
||||
relayhint = relay,
|
||||
blurhash = blurhash,
|
||||
hash = hash,
|
||||
dimensions = dim,
|
||||
mimeType = mimeType,
|
||||
/*magnetUri = magnetUri,
|
||||
mimeType = headerInfo.mimeType,
|
||||
hash = headerInfo.hash,
|
||||
size = headerInfo.size.toString(),
|
||||
dimensions = headerInfo.dim,
|
||||
blurhash = headerInfo.blurHash,
|
||||
alt = alt,
|
||||
originalHash = originalHash,
|
||||
sensitiveContent = sensitiveContent, */
|
||||
originalHash = originalHash, */
|
||||
signer = signer,
|
||||
) { event ->
|
||||
Client.send(event)
|
||||
@@ -2761,19 +2765,22 @@ class Account(
|
||||
// Takes a User's relay list and adds the types of feeds they are active for.
|
||||
fun activeRelays(): Array<RelaySetupInfo>? {
|
||||
val usersRelayList =
|
||||
userProfile().latestContactList?.relays()?.map {
|
||||
val url = RelayUrlFormatter.normalize(it.key)
|
||||
userProfile()
|
||||
.latestContactList
|
||||
?.relays()
|
||||
?.map {
|
||||
val url = RelayUrlFormatter.normalize(it.key)
|
||||
|
||||
val localFeedTypes =
|
||||
localRelays.firstOrNull { localRelay -> RelayUrlFormatter.normalize(localRelay.url) == url }?.feedTypes?.minus(setOf(FeedType.SEARCH, FeedType.WALLET_CONNECT))
|
||||
?: Constants.defaultRelays
|
||||
.filter { defaultRelay -> defaultRelay.url == url }
|
||||
.firstOrNull()
|
||||
?.feedTypes
|
||||
?: Constants.activeTypesGlobalChats
|
||||
val localFeedTypes =
|
||||
localRelays.firstOrNull { localRelay -> RelayUrlFormatter.normalize(localRelay.url) == url }?.feedTypes?.minus(setOf(FeedType.SEARCH, FeedType.WALLET_CONNECT))
|
||||
?: Constants.defaultRelays
|
||||
.filter { defaultRelay -> defaultRelay.url == url }
|
||||
.firstOrNull()
|
||||
?.feedTypes
|
||||
?: Constants.activeTypesGlobalChats
|
||||
|
||||
RelaySetupInfo(url, it.value.read, it.value.write, localFeedTypes)
|
||||
} ?: return null
|
||||
RelaySetupInfo(url, it.value.read, it.value.write, localFeedTypes)
|
||||
}?.ifEmpty { null } ?: return null
|
||||
|
||||
return usersRelayList.toTypedArray()
|
||||
}
|
||||
|
||||
@@ -112,7 +112,7 @@ object NostrHomeDataSource : AmethystNostrDataSource("HomeFeed") {
|
||||
|
||||
fun createFollowMetadataAndReleaseFilter(): TypedFilter? {
|
||||
val follows = account.liveHomeFollowLists.value?.users
|
||||
val followSet = follows?.plus(account.userProfile().pubkeyHex)?.toList()?.ifEmpty { null }
|
||||
val followSet = follows?.plus(account.userProfile().pubkeyHex)?.shuffled()?.ifEmpty { null }
|
||||
|
||||
return if (followSet != null) {
|
||||
TypedFilter(
|
||||
@@ -124,7 +124,7 @@ object NostrHomeDataSource : AmethystNostrDataSource("HomeFeed") {
|
||||
MetadataEvent.KIND,
|
||||
AdvertisedRelayListEvent.KIND,
|
||||
),
|
||||
authors = followSet,
|
||||
authors = followSet.take(500),
|
||||
since =
|
||||
latestEOSEs.users[account.userProfile()]
|
||||
?.followList
|
||||
|
||||
+6
@@ -319,6 +319,9 @@ fun groupByEOSEPresence(notes: Set<Note>): Collection<List<Note>> =
|
||||
.sorted()
|
||||
.joinToString(",")
|
||||
}.values
|
||||
.map {
|
||||
it.sortedBy { it.idHex } // important to keep in order otherwise the Relay thinks the filter has changed and we REQ again
|
||||
}
|
||||
|
||||
fun groupByEOSEPresence(users: Iterable<User>): Collection<List<User>> =
|
||||
users
|
||||
@@ -327,6 +330,9 @@ fun groupByEOSEPresence(users: Iterable<User>): Collection<List<User>> =
|
||||
.sorted()
|
||||
.joinToString(",")
|
||||
}.values
|
||||
.map {
|
||||
it.sortedBy { it.pubkeyHex } // important to keep in order otherwise the Relay thinks the filter has changed and we REQ again
|
||||
}
|
||||
|
||||
fun findMinimumEOSEs(notes: List<Note>): Map<String, EOSETime> {
|
||||
val minLatestEOSEs = mutableMapOf<String, EOSETime>()
|
||||
|
||||
+6
-7
@@ -64,6 +64,7 @@ object NostrSingleUserDataSource : AmethystNostrDataSource("SingleUserFeed") {
|
||||
.map { group ->
|
||||
val groupIds = group.map { it.pubkeyHex }
|
||||
val minEOSEs = findMinimumEOSEsForUsers(group)
|
||||
|
||||
listOf(
|
||||
TypedFilter(
|
||||
types = EVENT_FINDER_TYPES,
|
||||
@@ -92,13 +93,11 @@ object NostrSingleUserDataSource : AmethystNostrDataSource("SingleUserFeed") {
|
||||
checkNotInMainThread()
|
||||
|
||||
usersToWatch.forEach {
|
||||
if (it.latestMetadata != null) {
|
||||
val eose = it.latestEOSEs[relayUrl]
|
||||
if (eose == null) {
|
||||
it.latestEOSEs = it.latestEOSEs + Pair(relayUrl, EOSETime(time))
|
||||
} else {
|
||||
eose.time = time
|
||||
}
|
||||
val eose = it.latestEOSEs[relayUrl]
|
||||
if (eose == null) {
|
||||
it.latestEOSEs = it.latestEOSEs + Pair(relayUrl, EOSETime(time))
|
||||
} else {
|
||||
eose.time = time
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,6 +30,7 @@ import android.os.Build
|
||||
import android.os.Bundle
|
||||
import android.util.Log
|
||||
import androidx.activity.compose.setContent
|
||||
import androidx.activity.enableEdgeToEdge
|
||||
import androidx.activity.result.contract.ActivityResultContracts
|
||||
import androidx.annotation.RequiresApi
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
@@ -72,6 +73,7 @@ class MainActivity : AppCompatActivity() {
|
||||
|
||||
@RequiresApi(Build.VERSION_CODES.R)
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
enableEdgeToEdge()
|
||||
super.onCreate(savedInstanceState)
|
||||
|
||||
Log.d("Lifetime Event", "MainActivity.onCreate")
|
||||
|
||||
@@ -54,9 +54,9 @@ fun stringRes(
|
||||
String
|
||||
.format(
|
||||
LocalConfiguration.current.locales.get(0),
|
||||
resourceCache.get(id) ?: stringResource(id),
|
||||
resourceCache.get(id) ?: stringResource(id).also { resourceCache.put(id, it) },
|
||||
*args,
|
||||
).also { resourceCache.put(id, it) }
|
||||
)
|
||||
|
||||
fun stringRes(
|
||||
ctx: Context,
|
||||
|
||||
@@ -824,7 +824,7 @@ private fun RenderVideoPlayer(
|
||||
}
|
||||
|
||||
AnimatedShareButton(controllerVisible, Modifier.align(Alignment.TopEnd).padding(end = Size165dp)) { popupExpanded, toggle ->
|
||||
ShareImageAction(accountViewModel = accountViewModel, popupExpanded, videoUri, nostrUriCallback, toggle)
|
||||
ShareImageAction(accountViewModel = accountViewModel, popupExpanded, videoUri, null, null, null, null, nostrUriCallback, toggle)
|
||||
}
|
||||
} else {
|
||||
controller.volume = 0f
|
||||
|
||||
+13
-1
@@ -605,6 +605,10 @@ fun ShareImageAction(
|
||||
popupExpanded = popupExpanded,
|
||||
videoUri = content.url,
|
||||
postNostrUri = content.uri,
|
||||
blurhash = content.blurhash,
|
||||
dim = content.dim,
|
||||
hash = content.hash,
|
||||
mimeType = content.mimeType,
|
||||
onDismiss = onDismiss,
|
||||
)
|
||||
} else if (content is MediaPreloadedContent) {
|
||||
@@ -613,6 +617,10 @@ fun ShareImageAction(
|
||||
popupExpanded = popupExpanded,
|
||||
videoUri = content.localFile?.toUri().toString(),
|
||||
postNostrUri = content.uri,
|
||||
blurhash = content.blurhash,
|
||||
dim = content.dim,
|
||||
hash = null,
|
||||
mimeType = content.mimeType,
|
||||
onDismiss = onDismiss,
|
||||
)
|
||||
}
|
||||
@@ -625,6 +633,10 @@ fun ShareImageAction(
|
||||
popupExpanded: MutableState<Boolean>,
|
||||
videoUri: String?,
|
||||
postNostrUri: String?,
|
||||
blurhash: String?,
|
||||
dim: String?,
|
||||
hash: String?,
|
||||
mimeType: String?,
|
||||
onDismiss: () -> Unit,
|
||||
) {
|
||||
DropdownMenu(
|
||||
@@ -660,7 +672,7 @@ fun ShareImageAction(
|
||||
if (videoUri != null) {
|
||||
var n19 = Nip19Bech32.uriToRoute(postNostrUri)?.entity as? Nip19Bech32.NEvent
|
||||
if (n19 != null) {
|
||||
accountViewModel.addMediaToGallery(n19.hex, videoUri, n19.relay[0]) // TODO Whole list or first?
|
||||
accountViewModel.addMediaToGallery(n19.hex, videoUri, n19.relay[0], blurhash, dim, hash, mimeType) // TODO Whole list or first?
|
||||
accountViewModel.toast(R.string.image_saved_to_the_gallery, R.string.image_saved_to_the_gallery)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,6 +27,11 @@ import androidx.compose.foundation.Canvas
|
||||
import androidx.compose.foundation.layout.Box
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.RowScope
|
||||
import androidx.compose.foundation.layout.consumeWindowInsets
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.foundation.layout.height
|
||||
import androidx.compose.foundation.layout.windowInsetsPadding
|
||||
import androidx.compose.material3.BottomAppBarDefaults.windowInsets
|
||||
import androidx.compose.material3.HorizontalDivider
|
||||
import androidx.compose.material3.Icon
|
||||
import androidx.compose.material3.MaterialTheme
|
||||
@@ -43,11 +48,11 @@ import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.platform.LocalView
|
||||
import androidx.compose.ui.res.painterResource
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.lifecycle.compose.collectAsStateWithLifecycle
|
||||
import androidx.navigation.NavBackStackEntry
|
||||
import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel
|
||||
import com.vitorpamplona.amethyst.ui.stringRes
|
||||
import com.vitorpamplona.amethyst.ui.theme.BottomTopHeight
|
||||
import com.vitorpamplona.amethyst.ui.theme.DividerThickness
|
||||
import com.vitorpamplona.amethyst.ui.theme.Size0dp
|
||||
import com.vitorpamplona.amethyst.ui.theme.Size10Modifier
|
||||
@@ -126,11 +131,18 @@ private fun RenderBottomMenu(
|
||||
navEntryState: State<NavBackStackEntry?>,
|
||||
nav: (Route, Boolean) -> Unit,
|
||||
) {
|
||||
Column(modifier = BottomTopHeight) {
|
||||
Column(
|
||||
modifier =
|
||||
Modifier
|
||||
.fillMaxWidth()
|
||||
.windowInsetsPadding(windowInsets)
|
||||
.consumeWindowInsets(windowInsets)
|
||||
.height(50.dp),
|
||||
) {
|
||||
HorizontalDivider(
|
||||
thickness = DividerThickness,
|
||||
)
|
||||
NavigationBar(tonalElevation = Size0dp, containerColor = Color.Transparent) {
|
||||
NavigationBar(tonalElevation = Size0dp) {
|
||||
bottomNavigationItems.forEach { item ->
|
||||
HasNewItemsIcon(item, accountViewModel, navEntryState, nav)
|
||||
}
|
||||
|
||||
@@ -100,7 +100,7 @@ fun AppNavigation(
|
||||
) {
|
||||
val scope = rememberCoroutineScope()
|
||||
val nav =
|
||||
remember {
|
||||
remember(navController) {
|
||||
{ route: String ->
|
||||
scope.launch {
|
||||
if (getRouteWithArguments(navController) != route) {
|
||||
@@ -219,7 +219,6 @@ fun AppNavigation(
|
||||
|
||||
composable(Route.BlockedUsers.route, content = { HiddenUsersScreen(accountViewModel, nav) })
|
||||
composable(Route.Bookmarks.route, content = { BookmarkListScreen(accountViewModel, nav) })
|
||||
|
||||
composable(Route.Drafts.route, content = { DraftListScreen(accountViewModel, nav) })
|
||||
|
||||
Route.ContentDiscovery.let { route ->
|
||||
|
||||
@@ -20,7 +20,9 @@
|
||||
*/
|
||||
package com.vitorpamplona.amethyst.ui.navigation
|
||||
|
||||
import android.app.ActivityManager
|
||||
import android.content.Context
|
||||
import android.content.pm.ApplicationInfo
|
||||
import android.os.Debug
|
||||
import android.util.Log
|
||||
import androidx.compose.foundation.clickable
|
||||
@@ -66,6 +68,7 @@ import androidx.compose.ui.platform.LocalContext
|
||||
import androidx.compose.ui.text.font.FontWeight
|
||||
import androidx.compose.ui.text.style.TextOverflow
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.core.content.getSystemService
|
||||
import androidx.lifecycle.ViewModel
|
||||
import androidx.lifecycle.ViewModelProvider
|
||||
import androidx.lifecycle.compose.collectAsStateWithLifecycle
|
||||
@@ -130,7 +133,6 @@ import com.vitorpamplona.amethyst.ui.stringRes
|
||||
import com.vitorpamplona.amethyst.ui.theme.BottomTopHeight
|
||||
import com.vitorpamplona.amethyst.ui.theme.DividerThickness
|
||||
import com.vitorpamplona.amethyst.ui.theme.DoubleHorzSpacer
|
||||
import com.vitorpamplona.amethyst.ui.theme.HalfVertSpacer
|
||||
import com.vitorpamplona.amethyst.ui.theme.HeaderPictureModifier
|
||||
import com.vitorpamplona.amethyst.ui.theme.Size20Modifier
|
||||
import com.vitorpamplona.amethyst.ui.theme.Size22Modifier
|
||||
@@ -987,7 +989,6 @@ fun FlexibleTopBarWithBackButton(
|
||||
navigationIcon = { IconButton(onClick = popBack) { ArrowBackIcon() } },
|
||||
actions = {},
|
||||
)
|
||||
Spacer(modifier = HalfVertSpacer)
|
||||
HorizontalDivider(thickness = DividerThickness)
|
||||
}
|
||||
}
|
||||
@@ -1036,6 +1037,14 @@ fun debugState(context: Context) {
|
||||
|
||||
Log.d("STATE DUMP", "Total Native Heap Allocated: " + nativeHeap + " MB")
|
||||
|
||||
val activityManager: ActivityManager? = context.getSystemService()
|
||||
if (activityManager != null) {
|
||||
val isLargeHeap = (context.applicationInfo.flags and ApplicationInfo.FLAG_LARGE_HEAP) != 0
|
||||
val memClass = if (isLargeHeap) activityManager.largeMemoryClass else activityManager.memoryClass
|
||||
|
||||
Log.d("STATE DUMP", "Memory Class " + memClass + " MB (largeHeap $isLargeHeap)")
|
||||
}
|
||||
|
||||
Log.d("STATE DUMP", "Connected Relays: " + RelayPool.connectedRelays())
|
||||
|
||||
val imageLoader = Coil.imageLoader(context)
|
||||
@@ -1094,6 +1103,13 @@ fun debugState(context: Context) {
|
||||
LocalCache.observablesByKindAndAuthor.size,
|
||||
)
|
||||
|
||||
Log.d(
|
||||
"STATE DUMP",
|
||||
"Spam: " +
|
||||
LocalCache.antiSpam.recentMessages.size() +
|
||||
" / " + LocalCache.antiSpam.spamMessages.size(),
|
||||
)
|
||||
|
||||
Log.d(
|
||||
"STATE DUMP",
|
||||
"Memory used by Events: " +
|
||||
@@ -1111,11 +1127,11 @@ fun debugState(context: Context) {
|
||||
LocalCache.addressables
|
||||
.sumByGroup(groupMap = { _, it -> it.event?.kind() }, sumOf = { _, it -> it.event?.countMemory() ?: 0L })
|
||||
|
||||
qttNotes.forEach { kind, qtt ->
|
||||
Log.d("STATE DUMP", "Kind $kind:\t$qtt elements\t${bytesNotes.get(kind)?.div((1024 * 1024))}MB ")
|
||||
qttNotes.toList().sortedByDescending { bytesNotes.get(it.first) }.forEach { (kind, qtt) ->
|
||||
Log.d("STATE DUMP", "Kind ${kind.toString().padStart(5,' ')}:\t${qtt.toString().padStart(6,' ')} elements\t${bytesNotes.get(kind)?.div((1024 * 1024))}MB ")
|
||||
}
|
||||
qttAddressables.forEach { kind, qtt ->
|
||||
Log.d("STATE DUMP", "Kind $kind:\t$qtt elements\t${bytesAddressables.get(kind)?.div((1024 * 1024))}MB ")
|
||||
qttAddressables.toList().sortedByDescending { bytesNotes.get(it.first) }.forEach { (kind, qtt) ->
|
||||
Log.d("STATE DUMP", "Kind ${kind.toString().padStart(5,' ')}:\t${qtt.toString().padStart(6,' ')} elements\t${bytesAddressables.get(kind)?.div((1024 * 1024))}MB ")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -136,7 +136,9 @@ fun DrawerContent(
|
||||
drawerTonalElevation = 0.dp,
|
||||
) {
|
||||
Column(
|
||||
Modifier.fillMaxHeight().verticalScroll(rememberScrollState()),
|
||||
Modifier
|
||||
.fillMaxHeight()
|
||||
.verticalScroll(rememberScrollState()),
|
||||
) {
|
||||
ProfileContent(
|
||||
baseAccountUser = accountViewModel.account.userProfile(),
|
||||
@@ -146,7 +148,7 @@ fun DrawerContent(
|
||||
)
|
||||
|
||||
Column(drawerSpacing) {
|
||||
EditStatusBoxes(accountViewModel.account.userProfile(), accountViewModel)
|
||||
EditStatusBoxes(accountViewModel.account.userProfile(), accountViewModel, drawerState)
|
||||
}
|
||||
|
||||
FollowingAndFollowerCounts(accountViewModel.account.userProfile(), onClickUser)
|
||||
@@ -263,15 +265,16 @@ fun ProfileContentTemplate(
|
||||
private fun EditStatusBoxes(
|
||||
baseAccountUser: User,
|
||||
accountViewModel: AccountViewModel,
|
||||
drawerState: DrawerState,
|
||||
) {
|
||||
LoadStatuses(user = baseAccountUser, accountViewModel) { statuses ->
|
||||
if (statuses.isEmpty()) {
|
||||
StatusEditBar(accountViewModel = accountViewModel)
|
||||
StatusEditBar(accountViewModel = accountViewModel, drawerState = drawerState)
|
||||
} else {
|
||||
statuses.forEach {
|
||||
val originalStatus by it.live().content.observeAsState()
|
||||
|
||||
StatusEditBar(originalStatus, it.address, accountViewModel)
|
||||
StatusEditBar(originalStatus, it.address, accountViewModel, drawerState = drawerState)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -282,11 +285,17 @@ fun StatusEditBar(
|
||||
savedStatus: String? = null,
|
||||
tag: ATag? = null,
|
||||
accountViewModel: AccountViewModel,
|
||||
drawerState: DrawerState,
|
||||
) {
|
||||
val focusManager = LocalFocusManager.current
|
||||
|
||||
val currentStatus = remember { mutableStateOf(savedStatus ?: "") }
|
||||
val hasChanged = remember { derivedStateOf { currentStatus.value != (savedStatus ?: "") } }
|
||||
LaunchedEffect(drawerState.isClosed) {
|
||||
if (drawerState.isClosed) {
|
||||
focusManager.clearFocus(true)
|
||||
}
|
||||
}
|
||||
|
||||
OutlinedTextField(
|
||||
value = currentStatus.value,
|
||||
|
||||
@@ -991,11 +991,7 @@ fun FirstUserInfoRow(
|
||||
BoostedMark()
|
||||
}
|
||||
|
||||
if (editState.value is GenericLoadable.Loaded) {
|
||||
(editState.value as? GenericLoadable.Loaded<EditState>)?.loaded?.let {
|
||||
DisplayEditStatus(it)
|
||||
}
|
||||
}
|
||||
CheckAndDisplayEditStatus(editState)
|
||||
|
||||
if (baseNote.isDraft()) {
|
||||
DisplayDraft()
|
||||
@@ -1007,6 +1003,15 @@ fun FirstUserInfoRow(
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
fun CheckAndDisplayEditStatus(editState: State<GenericLoadable<EditState>>) {
|
||||
if (editState.value is GenericLoadable.Loaded) {
|
||||
(editState.value as? GenericLoadable.Loaded<EditState>)?.loaded?.let {
|
||||
DisplayEditStatus(it)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
fun observeEdits(
|
||||
baseNote: Note,
|
||||
|
||||
@@ -81,6 +81,7 @@ import com.vitorpamplona.amethyst.ui.components.ObserveDisplayNip05Status
|
||||
import com.vitorpamplona.amethyst.ui.components.mockAccountViewModel
|
||||
import com.vitorpamplona.amethyst.ui.navigation.routeFor
|
||||
import com.vitorpamplona.amethyst.ui.navigation.routeToMessage
|
||||
import com.vitorpamplona.amethyst.ui.note.CheckAndDisplayEditStatus
|
||||
import com.vitorpamplona.amethyst.ui.note.CheckHiddenFeedWatchBlockAndReport
|
||||
import com.vitorpamplona.amethyst.ui.note.DisplayDraft
|
||||
import com.vitorpamplona.amethyst.ui.note.DisplayOtsIfInOriginal
|
||||
@@ -95,7 +96,6 @@ import com.vitorpamplona.amethyst.ui.note.RenderRepost
|
||||
import com.vitorpamplona.amethyst.ui.note.WatchNoteEvent
|
||||
import com.vitorpamplona.amethyst.ui.note.calculateBackgroundColor
|
||||
import com.vitorpamplona.amethyst.ui.note.elements.DefaultImageHeader
|
||||
import com.vitorpamplona.amethyst.ui.note.elements.DisplayEditStatus
|
||||
import com.vitorpamplona.amethyst.ui.note.elements.DisplayFollowingCommunityInPost
|
||||
import com.vitorpamplona.amethyst.ui.note.elements.DisplayFollowingHashtagsInPost
|
||||
import com.vitorpamplona.amethyst.ui.note.elements.DisplayLocation
|
||||
@@ -421,11 +421,7 @@ private fun FullBleedNoteCompose(
|
||||
DisplayFollowingHashtagsInPost(baseNote, accountViewModel, nav)
|
||||
}
|
||||
|
||||
if (editState.value is GenericLoadable.Loaded) {
|
||||
(editState.value as? GenericLoadable.Loaded<EditState>)?.loaded?.let {
|
||||
DisplayEditStatus(it)
|
||||
}
|
||||
}
|
||||
CheckAndDisplayEditStatus(editState)
|
||||
|
||||
TimeAgo(note = baseNote)
|
||||
|
||||
|
||||
+5
-1
@@ -673,8 +673,12 @@ class AccountViewModel(
|
||||
hex: String,
|
||||
url: String,
|
||||
relay: String?,
|
||||
blurhash: String?,
|
||||
dim: String?,
|
||||
hash: String?,
|
||||
mimeType: String?,
|
||||
) {
|
||||
viewModelScope.launch(Dispatchers.IO) { account.addToGallery(hex, url, relay) }
|
||||
viewModelScope.launch(Dispatchers.IO) { account.addToGallery(hex, url, relay, blurhash, dim, hash, mimeType) }
|
||||
}
|
||||
|
||||
fun removefromMediaGallery(note: Note) {
|
||||
|
||||
@@ -34,9 +34,12 @@ import androidx.compose.animation.slideOutVertically
|
||||
import androidx.compose.animation.togetherWith
|
||||
import androidx.compose.foundation.layout.Box
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.consumeWindowInsets
|
||||
import androidx.compose.foundation.layout.defaultMinSize
|
||||
import androidx.compose.foundation.layout.imePadding
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.layout.statusBarsPadding
|
||||
import androidx.compose.foundation.layout.systemBarsPadding
|
||||
import androidx.compose.material3.DrawerValue
|
||||
import androidx.compose.material3.ExperimentalMaterial3Api
|
||||
import androidx.compose.material3.ModalBottomSheet
|
||||
@@ -487,10 +490,11 @@ private fun MainScaffold(
|
||||
) {
|
||||
Column(
|
||||
modifier =
|
||||
Modifier.padding(
|
||||
top = it.calculateTopPadding(),
|
||||
bottom = it.calculateBottomPadding(),
|
||||
),
|
||||
Modifier
|
||||
.padding(it)
|
||||
.consumeWindowInsets(it)
|
||||
.systemBarsPadding()
|
||||
.imePadding(),
|
||||
) {
|
||||
AppNavigation(
|
||||
homeFeedViewModel = homeFeedViewModel,
|
||||
|
||||
@@ -65,8 +65,8 @@ private val DarkColorPalette =
|
||||
primary = Purple200,
|
||||
secondary = Teal200,
|
||||
tertiary = Teal200,
|
||||
background = Color(0xFF000000),
|
||||
surface = Color(0xFF000000),
|
||||
background = Color(red = 0, green = 0, blue = 0),
|
||||
surface = Color(red = 0, green = 0, blue = 0),
|
||||
surfaceVariant = Color(red = 29, green = 26, blue = 34),
|
||||
)
|
||||
|
||||
@@ -451,14 +451,13 @@ fun AmethystTheme(
|
||||
if (!view.isInEditMode) {
|
||||
SideEffect {
|
||||
val window = (view.context as Activity).window
|
||||
val insetsController = WindowCompat.getInsetsController(window, view)
|
||||
if (darkTheme) {
|
||||
window.statusBarColor = colors.background.toArgb()
|
||||
} else {
|
||||
window.statusBarColor = colors.primary.toArgb()
|
||||
}
|
||||
val insets = WindowCompat.getInsetsController(window, view)
|
||||
|
||||
insets.isAppearanceLightNavigationBars = !darkTheme
|
||||
insets.isAppearanceLightStatusBars = !darkTheme
|
||||
|
||||
window.statusBarColor = colors.background.toArgb()
|
||||
window.navigationBarColor = colors.background.toArgb()
|
||||
insetsController.isAppearanceLightNavigationBars = !darkTheme
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
<string name="post_was_hidden">Esta publicación se ocultó porque menciona tus usuarios o palabras ocultas</string>
|
||||
<string name="post_was_flagged_as_inappropriate_by">Post marcado como inapropiado por</string>
|
||||
<string name="post_not_found">El evento se está cargando o no se puede encontrar en la lista de relés</string>
|
||||
<string name="post_not_found_short">👀</string>
|
||||
<string name="channel_image">Imagen del canal</string>
|
||||
<string name="referenced_event_not_found">Evento referenciado no encontrado</string>
|
||||
<string name="could_not_decrypt_the_message">No se pudo desencriptar el mensaje</string>
|
||||
@@ -132,6 +133,7 @@
|
||||
<string name="conversations">Conversaciones</string>
|
||||
<string name="notes">Notas</string>
|
||||
<string name="replies">Respuestas</string>
|
||||
<string name="gallery">Galería</string>
|
||||
<string name="follows">"Siguiendo"</string>
|
||||
<string name="reports">"Reportes"</string>
|
||||
<string name="more_options">Más opciones</string>
|
||||
@@ -255,6 +257,8 @@
|
||||
<string name="quick_action_delete">Eliminar</string>
|
||||
<string name="quick_action_unfollow">Dejar de seguir</string>
|
||||
<string name="quick_action_follow">Seguir</string>
|
||||
<string name="quick_action_request_deletion_gallery_title">Eliminar de la galería</string>
|
||||
<string name="quick_action_request_deletion_gallery_alert_body">Elimina este contenido multimedia de la galería, aunque puedes volver a agregarlo luego.</string>
|
||||
<string name="quick_action_request_deletion_alert_title">Solicitar eliminación</string>
|
||||
<string name="quick_action_request_deletion_alert_body">Amethyst solicitará que se elimine su nota de los relays a los que está conectado actualmente. No hay garantía de que su nota se elimine permanentemente de esos relays, o de otros relays donde pueda almacenarse.</string>
|
||||
<string name="quick_action_block_dialog_btn">Bloquear</string>
|
||||
@@ -517,6 +521,7 @@
|
||||
<string name="share_or_save">Compartir o guardar</string>
|
||||
<string name="copy_url_to_clipboard">Copiar URL al portapapeles</string>
|
||||
<string name="copy_the_note_id_to_the_clipboard">Copiar ID de la nota al portapapeles</string>
|
||||
<string name="add_media_to_gallery">Agregar contenido multimedia a la galería</string>
|
||||
<string name="created_at">Creado</string>
|
||||
<string name="rules">Reglas</string>
|
||||
<string name="login_with_external_signer">Iniciar sesión con Amber</string>
|
||||
@@ -720,6 +725,8 @@
|
||||
<string name="private_outbox_section_explainer">Inserta entre 1 y 3 relés para almacenar eventos que nadie más pueda ver, como los borradores o la configuración de la app. Lo ideal es que estos relés sean locales o requieran autenticación antes de descargar el contenido de cada usuario.</string>
|
||||
<string name="kind_3_section">Relés generales</string>
|
||||
<string name="kind_3_section_description">Amethyst usa estos relés para descargar publicaciones por ti.</string>
|
||||
<string name="kind_3_recommended_section">Relés recomendados</string>
|
||||
<string name="kind_3_recommended_section_description">Agrega los siguientes relés a la lista de relés generales para recibir publicaciones de los usuarios de la lista.</string>
|
||||
<string name="search_section">Relés de búsqueda</string>
|
||||
<string name="search_section_explainer">Lista de relés que se usarán al buscar contenido o usuarios. El etiquetado y la búsqueda no funcionarán si no hay opciones disponibles. Asegúrate de que implementen NIP-50.</string>
|
||||
<string name="local_section">Relés locales</string>
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
<string name="post_was_hidden">Esta publicación se ocultó porque menciona tus usuarios o palabras ocultas</string>
|
||||
<string name="post_was_flagged_as_inappropriate_by">La publicación fue reportada por</string>
|
||||
<string name="post_not_found">El evento se está cargando o no se puede encontrar en la lista de relés</string>
|
||||
<string name="post_not_found_short">👀</string>
|
||||
<string name="channel_image">Imagen del canal</string>
|
||||
<string name="referenced_event_not_found">No se encontró el evento referenciado</string>
|
||||
<string name="could_not_decrypt_the_message">No se pudo desencriptar el mensaje</string>
|
||||
@@ -132,6 +133,7 @@
|
||||
<string name="conversations">Conversaciones</string>
|
||||
<string name="notes">Notas</string>
|
||||
<string name="replies">Respuestas</string>
|
||||
<string name="gallery">Galería</string>
|
||||
<string name="follows">"Seguidos"</string>
|
||||
<string name="reports">"Reportes"</string>
|
||||
<string name="more_options">Más opciones</string>
|
||||
@@ -255,6 +257,8 @@
|
||||
<string name="quick_action_delete">Eliminar</string>
|
||||
<string name="quick_action_unfollow">Dejar de seguir</string>
|
||||
<string name="quick_action_follow">Seguir</string>
|
||||
<string name="quick_action_request_deletion_gallery_title">Eliminar de la galería</string>
|
||||
<string name="quick_action_request_deletion_gallery_alert_body">Elimina este contenido multimedia de la galería, aunque puedes volver a agregarlo luego.</string>
|
||||
<string name="quick_action_request_deletion_alert_title">Solicitar eliminación</string>
|
||||
<string name="quick_action_request_deletion_alert_body">Amethyst solicitará que se elimine la nota de los relés con los que tienes conexión actualmente. No hay garantía de que la nota se elimine permanentemente de esos relés o de otros donde pueda estar guardada.</string>
|
||||
<string name="quick_action_block_dialog_btn">Bloquear</string>
|
||||
@@ -517,6 +521,7 @@
|
||||
<string name="share_or_save">Compartir o guardar</string>
|
||||
<string name="copy_url_to_clipboard">Copiar URL al portapapeles</string>
|
||||
<string name="copy_the_note_id_to_the_clipboard">Copiar ID de la nota al portapapeles</string>
|
||||
<string name="add_media_to_gallery">Agregar contenido multimedia a la galería</string>
|
||||
<string name="created_at">Creado</string>
|
||||
<string name="rules">Reglas</string>
|
||||
<string name="login_with_external_signer">Iniciar sesión con Amber</string>
|
||||
@@ -720,6 +725,8 @@
|
||||
<string name="private_outbox_section_explainer">Inserta entre 1 y 3 relés para almacenar eventos que nadie más pueda ver, como los borradores o la configuración de la app. Lo ideal es que estos relés sean locales o requieran autenticación antes de descargar el contenido de cada usuario.</string>
|
||||
<string name="kind_3_section">Relés generales</string>
|
||||
<string name="kind_3_section_description">Amethyst usa estos relés para descargar publicaciones por ti.</string>
|
||||
<string name="kind_3_recommended_section">Relés recomendados</string>
|
||||
<string name="kind_3_recommended_section_description">Agrega los siguientes relés a la lista de relés generales para recibir publicaciones de los usuarios de la lista.</string>
|
||||
<string name="search_section">Relés de búsqueda</string>
|
||||
<string name="search_section_explainer">Lista de relés que se usarán al buscar contenido o usuarios. El etiquetado y la búsqueda no funcionarán si no hay opciones disponibles. Asegúrate de que implementen NIP-50.</string>
|
||||
<string name="local_section">Relés locales</string>
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
<string name="post_was_hidden">Esta publicación se ocultó porque menciona tus usuarios o palabras ocultas</string>
|
||||
<string name="post_was_flagged_as_inappropriate_by">La publicación fue reportada por</string>
|
||||
<string name="post_not_found">El evento se está cargando o no se puede encontrar en la lista de relés</string>
|
||||
<string name="post_not_found_short">👀</string>
|
||||
<string name="channel_image">Imagen del canal</string>
|
||||
<string name="referenced_event_not_found">No se encontró el evento referenciado</string>
|
||||
<string name="could_not_decrypt_the_message">No se pudo desencriptar el mensaje</string>
|
||||
@@ -132,6 +133,7 @@
|
||||
<string name="conversations">Conversaciones</string>
|
||||
<string name="notes">Notas</string>
|
||||
<string name="replies">Respuestas</string>
|
||||
<string name="gallery">Galería</string>
|
||||
<string name="follows">"Seguidos"</string>
|
||||
<string name="reports">"Reportes"</string>
|
||||
<string name="more_options">Más opciones</string>
|
||||
@@ -255,6 +257,8 @@
|
||||
<string name="quick_action_delete">Eliminar</string>
|
||||
<string name="quick_action_unfollow">Dejar de seguir</string>
|
||||
<string name="quick_action_follow">Seguir</string>
|
||||
<string name="quick_action_request_deletion_gallery_title">Eliminar de la galería</string>
|
||||
<string name="quick_action_request_deletion_gallery_alert_body">Elimina este contenido multimedia de la galería, aunque puedes volver a agregarlo luego.</string>
|
||||
<string name="quick_action_request_deletion_alert_title">Solicitar eliminación</string>
|
||||
<string name="quick_action_request_deletion_alert_body">Amethyst solicitará que se elimine la nota de los relés con los que tienes conexión actualmente. No hay garantía de que la nota se elimine permanentemente de esos relés o de otros donde pueda estar guardada.</string>
|
||||
<string name="quick_action_block_dialog_btn">Bloquear</string>
|
||||
@@ -517,6 +521,7 @@
|
||||
<string name="share_or_save">Compartir o guardar</string>
|
||||
<string name="copy_url_to_clipboard">Copiar URL al portapapeles</string>
|
||||
<string name="copy_the_note_id_to_the_clipboard">Copiar ID de la nota al portapapeles</string>
|
||||
<string name="add_media_to_gallery">Agregar contenido multimedia a la galería</string>
|
||||
<string name="created_at">Creado</string>
|
||||
<string name="rules">Reglas</string>
|
||||
<string name="login_with_external_signer">Iniciar sesión con Amber</string>
|
||||
@@ -720,6 +725,8 @@
|
||||
<string name="private_outbox_section_explainer">Inserta entre 1 y 3 relés para almacenar eventos que nadie más pueda ver, como los borradores o la configuración de la app. Lo ideal es que estos relés sean locales o requieran autenticación antes de descargar el contenido de cada usuario.</string>
|
||||
<string name="kind_3_section">Relés generales</string>
|
||||
<string name="kind_3_section_description">Amethyst usa estos relés para descargar publicaciones por ti.</string>
|
||||
<string name="kind_3_recommended_section">Relés recomendados</string>
|
||||
<string name="kind_3_recommended_section_description">Agrega los siguientes relés a la lista de relés generales para recibir publicaciones de los usuarios de la lista.</string>
|
||||
<string name="search_section">Relés de búsqueda</string>
|
||||
<string name="search_section_explainer">Lista de relés que se usarán al buscar contenido o usuarios. El etiquetado y la búsqueda no funcionarán si no hay opciones disponibles. Asegúrate de que implementen NIP-50.</string>
|
||||
<string name="local_section">Relés locales</string>
|
||||
|
||||
@@ -725,6 +725,8 @@
|
||||
<string name="private_outbox_section_explainer">१ - ३ पुनःप्रसारकों को जोडें उन घटनाओं को रखने के लिए जो कोई अन्य नहीं देख सकता जैसे कि पाण्डुलिपियाँ अथवा क्रमक के स्थापना विकल्प। आदर्शतः ये पुनःप्रसारक स्थानीय होने चाहिए अथवा प्रत्येक उपयोगकर्ता के विषयवस्तु अवरोहण के पूर्व परिचय प्रमाणीकरण अनिवार्य होना चाहिए।</string>
|
||||
<string name="kind_3_section">सामान्य पुनःप्रसारक</string>
|
||||
<string name="kind_3_section_description">अमेथिस्ट इन पुनःप्रसारकों का प्रयोग करता है आपके पत्रों का अवरोहण करने के लिए।</string>
|
||||
<string name="kind_3_recommended_section">पुनःशंसित पुनःप्रसारक</string>
|
||||
<string name="kind_3_recommended_section_description">सूचित उपयोगकर्ताओं के पत्र प्राप्त करने के लिए निम्नलिखित पुनःप्रसारकों को अपने सामान्य पुनःप्रसारक सूची में जोडें।</string>
|
||||
<string name="search_section">खोज पुनःप्रसारक</string>
|
||||
<string name="search_section_explainer">पुनःप्रसारकों की सूची जिनको किसी विषयवस्तु अथवा उपयोगकर्ताओं को खोजने में प्रयोग करना चाहिए। कोई विकल्प नहीं तो उपयोगकर्ता सूचक जोडना तथा खोज निष्क्रिय होंगे। सुनिश्चित करें कि वे निप॰-५० को कार्यान्वित किये हैं।</string>
|
||||
<string name="local_section">स्थानीय पुनःप्रसारक</string>
|
||||
|
||||
@@ -9,11 +9,13 @@
|
||||
<string name="post_was_hidden">Ez a bejegyzés el lett rejtve, mert említ rejtett felhasználóidat vagy szavaidat</string>
|
||||
<string name="post_was_flagged_as_inappropriate_by">A bejegyzést nem megfelelőként jelölte meg</string>
|
||||
<string name="post_not_found">Bejegyzés nem található</string>
|
||||
<string name="post_not_found_short">👀</string>
|
||||
<string name="channel_image">Csatorna Kép</string>
|
||||
<string name="referenced_event_not_found">A hivatkozott esemény nem található</string>
|
||||
<string name="could_not_decrypt_the_message">Az üzenet dekódolása sikertelen</string>
|
||||
<string name="group_picture">Csoport Kép</string>
|
||||
<string name="explicit_content">Szókimondó tartalom</string>
|
||||
<string name="spam">Spam</string>
|
||||
<string name="spam_description">Ebből a csomópontból érkező spam események száma</string>
|
||||
<string name="impersonation">Megszemélyesítés</string>
|
||||
<string name="illegal_behavior">Illegális viselkedés</string>
|
||||
@@ -35,6 +37,7 @@
|
||||
<string name="report_impersonation">Megszemélyesítés bejelentés</string>
|
||||
<string name="report_explicit_content">Szókimondó tartalom bejelentés</string>
|
||||
<string name="report_illegal_behaviour">Illegális viselkedés bejelentés</string>
|
||||
<string name="report_malware">Vírus bejelentése</string>
|
||||
<string name="login_with_a_private_key_to_be_able_to_reply">Jelentkezzen be privát kulccsal, hogy válaszolni tudjon</string>
|
||||
<string name="login_with_a_private_key_to_be_able_to_boost_posts">Jelentkezzen be privát kulccsal a bejegyzések megosztásához</string>
|
||||
<string name="login_with_a_private_key_to_like_posts">Jelentkezzen be privát kulccsal a bejegyzések kedveléséhez</string>
|
||||
@@ -52,6 +55,7 @@
|
||||
<string name="edited_number">szerkesztés #%1$s</string>
|
||||
<string name="original">eredeti</string>
|
||||
<string name="quote">Idézet</string>
|
||||
<string name="fork">Tükrözés</string>
|
||||
<string name="propose_an_edit">Szerkesztési javaslat</string>
|
||||
<string name="new_amount_in_sats">Új összeg sats-ban</string>
|
||||
<string name="add">Hozzáad</string>
|
||||
@@ -129,6 +133,7 @@
|
||||
<string name="conversations">Beszélgetések</string>
|
||||
<string name="notes">Bejegyzések</string>
|
||||
<string name="replies">Válaszok</string>
|
||||
<string name="gallery">Galéria</string>
|
||||
<string name="follows">"Követek"</string>
|
||||
<string name="reports">"Jelentések"</string>
|
||||
<string name="more_options">Több beállítás</string>
|
||||
@@ -251,6 +256,8 @@
|
||||
<string name="quick_action_delete">Törlés</string>
|
||||
<string name="quick_action_unfollow">Kikövetés</string>
|
||||
<string name="quick_action_follow">Követem</string>
|
||||
<string name="quick_action_request_deletion_gallery_title">Törlés a Galériából</string>
|
||||
<string name="quick_action_request_deletion_gallery_alert_body">Távolítsa el ezt a médiát a galériából, később elolvashatod</string>
|
||||
<string name="quick_action_request_deletion_alert_title">Törlés Kérése</string>
|
||||
<string name="quick_action_request_deletion_alert_body">Az Amethyst kérni fogja, hogy töröljék a bejegyzésed azokról a csomópontokról, amelyekhez jelenleg csatlakozol. Nincs garancia arra, hogy a bejegyzésed ezekről a csomópontokról vagy más közvetítőkből (ahol tárolni lehet) véglegesen törlődik.</string>
|
||||
<string name="quick_action_block_dialog_btn">Tiltás</string>
|
||||
@@ -264,6 +271,7 @@
|
||||
<string name="report_dialog_impersonation">Rosszindulatú megszemélyesítés</string>
|
||||
<string name="report_dialog_nudity">Meztelenség vagy pornográf tartalom</string>
|
||||
<string name="report_dialog_illegal">Illegális viselkedés</string>
|
||||
<string name="report_dialog_malware">Vírus</string>
|
||||
<string name="report_dialog_blocking_a_user">Az alkalmazásban egy felhasználó letiltása minden hozzá köthető tartalmat elrejt. Jegyzeteid továbbra is nyilvánosan megtekinthetők, beleértve a letiltott személyek számára is. A letiltott felhasználók a Biztonsági szűrők felületen jelennek meg.</string>
|
||||
<string name="report_dialog_block_hide_user_btn"><![CDATA[Felhasználó Tiltása és Elrejtése]]></string>
|
||||
<string name="report_dialog_report_btn">Visszaélés jelentése</string>
|
||||
@@ -301,6 +309,7 @@
|
||||
<string name="poll_zap_value_min">Minimum Zap</string>
|
||||
<string name="poll_zap_value_max">Maximum Zap</string>
|
||||
<string name="poll_consensus_threshold">Konszenzus</string>
|
||||
<string name="poll_consensus_threshold_percent">(0–100)%</string>
|
||||
<string name="poll_closing_time">Szavazás lezárása</string>
|
||||
<string name="poll_closing_time_days">napok</string>
|
||||
<string name="poll_unable_to_vote">Nem lehet szavazni</string>
|
||||
@@ -335,6 +344,14 @@
|
||||
<string name="zap_type_nonzap_explainer">Nostr-ban nyoma sincs, csak a Lightning-ben</string>
|
||||
<string name="file_server">Fájl Szerver</string>
|
||||
<string name="zap_forward_lnAddress">LnCím vagy @Felhasználó</string>
|
||||
<string name="media_servers">Média Szerverek</string>
|
||||
<string name="set_preferred_media_servers">Állítsd be a kívánt médiafeltöltő szervereket.</string>
|
||||
<string name="no_media_server_message">Nincs beállítva egyéni médiaszerver. Használhatod az Amethyst listáját, vagy alább hozzáadhatsz egyet ↓</string>
|
||||
<string name="built_in_media_servers_title">Beépített médiaszerverek</string>
|
||||
<string name="built_in_servers_description">Az Amethist alapértelmezett listája. Hozzáadhatod őket egyenként, vagy hozzáadhatod az egész listát.</string>
|
||||
<string name="use_default_servers">Az alapértelmezett lista használata</string>
|
||||
<string name="add_media_server">Médiaszerver hozzáadása</string>
|
||||
<string name="delete_media_server">Médiaszerver törlése</string>
|
||||
<string name="upload_server_relays_nip95">Saját csomópontjaid (NIP-95)</string>
|
||||
<string name="upload_server_relays_nip95_explainer">A fájlokat a csomópontokra töltik fel és ott tárolják. Rögzített URL-től mentesek (harmadik féltől való függőség). Győződj meg róla, hogy legalább egy NIP-95 csomópont a csomópontlistában szerepel</string>
|
||||
<string name="connect_via_tor_short">Tor/Orbot beállítása</string>
|
||||
@@ -363,6 +380,7 @@
|
||||
<string name="app_notification_dms_channel_description">Értesítést küld, amikor privát üzeneted érkezik</string>
|
||||
<string name="app_notification_zaps_channel_name">Zap-et kaptál</string>
|
||||
<string name="app_notification_zaps_channel_description">Értesítést küld, amikor valaki neked Zap-et küldött</string>
|
||||
<string name="app_notification_zaps_channel_message">%1$s sats</string>
|
||||
<string name="app_notification_zaps_channel_message_from">%1$s -tól</string>
|
||||
<string name="app_notification_zaps_channel_message_for">%1$s -ért</string>
|
||||
<string name="reply_notify">Értesítés: </string>
|
||||
@@ -414,6 +432,7 @@
|
||||
<string name="minimum_pow">Minimális PoW</string>
|
||||
<string name="auth">Azonosítás</string>
|
||||
<string name="payment">Fizetés</string>
|
||||
<string name="cashu">Cashu Token</string>
|
||||
<string name="cashu_redeem">Beváltás</string>
|
||||
<string name="cashu_redeem_to_zap">Küldje a Zap tárcába</string>
|
||||
<string name="cashu_redeem_to_cashu">Nyissa meg a Cashu tárcában</string>
|
||||
@@ -442,6 +461,7 @@
|
||||
<string name="settings">Beállítások</string>
|
||||
<string name="connectivity_type_always">Mindig</string>
|
||||
<string name="connectivity_type_wifi_only">Csak WIFI</string>
|
||||
<string name="connectivity_type_unmetered_wifi_only">Korlátlan WiFi</string>
|
||||
<string name="connectivity_type_never">Soha</string>
|
||||
<string name="ui_feature_set_type_complete">Teljes</string>
|
||||
<string name="ui_feature_set_type_simplified">Egyszerűsített</string>
|
||||
@@ -500,6 +520,7 @@
|
||||
<string name="share_or_save">Megosztás vagy Mentés</string>
|
||||
<string name="copy_url_to_clipboard">Az URL vágólapra másolása</string>
|
||||
<string name="copy_the_note_id_to_the_clipboard">A bejegyzésazonosító vágólapra másolása</string>
|
||||
<string name="add_media_to_gallery">Média hozzáadása a galériához</string>
|
||||
<string name="created_at">Létrehozva</string>
|
||||
<string name="rules">Szabályok</string>
|
||||
<string name="login_with_external_signer">Bejelentkezés Amber-el</string>
|
||||
@@ -530,6 +551,7 @@
|
||||
<string name="missing_lud16">Hiányzó lightning beállítás</string>
|
||||
<string name="user_x_does_not_have_a_lightning_address_setup_to_receive_sats">A %1$s felhasználó a sat fogadáshoz nem rendelkezik LN cím beállítással</string>
|
||||
<string name="zap_split_weight">Százalék</string>
|
||||
<string name="zap_split_weight_placeholder">25</string>
|
||||
<string name="splitting_zaps_with">Zap-ek megosztása</string>
|
||||
<string name="forwarding_zaps_to">Zap-ek továbbítása</string>
|
||||
<string name="lightning_wallets_not_found2">Lightning tárca nem található</string>
|
||||
@@ -596,9 +618,11 @@
|
||||
<string name="hi_there_is_this_still_available">Szia, ez még aktuális?</string>
|
||||
<string name="classifieds">Elem eladása</string>
|
||||
<string name="classifieds_title">Cím</string>
|
||||
<string name="classifieds_title_placeholder">iPhone 13</string>
|
||||
<string name="classifieds_condition">Állapot</string>
|
||||
<string name="classifieds_category">Kategória</string>
|
||||
<string name="classifieds_price">Ár (satoshiban)</string>
|
||||
<string name="classifieds_price_placeholder">1000</string>
|
||||
<string name="classifieds_location">Helyszín</string>
|
||||
<string name="classifieds_location_placeholder">Város, állam, ország</string>
|
||||
<string name="classifieds_condition_new">Új</string>
|
||||
@@ -617,6 +641,7 @@
|
||||
<string name="classifieds_category_books">Könyvek</string>
|
||||
<string name="classifieds_category_pets">Háziállatok</string>
|
||||
<string name="classifieds_category_sports">Sport</string>
|
||||
<string name="classifieds_category_fitness">Fitnesz</string>
|
||||
<string name="classifieds_category_art">Művészet</string>
|
||||
<string name="classifieds_category_crafts">Iparművészet</string>
|
||||
<string name="classifieds_category_home">Otthon</string>
|
||||
@@ -631,6 +656,8 @@
|
||||
<string name="server_did_not_provide_a_url_after_uploading">A szerver a feltöltés után nem adott URL-t</string>
|
||||
<string name="could_not_download_from_the_server">Nem sikerült a szerverről a feltöltött médiát letölteni</string>
|
||||
<string name="could_not_prepare_local_file_to_upload">Nem sikerült előkészíteni a helyi fájlt a feltöltésre: %1$s</string>
|
||||
<string name="failed_to_upload_with_message">Nem sikerült feltölteni: %1$s</string>
|
||||
<string name="failed_to_delete_with_message">Nem sikerült törölni: %1$s</string>
|
||||
<string name="edit_draft">Piszkozat szerkesztése</string>
|
||||
<string name="login_with_qr_code">Bejelentkezés QR kóddal</string>
|
||||
<string name="route">Útvonal</string>
|
||||
@@ -649,6 +676,9 @@
|
||||
<string name="close_all_reactions_to_this_post">Zárja be a bejegyzésre adott összes reakciót</string>
|
||||
<string name="reply_description">Válasz</string>
|
||||
<string name="boost_or_quote_description">Megosztás vagy Idézés</string>
|
||||
<string name="like_description">Like</string>
|
||||
<string name="zap_description">Zap</string>
|
||||
<string name="change_reaction">Változtasd meg a gyors reakciókat</string>
|
||||
<string name="profile_image_of_user">%1$s profilképe</string>
|
||||
<string name="relay_info">%1$s csomópont</string>
|
||||
<string name="expand_relay_list">Csomópont lista kibontása</string>
|
||||
@@ -694,6 +724,8 @@
|
||||
<string name="private_outbox_section_explainer">Adj hozzá 1–3 csomópontot, hogy olyan eseményeket tároljon, amelyeket senki más nem láthat, például a piszkozataidat és/vagy az alkalmazásbeállításaidat. Ideális esetben ezek a csomópontok vagy helyiek, vagy az egyes felhasználók tartalmának letöltése előtt hitelesítést igényelnek.</string>
|
||||
<string name="kind_3_section">Általános Csomópontok</string>
|
||||
<string name="kind_3_section_description">Az Amethyst ezeket a csomópontokat a bejegyzések letöltésére használja.</string>
|
||||
<string name="kind_3_recommended_section">Ajánlott csomópontok</string>
|
||||
<string name="kind_3_recommended_section_description">Add hozzá a következő csomópontokat az Általános Csomópontok listájához, hogy a felsorolt felhasználóktól üzeneteket kapj.</string>
|
||||
<string name="search_section">Kereső Csomópontok</string>
|
||||
<string name="search_section_explainer">A tartalom vagy a felhasználók kereséséhez használt csomópontok listája. A címkézés és a keresés nem működik, ha itt nincsenek megadott lehetőségek. Győződj meg arról, hogy alkalmazzák a NIP-50-et.</string>
|
||||
<string name="local_section">Helyi Csomópontok</string>
|
||||
@@ -705,10 +737,14 @@
|
||||
<string name="this_version_brought_to_you_by">Ezt a verziót hozta neked:</string>
|
||||
<string name="version_name">%1$s verzió</string>
|
||||
<string name="thank_you">Köszönöm!</string>
|
||||
<string name="max_limit">Max Limit</string>
|
||||
<string name="restricted_writes">Korlátozott írások</string>
|
||||
<string name="forked_from">Fork-olva innen</string>
|
||||
<string name="forked_tag">FORK</string>
|
||||
<string name="git_repository">Git-tár: %1$s</string>
|
||||
<string name="git_web_address">Web:</string>
|
||||
<string name="git_clone_address">Klónoz:</string>
|
||||
<string name="existed_since">OTS: %1$s</string>
|
||||
<string name="ots_info_title">Időbélyeg igazolás</string>
|
||||
<string name="ots_info_description">Bizonyíték van arra, hogy ezt a bejegyzést valamikor %1$s előtt írták alá. A bizonyítékot ezen a napon és időpontban a Bitcoin blokkláncába bélyegezték.</string>
|
||||
<string name="edit_post">Bejegyzés szerkesztése</string>
|
||||
@@ -736,4 +772,34 @@
|
||||
<string name="dvm_requesting_job">Feladatot kér a DVM-től</string>
|
||||
<string name="nwc_payment_request">Fizetési kérelem elküldve, megerősítésére vár a tárcádtól</string>
|
||||
<string name="dvm_waiting_to_confirm_payment">Várakozás a DVM-re a fizetés megerősítésére vagy az eredmények elküldésére</string>
|
||||
<string name="http_status_400">Hibás kérés – A szerver nem tudja vagy nem akarja a kérést feldolgozni.</string>
|
||||
<string name="http_status_401">Jogosulatlan – A felhasználó nem rendelkezik érvényes hitelesítési adatokkal</string>
|
||||
<string name="http_status_402">Fizetés szükséges – A szerver fizetséget kér a kérés teljesítéséhez</string>
|
||||
<string name="http_status_403">Tiltott – A felhasználónak nincs hozzáférési joga a kérelem benyújtásához</string>
|
||||
<string name="http_status_404">Nem található – A szerver a kért címet nem találja</string>
|
||||
<string name="http_status_405">Módszer Nem Engedélyezett – A kiszolgáló támogatja a kérési módszert, de a célerőforrás nem</string>
|
||||
<string name="http_status_406">Nem elfogadható – A szerver nem talál olyan tartalmat, amely a kérést kielégítené.</string>
|
||||
<string name="http_status_407">Proxy hitelesítés szükséges – A felhasználó nem rendelkezik érvényes hitelesítési adatokkal</string>
|
||||
<string name="http_status_408">Kérelem időtúllépése – A szerver időtúllépés miatt valaki másra vár</string>
|
||||
<string name="http_status_409">Ütközés – A szerver nem tudja teljesíteni a kérést, mert az erőforrással konfliktus van</string>
|
||||
<string name="http_status_410">Eltűnt – A kért tartalmat a szerverről véglegesen törölték, és nem lesz visszaállítva</string>
|
||||
<string name="http_status_411">Kötelező hossz – A szerver elutasítja a kérést, mert nincs kellően definiálva</string>
|
||||
<string name="http_status_412">Előfeltétel nem sikerült – A fejlécben lévő kérés előfeltételeit, a szerver nem teljesíti</string>
|
||||
<string name="http_status_413">A kérés túl nagy – A kérés nagyobb, mint a szerver által meghatározott korlátok, és a szerver nem hajlandó feldolgozni</string>
|
||||
<string name="http_status_414">Túl hosszú URI – Az ügyfél által kért URL túl hosszú ahhoz, hogy a szerver feldolgozza. </string>
|
||||
<string name="http_status_415">Nem támogatott médiatípus – A kérés olyan médiaformátumot használ, amelyet a szerver nem támogat</string>
|
||||
<string name="http_status_416">Tartomány nem teljesíthető – A szerver nem tudja teljesíteni a kérés Tartomány fejlécében jelzett értéket. </string>
|
||||
<string name="http_status_417">Az elvárás nem sikerült – A szerver nem tudja teljesíteni a Várható kérés fejlécében jelzett követelményeket</string>
|
||||
<string name="http_status_426">Frissítés szükséges – A szerver megtagadja a kérés feldolgozását az aktuális protokoll használatával, hacsak az ügyfél nem frissít egy másik protokollra.</string>
|
||||
<string name="http_status_500">Belső szerverhiba – A szerver váratlan hibát észlelt, és nem tudja a kérést teljesíteni</string>
|
||||
<string name="http_status_501">Nincs végrehajtva – A szerver nem tudja a kérést teljesíteni, vagy nem ismeri fel a kérés módszerét</string>
|
||||
<string name="http_status_502">Rossz átjáró – A szerver átjáróként működik, és érvénytelen választ kapott a gazdagéptől</string>
|
||||
<string name="http_status_503">A szolgáltatás nem elérhető – Ez gyakran akkor fordul elő, ha a kiszolgáló túlterhelt vagy karbantartás miatt leáll</string>
|
||||
<string name="http_status_504">Átjáró Időtúllépés – A szerver átjáróként vagy proxyként működött, és a válaszra várva időtúllépés történt</string>
|
||||
<string name="http_status_505">A HTTP-verzió nem támogatott – A szerver a kérésben szereplő HTTP-verziót nem támogatja</string>
|
||||
<string name="http_status_506">Váltózó porbléma – A kiszolgálón belső konfigurációs hiba lépett fel</string>
|
||||
<string name="http_status_507">Elégtelen tárhely – A szervernek nincs elég tárhelye a kérés sikeres feldolgozásához</string>
|
||||
<string name="http_status_508">Hurok észlelve – A szerver a kérés feldolgozása közben végtelen hurkot észlel</string>
|
||||
<string name="http_status_511">Hálózati hitelesítés szükséges – A klienst a hálózat eléréséhez hitelesíteni kell</string>
|
||||
<string name="add_a_nip96_server">Adj hozzá egy NIP-96 szervert</string>
|
||||
</resources>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources xmlns:tools="http://schemas.android.com/tools">
|
||||
<style name="Theme.Amethyst" parent="Theme.AppCompat.Light.NoActionBar">
|
||||
<style name="Theme.Amethyst" parent="Theme.AppCompat.DayNight.NoActionBar">
|
||||
<item name="android:statusBarColor">@color/purple_700</item>
|
||||
<item name="android:windowBackground">@color/black</item>
|
||||
<item name="android:windowLayoutInDisplayCutoutMode" tools:ignore="NewApi">shortEdges</item>
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
<string name="impersonation">Podszywanie się</string>
|
||||
<string name="illegal_behavior">Antyspołeczne zachowanie</string>
|
||||
<string name="other">Inne</string>
|
||||
<string name="unknown">Nieznany</string>
|
||||
<string name="unknown">Nieznani</string>
|
||||
<string name="relay_icon">Ikona transmitera</string>
|
||||
<string name="unknown_author">Autor nieznany</string>
|
||||
<string name="copy_text">Skopiuj tekst</string>
|
||||
@@ -126,7 +126,7 @@
|
||||
<string name="copy_channel_id_note_to_the_clipboard">Kopiuj ID kanału (wpisu) do schowka</string>
|
||||
<string name="edits_the_channel_metadata">Edytuje metadane kanału</string>
|
||||
<string name="join">Dołącz</string>
|
||||
<string name="known">Popularne</string>
|
||||
<string name="known">Znajomi</string>
|
||||
<string name="new_requests">Nowe Prośby</string>
|
||||
<string name="blocked_users">Zablokowani użytkownicy</string>
|
||||
<string name="new_threads">Nowe Wpisy</string>
|
||||
@@ -725,6 +725,8 @@
|
||||
<string name="private_outbox_section_explainer">Wstaw od 1 do 3 transmiterów przechowujących dane zdarzeń, których nikt inny nie widzi, takich jak Wersje robocze i/lub ustawienia aplikacji. Idealnie byłoby, gdyby te transmitery były lokalne lub wymagały uwierzytelnienia przed pobraniem treści każdego użytkownika.</string>
|
||||
<string name="kind_3_section">Transmitery ogólne</string>
|
||||
<string name="kind_3_section_description">Amethyst używa tych przekaźników, aby pobrać dla Ciebie posty.</string>
|
||||
<string name="kind_3_recommended_section">Polecane Transmitery</string>
|
||||
<string name="kind_3_recommended_section_description">Dodaj te transmitery do głównej listy, aby otrzymywać wiadomości od wymienionych użytkowników.</string>
|
||||
<string name="search_section">Transmitery wyszukujące</string>
|
||||
<string name="search_section_explainer">Lista transmiterów używanych podczas wyszukiwania treści lub użytkowników. Tagowanie i wyszukiwanie nie będą działać, jeśli nie będą dostępne żadne opcje. Upewnij się, że zaimplementowano NIP-50.</string>
|
||||
<string name="local_section">Lokalne Transmitery</string>
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
# Add project specific ProGuard rules here.
|
||||
# You can control the set of applied configuration files using the
|
||||
# proguardFiles setting in build.gradle.
|
||||
#
|
||||
# For more details, see
|
||||
# http://developer.android.com/guide/developing/tools/proguard.html
|
||||
|
||||
# If your project uses WebView with JS, uncomment the following
|
||||
# and specify the fully qualified class name to the JavaScript interface
|
||||
# class:
|
||||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
||||
# public *;
|
||||
#}
|
||||
|
||||
# Uncomment this to preserve the line number information for
|
||||
# debugging stack traces.
|
||||
#-keepattributes SourceFile,LineNumberTable
|
||||
|
||||
# If you keep the line number information, uncomment this to
|
||||
# hide the original source file name.
|
||||
#-renamesourcefileattribute SourceFile
|
||||
# preserve the line number information for debugging stack traces.
|
||||
-dontobfuscate
|
||||
-keepattributes LocalVariableTable
|
||||
-keepattributes LocalVariableTypeTable
|
||||
-keepattributes *Annotation*
|
||||
-keepattributes SourceFile
|
||||
-keepattributes LineNumberTable
|
||||
-keepattributes Signature
|
||||
-keepattributes Exceptions
|
||||
-keepattributes InnerClasses
|
||||
-keepattributes EnclosingMethod
|
||||
-keepattributes MethodParameters
|
||||
-keepparameternames
|
||||
|
||||
-keepdirectories libs
|
||||
|
||||
# Keep all names
|
||||
-keepnames class ** { *; }
|
||||
|
||||
# Keep All enums
|
||||
-keep enum ** { *; }
|
||||
|
||||
-keep class com.vitorpamplona.ammolite.service.** { *; }
|
||||
-keep class com.vitorpamplona.ammolite.relays.** { *; }
|
||||
Vendored
+21
@@ -19,6 +19,27 @@
|
||||
# If you keep the line number information, uncomment this to
|
||||
# hide the original source file name.
|
||||
#-renamesourcefileattribute SourceFile
|
||||
# preserve the line number information for debugging stack traces.
|
||||
-dontobfuscate
|
||||
-keepattributes LocalVariableTable
|
||||
-keepattributes LocalVariableTypeTable
|
||||
-keepattributes *Annotation*
|
||||
-keepattributes SourceFile
|
||||
-keepattributes LineNumberTable
|
||||
-keepattributes Signature
|
||||
-keepattributes Exceptions
|
||||
-keepattributes InnerClasses
|
||||
-keepattributes EnclosingMethod
|
||||
-keepattributes MethodParameters
|
||||
-keepparameternames
|
||||
|
||||
-keepdirectories libs
|
||||
|
||||
# Keep all names
|
||||
-keepnames class ** { *; }
|
||||
|
||||
# Keep All enums
|
||||
-keep enum ** { *; }
|
||||
|
||||
-keep class com.vitorpamplona.ammolite.service.** { *; }
|
||||
-keep class com.vitorpamplona.ammolite.relays.** { *; }
|
||||
@@ -28,7 +28,10 @@ import kotlinx.coroutines.DelicateCoroutinesApi
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.GlobalScope
|
||||
import kotlinx.coroutines.launch
|
||||
import kotlinx.coroutines.runBlocking
|
||||
import java.util.UUID
|
||||
import java.util.concurrent.CountDownLatch
|
||||
import java.util.concurrent.TimeUnit
|
||||
|
||||
/**
|
||||
* The Nostr Client manages multiple personae the user may switch between. Events are received and
|
||||
@@ -110,7 +113,7 @@ object Client : RelayPool.Listener {
|
||||
checkNotInMainThread()
|
||||
|
||||
subscribe(
|
||||
object : Listener() {
|
||||
object : Listener {
|
||||
override fun onEvent(
|
||||
event: Event,
|
||||
subId: String,
|
||||
@@ -130,6 +133,87 @@ object Client : RelayPool.Listener {
|
||||
RelayPool.sendFilter(subscriptionId, filters)
|
||||
}
|
||||
|
||||
@OptIn(DelicateCoroutinesApi::class)
|
||||
suspend fun sendAndWaitForResponse(
|
||||
signedEvent: EventInterface,
|
||||
relay: String? = null,
|
||||
feedTypes: Set<FeedType>? = null,
|
||||
relayList: List<RelaySetupInfo>? = null,
|
||||
onDone: (() -> Unit)? = null,
|
||||
additionalListener: Listener? = null,
|
||||
timeoutInSeconds: Long = 15,
|
||||
): Boolean {
|
||||
checkNotInMainThread()
|
||||
|
||||
val size = if (relay != null) 1 else relayList?.size ?: RelayPool.availableRelays()
|
||||
val latch = CountDownLatch(size)
|
||||
val relayErrors = mutableMapOf<String, String>()
|
||||
var result = false
|
||||
|
||||
Log.d("sendAndWaitForResponse", "Waiting for $size responses")
|
||||
|
||||
val subscription =
|
||||
object : Listener {
|
||||
override fun onError(
|
||||
error: Error,
|
||||
subscriptionId: String,
|
||||
relay: Relay,
|
||||
) {
|
||||
relayErrors[relay.url]?.let {
|
||||
latch.countDown()
|
||||
}
|
||||
Log.d("sendAndWaitForResponse", "onError Error from relay ${relay.url} count: ${latch.count} error: $error")
|
||||
}
|
||||
|
||||
override fun onRelayStateChange(
|
||||
type: Relay.StateType,
|
||||
relay: Relay,
|
||||
subscriptionId: String?,
|
||||
) {
|
||||
if (type == Relay.StateType.DISCONNECT || type == Relay.StateType.EOSE) {
|
||||
latch.countDown()
|
||||
}
|
||||
if (type == Relay.StateType.CONNECT) {
|
||||
Log.d("sendAndWaitForResponse", "${type.name} Sending event to relay ${relay.url} count: ${latch.count}")
|
||||
relay.sendOverride(signedEvent)
|
||||
}
|
||||
Log.d("sendAndWaitForResponse", "onRelayStateChange ${type.name} from relay ${relay.url} count: ${latch.count}")
|
||||
}
|
||||
|
||||
override fun onSendResponse(
|
||||
eventId: String,
|
||||
success: Boolean,
|
||||
message: String,
|
||||
relay: Relay,
|
||||
) {
|
||||
if (eventId == signedEvent.id()) {
|
||||
if (success) {
|
||||
result = true
|
||||
}
|
||||
latch.countDown()
|
||||
Log.d("sendAndWaitForResponse", "onSendResponse Received response for $eventId from relay ${relay.url} count: ${latch.count} message $message success $success")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
subscribe(subscription)
|
||||
additionalListener?.let { subscribe(it) }
|
||||
|
||||
val job =
|
||||
GlobalScope.launch(Dispatchers.IO) {
|
||||
send(signedEvent, relay, feedTypes, relayList, onDone)
|
||||
}
|
||||
job.join()
|
||||
|
||||
runBlocking {
|
||||
latch.await(timeoutInSeconds, TimeUnit.SECONDS)
|
||||
}
|
||||
Log.d("sendAndWaitForResponse", "countdown finished")
|
||||
unsubscribe(subscription)
|
||||
additionalListener?.let { unsubscribe(it) }
|
||||
return result
|
||||
}
|
||||
|
||||
fun sendFilterOnlyIfDisconnected(
|
||||
subscriptionId: String = UUID.randomUUID().toString().substring(0..10),
|
||||
filters: List<TypedFilter> = listOf(),
|
||||
@@ -206,6 +290,7 @@ object Client : RelayPool.Listener {
|
||||
// }
|
||||
}
|
||||
|
||||
@OptIn(DelicateCoroutinesApi::class)
|
||||
override fun onSendResponse(
|
||||
eventId: String,
|
||||
success: Boolean,
|
||||
@@ -219,6 +304,7 @@ object Client : RelayPool.Listener {
|
||||
}
|
||||
}
|
||||
|
||||
@OptIn(DelicateCoroutinesApi::class)
|
||||
override fun onAuth(
|
||||
relay: Relay,
|
||||
challenge: String,
|
||||
@@ -228,6 +314,7 @@ object Client : RelayPool.Listener {
|
||||
GlobalScope.launch(Dispatchers.Default) { listeners.forEach { it.onAuth(relay, challenge) } }
|
||||
}
|
||||
|
||||
@OptIn(DelicateCoroutinesApi::class)
|
||||
override fun onNotify(
|
||||
relay: Relay,
|
||||
description: String,
|
||||
@@ -239,6 +326,7 @@ object Client : RelayPool.Listener {
|
||||
}
|
||||
}
|
||||
|
||||
@OptIn(DelicateCoroutinesApi::class)
|
||||
override fun onSend(
|
||||
relay: Relay,
|
||||
msg: String,
|
||||
@@ -249,6 +337,7 @@ object Client : RelayPool.Listener {
|
||||
}
|
||||
}
|
||||
|
||||
@OptIn(DelicateCoroutinesApi::class)
|
||||
override fun onBeforeSend(
|
||||
relay: Relay,
|
||||
event: EventInterface,
|
||||
@@ -258,6 +347,7 @@ object Client : RelayPool.Listener {
|
||||
}
|
||||
}
|
||||
|
||||
@OptIn(DelicateCoroutinesApi::class)
|
||||
override fun onError(
|
||||
error: Error,
|
||||
subscriptionId: String,
|
||||
@@ -282,7 +372,7 @@ object Client : RelayPool.Listener {
|
||||
|
||||
fun getSubscriptionFilters(subId: String): List<TypedFilter> = subscriptions[subId] ?: emptyList()
|
||||
|
||||
abstract class Listener {
|
||||
interface Listener {
|
||||
/** A new message was received */
|
||||
open fun onEvent(
|
||||
event: Event,
|
||||
|
||||
@@ -67,7 +67,7 @@ abstract class NostrDataSource(
|
||||
): Int = 31 * str1.hashCode() + str2.hashCode()
|
||||
|
||||
private val clientListener =
|
||||
object : Client.Listener() {
|
||||
object : Client.Listener {
|
||||
override fun onEvent(
|
||||
event: Event,
|
||||
subscriptionId: String,
|
||||
|
||||
@@ -75,6 +75,7 @@ class Relay(
|
||||
private var afterEOSEPerSubscription = mutableMapOf<String, Boolean>()
|
||||
|
||||
private val authResponse = mutableMapOf<HexKey, Boolean>()
|
||||
private val authChallengesSent = mutableSetOf<String>()
|
||||
private val outboxCache = mutableMapOf<HexKey, EventInterface>()
|
||||
|
||||
fun register(listener: Listener) {
|
||||
@@ -372,6 +373,9 @@ class Relay(
|
||||
|
||||
fun resetEOSEStatuses() {
|
||||
afterEOSEPerSubscription = LinkedHashMap(afterEOSEPerSubscription.size)
|
||||
|
||||
authResponse.clear()
|
||||
authChallengesSent.clear()
|
||||
}
|
||||
|
||||
fun sendFilter(
|
||||
@@ -492,8 +496,19 @@ class Relay(
|
||||
}
|
||||
|
||||
private fun sendAuth(signedEvent: RelayAuthEvent) {
|
||||
authResponse.put(signedEvent.id, false)
|
||||
writeToSocket("""["AUTH",${signedEvent.toJson()}]""")
|
||||
val challenge = signedEvent.challenge() ?: ""
|
||||
|
||||
// only send replies to new challenges to avoid infinite loop:
|
||||
// 1. Auth is sent
|
||||
// 2. auth is rejected
|
||||
// 3. auth is requested
|
||||
// 4. auth is sent
|
||||
// ...
|
||||
if (!authChallengesSent.contains(challenge)) {
|
||||
authResponse.put(signedEvent.id, false)
|
||||
authChallengesSent.add(challenge)
|
||||
writeToSocket("""["AUTH",${signedEvent.toJson()}]""")
|
||||
}
|
||||
}
|
||||
|
||||
private fun sendEvent(signedEvent: EventInterface) {
|
||||
|
||||
@@ -13,14 +13,14 @@ benchmark = "1.2.4"
|
||||
benchmarkJunit4 = "1.2.4"
|
||||
biometricKtx = "1.2.0-alpha05"
|
||||
blurhash = "1.0.0"
|
||||
coil = "2.6.0"
|
||||
coil = "2.7.0"
|
||||
composeBom = "2024.06.00"
|
||||
coreKtx = "1.13.1"
|
||||
espressoCore = "3.6.1"
|
||||
firebaseBom = "33.1.2"
|
||||
fragmentKtx = "1.8.1"
|
||||
gms = "4.4.2"
|
||||
jacksonModuleKotlin = "2.17.1"
|
||||
jacksonModuleKotlin = "2.17.2"
|
||||
jna = "5.14.0"
|
||||
junit = "4.13.2"
|
||||
kotlin = "2.0.0"
|
||||
|
||||
@@ -59,7 +59,7 @@ class FileServersEvent(
|
||||
servers
|
||||
.map {
|
||||
arrayOf("server", it)
|
||||
}.plusElement(arrayOf("alt", "Relay list to use for Search"))
|
||||
}.plusElement(arrayOf("alt", ALT))
|
||||
.toTypedArray()
|
||||
|
||||
fun updateRelayList(
|
||||
|
||||
Reference in New Issue
Block a user