Move img.swipe notice block up
| @@ -2080,6 +2080,19 @@ async function onImageSwiped(messageId, element, direction) { | |||
| 2080 | return; | 2080 | return; |
| 2081 | } | 2081 | } |
| 2082 | 2082 | ||
| 2083 | // Show a message that swipe right no longer automatically generates an image | ||
| 2084 | if (direction === SWIPE_DIRECTION.RIGHT && message.extra.media_index === media.length - 1) { | ||
| 2085 | const key = 'imageSwipeNoticeShown'; | ||
| 2086 | const hasSeenNotice = accountStorage.getItem(key); | ||
| 2087 | if (!hasSeenNotice) { | ||
| 2088 | await Popup.show.text( | ||
| 2089 | t`Image swiping no longer automatically generates new images.`, | ||
| 2090 | t`Use the 'Generate Image' (paintbrush) button in the message actions menu to generate more images. This message will not be shown again.`, | ||
| 2091 | ); | ||
| 2092 | accountStorage.setItem(key, 'true'); | ||
| 2093 | } | ||
| 2094 | } | ||
| 2095 | |||
| 2083 | if (media.length === 1) { | 2096 | if (media.length === 1) { |
| 2084 | console.warn('Only one media item in the message, swiping is not applicable'); | 2097 | console.warn('Only one media item in the message, swiping is not applicable'); |
| 2085 | return; | 2098 | return; |
| @@ -2105,19 +2118,6 @@ async function onImageSwiped(messageId, element, direction) { | |||
| 2105 | message.extra.media_index = newIndex >= media.length ? 0 : newIndex; | 2118 | message.extra.media_index = newIndex >= media.length ? 0 : newIndex; |
| 2106 | } | 2119 | } |
| 2107 | 2120 | ||
| 2108 | // Show a message that swipe right no longer automatically generates an image | ||
| 2109 | if (media.length > 0 && direction === SWIPE_DIRECTION.RIGHT && message.extra.media_index === 0) { | ||
| 2110 | const key = 'imageSwipeNoticeShown'; | ||
| 2111 | const hasSeenNotice = accountStorage.getItem(key); | ||
| 2112 | if (!hasSeenNotice) { | ||
| 2113 | await Popup.show.text( | ||
| 2114 | t`Image swiping no longer automatically generates new images.`, | ||
| 2115 | t`Use the 'Generate Image' (paintbrush) button in the message actions menu to generate more images. This message will not be shown again.`, | ||
| 2116 | ); | ||
| 2117 | accountStorage.setItem(key, 'true'); | ||
| 2118 | } | ||
| 2119 | } | ||
| 2120 | |||
| 2121 | await saveChatConditional(); | 2121 | await saveChatConditional(); |
| 2122 | await eventSource.emit(event_types.IMAGE_SWIPED, { message, element, direction }); | 2122 | await eventSource.emit(event_types.IMAGE_SWIPED, { message, element, direction }); |
| 2123 | appendMediaToMessage(message, element); | 2123 | appendMediaToMessage(message, element); |