From 4f63242799544aced12a661eb2ed907b54d68edd Mon Sep 17 00:00:00 2001 From: Artem Umerov Date: Tue, 9 May 2023 22:04:13 +0300 Subject: [PATCH] 26 26 --- .../fenrir/activity/DeltaOwnerActivity.kt | 1 + .../fenrir/activity/LottieActivity.kt | 1 + .../ragnarok/fenrir/activity/MainActivity.kt | 15 +----------- .../fenrir/activity/NoMainActivity.kt | 1 + .../activity/PostPublishPrepareActivity.kt | 1 + .../fenrir/activity/VideoPlayerActivity.kt | 1 + .../ragnarok/fenrir/api/impl/MessagesApi.kt | 13 ++++++++++- .../fenrir/api/interfaces/IMessagesApi.kt | 10 ++++++-- .../fenrir/api/services/IMessageService.kt | 6 ++++- .../ChatAttachmentAudioPresenter.kt | 3 ++- .../ChatAttachmentDocsPresenter.kt | 2 +- .../ChatAttachmentLinksPresenter.kt | 2 +- .../ChatAttachmentPhotoPresenter.kt | 3 ++- .../ChatAttachmentPostsPresenter.kt | 2 +- .../ChatAttachmentVideoPresenter.kt | 3 ++- .../kotlin/dev/ragnarok/fenrir/util/Utils.kt | 23 +++++++++++++++++++ 16 files changed, 63 insertions(+), 24 deletions(-) diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/activity/DeltaOwnerActivity.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/activity/DeltaOwnerActivity.kt index 7bbfb4951..227a98800 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/activity/DeltaOwnerActivity.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/activity/DeltaOwnerActivity.kt @@ -60,6 +60,7 @@ class DeltaOwnerActivity : AppCompatActivity(), PlaceProvider, AppStyleable { public override fun onCreate(savedInstanceState: Bundle?) { setTheme(ThemesController.currentStyle()) Utils.prepareDensity(this) + Utils.registerColorsThorVG(this) super.onCreate(savedInstanceState) attach( this, diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/activity/LottieActivity.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/activity/LottieActivity.kt index 44efddd9d..f50b3cb8a 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/activity/LottieActivity.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/activity/LottieActivity.kt @@ -120,6 +120,7 @@ class LottieActivity : AppCompatActivity() { public override fun onCreate(savedInstanceState: Bundle?) { setTheme(currentStyle()) Utils.prepareDensity(this) + Utils.registerColorsThorVG(this) super.onCreate(savedInstanceState) setContentView(R.layout.activity_lottie) lottie = findViewById(R.id.lottie_preview) diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/activity/MainActivity.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/activity/MainActivity.kt index 048ac0482..6ebe6828c 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/activity/MainActivity.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/activity/MainActivity.kt @@ -149,8 +149,6 @@ import dev.ragnarok.fenrir.model.* import dev.ragnarok.fenrir.model.drawer.AbsMenuItem import dev.ragnarok.fenrir.model.drawer.RecentChat import dev.ragnarok.fenrir.model.drawer.SectionMenuItem -import dev.ragnarok.fenrir.module.FenrirNative -import dev.ragnarok.fenrir.module.thorvg.ThorVGRender import dev.ragnarok.fenrir.place.Place import dev.ragnarok.fenrir.place.PlaceFactory import dev.ragnarok.fenrir.place.PlaceProvider @@ -350,18 +348,7 @@ open class MainActivity : AppCompatActivity(), NavigationDrawerCallbacks, OnSect } setTheme(currentStyle()) Utils.prepareDensity(this) - - if (FenrirNative.isNativeLoaded && getMainActivityTransform() == MainActivityTransforms.MAIN) { - ThorVGRender.registerColors( - mapOf( - "primary_color" to CurrentTheme.getColorPrimary(this), - "secondary_color" to CurrentTheme.getColorSecondary(this), - "on_surface_color" to CurrentTheme.getColorOnSurface(this), - "white_color_contrast_fix" to CurrentTheme.getColorWhiteContrastFix(this), - "black_color_contrast_fix" to CurrentTheme.getColorBlackContrastFix(this) - ) - ) - } + Utils.registerColorsThorVG(this) super.onCreate(savedInstanceState) isActivityDestroyed = false diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/activity/NoMainActivity.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/activity/NoMainActivity.kt index c9a2dde49..cf84cb15c 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/activity/NoMainActivity.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/activity/NoMainActivity.kt @@ -33,6 +33,7 @@ abstract class NoMainActivity : AppCompatActivity() { override fun onCreate(savedInstanceState: Bundle?) { setTheme(currentStyle()) Utils.prepareDensity(this) + Utils.registerColorsThorVG(this) super.onCreate(savedInstanceState) isZoomPhoto = Settings.get().other().isDo_zoom_photo setContentView(getNoMainContentView()) diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/activity/PostPublishPrepareActivity.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/activity/PostPublishPrepareActivity.kt index 7b9b638b0..6636d1460 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/activity/PostPublishPrepareActivity.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/activity/PostPublishPrepareActivity.kt @@ -43,6 +43,7 @@ class PostPublishPrepareActivity : AppCompatActivity(), RecyclerMenuAdapter.Acti override fun onCreate(savedInstanceState: Bundle?) { setTheme(currentStyle()) Utils.prepareDensity(this) + Utils.registerColorsThorVG(this) super.onCreate(savedInstanceState) setContentView(R.layout.activity_post_publish_prepare) adapter = RecyclerMenuAdapter(R.layout.item_advanced_menu_alternative, emptyList()) diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/activity/VideoPlayerActivity.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/activity/VideoPlayerActivity.kt index 29fb4bac0..298a42a8b 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/activity/VideoPlayerActivity.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/activity/VideoPlayerActivity.kt @@ -148,6 +148,7 @@ class VideoPlayerActivity : AppCompatActivity(), SurfaceHolder.Callback, override fun onCreate(savedInstanceState: Bundle?) { setTheme(currentStyle()) Utils.prepareDensity(this) + Utils.registerColorsThorVG(this) super.onCreate(savedInstanceState) setContentView(R.layout.activity_video) val surfaceContainer = findViewById(R.id.videoSurfaceContainer) diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/impl/MessagesApi.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/impl/MessagesApi.kt index 0a43754c9..ffc7309fb 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/impl/MessagesApi.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/impl/MessagesApi.kt @@ -262,13 +262,24 @@ internal class MessagesApi(accountId: Long, provider: IServiceProvider) : mediaType: String?, startFrom: String?, photoSizes: Int?, + preserve_order: Int?, + max_forwards_level: Int?, count: Int?, fields: String? ): Single { return serviceRx(TokenType.USER, TokenType.COMMUNITY) .flatMap { service -> service - .getHistoryAttachments(peerId, mediaType, startFrom, count, photoSizes, fields) + .getHistoryAttachments( + peerId, + mediaType, + startFrom, + count, + photoSizes, + preserve_order, + max_forwards_level, + fields + ) .map(extractResponseWithErrorHandling()) } } diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/interfaces/IMessagesApi.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/interfaces/IMessagesApi.kt index 5dc7f6bc6..0afd6e882 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/interfaces/IMessagesApi.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/interfaces/IMessagesApi.kt @@ -98,8 +98,14 @@ interface IMessagesApi { @CheckResult fun getHistoryAttachments( - peerId: Long, mediaType: String?, startFrom: String?, photoSizes: Int?, - count: Int?, fields: String? + peerId: Long, + mediaType: String?, + startFrom: String?, + photoSizes: Int?, + preserve_order: Int?, + max_forwards_level: Int?, + count: Int?, + fields: String? ): Single @CheckResult diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/services/IMessageService.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/services/IMessageService.kt index 6f31451f3..641caa071 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/services/IMessageService.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/services/IMessageService.kt @@ -401,6 +401,8 @@ class IMessageService : IServiceRest() { startFrom: String?, count: Int?, photoSizes: Int?, + preserve_order: Int?, + max_forwards_level: Int?, fields: String? ): Single> { return rest.request( @@ -411,7 +413,9 @@ class IMessageService : IServiceRest() { "start_from" to startFrom, "count" to count, "photo_sizes" to photoSizes, - "fields" to fields + "fields" to fields, + "preserve_order" to preserve_order, + "max_forwards_level" to max_forwards_level ), base(AttachmentsHistoryResponse.serializer()) ) diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/conversation/conversationaudios/ChatAttachmentAudioPresenter.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/conversation/conversationaudios/ChatAttachmentAudioPresenter.kt index 310c4bdf9..c47d880a1 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/conversation/conversationaudios/ChatAttachmentAudioPresenter.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/conversation/conversationaudios/ChatAttachmentAudioPresenter.kt @@ -4,6 +4,7 @@ import android.os.Bundle import dev.ragnarok.fenrir.R import dev.ragnarok.fenrir.api.Apis.get import dev.ragnarok.fenrir.api.model.VKApiAudio +import dev.ragnarok.fenrir.api.model.interfaces.VKApiAttachment import dev.ragnarok.fenrir.domain.mappers.Dto2Model import dev.ragnarok.fenrir.fragment.conversation.abschatattachments.BaseChatAttachmentsPresenter import dev.ragnarok.fenrir.model.Audio @@ -30,7 +31,7 @@ class ChatAttachmentAudioPresenter(peerId: Long, accountId: Long, savedInstanceS ): Single>> { return get().vkDefault(accountId) .messages() - .getHistoryAttachments(peerId, "audio", nextFrom, 0, 50, null) + .getHistoryAttachments(peerId, VKApiAttachment.TYPE_AUDIO, nextFrom, 0, 1, 45, 50, null) .map { response -> val audios: MutableList