Moves reactions to packages for their nips
This commit is contained in:
@@ -24,6 +24,8 @@ import androidx.compose.runtime.Stable
|
|||||||
import com.vitorpamplona.amethyst.BuildConfig
|
import com.vitorpamplona.amethyst.BuildConfig
|
||||||
import com.vitorpamplona.amethyst.LocalPreferences
|
import com.vitorpamplona.amethyst.LocalPreferences
|
||||||
import com.vitorpamplona.amethyst.commons.model.IAccount
|
import com.vitorpamplona.amethyst.commons.model.IAccount
|
||||||
|
import com.vitorpamplona.amethyst.commons.model.nip18Reposts.RepostAction
|
||||||
|
import com.vitorpamplona.amethyst.commons.model.nip25Reactions.ReactionAction
|
||||||
import com.vitorpamplona.amethyst.commons.richtext.RichTextParser
|
import com.vitorpamplona.amethyst.commons.richtext.RichTextParser
|
||||||
import com.vitorpamplona.amethyst.logTime
|
import com.vitorpamplona.amethyst.logTime
|
||||||
import com.vitorpamplona.amethyst.model.edits.PrivateStorageRelayListDecryptionCache
|
import com.vitorpamplona.amethyst.model.edits.PrivateStorageRelayListDecryptionCache
|
||||||
@@ -44,8 +46,6 @@ import com.vitorpamplona.amethyst.model.nip02FollowLists.Kind3FollowListState
|
|||||||
import com.vitorpamplona.amethyst.model.nip03Timestamp.OtsState
|
import com.vitorpamplona.amethyst.model.nip03Timestamp.OtsState
|
||||||
import com.vitorpamplona.amethyst.model.nip17Dms.DmInboxRelayState
|
import com.vitorpamplona.amethyst.model.nip17Dms.DmInboxRelayState
|
||||||
import com.vitorpamplona.amethyst.model.nip17Dms.DmRelayListState
|
import com.vitorpamplona.amethyst.model.nip17Dms.DmRelayListState
|
||||||
import com.vitorpamplona.amethyst.model.nip18Reposts.RepostAction
|
|
||||||
import com.vitorpamplona.amethyst.model.nip25Reactions.ReactionAction
|
|
||||||
import com.vitorpamplona.amethyst.model.nip28PublicChats.PublicChatChannel
|
import com.vitorpamplona.amethyst.model.nip28PublicChats.PublicChatChannel
|
||||||
import com.vitorpamplona.amethyst.model.nip28PublicChats.PublicChatListDecryptionCache
|
import com.vitorpamplona.amethyst.model.nip28PublicChats.PublicChatListDecryptionCache
|
||||||
import com.vitorpamplona.amethyst.model.nip28PublicChats.PublicChatListState
|
import com.vitorpamplona.amethyst.model.nip28PublicChats.PublicChatListState
|
||||||
|
|||||||
@@ -1,39 +0,0 @@
|
|||||||
/**
|
|
||||||
* Copyright (c) 2025 Vitor Pamplona
|
|
||||||
*
|
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
||||||
* this software and associated documentation files (the "Software"), to deal in
|
|
||||||
* the Software without restriction, including without limitation the rights to use,
|
|
||||||
* copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
|
|
||||||
* Software, and to permit persons to whom the Software is furnished to do so,
|
|
||||||
* subject to the following conditions:
|
|
||||||
*
|
|
||||||
* The above copyright notice and this permission notice shall be included in all
|
|
||||||
* copies or substantial portions of the Software.
|
|
||||||
*
|
|
||||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
|
||||||
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
|
||||||
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
|
||||||
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
||||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
||||||
*/
|
|
||||||
package com.vitorpamplona.amethyst.model.nip18Reposts
|
|
||||||
|
|
||||||
import com.vitorpamplona.amethyst.model.Note
|
|
||||||
import com.vitorpamplona.quartz.nip01Core.core.Event
|
|
||||||
import com.vitorpamplona.quartz.nip01Core.signers.NostrSigner
|
|
||||||
import com.vitorpamplona.amethyst.commons.actions.RepostAction as CommonsRepostAction
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Android wrapper - pure proxy to commons implementation.
|
|
||||||
* All logic and validation handled in commons.
|
|
||||||
*/
|
|
||||||
class RepostAction {
|
|
||||||
companion object {
|
|
||||||
suspend fun repost(
|
|
||||||
note: Note,
|
|
||||||
signer: NostrSigner,
|
|
||||||
): Event? = CommonsRepostAction.repost(note, signer)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
-45
@@ -1,45 +0,0 @@
|
|||||||
/**
|
|
||||||
* Copyright (c) 2025 Vitor Pamplona
|
|
||||||
*
|
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
||||||
* this software and associated documentation files (the "Software"), to deal in
|
|
||||||
* the Software without restriction, including without limitation the rights to use,
|
|
||||||
* copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
|
|
||||||
* Software, and to permit persons to whom the Software is furnished to do so,
|
|
||||||
* subject to the following conditions:
|
|
||||||
*
|
|
||||||
* The above copyright notice and this permission notice shall be included in all
|
|
||||||
* copies or substantial portions of the Software.
|
|
||||||
*
|
|
||||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
|
||||||
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
|
||||||
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
|
||||||
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
||||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
||||||
*/
|
|
||||||
package com.vitorpamplona.amethyst.model.nip25Reactions
|
|
||||||
|
|
||||||
import com.vitorpamplona.amethyst.model.Note
|
|
||||||
import com.vitorpamplona.amethyst.model.User
|
|
||||||
import com.vitorpamplona.quartz.nip01Core.signers.NostrSigner
|
|
||||||
import com.vitorpamplona.quartz.nip17Dm.NIP17Factory
|
|
||||||
import com.vitorpamplona.quartz.nip25Reactions.ReactionEvent
|
|
||||||
import com.vitorpamplona.amethyst.commons.actions.ReactionAction as CommonsReactionAction
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Android wrapper - pure proxy to commons implementation.
|
|
||||||
* All logic and validation handled in commons.
|
|
||||||
*/
|
|
||||||
class ReactionAction {
|
|
||||||
companion object {
|
|
||||||
suspend fun reactTo(
|
|
||||||
note: Note,
|
|
||||||
reaction: String,
|
|
||||||
by: User,
|
|
||||||
signer: NostrSigner,
|
|
||||||
onPublic: (ReactionEvent) -> Unit,
|
|
||||||
onPrivate: suspend (NIP17Factory.Result) -> Unit,
|
|
||||||
) = CommonsReactionAction.reactTo(note, reaction, by, signer, onPublic, onPrivate)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
+1
-1
@@ -18,7 +18,7 @@
|
|||||||
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
*/
|
*/
|
||||||
package com.vitorpamplona.amethyst.commons.actions
|
package com.vitorpamplona.amethyst.commons.model.nip18Reposts
|
||||||
|
|
||||||
import com.vitorpamplona.amethyst.commons.model.Note
|
import com.vitorpamplona.amethyst.commons.model.Note
|
||||||
import com.vitorpamplona.quartz.nip01Core.core.Event
|
import com.vitorpamplona.quartz.nip01Core.core.Event
|
||||||
+1
-1
@@ -18,7 +18,7 @@
|
|||||||
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
*/
|
*/
|
||||||
package com.vitorpamplona.amethyst.commons.actions
|
package com.vitorpamplona.amethyst.commons.model.nip25Reactions
|
||||||
|
|
||||||
import com.vitorpamplona.amethyst.commons.model.Note
|
import com.vitorpamplona.amethyst.commons.model.Note
|
||||||
import com.vitorpamplona.amethyst.commons.model.User
|
import com.vitorpamplona.amethyst.commons.model.User
|
||||||
@@ -40,10 +40,10 @@ import androidx.compose.ui.Alignment
|
|||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import com.vitorpamplona.amethyst.commons.account.AccountState
|
import com.vitorpamplona.amethyst.commons.account.AccountState
|
||||||
import com.vitorpamplona.amethyst.commons.actions.ReactionAction
|
|
||||||
import com.vitorpamplona.amethyst.commons.actions.RepostAction
|
|
||||||
import com.vitorpamplona.amethyst.commons.icons.Reply
|
import com.vitorpamplona.amethyst.commons.icons.Reply
|
||||||
import com.vitorpamplona.amethyst.commons.icons.Repost
|
import com.vitorpamplona.amethyst.commons.icons.Repost
|
||||||
|
import com.vitorpamplona.amethyst.commons.model.nip18Reposts.RepostAction
|
||||||
|
import com.vitorpamplona.amethyst.commons.model.nip25Reactions.ReactionAction
|
||||||
import com.vitorpamplona.amethyst.desktop.network.DesktopRelayConnectionManager
|
import com.vitorpamplona.amethyst.desktop.network.DesktopRelayConnectionManager
|
||||||
import com.vitorpamplona.quartz.nip01Core.core.Event
|
import com.vitorpamplona.quartz.nip01Core.core.Event
|
||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
|
|||||||
Reference in New Issue
Block a user