|
1 | 1 | import Services from '#services'
|
2 | 2 | import { encodeByNetwork } from '@masknet/encryption'
|
3 |
| -import { PluginID, PostIdentifier, Sniffings, SOCIAL_MEDIA_NAME } from '@masknet/shared-base' |
| 3 | +import { PluginID, Sniffings, SOCIAL_MEDIA_NAME } from '@masknet/shared-base' |
4 | 4 | import type { Meta } from '@masknet/typed-message'
|
5 | 5 | import { Telemetry } from '@masknet/web3-telemetry'
|
6 | 6 | import { EventID, EventType } from '@masknet/web3-telemetry/types'
|
@@ -51,42 +51,19 @@ export function useSubmit(onClose: () => void, reason: 'timeline' | 'popup' | 'r
|
51 | 51 | await SteganographyPayload(typeof rawEncrypted === 'string' ? encrypted : rawEncrypted)
|
52 | 52 | : undefined
|
53 | 53 |
|
54 |
| - if (activatedSiteAdaptorUI?.automation.endpoint?.publishPost && reason === 'timeline') { |
55 |
| - const postId = await activatedSiteAdaptorUI.automation.endpoint.publishPost( |
56 |
| - mediaObject ? [decoratedText || defaultText, mediaObject] : [decoratedText || defaultText], |
57 |
| - { |
58 |
| - reason, |
59 |
| - }, |
60 |
| - ) |
61 |
| - const postIdentifier = |
62 |
| - lastRecognizedIdentity.identifier && postId ? |
63 |
| - new PostIdentifier(lastRecognizedIdentity.identifier, postId) |
64 |
| - : undefined |
65 |
| - |
66 |
| - if (postIdentifier) { |
67 |
| - const postUrl = activatedSiteAdaptorUI.utils.getPostURL?.(postIdentifier) |
68 |
| - if (postUrl) location.assign(postUrl) |
69 |
| - } else if (postId) { |
70 |
| - location.reload() |
71 |
| - } |
| 54 | + if (encode === 'image') { |
| 55 | + if (!mediaObject) throw new Error('Failed to create image payload.') |
| 56 | + // Don't await this, otherwise the dialog won't disappear |
| 57 | + activatedSiteAdaptorUI?.automation.nativeCompositionDialog?.attachImage?.(mediaObject, { |
| 58 | + recover: true, |
| 59 | + relatedTextPayload: decoratedText || defaultText, |
| 60 | + reason, |
| 61 | + }) |
72 | 62 | } else {
|
73 |
| - if (encode === 'image') { |
74 |
| - if (!mediaObject) throw new Error('Failed to create image payload.') |
75 |
| - // Don't await this, otherwise the dialog won't disappear |
76 |
| - activatedSiteAdaptorUI?.automation.nativeCompositionDialog?.attachImage?.(mediaObject, { |
77 |
| - recover: true, |
78 |
| - relatedTextPayload: decoratedText || defaultText, |
79 |
| - reason, |
80 |
| - }) |
81 |
| - } else { |
82 |
| - activatedSiteAdaptorUI?.automation.nativeCompositionDialog?.attachText?.( |
83 |
| - decoratedText || defaultText, |
84 |
| - { |
85 |
| - recover: true, |
86 |
| - reason, |
87 |
| - }, |
88 |
| - ) |
89 |
| - } |
| 63 | + activatedSiteAdaptorUI?.automation.nativeCompositionDialog?.attachText?.(decoratedText || defaultText, { |
| 64 | + recover: true, |
| 65 | + reason, |
| 66 | + }) |
90 | 67 | }
|
91 | 68 |
|
92 | 69 | if (content.meta?.has(`${PluginID.RedPacket}:1`) || content.meta?.has(`${PluginID.RedPacket}_nft:1`))
|
|
0 commit comments