diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/Extra.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/Extra.kt index bbe0051f0..10a675c67 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/Extra.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/Extra.kt @@ -1,119 +1,115 @@ package dev.ragnarok.fenrir object Extra { - const val PRIVACY = "domain" - const val DOMAIN = "domain" - const val URL = "url" - const val ACTION = "action" - const val COUNTERS = "counters" - const val TOKEN = "token" - const val LOGIN = "login" - const val PASSWORD = "password" - const val TWO_FA = "two_fa" + const val ACCESS_KEY = "access_key" const val ACCOUNT_ID = "account_id" - const val CAPTCHA_URL = "captcha_url" - const val CAPTCHA_SID = "captcha_sid" - const val PHOTOS = "photos" - const val OWNER = "owner" - const val OWNERS = "owners" - const val OWNER_ID = "owner_id" - const val ITEM_ID = "item_id" + const val ACTION = "action" const val ALBUM = "album" const val ALBUM_ID = "album_id" - const val POST_ID = "post_id" - const val FILTER = "filter" - const val ID = "id" + const val ANSWER = "answer" + const val ARTIST = "artist" const val ATTACHMENTS = "attachments" - const val ACCESS_KEY = "access_key" - const val LIST = "list" - const val VIDEO = "video" + const val ATTRS = "attrs" + const val AUDIOS = "audios" + const val BANNED = "banned" + const val BODY = "body" + const val BUNDLE = "bundle" + const val CAPTCHA_SID = "captcha_sid" + const val CAPTCHA_URL = "captcha_url" + const val CHAIR = "chair" + const val CHAIR_ID = "chair_id" + const val CHAT_ID = "chat_id" + const val CITY = "city" + const val CITY_ID = "city_id" + const val COMMENT = "comment" + const val COMMENTED = "commented" const val COMMENT_ID = "comment_id" - const val TYPE = "type" - const val RANGE = "range" const val COUNT = "count" - const val SORT = "sort" - const val POST = "post" - const val MESSAGE_ID = "message_id" - const val PEER_ID = "peer_id" - const val TITLE = "title" - const val HIDE_TITLE = "hide_title" - const val USER_ID = "user_id" - const val AUDIOS = "audios" - const val POSITION = "position" - const val SHUFFLE_MODE = "shuffle_mode" - const val USERS = "users" - const val USER = "user" + const val COUNTERS = "counters" + const val COUNTRY = "country" const val CRITERIA = "criteria" - const val VIDEOS = "videos" - const val DOCS = "docs" const val DOC = "doc" + const val DOCS = "docs" const val DOC_ID = "doc_id" - const val TAB = "tab" - const val ALL = "all" - const val COUNTRY = "country" - const val CITY = "city" - const val UNIVERSITY = "university" + const val DOMAIN = "domain" + const val ERROR = "error" + const val EXT = "ext" const val FACULTY = "faculty" const val FACULTY_ID = "faculty_id" - const val CHAIR_ID = "chair_id" - const val UNIVERSITY_ID = "university_id" - const val CITY_ID = "city_id" - const val KEY = "key" + const val FILTER = "filter" + const val FOCUS_TO = "focus_to" const val GROUP = "group" const val GROUP_ID = "group_id" - const val PLACE = "place" + const val HIDE_TITLE = "hide_title" + const val ID = "id" const val IMAGE = "image" - const val CHAT_ID = "chat_id" - const val CHAIR = "chair" + const val INCOMING = "incoming" + const val INDEX = "index" + const val INVERT = "invert" + const val IS_BOARD = "is_board" + const val IS_OUT_OF_MEMORY = "is_out_of_memory" + const val ITEM_ID = "item_id" + const val KEY = "key" + const val LIST = "list" + const val LOGIN = "login" + const val MANAGER = "manager" + const val MARKET = "market" + const val MAX_COUNT = "max_count" + const val MESSAGE = "message" + const val MESSAGES = "messages" + const val MESSAGE_ID = "message_id" + const val METHOD = "method" + const val NEW = "new" + const val OLD = "old" + const val OUTGOING = "outgoing" + const val OWNER = "owner" + const val OWNERS = "owners" + const val OWNER_ID = "owner_id" + const val PASSWORD = "password" + const val PATH = "path" + const val PEER = "peer" + const val PEER_ID = "peer_id" + const val PHOTOS = "photos" + const val PLACE = "place" + const val PLACE_TYPE = "place_type" + const val POLL = "poll" + const val POSITION = "position" + const val POST = "post" + const val POST_ID = "post_id" + const val PRIVACY = "privacy" + const val PTR = "ptr" + const val QUERY = "query" + const val READONLY = "readonly" + const val REQUEST = "request" + const val SAVE = "save" const val SCHOOL = "school" - const val SCHOOL_ID = "school_id" const val SCHOOL_CLASS = "school_class" const val SCHOOL_CLASS_ID = "school_class_id" - const val BODY = "body" - const val COMMENT = "comment" - const val ARTIST = "artist" + const val SCHOOL_ID = "school_id" + const val SECTION_ID = "section_id" + const val SELECTED = "selected" const val SERVICE = "service" - const val STATUS = "status" - const val ERROR = "error" - const val COMMENTED = "commented" - const val FOCUS_TO = "focus_to" - const val MESSAGES = "messages" - const val MESSAGE = "message" - const val METHOD = "method" - const val PLACE_TYPE = "place_type" - const val INDEX = "index" - const val PEER = "peer" const val SESSION_ID = "session_id" - const val POLL = "poll" - const val USER_IDS = "user_ids" - const val MAX_COUNT = "max_count" - const val BUNDLE = "bundle" - const val ATTRS = "attrs" - const val SUBTITLE = "subtitle" const val SETTINGS = "settings" - const val BANNED = "banned" + const val SHUFFLE_MODE = "shuffle_mode" const val SOURCE = "source" const val SOURCES = "sources" - const val MANAGER = "manager" + const val STACK_TRACE = "stack_trace" + const val STATUS = "status" const val STORY = "story" - const val MARKET = "market" - const val SAVE = "save" - const val NEW = "new" - const val OLD = "old" - const val INCOMING = "incoming" - const val OUTGOING = "outgoing" + const val SUBTITLE = "subtitle" + const val TAB = "tab" + const val TITLE = "title" + const val TOKEN = "token" const val TOP = "top" - const val READONLY = "readonly" - const val INVERT = "invert" - const val PTR = "ptr" - const val REQUEST = "request" - const val PATH = "path" - const val EXT = "ext" - const val STACK_TRACE = "stack_trace" - const val IS_OUT_OF_MEMORY = "is_out_of_memory" - const val IS_BOARD = "is_board" - const val ANSWER = "answer" - const val SELECTED = "selected" - const val SECTION_ID = "section_id" - const val QUERY = "query" + const val TWO_FA = "two_fa" + const val TYPE = "type" + const val UNIVERSITY = "university" + const val UNIVERSITY_ID = "university_id" + const val URL = "url" + const val USER = "user" + const val USERS = "users" + const val USER_ID = "user_id" + const val VIDEO = "video" + const val VIDEOS = "videos" } \ No newline at end of file diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/adapters/AbsAdapter.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/adapters/AbsAdapter.kt index 5c12de634..5d9ee2944 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/adapters/AbsAdapter.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/adapters/AbsAdapter.kt @@ -212,6 +212,26 @@ abstract class AbsAdapter(name: String) : KSerializer { } } + fun getFirstLong(json: JsonObject?, fallback: Long, vararg names: String): Long { + contract { + returns(true) implies (json != null) + } + json ?: return fallback + return try { + for (name in names) { + val element = json[name] + if (element is JsonPrimitive) { + return element.longOrNull ?: fallback + } + } + fallback + } catch (e: Exception) { + if (Constants.IS_DEBUG) { + e.printStackTrace() + } + fallback + } + } @JvmOverloads fun optLong(array: JsonArray?, index: Int, fallback: Long = 0L): Long { @@ -345,7 +365,6 @@ abstract class AbsAdapter(name: String) : KSerializer { } } - fun optIntArray(root: JsonObject?, name: String, fallback: IntArray?): IntArray? { contract { returns(true) implies (root != null) @@ -364,7 +383,6 @@ abstract class AbsAdapter(name: String) : KSerializer { } } - fun optIntArray(array: JsonArray?, index: Int, fallback: IntArray?): IntArray? { contract { returns(true) implies (array != null) @@ -386,6 +404,57 @@ abstract class AbsAdapter(name: String) : KSerializer { } } + fun optLongArray(root: JsonObject?, name: String, fallback: LongArray?): LongArray? { + contract { + returns(true) implies (root != null) + } + root ?: return fallback + return try { + val element = root[name] + if (!checkArray(element)) { + fallback + } else parseLongArray(element.jsonArray) + } catch (e: Exception) { + if (Constants.IS_DEBUG) { + e.printStackTrace() + } + fallback + } + } + + fun optLongArray(array: JsonArray?, index: Int, fallback: LongArray?): LongArray? { + contract { + returns(true) implies (array != null) + } + array ?: return fallback + return try { + if (index < 0 || index >= array.size) { + return fallback + } + val array_r = array[index] + if (!checkArray(array_r)) { + fallback + } else parseLongArray(array_r.jsonArray) + } catch (e: Exception) { + if (Constants.IS_DEBUG) { + e.printStackTrace() + } + fallback + } + } + + private fun parseLongArray(array: JsonArray?): LongArray { + contract { + returns(true) implies (array != null) + } + array ?: return LongArray(0) + val list = LongArray(array.size) + for (i in 0 until array.size) { + list[i] = array[i].jsonPrimitive.long + } + return list + } + private fun parseIntArray(array: JsonArray?): IntArray { contract { returns(true) implies (array != null) diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/adapters/AttachmentsDtoAdapter.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/adapters/AttachmentsDtoAdapter.kt index c3eeb6220..dbefecef0 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/adapters/AttachmentsDtoAdapter.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/adapters/AttachmentsDtoAdapter.kt @@ -1,6 +1,7 @@ package dev.ragnarok.fenrir.api.adapters import dev.ragnarok.fenrir.api.model.* +import dev.ragnarok.fenrir.api.model.interfaces.VKApiAttachment import dev.ragnarok.fenrir.kJson import dev.ragnarok.fenrir.nonNullNoEmpty import dev.ragnarok.fenrir.util.Utils diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/adapters/AttachmentsEntryDtoAdapter.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/adapters/AttachmentsEntryDtoAdapter.kt index fc96303dd..c033cce96 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/adapters/AttachmentsEntryDtoAdapter.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/adapters/AttachmentsEntryDtoAdapter.kt @@ -1,9 +1,9 @@ package dev.ragnarok.fenrir.api.adapters import dev.ragnarok.fenrir.api.adapters.AttachmentsDtoAdapter.Companion.parse -import dev.ragnarok.fenrir.api.model.VKApiAttachment import dev.ragnarok.fenrir.api.model.VKApiAttachments import dev.ragnarok.fenrir.api.model.VKApiNotSupported +import dev.ragnarok.fenrir.api.model.interfaces.VKApiAttachment import dev.ragnarok.fenrir.util.serializeble.json.JsonElement import dev.ragnarok.fenrir.util.serializeble.json.jsonObject diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/adapters/AudioPlaylistDtoAdapter.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/adapters/AudioPlaylistDtoAdapter.kt index a9208dd36..426d5a8d9 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/adapters/AudioPlaylistDtoAdapter.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/adapters/AudioPlaylistDtoAdapter.kt @@ -20,7 +20,7 @@ class AudioPlaylistDtoAdapter : AbsAdapter("VKApiAudioPlayli album.title = optString(root, "title") album.access_key = optString(root, "access_key") album.description = optString(root, "description") - album.update_time = optInt(root, "update_time").toLong() + album.update_time = optLong(root, "update_time") album.Year = optInt(root, "year") if (hasArray(root, "genres")) { val build = StringBuilder() @@ -69,4 +69,4 @@ class AudioPlaylistDtoAdapter : AbsAdapter("VKApiAudioPlayli companion object { private val TAG = AudioPlaylistDtoAdapter::class.java.simpleName } -} \ No newline at end of file +} diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/adapters/GroupSettingsAdapter.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/adapters/GroupSettingsAdapter.kt index c080c7660..d292820a0 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/adapters/GroupSettingsAdapter.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/adapters/GroupSettingsAdapter.kt @@ -20,11 +20,6 @@ class GroupSettingsAdapter : AbsAdapter("GroupSettingsDto") { dto.title = optString(root, "title") dto.description = optString(root, "description") dto.address = optString(root, "address") - if (hasObject(root, "place")) { - dto.place = root["place"]?.let { - kJson.decodeFromJsonElement(GroupSettingsDto.Place.serializer(), it) - } - } dto.country_id = optInt(root, "country_id") dto.city_id = optInt(root, "city_id") dto.wall = optInt(root, "wall") @@ -81,4 +76,4 @@ class GroupSettingsAdapter : AbsAdapter("GroupSettingsDto") { companion object { private val TAG = GroupSettingsAdapter::class.java.simpleName } -} \ No newline at end of file +} diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/adapters/LongpollUpdateAdapter.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/adapters/LongpollUpdateAdapter.kt index d3227f83b..c4c398139 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/adapters/LongpollUpdateAdapter.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/adapters/LongpollUpdateAdapter.kt @@ -47,7 +47,7 @@ class LongpollUpdateAdapter : AbsAdapter("AbsLongpollEvent?") val u = UserIsOnlineUpdate() u.userId = -optInt(array, 1) u.platform = optInt(array, 2) - u.timestamp = optInt(array, 3) + u.timestamp = optLong(array, 3) u.app_id = optInt(array, 4) return u } @@ -55,7 +55,7 @@ class LongpollUpdateAdapter : AbsAdapter("AbsLongpollEvent?") val u1 = UserIsOfflineUpdate() u1.userId = -optInt(array, 1) u1.isTimeout = optInt(array, 2) != 0 - u1.timestamp = optInt(array, 3) + u1.timestamp = optLong(array, 3) u1.app_id = optInt(array, 4) return u1 } diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/adapters/MessageDtoAdapter.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/adapters/MessageDtoAdapter.kt index b61e33d14..ad7b1c200 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/adapters/MessageDtoAdapter.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/adapters/MessageDtoAdapter.kt @@ -1,6 +1,7 @@ package dev.ragnarok.fenrir.api.adapters import dev.ragnarok.fenrir.api.model.* +import dev.ragnarok.fenrir.api.model.interfaces.VKApiAttachment import dev.ragnarok.fenrir.api.util.VKStringUtils import dev.ragnarok.fenrir.kJson import dev.ragnarok.fenrir.orZero diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/adapters/StoryDtoAdapter.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/adapters/StoryDtoAdapter.kt index 613412a5e..780bc4a9a 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/adapters/StoryDtoAdapter.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/adapters/StoryDtoAdapter.kt @@ -18,8 +18,8 @@ class StoryDtoAdapter : AbsAdapter("VKApiStory") { val root = json.asJsonObject story.id = optInt(root, "id") story.owner_id = optInt(root, "owner_id") - story.date = optInt(root, "owner_id").toLong() - story.expires_at = optInt(root, "expires_at").toLong() + story.date = optLong(root, "owner_id") + story.expires_at = optLong(root, "expires_at") story.is_expired = optBoolean(root, "is_expired") story.is_ads = optBoolean(root, "is_ads") if (hasObject(root, "photo")) { @@ -47,4 +47,4 @@ class StoryDtoAdapter : AbsAdapter("VKApiStory") { companion object { private val TAG = StoryDtoAdapter::class.java.simpleName } -} \ No newline at end of file +} diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/adapters/TopicDtoAdapter.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/adapters/TopicDtoAdapter.kt index c9199f209..c5b99cee5 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/adapters/TopicDtoAdapter.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/adapters/TopicDtoAdapter.kt @@ -23,7 +23,7 @@ class TopicDtoAdapter : AbsAdapter("VKApiTopic") { dto.title = optString(root, "title") dto.created = optLong(root, "created") dto.created_by = optInt(root, "created_by") - dto.updated = optInt(root, "updated").toLong() + dto.updated = optLong(root, "updated") dto.updated_by = optInt(root, "updated_by") dto.is_closed = optBoolean(root, "is_closed") dto.is_fixed = optBoolean(root, "is_fixed") diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/adapters/VideoAlbumDtoAdapter.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/adapters/VideoAlbumDtoAdapter.kt index 79b0af6d0..7ad2506c1 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/adapters/VideoAlbumDtoAdapter.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/adapters/VideoAlbumDtoAdapter.kt @@ -22,7 +22,7 @@ class VideoAlbumDtoAdapter : AbsAdapter("VKApiVideoAlbum") { album.owner_id = optInt(root, "owner_id") album.title = optString(root, "title") album.count = optInt(root, "count") - album.updated_time = optInt(root, "updated_time").toLong() + album.updated_time = optLong(root, "updated_time") if (hasObject(root, "privacy_view")) { album.privacy = root["privacy_view"]?.let { @@ -57,4 +57,4 @@ class VideoAlbumDtoAdapter : AbsAdapter("VKApiVideoAlbum") { companion object { private val TAG = VideoAlbumDtoAdapter::class.java.simpleName } -} \ No newline at end of file +} diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/impl/AbsApi.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/impl/AbsApi.kt index 0b7471ef9..cbb126697 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/impl/AbsApi.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/impl/AbsApi.kt @@ -5,8 +5,8 @@ import dev.ragnarok.fenrir.* import dev.ragnarok.fenrir.api.* import dev.ragnarok.fenrir.api.model.Captcha import dev.ragnarok.fenrir.api.model.Error -import dev.ragnarok.fenrir.api.model.IAttachmentToken import dev.ragnarok.fenrir.api.model.Params +import dev.ragnarok.fenrir.api.model.interfaces.IAttachmentToken import dev.ragnarok.fenrir.api.model.response.BaseResponse import dev.ragnarok.fenrir.api.model.response.VkResponse import dev.ragnarok.fenrir.api.rest.HttpException diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/impl/BoardApi.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/impl/BoardApi.kt index 14245aead..09325b220 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/impl/BoardApi.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/impl/BoardApi.kt @@ -3,7 +3,7 @@ package dev.ragnarok.fenrir.api.impl import dev.ragnarok.fenrir.api.IServiceProvider import dev.ragnarok.fenrir.api.TokenType import dev.ragnarok.fenrir.api.interfaces.IBoardApi -import dev.ragnarok.fenrir.api.model.IAttachmentToken +import dev.ragnarok.fenrir.api.model.interfaces.IAttachmentToken import dev.ragnarok.fenrir.api.model.response.DefaultCommentsResponse import dev.ragnarok.fenrir.api.model.response.TopicsResponse import dev.ragnarok.fenrir.api.services.IBoardService diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/impl/FriendsApi.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/impl/FriendsApi.kt index 525e8afe0..6e7b0a366 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/impl/FriendsApi.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/impl/FriendsApi.kt @@ -100,6 +100,16 @@ internal class FriendsApi(accountId: Int, provider: IServiceProvider) : } } + override fun deleteSubscriber( + subscriber_id: Int + ): Single { + return provideService(IFriendsService(), TokenType.USER) + .flatMap { service -> + service.deleteSubscriber(subscriber_id) + .map(extractResponseWithErrorHandling()) + } + } + override fun getLists(userId: Int?, returnSystem: Boolean?): Single> { return provideService(IFriendsService(), TokenType.USER) .flatMap { service -> 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 e2ad1565d..ed695a1fa 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 @@ -4,6 +4,7 @@ import dev.ragnarok.fenrir.api.IServiceProvider import dev.ragnarok.fenrir.api.TokenType import dev.ragnarok.fenrir.api.interfaces.IMessagesApi import dev.ragnarok.fenrir.api.model.* +import dev.ragnarok.fenrir.api.model.interfaces.IAttachmentToken import dev.ragnarok.fenrir.api.model.response.* import dev.ragnarok.fenrir.api.services.IMessageService import dev.ragnarok.fenrir.util.Utils.listEmptyIfNull @@ -110,7 +111,7 @@ internal class MessagesApi(accountId: Int, provider: IServiceProvider) : } } - override fun createChat(userIds: Collection?, title: String?): Single { + override fun createChat(userIds: Collection, title: String?): Single { return serviceRx(TokenType.USER, TokenType.COMMUNITY) .flatMap { service -> service diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/impl/PhotosApi.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/impl/PhotosApi.kt index d2500a772..52f5ff08d 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/impl/PhotosApi.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/impl/PhotosApi.kt @@ -4,6 +4,7 @@ import dev.ragnarok.fenrir.api.IServiceProvider import dev.ragnarok.fenrir.api.TokenType import dev.ragnarok.fenrir.api.interfaces.IPhotosApi import dev.ragnarok.fenrir.api.model.* +import dev.ragnarok.fenrir.api.model.interfaces.IAttachmentToken import dev.ragnarok.fenrir.api.model.response.DefaultCommentsResponse import dev.ragnarok.fenrir.api.model.response.UploadChatPhotoResponse import dev.ragnarok.fenrir.api.model.response.UploadOwnerPhotoResponse @@ -296,7 +297,7 @@ internal class PhotosApi(accountId: Int, provider: IServiceProvider) : } override fun get( - ownerId: Int?, albumId: String?, photoIds: Collection?, + ownerId: Int?, albumId: String?, photoIds: Collection?, rev: Boolean?, offset: Int?, count: Int? ): Single> { val photos = join(photoIds, ",") @@ -355,7 +356,7 @@ internal class PhotosApi(accountId: Int, provider: IServiceProvider) : } override fun getAlbums( - ownerId: Int?, albumIds: Collection?, + ownerId: Int?, albumIds: Collection?, offset: Int?, count: Int?, needSystem: Boolean?, needCovers: Boolean? ): Single> { diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/impl/VideoApi.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/impl/VideoApi.kt index 37ad8218c..f1c228e25 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/impl/VideoApi.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/impl/VideoApi.kt @@ -3,7 +3,11 @@ package dev.ragnarok.fenrir.api.impl import dev.ragnarok.fenrir.api.IServiceProvider import dev.ragnarok.fenrir.api.TokenType import dev.ragnarok.fenrir.api.interfaces.IVideoApi -import dev.ragnarok.fenrir.api.model.* +import dev.ragnarok.fenrir.api.model.AccessIdPair +import dev.ragnarok.fenrir.api.model.Items +import dev.ragnarok.fenrir.api.model.VKApiVideo +import dev.ragnarok.fenrir.api.model.VKApiVideoAlbum +import dev.ragnarok.fenrir.api.model.interfaces.IAttachmentToken import dev.ragnarok.fenrir.api.model.response.DefaultCommentsResponse import dev.ragnarok.fenrir.api.model.response.SearchVideoResponse import dev.ragnarok.fenrir.api.services.IVideoService diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/impl/WallApi.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/impl/WallApi.kt index f213d37a3..e34d8e1e7 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/impl/WallApi.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/impl/WallApi.kt @@ -3,8 +3,8 @@ package dev.ragnarok.fenrir.api.impl import dev.ragnarok.fenrir.api.IServiceProvider import dev.ragnarok.fenrir.api.TokenType import dev.ragnarok.fenrir.api.interfaces.IWallApi -import dev.ragnarok.fenrir.api.model.IAttachmentToken import dev.ragnarok.fenrir.api.model.IdPair +import dev.ragnarok.fenrir.api.model.interfaces.IAttachmentToken import dev.ragnarok.fenrir.api.model.response.* import dev.ragnarok.fenrir.api.services.IWallService import io.reactivex.rxjava3.core.Single diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/interfaces/IBoardApi.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/interfaces/IBoardApi.kt index 1fcc16f80..38af898ce 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/interfaces/IBoardApi.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/interfaces/IBoardApi.kt @@ -1,7 +1,7 @@ package dev.ragnarok.fenrir.api.interfaces import androidx.annotation.CheckResult -import dev.ragnarok.fenrir.api.model.IAttachmentToken +import dev.ragnarok.fenrir.api.model.interfaces.IAttachmentToken import dev.ragnarok.fenrir.api.model.response.DefaultCommentsResponse import dev.ragnarok.fenrir.api.model.response.TopicsResponse import io.reactivex.rxjava3.core.Single diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/interfaces/IFriendsApi.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/interfaces/IFriendsApi.kt index 905db5057..103b13c8a 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/interfaces/IFriendsApi.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/interfaces/IFriendsApi.kt @@ -31,6 +31,11 @@ interface IFriendsApi { nameCase: String? ): Single> + @CheckResult + fun deleteSubscriber( + subscriber_id: Int + ): Single + @CheckResult fun getLists(userId: Int?, returnSystem: Boolean?): Single> 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 5db58e9b1..bca330eb7 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 @@ -2,6 +2,7 @@ package dev.ragnarok.fenrir.api.interfaces import androidx.annotation.CheckResult import dev.ragnarok.fenrir.api.model.* +import dev.ragnarok.fenrir.api.model.interfaces.IAttachmentToken import dev.ragnarok.fenrir.api.model.response.* import io.reactivex.rxjava3.core.Completable import io.reactivex.rxjava3.core.Single @@ -44,7 +45,7 @@ interface IMessagesApi { fun editChat(chatId: Int, title: String?): Single @CheckResult - fun createChat(userIds: Collection?, title: String?): Single + fun createChat(userIds: Collection, title: String?): Single @CheckResult fun deleteDialog(peerId: Int): Single diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/interfaces/IPhotosApi.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/interfaces/IPhotosApi.kt index 30ac0e533..bac3c2817 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/interfaces/IPhotosApi.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/interfaces/IPhotosApi.kt @@ -2,6 +2,7 @@ package dev.ragnarok.fenrir.api.interfaces import androidx.annotation.CheckResult import dev.ragnarok.fenrir.api.model.* +import dev.ragnarok.fenrir.api.model.interfaces.IAttachmentToken import dev.ragnarok.fenrir.api.model.response.DefaultCommentsResponse import dev.ragnarok.fenrir.api.model.response.UploadChatPhotoResponse import dev.ragnarok.fenrir.api.model.response.UploadOwnerPhotoResponse @@ -100,7 +101,7 @@ interface IPhotosApi { @CheckResult operator fun get( - ownerId: Int?, albumId: String?, photoIds: Collection?, rev: Boolean?, + ownerId: Int?, albumId: String?, photoIds: Collection?, rev: Boolean?, offset: Int?, count: Int? ): Single> @@ -130,7 +131,7 @@ interface IPhotosApi { @CheckResult fun getAlbums( - ownerId: Int?, albumIds: Collection?, offset: Int?, + ownerId: Int?, albumIds: Collection?, offset: Int?, count: Int?, needSystem: Boolean?, needCovers: Boolean? ): Single> diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/interfaces/IVideoApi.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/interfaces/IVideoApi.kt index 98212f802..2d79c2402 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/interfaces/IVideoApi.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/interfaces/IVideoApi.kt @@ -1,7 +1,11 @@ package dev.ragnarok.fenrir.api.interfaces import androidx.annotation.CheckResult -import dev.ragnarok.fenrir.api.model.* +import dev.ragnarok.fenrir.api.model.AccessIdPair +import dev.ragnarok.fenrir.api.model.Items +import dev.ragnarok.fenrir.api.model.VKApiVideo +import dev.ragnarok.fenrir.api.model.VKApiVideoAlbum +import dev.ragnarok.fenrir.api.model.interfaces.IAttachmentToken import dev.ragnarok.fenrir.api.model.response.DefaultCommentsResponse import dev.ragnarok.fenrir.api.model.response.SearchVideoResponse import io.reactivex.rxjava3.core.Single diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/interfaces/IWallApi.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/interfaces/IWallApi.kt index fb91cd36d..3fa3cc489 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/interfaces/IWallApi.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/interfaces/IWallApi.kt @@ -1,8 +1,8 @@ package dev.ragnarok.fenrir.api.interfaces import androidx.annotation.CheckResult -import dev.ragnarok.fenrir.api.model.IAttachmentToken import dev.ragnarok.fenrir.api.model.IdPair +import dev.ragnarok.fenrir.api.model.interfaces.IAttachmentToken import dev.ragnarok.fenrir.api.model.response.* import io.reactivex.rxjava3.core.Single diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/AttachmentToken.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/AttachmentToken.kt deleted file mode 100644 index 76f63de0b..000000000 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/AttachmentToken.kt +++ /dev/null @@ -1,29 +0,0 @@ -package dev.ragnarok.fenrir.api.model - -import kotlinx.serialization.Serializable - -@Serializable -class AttachmentToken : IAttachmentToken { - val type: String - val id: Int - val ownerId: Int - val accessKey: String? - - constructor(type: String, id: Int, ownerId: Int) { - this.type = type - this.id = id - this.ownerId = ownerId - accessKey = null - } - - constructor(type: String, id: Int, ownerId: Int, accessKey: String?) { - this.type = type - this.id = id - this.ownerId = ownerId - this.accessKey = accessKey - } - - override fun format(): String { - return type + ownerId + "_" + id + if (accessKey == null || accessKey.isEmpty()) "" else "_$accessKey" - } -} \ No newline at end of file diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/AttachmentTokenString.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/AttachmentTokenString.kt deleted file mode 100644 index f8eebd19d..000000000 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/AttachmentTokenString.kt +++ /dev/null @@ -1,10 +0,0 @@ -package dev.ragnarok.fenrir.api.model - -import kotlinx.serialization.Serializable - -@Serializable -class AttachmentTokenString(val type: String?, val id: String?) : IAttachmentToken { - override fun format(): String { - return type + if (id == null || id.isEmpty()) "" else id - } -} \ No newline at end of file diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/AttachmentTokens.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/AttachmentTokens.kt new file mode 100644 index 000000000..940ca6b40 --- /dev/null +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/AttachmentTokens.kt @@ -0,0 +1,54 @@ +package dev.ragnarok.fenrir.api.model + +import dev.ragnarok.fenrir.api.model.interfaces.IAttachmentToken +import kotlinx.serialization.Serializable + +object AttachmentTokens { + @Serializable + class AttachmentToken : IAttachmentToken { + val type: String + val id: Int + val ownerId: Int + val accessKey: String? + + constructor(type: String, id: Int, ownerId: Int) { + this.type = type + this.id = id + this.ownerId = ownerId + accessKey = null + } + + constructor(type: String, id: Int, ownerId: Int, accessKey: String?) { + this.type = type + this.id = id + this.ownerId = ownerId + this.accessKey = accessKey + } + + override fun format(): String { + return "$type${ownerId}_$id" + if (accessKey.isNullOrEmpty()) "" else "_$accessKey" + } + } + + @Serializable + class AttachmentTokenForArtist(val type: String, val id: String?) : IAttachmentToken { + override fun format(): String { + return type + if (id.isNullOrEmpty()) "" else id + } + } + + @Serializable + class AttachmentTokenStringSpecial(val type: String, val id: String?, val guid: String?) : + IAttachmentToken { + override fun format(): String { + return type + if (id.isNullOrEmpty()) "" else "_$id" + if (guid.isNullOrEmpty()) "" else "_$guid" + } + } + + @Serializable + class LinkAttachmentToken(val url: String?) : IAttachmentToken { + override fun format(): String { + return url ?: "null" + } + } +} diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/AttachmentsTokenCreator.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/AttachmentsTokenCreator.kt index dbc2326ec..16b7acdd1 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/AttachmentsTokenCreator.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/AttachmentsTokenCreator.kt @@ -1,83 +1,94 @@ package dev.ragnarok.fenrir.api.model +import dev.ragnarok.fenrir.api.model.interfaces.IAttachmentToken + object AttachmentsTokenCreator { fun ofDocument(id: Int, ownerId: Int, accessKey: String?): IAttachmentToken { - return AttachmentToken("doc", id, ownerId, accessKey) + return AttachmentTokens.AttachmentToken("doc", id, ownerId, accessKey) } fun ofAudio(id: Int, ownerId: Int, accessKey: String?): IAttachmentToken { - return AttachmentToken("audio", id, ownerId, accessKey) + return AttachmentTokens.AttachmentToken("audio", id, ownerId, accessKey) } fun ofLink(url: String?): IAttachmentToken { - return LinkAttachmentToken(url) + return AttachmentTokens.LinkAttachmentToken(url) } fun ofArticle(id: Int, ownerId: Int, accessKey: String?): IAttachmentToken { - return AttachmentToken("article", id, ownerId, accessKey) + return AttachmentTokens.AttachmentToken("article", id, ownerId, accessKey) } fun ofStory(id: Int, ownerId: Int, accessKey: String?): IAttachmentToken { - return AttachmentToken("story", id, ownerId, accessKey) + return AttachmentTokens.AttachmentToken("story", id, ownerId, accessKey) } fun ofPhotoAlbum(id: Int, ownerId: Int): IAttachmentToken { - return AttachmentToken("album", id, ownerId) + return AttachmentTokens.AttachmentToken("album", id, ownerId) } fun ofAudioPlaylist(id: Int, ownerId: Int, accessKey: String?): IAttachmentToken { - return AttachmentToken("audio_playlist", id, ownerId, accessKey) + return AttachmentTokens.AttachmentToken("audio_playlist", id, ownerId, accessKey) } - fun ofGraffity(id: Int, ownerId: Int, accessKey: String?): IAttachmentToken { - return AttachmentToken("graffiti", id, ownerId, accessKey) + fun ofGraffiti(id: Int, ownerId: Int, accessKey: String?): IAttachmentToken { + return AttachmentTokens.AttachmentToken("graffiti", id, ownerId, accessKey) } - fun ofCall(initiator_id: Int, receiver_id: Int, state: String?, time: Long): IAttachmentToken { - return AttachmentToken("call", initiator_id, receiver_id, state + "_" + time) + fun ofCall( + initiator_id: Int, + receiver_id: Int, + state: String?, + time: Long + ): IAttachmentToken { + return AttachmentTokens.AttachmentTokenStringSpecial( + "call", + initiator_id.toString(), + receiver_id.toString() + "_{$state}_$time" + ) } fun ofGeo(latitude: String?, longitude: String?): IAttachmentToken { - return AttachmentToken("geo", latitude.hashCode(), longitude.hashCode()) + return AttachmentTokens.AttachmentToken("geo", latitude.hashCode(), longitude.hashCode()) } fun ofPhoto(id: Int, ownerId: Int, accessKey: String?): IAttachmentToken { - return AttachmentToken("photo", id, ownerId, accessKey) + return AttachmentTokens.AttachmentToken("photo", id, ownerId, accessKey) } fun ofPoll(id: Int, ownerId: Int): IAttachmentToken { - return AttachmentToken("poll", id, ownerId) + return AttachmentTokens.AttachmentToken("poll", id, ownerId) } fun ofWallReply(id: Int, ownerId: Int): IAttachmentToken { - return AttachmentToken("wall_reply", id, ownerId) + return AttachmentTokens.AttachmentToken("wall_reply", id, ownerId) } fun ofPost(id: Int, ownerId: Int): IAttachmentToken { - return AttachmentToken("wall", id, ownerId) + return AttachmentTokens.AttachmentToken("wall", id, ownerId) } fun ofError(type: String?, data: String?): IAttachmentToken { - return AttachmentToken("error", type.hashCode(), data.hashCode()) + return AttachmentTokens.AttachmentToken("error", type.hashCode(), data.hashCode()) } fun ofEvent(id: Int, button_text: String?): IAttachmentToken { - return AttachmentToken("event", id, button_text.hashCode()) + return AttachmentTokens.AttachmentToken("event", id, button_text.hashCode()) } fun ofMarket(id: Int, ownerId: Int, accessKey: String?): IAttachmentToken { - return AttachmentToken("market", id, ownerId, accessKey) + return AttachmentTokens.AttachmentToken("market", id, ownerId, accessKey) } fun ofMarketAlbum(id: Int, ownerId: Int, accessKey: String?): IAttachmentToken { - return AttachmentToken("market_album", id, ownerId, accessKey) + return AttachmentTokens.AttachmentToken("market_album", id, ownerId, accessKey) } fun ofVideo(id: Int, ownerId: Int, accessKey: String?): IAttachmentToken { - return AttachmentToken("video", id, ownerId, accessKey) + return AttachmentTokens.AttachmentToken("video", id, ownerId, accessKey) } fun ofArtist(id: String?): IAttachmentToken { - return AttachmentTokenString("artist", id) + return AttachmentTokens.AttachmentTokenForArtist("artist", id) } -} \ No newline at end of file +} diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/Commentable.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/Commentable.kt deleted file mode 100644 index 3a8ca0ea4..000000000 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/Commentable.kt +++ /dev/null @@ -1,3 +0,0 @@ -package dev.ragnarok.fenrir.api.model - -interface Commentable \ No newline at end of file diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/Copyable.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/Copyable.kt deleted file mode 100644 index df836824c..000000000 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/Copyable.kt +++ /dev/null @@ -1,3 +0,0 @@ -package dev.ragnarok.fenrir.api.model - -interface Copyable \ No newline at end of file diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/CountersDto.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/CountersDto.kt index 60a09ed1b..8790e00e8 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/CountersDto.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/CountersDto.kt @@ -31,10 +31,4 @@ class CountersDto { @SerialName("notifications") var notifications = 0 - - @SerialName("sdk") - var sdk = 0 - - @SerialName("app_requests") - var app_requests = 0 -} \ No newline at end of file +} diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/GroupSettingsDto.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/GroupSettingsDto.kt index 57c4fe174..57f01ae59 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/GroupSettingsDto.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/GroupSettingsDto.kt @@ -9,7 +9,6 @@ class GroupSettingsDto { var title: String? = null var description: String? = null var address: String? = null - var place: Place? = null var country_id = 0 var city_id = 0 @@ -57,48 +56,6 @@ class GroupSettingsDto { var age_limits = 0 var market: Market? = null - @Serializable - class Place { - @SerialName("id") - var id = 0 - - @SerialName("title") - var title: String? = null - - @SerialName("latitude") - var latitude = 0.0 - - @SerialName("longitude") - var longitude = 0.0 - - @SerialName("created") - var created: Long = 0 - - @SerialName("icon") - var icon: String? = null - - @SerialName("group_id") - var group_id = 0 - - @SerialName("group_photo") - var group_photo: String? = null - - @SerialName("checkins") - var checkins = 0 - - @SerialName("type") - var type = 0 - - @SerialName("country") - var country = 0 - - @SerialName("city") - var city = 0 - - @SerialName("address") - var address: String? = null - } - @Serializable class PublicCategory { @SerialName("id") @@ -148,4 +105,4 @@ class GroupSettingsDto { @SerialName("name") var name: String? = null } -} \ No newline at end of file +} diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/IUserActivityPoint.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/IUserActivityPoint.kt deleted file mode 100644 index b1c292f2f..000000000 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/IUserActivityPoint.kt +++ /dev/null @@ -1,3 +0,0 @@ -package dev.ragnarok.fenrir.api.model - -interface IUserActivityPoint \ No newline at end of file diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/Likeable.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/Likeable.kt deleted file mode 100644 index 30c543ad6..000000000 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/Likeable.kt +++ /dev/null @@ -1,3 +0,0 @@ -package dev.ragnarok.fenrir.api.model - -interface Likeable \ No newline at end of file diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/LinkAttachmentToken.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/LinkAttachmentToken.kt deleted file mode 100644 index a1283ee9a..000000000 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/LinkAttachmentToken.kt +++ /dev/null @@ -1,10 +0,0 @@ -package dev.ragnarok.fenrir.api.model - -import kotlinx.serialization.Serializable - -@Serializable -class LinkAttachmentToken(val url: String?) : IAttachmentToken { - override fun format(): String { - return url ?: "null" - } -} \ No newline at end of file diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/VKApiArticle.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/VKApiArticle.kt index a0593c77d..a12319aa3 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/VKApiArticle.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/VKApiArticle.kt @@ -1,6 +1,7 @@ package dev.ragnarok.fenrir.api.model import dev.ragnarok.fenrir.api.adapters.ArticleDtoAdapter +import dev.ragnarok.fenrir.api.model.interfaces.VKApiAttachment import kotlinx.serialization.Serializable @Serializable(with = ArticleDtoAdapter::class) diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/VKApiAttachments.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/VKApiAttachments.kt index 3488ff307..fdd487e37 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/VKApiAttachments.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/VKApiAttachments.kt @@ -2,6 +2,7 @@ package dev.ragnarok.fenrir.api.model import dev.ragnarok.fenrir.api.adapters.AttachmentsDtoAdapter import dev.ragnarok.fenrir.api.adapters.AttachmentsEntryDtoAdapter +import dev.ragnarok.fenrir.api.model.interfaces.VKApiAttachment import kotlinx.serialization.Serializable import java.util.* diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/VKApiAudio.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/VKApiAudio.kt index 38f205a9a..ea205a7ff 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/VKApiAudio.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/VKApiAudio.kt @@ -4,6 +4,7 @@ import android.content.Context import dev.ragnarok.fenrir.R import dev.ragnarok.fenrir.api.adapters.AudioDtoAdapter import dev.ragnarok.fenrir.api.model.catalog_v2_audio.IIdComparable +import dev.ragnarok.fenrir.api.model.interfaces.VKApiAttachment import kotlinx.serialization.Serializable /** diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/VKApiAudioArtist.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/VKApiAudioArtist.kt index e5de5bf9e..ca7311964 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/VKApiAudioArtist.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/VKApiAudioArtist.kt @@ -1,5 +1,6 @@ package dev.ragnarok.fenrir.api.model +import dev.ragnarok.fenrir.api.model.interfaces.VKApiAttachment import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/VKApiAudioMessage.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/VKApiAudioMessage.kt index fc7a17231..1dd7c87af 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/VKApiAudioMessage.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/VKApiAudioMessage.kt @@ -1,5 +1,6 @@ package dev.ragnarok.fenrir.api.model +import dev.ragnarok.fenrir.api.model.interfaces.VKApiAttachment import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/VKApiAudioPlaylist.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/VKApiAudioPlaylist.kt index 1e03289eb..366b3ba98 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/VKApiAudioPlaylist.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/VKApiAudioPlaylist.kt @@ -2,6 +2,7 @@ package dev.ragnarok.fenrir.api.model import dev.ragnarok.fenrir.api.adapters.AudioPlaylistDtoAdapter import dev.ragnarok.fenrir.api.model.catalog_v2_audio.IIdComparable +import dev.ragnarok.fenrir.api.model.interfaces.VKApiAttachment import kotlinx.serialization.Serializable @Serializable(with = AudioPlaylistDtoAdapter::class) diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/VKApiCall.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/VKApiCall.kt index 517178ee5..8812b6fd9 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/VKApiCall.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/VKApiCall.kt @@ -1,5 +1,6 @@ package dev.ragnarok.fenrir.api.model +import dev.ragnarok.fenrir.api.model.interfaces.VKApiAttachment import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/VKApiCareer.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/VKApiCareer.kt index 5243490f3..ed3ac8ad1 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/VKApiCareer.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/VKApiCareer.kt @@ -1,5 +1,6 @@ package dev.ragnarok.fenrir.api.model +import dev.ragnarok.fenrir.api.model.interfaces.IUserActivityPoint import kotlinx.serialization.Serializable /** diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/VKApiCommunity.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/VKApiCommunity.kt index 3d55ac268..4fdb5af6e 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/VKApiCommunity.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/VKApiCommunity.kt @@ -1,6 +1,7 @@ package dev.ragnarok.fenrir.api.model import dev.ragnarok.fenrir.api.adapters.CommunityDtoAdapter +import dev.ragnarok.fenrir.api.model.interfaces.Identificable import dev.ragnarok.fenrir.nonNullNoEmpty import kotlinx.serialization.Serializable diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/VKApiDoc.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/VKApiDoc.kt index 5e7ea45bf..26c3c490f 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/VKApiDoc.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/VKApiDoc.kt @@ -1,6 +1,7 @@ package dev.ragnarok.fenrir.api.model import dev.ragnarok.fenrir.api.adapters.DocsEntryDtoAdapter +import dev.ragnarok.fenrir.api.model.interfaces.VKApiAttachment import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/VKApiEvent.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/VKApiEvent.kt index 27fb3e559..8ea27d6a6 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/VKApiEvent.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/VKApiEvent.kt @@ -1,5 +1,6 @@ package dev.ragnarok.fenrir.api.model +import dev.ragnarok.fenrir.api.model.interfaces.VKApiAttachment import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/VKApiGeo.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/VKApiGeo.kt index fe2775bf9..57f9528cc 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/VKApiGeo.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/VKApiGeo.kt @@ -1,6 +1,7 @@ package dev.ragnarok.fenrir.api.model import dev.ragnarok.fenrir.api.adapters.GeoDtoAdapter +import dev.ragnarok.fenrir.api.model.interfaces.VKApiAttachment import kotlinx.serialization.Serializable @Serializable(with = GeoDtoAdapter::class) diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/VKApiGiftItem.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/VKApiGiftItem.kt index d4dee3812..e78db3001 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/VKApiGiftItem.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/VKApiGiftItem.kt @@ -1,5 +1,6 @@ package dev.ragnarok.fenrir.api.model +import dev.ragnarok.fenrir.api.model.interfaces.VKApiAttachment import kotlinx.serialization.Serializable @Serializable diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/VKApiGraffiti.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/VKApiGraffiti.kt index 074372916..95fbf40ca 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/VKApiGraffiti.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/VKApiGraffiti.kt @@ -1,5 +1,6 @@ package dev.ragnarok.fenrir.api.model +import dev.ragnarok.fenrir.api.model.interfaces.VKApiAttachment import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/VKApiLink.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/VKApiLink.kt index f31e96b0e..3f5ba7766 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/VKApiLink.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/VKApiLink.kt @@ -1,5 +1,6 @@ package dev.ragnarok.fenrir.api.model +import dev.ragnarok.fenrir.api.model.interfaces.VKApiAttachment import kotlinx.serialization.Serializable /** diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/VKApiMarket.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/VKApiMarket.kt index d8370c07f..8a81f9c64 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/VKApiMarket.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/VKApiMarket.kt @@ -1,6 +1,7 @@ package dev.ragnarok.fenrir.api.model import dev.ragnarok.fenrir.api.adapters.MarketDtoAdapter +import dev.ragnarok.fenrir.api.model.interfaces.VKApiAttachment import kotlinx.serialization.Serializable @Serializable(with = MarketDtoAdapter::class) diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/VKApiMarketAlbum.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/VKApiMarketAlbum.kt index 69c13b35c..2e548eee4 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/VKApiMarketAlbum.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/VKApiMarketAlbum.kt @@ -1,5 +1,6 @@ package dev.ragnarok.fenrir.api.model +import dev.ragnarok.fenrir.api.model.interfaces.VKApiAttachment import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/VKApiNotSupported.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/VKApiNotSupported.kt index 6595c831e..6e1aba190 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/VKApiNotSupported.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/VKApiNotSupported.kt @@ -1,5 +1,6 @@ package dev.ragnarok.fenrir.api.model +import dev.ragnarok.fenrir.api.model.interfaces.VKApiAttachment import kotlinx.serialization.Serializable @Serializable diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/VKApiNote.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/VKApiNote.kt index 37904bc6e..a7b047837 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/VKApiNote.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/VKApiNote.kt @@ -1,5 +1,6 @@ package dev.ragnarok.fenrir.api.model +import dev.ragnarok.fenrir.api.model.interfaces.VKApiAttachment import kotlinx.serialization.Serializable /** diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/VKApiPhoto.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/VKApiPhoto.kt index c791b2c73..adb0a5612 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/VKApiPhoto.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/VKApiPhoto.kt @@ -1,6 +1,10 @@ package dev.ragnarok.fenrir.api.model import dev.ragnarok.fenrir.api.adapters.PhotoDtoAdapter +import dev.ragnarok.fenrir.api.model.interfaces.Commentable +import dev.ragnarok.fenrir.api.model.interfaces.Copyable +import dev.ragnarok.fenrir.api.model.interfaces.Likeable +import dev.ragnarok.fenrir.api.model.interfaces.VKApiAttachment import kotlinx.serialization.Serializable /** diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/VKApiPhotoAlbum.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/VKApiPhotoAlbum.kt index b0e359c11..9541c4fef 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/VKApiPhotoAlbum.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/VKApiPhotoAlbum.kt @@ -1,6 +1,7 @@ package dev.ragnarok.fenrir.api.model import dev.ragnarok.fenrir.api.adapters.PhotoAlbumDtoAdapter +import dev.ragnarok.fenrir.api.model.interfaces.VKApiAttachment import kotlinx.serialization.Serializable /** diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/VKApiPoll.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/VKApiPoll.kt index 46c56e6f6..96934890d 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/VKApiPoll.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/VKApiPoll.kt @@ -1,5 +1,6 @@ package dev.ragnarok.fenrir.api.model +import dev.ragnarok.fenrir.api.model.interfaces.VKApiAttachment import kotlinx.serialization.Serializable /** diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/VKApiPost.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/VKApiPost.kt index 2bf659b97..ca2234e8d 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/VKApiPost.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/VKApiPost.kt @@ -1,6 +1,10 @@ package dev.ragnarok.fenrir.api.model import dev.ragnarok.fenrir.api.adapters.PostDtoAdapter +import dev.ragnarok.fenrir.api.model.interfaces.Commentable +import dev.ragnarok.fenrir.api.model.interfaces.Copyable +import dev.ragnarok.fenrir.api.model.interfaces.Likeable +import dev.ragnarok.fenrir.api.model.interfaces.VKApiAttachment import dev.ragnarok.fenrir.nonNullNoEmpty import dev.ragnarok.fenrir.orZero import kotlinx.serialization.Serializable diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/VKApiSchool.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/VKApiSchool.kt index bce61f478..d0a8d7a5a 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/VKApiSchool.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/VKApiSchool.kt @@ -1,5 +1,6 @@ package dev.ragnarok.fenrir.api.model +import dev.ragnarok.fenrir.api.model.interfaces.IUserActivityPoint import kotlinx.serialization.Serializable /** diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/VKApiSticker.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/VKApiSticker.kt index 711ab77c5..46b3013f9 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/VKApiSticker.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/VKApiSticker.kt @@ -1,5 +1,6 @@ package dev.ragnarok.fenrir.api.model +import dev.ragnarok.fenrir.api.model.interfaces.VKApiAttachment import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/VKApiStickerSet.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/VKApiStickerSet.kt index bcfe2d3c7..80024a607 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/VKApiStickerSet.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/VKApiStickerSet.kt @@ -1,5 +1,6 @@ package dev.ragnarok.fenrir.api.model +import dev.ragnarok.fenrir.api.model.interfaces.Identificable import dev.ragnarok.fenrir.orZero import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/VKApiStory.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/VKApiStory.kt index 0fc3e6f99..e35660dd2 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/VKApiStory.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/VKApiStory.kt @@ -1,6 +1,7 @@ package dev.ragnarok.fenrir.api.model import dev.ragnarok.fenrir.api.adapters.StoryDtoAdapter +import dev.ragnarok.fenrir.api.model.interfaces.VKApiAttachment import kotlinx.serialization.Serializable @Serializable(with = StoryDtoAdapter::class) diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/VKApiTopic.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/VKApiTopic.kt index 4cf072efe..325d41697 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/VKApiTopic.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/VKApiTopic.kt @@ -1,6 +1,7 @@ package dev.ragnarok.fenrir.api.model import dev.ragnarok.fenrir.api.adapters.TopicDtoAdapter +import dev.ragnarok.fenrir.api.model.interfaces.Commentable import kotlinx.serialization.Serializable /** diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/VKApiUniversity.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/VKApiUniversity.kt index d86c2b9a3..ca9c18bde 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/VKApiUniversity.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/VKApiUniversity.kt @@ -1,5 +1,6 @@ package dev.ragnarok.fenrir.api.model +import dev.ragnarok.fenrir.api.model.interfaces.IUserActivityPoint import kotlinx.serialization.Serializable /** diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/VKApiVideo.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/VKApiVideo.kt index 3562b2fb0..166b0a7fe 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/VKApiVideo.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/VKApiVideo.kt @@ -2,6 +2,10 @@ package dev.ragnarok.fenrir.api.model import dev.ragnarok.fenrir.api.adapters.VideoDtoAdapter import dev.ragnarok.fenrir.api.model.catalog_v2_audio.IIdComparable +import dev.ragnarok.fenrir.api.model.interfaces.Commentable +import dev.ragnarok.fenrir.api.model.interfaces.Copyable +import dev.ragnarok.fenrir.api.model.interfaces.Likeable +import dev.ragnarok.fenrir.api.model.interfaces.VKApiAttachment import kotlinx.serialization.Serializable /** diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/VKApiWallReply.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/VKApiWallReply.kt index 5c3cd90fc..721e123ee 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/VKApiWallReply.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/VKApiWallReply.kt @@ -1,5 +1,6 @@ package dev.ragnarok.fenrir.api.model +import dev.ragnarok.fenrir.api.model.interfaces.VKApiAttachment import dev.ragnarok.fenrir.orZero import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/VKApiWikiPage.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/VKApiWikiPage.kt index baa91a92c..e9bf380c9 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/VKApiWikiPage.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/VKApiWikiPage.kt @@ -1,5 +1,6 @@ package dev.ragnarok.fenrir.api.model +import dev.ragnarok.fenrir.api.model.interfaces.VKApiAttachment import kotlinx.serialization.Serializable /** diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/feedback/VKApiCommentFeedback.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/feedback/VKApiCommentFeedback.kt index 5c3186891..65e1d3205 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/feedback/VKApiCommentFeedback.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/feedback/VKApiCommentFeedback.kt @@ -1,7 +1,7 @@ package dev.ragnarok.fenrir.api.model.feedback -import dev.ragnarok.fenrir.api.model.Commentable import dev.ragnarok.fenrir.api.model.VKApiComment +import dev.ragnarok.fenrir.api.model.interfaces.Commentable import kotlinx.serialization.Serializable @Serializable diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/feedback/VKApiCopyFeedback.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/feedback/VKApiCopyFeedback.kt index 889b2f303..d06c486f2 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/feedback/VKApiCopyFeedback.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/feedback/VKApiCopyFeedback.kt @@ -1,6 +1,6 @@ package dev.ragnarok.fenrir.api.model.feedback -import dev.ragnarok.fenrir.api.model.Copyable +import dev.ragnarok.fenrir.api.model.interfaces.Copyable import kotlinx.serialization.Serializable @Serializable diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/feedback/VKApiLikeCommentFeedback.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/feedback/VKApiLikeCommentFeedback.kt index 573de1477..53bdcdd39 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/feedback/VKApiLikeCommentFeedback.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/feedback/VKApiLikeCommentFeedback.kt @@ -1,7 +1,7 @@ package dev.ragnarok.fenrir.api.model.feedback -import dev.ragnarok.fenrir.api.model.Commentable import dev.ragnarok.fenrir.api.model.VKApiComment +import dev.ragnarok.fenrir.api.model.interfaces.Commentable import kotlinx.serialization.Serializable @Serializable diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/feedback/VKApiLikeFeedback.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/feedback/VKApiLikeFeedback.kt index faa86f2ad..eea41c922 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/feedback/VKApiLikeFeedback.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/feedback/VKApiLikeFeedback.kt @@ -1,6 +1,6 @@ package dev.ragnarok.fenrir.api.model.feedback -import dev.ragnarok.fenrir.api.model.Likeable +import dev.ragnarok.fenrir.api.model.interfaces.Likeable import kotlinx.serialization.Serializable @Serializable diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/feedback/VKApiMentionCommentFeedback.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/feedback/VKApiMentionCommentFeedback.kt index 4994ad01c..38d0558ed 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/feedback/VKApiMentionCommentFeedback.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/feedback/VKApiMentionCommentFeedback.kt @@ -1,7 +1,7 @@ package dev.ragnarok.fenrir.api.model.feedback -import dev.ragnarok.fenrir.api.model.Commentable import dev.ragnarok.fenrir.api.model.VKApiComment +import dev.ragnarok.fenrir.api.model.interfaces.Commentable import kotlinx.serialization.Serializable @Serializable diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/feedback/VKApiReplyCommentFeedback.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/feedback/VKApiReplyCommentFeedback.kt index d5984d0e3..bbcec8a3f 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/feedback/VKApiReplyCommentFeedback.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/feedback/VKApiReplyCommentFeedback.kt @@ -1,7 +1,7 @@ package dev.ragnarok.fenrir.api.model.feedback -import dev.ragnarok.fenrir.api.model.Commentable import dev.ragnarok.fenrir.api.model.VKApiComment +import dev.ragnarok.fenrir.api.model.interfaces.Commentable import kotlinx.serialization.Serializable @Serializable diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/interfaces/Commentable.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/interfaces/Commentable.kt new file mode 100644 index 000000000..129b40906 --- /dev/null +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/interfaces/Commentable.kt @@ -0,0 +1,3 @@ +package dev.ragnarok.fenrir.api.model.interfaces + +interface Commentable \ No newline at end of file diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/interfaces/Copyable.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/interfaces/Copyable.kt new file mode 100644 index 000000000..b64d1d309 --- /dev/null +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/interfaces/Copyable.kt @@ -0,0 +1,3 @@ +package dev.ragnarok.fenrir.api.model.interfaces + +interface Copyable \ No newline at end of file diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/IAttachmentToken.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/interfaces/IAttachmentToken.kt similarity index 53% rename from app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/IAttachmentToken.kt rename to app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/interfaces/IAttachmentToken.kt index 1931b1529..8390a7133 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/IAttachmentToken.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/interfaces/IAttachmentToken.kt @@ -1,4 +1,4 @@ -package dev.ragnarok.fenrir.api.model +package dev.ragnarok.fenrir.api.model.interfaces interface IAttachmentToken { fun format(): String diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/interfaces/IUserActivityPoint.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/interfaces/IUserActivityPoint.kt new file mode 100644 index 000000000..13bc1522d --- /dev/null +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/interfaces/IUserActivityPoint.kt @@ -0,0 +1,3 @@ +package dev.ragnarok.fenrir.api.model.interfaces + +interface IUserActivityPoint \ No newline at end of file diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/Identificable.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/interfaces/Identificable.kt similarity index 81% rename from app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/Identificable.kt rename to app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/interfaces/Identificable.kt index 1ad2a7644..6c6c44c9d 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/Identificable.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/interfaces/Identificable.kt @@ -1,4 +1,4 @@ -package dev.ragnarok.fenrir.api.model +package dev.ragnarok.fenrir.api.model.interfaces /** * Describes objects that contains an "id" field. diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/interfaces/Likeable.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/interfaces/Likeable.kt new file mode 100644 index 000000000..39c2d63f9 --- /dev/null +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/interfaces/Likeable.kt @@ -0,0 +1,3 @@ +package dev.ragnarok.fenrir.api.model.interfaces + +interface Likeable \ No newline at end of file diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/VKApiAttachment.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/interfaces/VKApiAttachment.kt similarity index 96% rename from app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/VKApiAttachment.kt rename to app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/interfaces/VKApiAttachment.kt index 4ff9604ac..e302a58cf 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/VKApiAttachment.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/interfaces/VKApiAttachment.kt @@ -1,4 +1,4 @@ -package dev.ragnarok.fenrir.api.model +package dev.ragnarok.fenrir.api.model.interfaces /** * An abstract class for all attachments diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/longpoll/InputMessagesSetReadUpdate.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/longpoll/InputMessagesSetReadUpdate.kt index 6eaef2f2c..8c3d82220 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/longpoll/InputMessagesSetReadUpdate.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/longpoll/InputMessagesSetReadUpdate.kt @@ -5,4 +5,11 @@ class InputMessagesSetReadUpdate : var peerId = 0 var localId = 0 var unreadCount = 0 + + fun set(peerId: Int, localId: Int, unreadCount: Int): InputMessagesSetReadUpdate { + this.peerId = peerId + this.localId = localId + this.unreadCount = unreadCount + return this + } } \ No newline at end of file diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/longpoll/UserIsOfflineUpdate.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/longpoll/UserIsOfflineUpdate.kt index 6dc241a7c..9441c7892 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/longpoll/UserIsOfflineUpdate.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/longpoll/UserIsOfflineUpdate.kt @@ -2,7 +2,7 @@ package dev.ragnarok.fenrir.api.model.longpoll class UserIsOfflineUpdate : AbsLongpollEvent(ACTION_USER_IS_OFFLINE) { var userId = 0 - var timestamp = 0 + var timestamp = 0L var isTimeout = false var app_id = 0 -} \ No newline at end of file +} diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/longpoll/UserIsOnlineUpdate.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/longpoll/UserIsOnlineUpdate.kt index 1fd7a29e0..3a881a9ca 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/longpoll/UserIsOnlineUpdate.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/longpoll/UserIsOnlineUpdate.kt @@ -3,6 +3,6 @@ package dev.ragnarok.fenrir.api.model.longpoll class UserIsOnlineUpdate : AbsLongpollEvent(ACTION_USER_IS_ONLINE) { var userId = 0 var platform = 0 - var timestamp = 0 + var timestamp = 0L var app_id = 0 -} \ No newline at end of file +} diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/response/BaseResponse.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/response/BaseResponse.kt index 389f68195..dbed377d4 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/response/BaseResponse.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/response/BaseResponse.kt @@ -1,6 +1,5 @@ package dev.ragnarok.fenrir.api.model.response -import dev.ragnarok.fenrir.api.model.Error import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable @@ -8,7 +7,4 @@ import kotlinx.serialization.Serializable class BaseResponse : VkResponse() { @SerialName("response") var response: T? = null - - @SerialName("execute_errors") - var executeErrors: List? = null -} \ No newline at end of file +} diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/response/BlockResponse.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/response/BlockResponse.kt deleted file mode 100644 index 14f9c0063..000000000 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/response/BlockResponse.kt +++ /dev/null @@ -1,10 +0,0 @@ -package dev.ragnarok.fenrir.api.model.response - -import kotlinx.serialization.SerialName -import kotlinx.serialization.Serializable - -@Serializable -class BlockResponse { - @SerialName("block") - var block: T? = null -} \ No newline at end of file diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/response/MessageImportantResponse.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/response/MessageImportantResponse.kt index f7c980b94..882bde29e 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/response/MessageImportantResponse.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/response/MessageImportantResponse.kt @@ -1,7 +1,6 @@ package dev.ragnarok.fenrir.api.model.response import dev.ragnarok.fenrir.api.model.VKApiCommunity -import dev.ragnarok.fenrir.api.model.VKApiConversation import dev.ragnarok.fenrir.api.model.VKApiMessage import dev.ragnarok.fenrir.api.model.VKApiUser import kotlinx.serialization.SerialName @@ -12,9 +11,6 @@ class MessageImportantResponse { @SerialName("messages") var messages: Message? = null - @SerialName("conversations") - var conversations: List? = null - @SerialName("profiles") var profiles: List? = null @@ -29,4 +25,4 @@ class MessageImportantResponse { @SerialName("count") var count = 0 } -} \ No newline at end of file +} diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/response/PushSettingsResponse.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/response/PushSettingsResponse.kt index 14970dcb0..a7bc60746 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/response/PushSettingsResponse.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/response/PushSettingsResponse.kt @@ -19,10 +19,10 @@ class PushSettingsResponse { @Serializable class ConversationPushItem { @SerialName("disabled_until") - var disabled_until = 0 + var disabled_until = 0L @SerialName("peer_id") var peer_id = 0 } } -} \ No newline at end of file +} diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/response/VkResponse.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/response/VkResponse.kt index 4e7f69ce6..87544e46f 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/response/VkResponse.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/model/response/VkResponse.kt @@ -8,4 +8,9 @@ import kotlinx.serialization.Serializable open class VkResponse { @SerialName("error") var error: Error? = null -} \ No newline at end of file + + /* + @SerialName("execute_errors") + var executeErrors: List? = null + */ +} diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/services/IFriendsService.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/services/IFriendsService.kt index 542bdd03e..9fd7515ee 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/services/IFriendsService.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/api/services/IFriendsService.kt @@ -95,6 +95,16 @@ class IFriendsService : IServiceRest() { ) } + fun deleteSubscriber( + subscriber_id: Int + ): Single> { + return rest.request( + "friends.deleteSubscriber", form( + "subscriber_id" to subscriber_id, + ), baseInt + ) + } + //https://vk.com/dev/friends.search fun search( userId: Int, diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/crypt/SessionIdGenerationException.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/crypt/SessionIdGenerationException.kt deleted file mode 100644 index 5d7533b40..000000000 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/crypt/SessionIdGenerationException.kt +++ /dev/null @@ -1,3 +0,0 @@ -package dev.ragnarok.fenrir.crypt - -class SessionIdGenerationException(message: String?) : Exception(message) \ No newline at end of file diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/db/TempDataHelper.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/db/TempDataHelper.kt index 920c3ca37..902dc708f 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/db/TempDataHelper.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/db/TempDataHelper.kt @@ -27,16 +27,16 @@ class TempDataHelper(context: Context) : } private fun createStickerSetTable(db: SQLiteDatabase) { - val sql = "CREATE TABLE IF NOT EXISTS [" + StikerSetColumns.TABLENAME + "] (\n" + + val sql = "CREATE TABLE IF NOT EXISTS [" + StickerSetColumns.TABLENAME + "] (\n" + " [" + BaseColumns._ID + "] INTEGER NOT NULL UNIQUE ON CONFLICT REPLACE, " + - " [" + StikerSetColumns.ACCOUNT_ID + "] INTEGER, " + - " [" + StikerSetColumns.POSITION + "] INTEGER, " + - " [" + StikerSetColumns.TITLE + "] TEXT, " + - " [" + StikerSetColumns.ICON + "] BLOB, " + - " [" + StikerSetColumns.PURCHASED + "] BOOLEAN, " + - " [" + StikerSetColumns.PROMOTED + "] BOOLEAN, " + - " [" + StikerSetColumns.ACTIVE + "] BOOLEAN, " + - " [" + StikerSetColumns.STICKERS + "] BLOB, " + + " [" + StickerSetColumns.ACCOUNT_ID + "] INTEGER, " + + " [" + StickerSetColumns.POSITION + "] INTEGER, " + + " [" + StickerSetColumns.TITLE + "] TEXT, " + + " [" + StickerSetColumns.ICON + "] BLOB, " + + " [" + StickerSetColumns.PURCHASED + "] BOOLEAN, " + + " [" + StickerSetColumns.PROMOTED + "] BOOLEAN, " + + " [" + StickerSetColumns.ACTIVE + "] BOOLEAN, " + + " [" + StickerSetColumns.STICKERS + "] BLOB, " + " CONSTRAINT [] PRIMARY KEY([" + BaseColumns._ID + "]) ON CONFLICT REPLACE);" db.execSQL(sql) } @@ -139,7 +139,7 @@ class TempDataHelper(context: Context) : db.execSQL("DROP TABLE IF EXISTS " + LogColumns.TABLENAME) db.execSQL("DROP TABLE IF EXISTS " + ShortcutColumns.TABLENAME) db.execSQL("DROP TABLE IF EXISTS " + AudioColumns.TABLENAME) - db.execSQL("DROP TABLE IF EXISTS " + StikerSetColumns.TABLENAME) + db.execSQL("DROP TABLE IF EXISTS " + StickerSetColumns.TABLENAME) db.execSQL("DROP TABLE IF EXISTS " + StickersKeywordsColumns.TABLENAME) onCreate(db) } diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/db/column/StikerSetColumns.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/db/column/StickerSetColumns.kt similarity index 90% rename from app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/db/column/StikerSetColumns.kt rename to app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/db/column/StickerSetColumns.kt index 695a67871..14a930bf9 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/db/column/StikerSetColumns.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/db/column/StickerSetColumns.kt @@ -2,7 +2,7 @@ package dev.ragnarok.fenrir.db.column import android.provider.BaseColumns -object StikerSetColumns : BaseColumns { +object StickerSetColumns : BaseColumns { const val TABLENAME = "sticker_set" const val ACCOUNT_ID = "account_id" const val POSITION = "position" diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/db/impl/DialogsStorage.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/db/impl/DialogsStorage.kt index b3f54bab9..71c529cff 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/db/impl/DialogsStorage.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/db/impl/DialogsStorage.kt @@ -466,7 +466,7 @@ internal class DialogsStorage(base: AppStorages) : AbsStorage(base), IDialogsSto .setBody(cursor.getString(DialogsColumns.FOREIGN_MESSAGE_BODY)) .setDate(cursor.getLong(DialogsColumns.FOREIGN_MESSAGE_DATE)) .setOut(cursor.getBoolean(DialogsColumns.FOREIGN_MESSAGE_OUT)) - .setHasAttachmens(cursor.getBoolean(DialogsColumns.FOREIGN_MESSAGE_HAS_ATTACHMENTS)) + .setHasAttachments(cursor.getBoolean(DialogsColumns.FOREIGN_MESSAGE_HAS_ATTACHMENTS)) .setForwardCount(cursor.getInt(DialogsColumns.FOREIGN_MESSAGE_FWD_COUNT)) .setAction(action) .setEncrypted(encrypted) diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/db/impl/FeedStorage.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/db/impl/FeedStorage.kt index 2553e12c3..4a9833133 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/db/impl/FeedStorage.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/db/impl/FeedStorage.kt @@ -106,9 +106,9 @@ internal class FeedStorage(base: AppStorages) : AbsStorage(base), IFeedStorage { } } - override fun storeLists(accountid: Int, entities: List): Completable { + override fun storeLists(accountId: Int, entities: List): Completable { return Completable.create { e: CompletableEmitter -> - val uri = getFeedListsContentUriFor(accountid) + val uri = getFeedListsContentUriFor(accountId) val operations = ArrayList() operations.add( ContentProviderOperation.newDelete(uri) @@ -307,4 +307,4 @@ internal class FeedStorage(base: AppStorages) : AbsStorage(base), IFeedStorage { .setNoReposts(cursor.getBoolean(FeedListsColumns.NO_REPOSTS)) } } -} \ No newline at end of file +} diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/db/impl/KeysPersistStorage.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/db/impl/KeysPersistStorage.kt index e9a76bdc6..1ec255cd0 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/db/impl/KeysPersistStorage.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/db/impl/KeysPersistStorage.kt @@ -31,9 +31,9 @@ internal class KeysPersistStorage(context: AppStorages) : AbsStorage(context), I override fun saveKeyPair(pair: AesKeyPair): Completable { return Completable.create { e: CompletableEmitter -> - val alreaadyExist = findKeyPairFor(pair.accountId, pair.sessionId) + val alreadyExist = findKeyPairFor(pair.accountId, pair.sessionId) .blockingGet() - if (alreaadyExist != null) { + if (alreadyExist != null) { e.tryOnError(DatabaseException("Key pair with the session ID is already in the database")) return@create } @@ -149,4 +149,4 @@ internal class KeysPersistStorage(context: AppStorages) : AbsStorage(context), I e.onComplete() } } -} \ No newline at end of file +} diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/db/impl/MessagesStorage.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/db/impl/MessagesStorage.kt index b4af949c5..8190bc2ec 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/db/impl/MessagesStorage.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/db/impl/MessagesStorage.kt @@ -86,9 +86,9 @@ internal class MessagesStorage(base: AppStorages) : AbsStorage(base), IMessagesS } } - override fun findLastSentMessageIdForPeer(accounId: Int, peerId: Int): Single> { + override fun findLastSentMessageIdForPeer(accountId: Int, peerId: Int): Single> { return Single.create { emitter: SingleEmitter> -> - val uri = getMessageContentUriFor(accounId) + val uri = getMessageContentUriFor(accountId) val projection = arrayOf(MessageColumns._ID) val where = MessageColumns.PEER_ID + " = ?" + " AND " + MessageColumns.STATUS + " = ?" + @@ -336,7 +336,7 @@ internal class MessagesStorage(base: AppStorages) : AbsStorage(base), IMessagesS cancelable: Cancelable ): MessageDboEntity { val dbo = baseMapDbo(cursor) - if (withAttachments && dbo.isHasAttachmens) { + if (withAttachments && dbo.isHasAttachments) { val attachments = stores .attachments() .getAttachmentsDbosSync(accountId, AttachToType.MESSAGE, dbo.id, cancelable) @@ -385,16 +385,16 @@ internal class MessagesStorage(base: AppStorages) : AbsStorage(base), IMessagesS } } - override fun saveDraftMessageBody(acocuntId: Int, peerId: Int, body: String?): Single { + override fun saveDraftMessageBody(accountId: Int, peerId: Int, body: String?): Single { return Single.create { e: SingleEmitter -> val start = System.currentTimeMillis() - val uri = getMessageContentUriFor(acocuntId) + val uri = getMessageContentUriFor(accountId) val cv = ContentValues() cv.put(MessageColumns.BODY, body) cv.put(MessageColumns.PEER_ID, peerId) cv.put(MessageColumns.STATUS, MessageStatus.EDITING) val cr = contentResolver - var existDraftMessageId = findDraftMessageId(acocuntId, peerId) + var existDraftMessageId = findDraftMessageId(accountId, peerId) //.blockingGet(); if (existDraftMessageId != null) { cr.update( @@ -604,7 +604,7 @@ internal class MessagesStorage(base: AppStorages) : AbsStorage(base), IMessagesS override fun findMessagesByIds( accountId: Int, ids: List, - withAtatchments: Boolean, + withAttachments: Boolean, withForwardMessages: Boolean ): Single> { return Single.create { emitter: SingleEmitter> -> @@ -632,7 +632,7 @@ internal class MessagesStorage(base: AppStorages) : AbsStorage(base), IMessagesS val dbo = fullMapDbo( accountId, cursor, - withAtatchments, + withAttachments, withForwardMessages, cancelable ) @@ -647,7 +647,7 @@ internal class MessagesStorage(base: AppStorages) : AbsStorage(base), IMessagesS override fun findFirstUnsentMessage( accountIds: Collection, - withAtatchments: Boolean, + withAttachments: Boolean, withForwardMessages: Boolean ): Single>> { return Single.create { emitter: SingleEmitter>> -> @@ -666,7 +666,7 @@ internal class MessagesStorage(base: AppStorages) : AbsStorage(base), IMessagesS entity = fullMapDbo( accountId, cursor, - withAtatchments, + withAttachments, withForwardMessages, object : Cancelable { override val isOperationCancelled: Boolean @@ -759,7 +759,7 @@ internal class MessagesStorage(base: AppStorages) : AbsStorage(base), IMessagesS cv.put(MessageColumns.IMPORTANT, dbo.isImportant) cv.put(MessageColumns.DELETED, dbo.isDeleted) cv.put(MessageColumns.FORWARD_COUNT, dbo.forwardCount) - cv.put(MessageColumns.HAS_ATTACHMENTS, dbo.isHasAttachmens) + cv.put(MessageColumns.HAS_ATTACHMENTS, dbo.isHasAttachments) cv.put(MessageColumns.STATUS, dbo.status) cv.put(MessageColumns.ORIGINAL_ID, dbo.originalId) cv.put(MessageColumns.ACTION, dbo.action) @@ -805,7 +805,7 @@ internal class MessagesStorage(base: AppStorages) : AbsStorage(base), IMessagesS builder.withValueBackReference(MessageColumns.ATTACH_TO, attachToIndex) } val index = addToListAndReturnIndex(target, builder.build()) - if (dbo.isHasAttachmens) { + if (dbo.isHasAttachments) { dbo.getAttachments().nonNullNoEmpty { for (attachmentEntity in it) { appendAttachOperationWithBackReference( @@ -861,7 +861,7 @@ internal class MessagesStorage(base: AppStorages) : AbsStorage(base), IMessagesS .setOut(cursor.getBoolean(MessageColumns.OUT)) .setStatus(status) .setDate(cursor.getLong(MessageColumns.DATE)) - .setHasAttachmens(cursor.getBoolean(MessageColumns.HAS_ATTACHMENTS)) + .setHasAttachments(cursor.getBoolean(MessageColumns.HAS_ATTACHMENTS)) .setForwardCount(cursor.getInt(MessageColumns.FORWARD_COUNT)) .setDeleted(cursor.getBoolean(MessageColumns.DELETED)) .setDeletedForAll(cursor.getBoolean(MessageColumns.DELETED_FOR_ALL)) //.setTitle(cursor.getString(MessageColumns.TITLE)) @@ -880,4 +880,4 @@ internal class MessagesStorage(base: AppStorages) : AbsStorage(base), IMessagesS .setKeyboard(keyboard) } } -} \ No newline at end of file +} diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/db/impl/OwnersStorage.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/db/impl/OwnersStorage.kt index bf07638ab..9902e4698 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/db/impl/OwnersStorage.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/db/impl/OwnersStorage.kt @@ -495,11 +495,11 @@ internal class OwnersStorage(context: AppStorages) : AbsStorage(context), IOwner fun appendUsersInsertOperation( operations: MutableList, - accouuntId: Int, + accountId: Int, dbos: List? ) { dbos ?: return - val uri = getUserContentUriFor(accouuntId) + val uri = getUserContentUriFor(accountId) for (dbo in dbos) { appendUserInsertOperation(operations, uri, dbo) } @@ -508,11 +508,11 @@ internal class OwnersStorage(context: AppStorages) : AbsStorage(context), IOwner fun appendCommunitiesInsertOperation( operations: MutableList, - accouuntId: Int, + accountId: Int, dbos: List? ) { dbos ?: return - val uri = getGroupsContentUriFor(accouuntId) + val uri = getGroupsContentUriFor(accountId) for (dbo in dbos) { appendCommunityInsertOperation(operations, uri, dbo) } @@ -617,4 +617,4 @@ internal class OwnersStorage(context: AppStorages) : AbsStorage(context), IOwner } } -} \ No newline at end of file +} diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/db/impl/StickersStorage.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/db/impl/StickersStorage.kt index 79a70d2ab..68a8293ab 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/db/impl/StickersStorage.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/db/impl/StickersStorage.kt @@ -5,8 +5,8 @@ import android.database.Cursor import android.provider.BaseColumns import dev.ragnarok.fenrir.* import dev.ragnarok.fenrir.db.TempDataHelper +import dev.ragnarok.fenrir.db.column.StickerSetColumns import dev.ragnarok.fenrir.db.column.StickersKeywordsColumns -import dev.ragnarok.fenrir.db.column.StikerSetColumns import dev.ragnarok.fenrir.db.interfaces.IStickersStorage import dev.ragnarok.fenrir.db.model.entity.StickerDboEntity import dev.ragnarok.fenrir.db.model.entity.StickerSetEntity @@ -30,10 +30,10 @@ internal class StickersStorage(base: AppStorages) : AbsStorage(base), IStickersS val db = TempDataHelper.helper.writableDatabase db.beginTransaction() try { - val whereDel = StikerSetColumns.ACCOUNT_ID + " = ?" - db.delete(StikerSetColumns.TABLENAME, whereDel, arrayOf(accountId.toString())) + val whereDel = StickerSetColumns.ACCOUNT_ID + " = ?" + db.delete(StickerSetColumns.TABLENAME, whereDel, arrayOf(accountId.toString())) for ((i, entity) in sets.withIndex()) { - db.insert(StikerSetColumns.TABLENAME, null, createCv(accountId, entity, i)) + db.insert(StickerSetColumns.TABLENAME, null, createCv(accountId, entity, i)) } db.setTransactionSuccessful() db.endTransaction() @@ -47,13 +47,13 @@ internal class StickersStorage(base: AppStorages) : AbsStorage(base), IStickersS } override fun clearAccount(accountId: Int): Completable { - Settings.get().other().del_last_stikers_sync(accountId) + Settings.get().other().del_last_stickers_sync(accountId) return Completable.create { e: CompletableEmitter -> val db = TempDataHelper.helper.writableDatabase db.beginTransaction() try { - val whereDel = StikerSetColumns.ACCOUNT_ID + " = ?" - db.delete(StikerSetColumns.TABLENAME, whereDel, arrayOf(accountId.toString())) + val whereDel = StickerSetColumns.ACCOUNT_ID + " = ?" + db.delete(StickerSetColumns.TABLENAME, whereDel, arrayOf(accountId.toString())) val whereDelK = StickersKeywordsColumns.ACCOUNT_ID + " = ?" db.delete( StickersKeywordsColumns.TABLENAME, @@ -104,10 +104,10 @@ internal class StickersStorage(base: AppStorages) : AbsStorage(base), IStickersS return Single.create { e: SingleEmitter> -> val start = System.currentTimeMillis() val where = - "${StikerSetColumns.ACCOUNT_ID} = ? AND ${StikerSetColumns.PURCHASED} = ? AND ${StikerSetColumns.ACTIVE} = ?" + "${StickerSetColumns.ACCOUNT_ID} = ? AND ${StickerSetColumns.PURCHASED} = ? AND ${StickerSetColumns.ACTIVE} = ?" val args = arrayOf(accountId.toString(), "1", "1") val cursor = TempDataHelper.helper.readableDatabase.query( - StikerSetColumns.TABLENAME, + StickerSetColumns.TABLENAME, COLUMNS_STICKER_SET, where, args, @@ -165,14 +165,14 @@ internal class StickersStorage(base: AppStorages) : AbsStorage(base), IStickersS companion object { private val COLUMNS_STICKER_SET = arrayOf( BaseColumns._ID, - StikerSetColumns.ACCOUNT_ID, - StikerSetColumns.POSITION, - StikerSetColumns.TITLE, - StikerSetColumns.ICON, - StikerSetColumns.PURCHASED, - StikerSetColumns.PROMOTED, - StikerSetColumns.ACTIVE, - StikerSetColumns.STICKERS + StickerSetColumns.ACCOUNT_ID, + StickerSetColumns.POSITION, + StickerSetColumns.TITLE, + StickerSetColumns.ICON, + StickerSetColumns.PURCHASED, + StickerSetColumns.PROMOTED, + StickerSetColumns.ACTIVE, + StickerSetColumns.STICKERS ) private val KEYWORDS_STICKER_COLUMNS = arrayOf( BaseColumns._ID, @@ -188,31 +188,31 @@ internal class StickersStorage(base: AppStorages) : AbsStorage(base), IStickersS internal fun createCv(accountId: Int, entity: StickerSetEntity, pos: Int): ContentValues { val cv = ContentValues() cv.put(BaseColumns._ID, entity.id) - cv.put(StikerSetColumns.ACCOUNT_ID, accountId) - cv.put(StikerSetColumns.POSITION, pos) + cv.put(StickerSetColumns.ACCOUNT_ID, accountId) + cv.put(StickerSetColumns.POSITION, pos) entity.icon.ifNonNull({ cv.put( - StikerSetColumns.ICON, + StickerSetColumns.ICON, MsgPack.encodeToByteArrayEx( ListSerializer(StickerSetEntity.Img.serializer()), it ) ) }, { - cv.putNull(StikerSetColumns.ICON) + cv.putNull(StickerSetColumns.ICON) }) - cv.put(StikerSetColumns.TITLE, entity.title) - cv.put(StikerSetColumns.PURCHASED, entity.isPurchased) - cv.put(StikerSetColumns.PROMOTED, entity.isPromoted) - cv.put(StikerSetColumns.ACTIVE, entity.isActive) + cv.put(StickerSetColumns.TITLE, entity.title) + cv.put(StickerSetColumns.PURCHASED, entity.isPurchased) + cv.put(StickerSetColumns.PROMOTED, entity.isPromoted) + cv.put(StickerSetColumns.ACTIVE, entity.isActive) entity.stickers.ifNonNull({ cv.put( - StikerSetColumns.STICKERS, + StickerSetColumns.STICKERS, MsgPack.encodeToByteArrayEx(ListSerializer(StickerDboEntity.serializer()), it) ) }, { - cv.putNull(StikerSetColumns.STICKERS) + cv.putNull(StickerSetColumns.STICKERS) }) return cv } @@ -245,8 +245,8 @@ internal class StickersStorage(base: AppStorages) : AbsStorage(base), IStickersS } internal fun mapStickerSet(cursor: Cursor): StickerSetEntity { - val stickersJson = cursor.getBlob(StikerSetColumns.STICKERS) - val iconJson = cursor.getBlob(StikerSetColumns.ICON) + val stickersJson = cursor.getBlob(StickerSetColumns.STICKERS) + val iconJson = cursor.getBlob(StickerSetColumns.ICON) return StickerSetEntity(cursor.getInt(BaseColumns._ID)) .setStickers( if (stickersJson == null) null else MsgPack.decodeFromByteArrayEx( @@ -254,9 +254,9 @@ internal class StickersStorage(base: AppStorages) : AbsStorage(base), IStickersS stickersJson ) ) - .setActive(cursor.getBoolean(StikerSetColumns.ACTIVE)) - .setPurchased(cursor.getBoolean(StikerSetColumns.PURCHASED)) - .setPromoted(cursor.getBoolean(StikerSetColumns.PROMOTED)) + .setActive(cursor.getBoolean(StickerSetColumns.ACTIVE)) + .setPurchased(cursor.getBoolean(StickerSetColumns.PURCHASED)) + .setPromoted(cursor.getBoolean(StickerSetColumns.PROMOTED)) .setIcon( if (iconJson == null) null else MsgPack.decodeFromByteArrayEx( ListSerializer( @@ -264,8 +264,8 @@ internal class StickersStorage(base: AppStorages) : AbsStorage(base), IStickersS ), iconJson ) ) - .setPosition(cursor.getInt(StikerSetColumns.POSITION)) - .setTitle(cursor.getString(StikerSetColumns.TITLE)) + .setPosition(cursor.getInt(StickerSetColumns.POSITION)) + .setTitle(cursor.getString(StickerSetColumns.TITLE)) } internal fun mapStickersKeywords(cursor: Cursor): StickersKeywordsEntity { diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/db/interfaces/IFeedStorage.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/db/interfaces/IFeedStorage.kt index 91c3f11f9..1742cac49 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/db/interfaces/IFeedStorage.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/db/interfaces/IFeedStorage.kt @@ -17,6 +17,6 @@ interface IFeedStorage : IStorage { clearBeforeStore: Boolean ): Single - fun storeLists(accountid: Int, entities: List): Completable + fun storeLists(accountId: Int, entities: List): Completable fun getAllLists(criteria: FeedSourceCriteria): Single> -} \ No newline at end of file +} diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/db/interfaces/IMessagesStorage.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/db/interfaces/IMessagesStorage.kt index ae61d655b..4d3a0c98a 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/db/interfaces/IMessagesStorage.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/db/interfaces/IMessagesStorage.kt @@ -35,7 +35,7 @@ interface IMessagesStorage : IStorage { fun findDraftMessage(accountId: Int, peerId: Int): Maybe @CheckResult - fun saveDraftMessageBody(acocuntId: Int, peerId: Int, body: String?): Single + fun saveDraftMessageBody(accountId: Int, peerId: Int, body: String?): Single //@CheckResult //Maybe getDraftMessageId(int accountId, int peerId); @@ -61,17 +61,17 @@ interface IMessagesStorage : IStorage { //Completable updateMessageFlag(int accountId, int messageId, Collection> values); @CheckResult fun deleteMessage(accountId: Int, messageId: Int): Single - fun findLastSentMessageIdForPeer(accounId: Int, peerId: Int): Single> + fun findLastSentMessageIdForPeer(accountId: Int, peerId: Int): Single> fun findMessagesByIds( accountId: Int, ids: List, - withAtatchments: Boolean, + withAttachments: Boolean, withForwardMessages: Boolean ): Single> fun findFirstUnsentMessage( accountIds: Collection, - withAtatchments: Boolean, + withAttachments: Boolean, withForwardMessages: Boolean ): Single>> @@ -102,4 +102,4 @@ interface IMessagesStorage : IStorage { @CheckResult fun deleteMessages(accountId: Int, ids: Collection): Single -} \ No newline at end of file +} diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/db/model/AttachmentsTypes.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/db/model/AttachmentsTypes.kt index 1132a0e40..511511dd5 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/db/model/AttachmentsTypes.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/db/model/AttachmentsTypes.kt @@ -19,7 +19,7 @@ import androidx.annotation.IntDef AttachmentsTypes.TOPIC, AttachmentsTypes.AUDIO_MESSAGE, AttachmentsTypes.GIFT, - AttachmentsTypes.GRAFFITY, + AttachmentsTypes.GRAFFITI, AttachmentsTypes.ALBUM, AttachmentsTypes.NOT_SUPPORTED, AttachmentsTypes.WALL_REPLY, @@ -49,7 +49,7 @@ annotation class AttachmentsTypes { const val TOPIC = 14 const val AUDIO_MESSAGE = 15 const val GIFT = 16 - const val GRAFFITY = 17 + const val GRAFFITI = 17 const val ALBUM = 18 const val NOT_SUPPORTED = 19 const val WALL_REPLY = 20 diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/db/model/entity/MessageDboEntity.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/db/model/entity/MessageDboEntity.kt index 56a8b684d..5be8cc86f 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/db/model/entity/MessageDboEntity.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/db/model/entity/MessageDboEntity.kt @@ -30,7 +30,7 @@ class MessageDboEntity : DboEntity() { private set var forwardCount = 0 private set - var isHasAttachmens = false + var isHasAttachments = false private set var keyboard: KeyboardEntity? = null private set @@ -130,8 +130,8 @@ class MessageDboEntity : DboEntity() { return this } - fun setHasAttachmens(hasAttachmens: Boolean): MessageDboEntity { - isHasAttachmens = hasAttachmens + fun setHasAttachments(hasAttachments: Boolean): MessageDboEntity { + isHasAttachments = hasAttachments return this } diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/domain/IRelationshipInteractor.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/domain/IRelationshipInteractor.kt index aa2f1affb..56cb528e0 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/domain/IRelationshipInteractor.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/domain/IRelationshipInteractor.kt @@ -34,6 +34,7 @@ interface IRelationshipInteractor { ): Single> fun getRecommendations(accountId: Int, count: Int?): Single> + fun deleteSubscriber(accountId: Int, subscriber_id: Int): Single fun getFollowers(accountId: Int, objectId: Int, count: Int, offset: Int): Single> fun getMutualFriends( accountId: Int, diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/domain/impl/AccountsInteractor.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/domain/impl/AccountsInteractor.kt index fc5711581..2811e3ed0 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/domain/impl/AccountsInteractor.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/domain/impl/AccountsInteractor.kt @@ -36,7 +36,7 @@ class AccountsInteractor( val owners = Dto2Model.transformOwners(items.profiles, items.groups) val result = ArrayList(owners.size) for (i in items.items.orEmpty()) { - val ip = Utils.findOwnerIndexById(owners, i) + val ip = Utils.findIndexById(owners, i) if (ip < 0) { continue } diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/domain/impl/CommentsInteractor.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/domain/impl/CommentsInteractor.kt index 6c3b5f00b..07dc8da8c 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/domain/impl/CommentsInteractor.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/domain/impl/CommentsInteractor.kt @@ -2,10 +2,10 @@ package dev.ragnarok.fenrir.domain.impl import dev.ragnarok.fenrir.api.Fields import dev.ragnarok.fenrir.api.interfaces.INetworker -import dev.ragnarok.fenrir.api.model.IAttachmentToken import dev.ragnarok.fenrir.api.model.VKApiComment import dev.ragnarok.fenrir.api.model.VKApiCommunity import dev.ragnarok.fenrir.api.model.VKApiUser +import dev.ragnarok.fenrir.api.model.interfaces.IAttachmentToken import dev.ragnarok.fenrir.api.model.response.DefaultCommentsResponse import dev.ragnarok.fenrir.db.AttachToType import dev.ragnarok.fenrir.db.interfaces.IStorages diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/domain/impl/MessagesRepository.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/domain/impl/MessagesRepository.kt index 89d1e5442..61553ba49 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/domain/impl/MessagesRepository.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/domain/impl/MessagesRepository.kt @@ -11,6 +11,7 @@ import dev.ragnarok.fenrir.Includes.provideMainThreadScheduler import dev.ragnarok.fenrir.api.Fields import dev.ragnarok.fenrir.api.interfaces.INetworker import dev.ragnarok.fenrir.api.model.* +import dev.ragnarok.fenrir.api.model.interfaces.IAttachmentToken import dev.ragnarok.fenrir.api.model.local_json.ChatJsonResponse import dev.ragnarok.fenrir.api.model.longpoll.* import dev.ragnarok.fenrir.crypt.CryptHelper.encryptWithAes @@ -344,9 +345,13 @@ class MessagesRepository( } if (resetUpdates.nonNullNoEmpty()) { for (update in resetUpdates) { + val patch = PeerPatch(update.peerId).withInRead(update.localId) + .withUnreadCount(update.unreadCount) + if (update.peerId == accountId) { + patch.withOutRead(update.localId) + } patches.add( - PeerPatch(update.peerId).withInRead(update.localId) - .withUnreadCount(update.unreadCount) + patch ) tryCancelNotificationForPeer(provideApplicationContext(), accountId, update.peerId) } @@ -958,7 +963,7 @@ class MessagesRepository( ids: List ): Single> { return storages.messages() - .findMessagesByIds(accountId, ids, withAtatchments = true, withForwardMessages = true) + .findMessagesByIds(accountId, ids, withAttachments = true, withForwardMessages = true) .compose(entities2Models(accountId)) .compose(decryptor.withMessagesDecryption(accountId)) } @@ -1019,7 +1024,7 @@ class MessagesRepository( storages.messages() .findMessagesByIds( accountId, listOf(resultMid), - withAtatchments = true, withForwardMessages = true + withAttachments = true, withForwardMessages = true ) .compose(entities2Models(accountId)) .map { messages -> @@ -1072,7 +1077,7 @@ class MessagesRepository( override fun sendUnsentMessage(accountIds: Collection): Single { val store = storages.messages() return store - .findFirstUnsentMessage(accountIds, withAtatchments = true, withForwardMessages = false) + .findFirstUnsentMessage(accountIds, withAttachments = true, withForwardMessages = false) .flatMap { optional -> if (optional.isEmpty) { return@flatMap Single.error(NotFoundException()) diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/domain/impl/OwnersRepository.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/domain/impl/OwnersRepository.kt index 62bbbde41..1f73a0a83 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/domain/impl/OwnersRepository.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/domain/impl/OwnersRepository.kt @@ -467,7 +467,7 @@ class OwnersRepository(private val networker: INetworker, private val cache: IOw if (offlineUpdates.nonNullNoEmpty()) { for (update in offlineUpdates) { val lastSeeenUnixtime = - if (update.isTimeout) now() - 5 * 60 else update.timestamp.toLong() + if (update.isTimeout) now() - 5 * 60 else update.timestamp patches.add( UserPatch(update.userId).setOnlineUpdate( UserPatch.Online( diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/domain/impl/RelationshipInteractor.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/domain/impl/RelationshipInteractor.kt index 134726483..36ecf3732 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/domain/impl/RelationshipInteractor.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/domain/impl/RelationshipInteractor.kt @@ -123,6 +123,12 @@ class RelationshipInteractor( .map { obj -> transformUsers(obj) } } + override fun deleteSubscriber(accountId: Int, subscriber_id: Int): Single { + return networker.vkDefault(accountId) + .friends() + .deleteSubscriber(subscriber_id) + } + override fun getFollowers( accountId: Int, objectId: Int, diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/domain/impl/StickersInteractor.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/domain/impl/StickersInteractor.kt index b7afc2ce5..2d8633d82 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/domain/impl/StickersInteractor.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/domain/impl/StickersInteractor.kt @@ -11,7 +11,7 @@ import dev.ragnarok.fenrir.db.model.entity.StickerSetEntity import dev.ragnarok.fenrir.db.model.entity.StickersKeywordsEntity import dev.ragnarok.fenrir.domain.IStickersInteractor import dev.ragnarok.fenrir.domain.mappers.Dto2Entity.mapSticker -import dev.ragnarok.fenrir.domain.mappers.Dto2Entity.mapStikerSet +import dev.ragnarok.fenrir.domain.mappers.Dto2Entity.mapStickerSet import dev.ragnarok.fenrir.domain.mappers.Entity2Model.buildStickerFromDbo import dev.ragnarok.fenrir.domain.mappers.Entity2Model.map import dev.ragnarok.fenrir.domain.mappers.MapUtil.mapAll @@ -47,7 +47,7 @@ class StickersInteractor(private val networker: INetworker, private val storage: ) }).setActive(true).setPurchased(true) val ret = - mapAllMutable(list) { mapStikerSet(it) } + mapAllMutable(list) { mapStickerSet(it) } ret.add(temp) storage.storeStickerSets(accountId, ret) } diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/domain/impl/WallsRepository.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/domain/impl/WallsRepository.kt index 5c7eb3a4d..5207d4842 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/domain/impl/WallsRepository.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/domain/impl/WallsRepository.kt @@ -2,7 +2,7 @@ package dev.ragnarok.fenrir.domain.impl import dev.ragnarok.fenrir.api.Fields import dev.ragnarok.fenrir.api.interfaces.INetworker -import dev.ragnarok.fenrir.api.model.IAttachmentToken +import dev.ragnarok.fenrir.api.model.interfaces.IAttachmentToken import dev.ragnarok.fenrir.db.interfaces.IStorages import dev.ragnarok.fenrir.db.interfaces.IWallStorage.IClearWallTask import dev.ragnarok.fenrir.db.model.PostPatch diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/domain/mappers/Dto2Entity.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/domain/mappers/Dto2Entity.kt index acc1c0f22..2df25fd29 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/domain/mappers/Dto2Entity.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/domain/mappers/Dto2Entity.kt @@ -5,6 +5,9 @@ import dev.ragnarok.fenrir.api.model.VKApiConversation.CurrentKeyboard import dev.ragnarok.fenrir.api.model.VKApiSticker.VKApiAnimation import dev.ragnarok.fenrir.api.model.VKApiStickerSet.Product import dev.ragnarok.fenrir.api.model.feedback.* +import dev.ragnarok.fenrir.api.model.interfaces.Commentable +import dev.ragnarok.fenrir.api.model.interfaces.Likeable +import dev.ragnarok.fenrir.api.model.interfaces.VKApiAttachment import dev.ragnarok.fenrir.api.model.response.FavePageResponse import dev.ragnarok.fenrir.crypt.CryptHelper.analizeMessageBody import dev.ragnarok.fenrir.crypt.MessageType @@ -673,7 +676,7 @@ object Dto2Entity { ) }) if (news.hasAttachments()) { - entity.setAttachments(news.attachments?.let { mapAttachemntsList(it) }) + entity.setAttachments(news.attachments?.let { mapAttachmentsList(it) }) } else { entity.setAttachments(null) } @@ -695,7 +698,7 @@ object Dto2Entity { ): CommentEntity { var attachmentsEntities: List? = null comment.attachments.requireNonNull { - attachmentsEntities = mapAttachemntsList(it) + attachmentsEntities = mapAttachmentsList(it) } return CommentEntity().set(sourceId, sourceOwnerId, sourceType, sourceAccessKey, comment.id) .setFromId(comment.from_id) @@ -853,7 +856,7 @@ object Dto2Entity { return null } - private fun mapAttachemntsList(attachments: VKApiAttachments): List? { + private fun mapAttachmentsList(attachments: VKApiAttachments): List? { val entries = attachments.entryList() if (entries.isEmpty()) { return null @@ -892,7 +895,7 @@ object Dto2Entity { return mapStory(dto as VKApiStory) } VKApiAttachment.TYPE_GRAFFITI -> { - return mapGraffity(dto as VKApiGraffiti) + return mapGraffiti(dto as VKApiGraffiti) } VKApiAttachment.TYPE_ALBUM -> { return buildPhotoAlbumDbo(dto as VKApiPhotoAlbum) @@ -1045,7 +1048,7 @@ object Dto2Entity { dbo.setSource(SourceDbo().set(source.type, source.platform, source.data, source.url)) } if (dto.hasAttachments()) { - dbo.setAttachments(dto.attachments?.let { mapAttachemntsList(it) }) + dbo.setAttachments(dto.attachments?.let { mapAttachmentsList(it) }) } else { dbo.setAttachments(null) } @@ -1089,7 +1092,7 @@ object Dto2Entity { } - fun mapStikerSet(dto: Product): StickerSetEntity { + fun mapStickerSet(dto: Product): StickerSetEntity { return StickerSetEntity(dto.id) .setTitle(dto.title) .setPromoted(dto.promoted) @@ -1174,7 +1177,7 @@ object Dto2Entity { } private fun mapWallReply(dto: VKApiWallReply): WallReplyDboEntity { - val attachmentsEntities: List? = dto.attachments?.let { mapAttachemntsList(it) } + val attachmentsEntities: List? = dto.attachments?.let { mapAttachmentsList(it) } return WallReplyDboEntity().setId(dto.id) .setOwnerId(dto.owner_id) .setAttachments(attachmentsEntities) @@ -1183,7 +1186,7 @@ object Dto2Entity { .setText(dto.text) } - private fun mapGraffity(dto: VKApiGraffiti): GraffitiDboEntity { + private fun mapGraffiti(dto: VKApiGraffiti): GraffitiDboEntity { return GraffitiDboEntity().setId(dto.id) .setOwner_id(dto.owner_id) .setAccess_key(dto.access_key) @@ -1310,7 +1313,7 @@ object Dto2Entity { .setDeleted(dto.deleted) .setDeletedForAll(false) // cant be deleted for all? .setForwardCount(safeCountOf(dto.fwd_messages)) - .setHasAttachmens(dto.attachments != null && dto.attachments?.nonEmpty() == true) + .setHasAttachments(dto.attachments != null && dto.attachments?.nonEmpty() == true) .setStatus(MessageStatus.SENT) // only sent can be .setOriginalId(dto.id) .setAction(Message.fromApiChatAction(dto.action)) @@ -1323,8 +1326,8 @@ object Dto2Entity { .setRandomId(randomId) .setUpdateTime(dto.update_time) .setPayload(dto.payload) - if (entity.isHasAttachmens) { - entity.setAttachments(dto.attachments?.let { mapAttachemntsList(it) }) + if (entity.isHasAttachments) { + entity.setAttachments(dto.attachments?.let { mapAttachmentsList(it) }) } else { entity.setAttachments(null) } diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/domain/mappers/Dto2Model.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/domain/mappers/Dto2Model.kt index 5bad63f46..4dd452f1f 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/domain/mappers/Dto2Model.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/domain/mappers/Dto2Model.kt @@ -2,6 +2,7 @@ package dev.ragnarok.fenrir.domain.mappers import dev.ragnarok.fenrir.api.model.* import dev.ragnarok.fenrir.api.model.VKApiConversation.CurrentKeyboard +import dev.ragnarok.fenrir.api.model.interfaces.VKApiAttachment import dev.ragnarok.fenrir.api.model.longpoll.AddMessageUpdate import dev.ragnarok.fenrir.api.model.response.FavePageResponse import dev.ragnarok.fenrir.api.util.VKStringUtils.unescape @@ -586,7 +587,7 @@ object Dto2Model { } dto.attachments.requireNonNull { comment.setAttachments(buildAttachments(it, owners)) - //comment.setHasAttachmens(comment.getAttachments().count()); + //comment.setHasAttachments(comment.getAttachments().count()); } return comment } @@ -714,7 +715,7 @@ object Dto2Model { .setAuthor(owners.getById(dto.from_id)) dto.attachments.requireNonNull { comment.setAttachments(buildAttachments(it, owners)) - //comment.setHasAttachmens(comment.getAttachments().count()); + //comment.setHasAttachments(comment.getAttachments().count()); } return comment } @@ -1101,7 +1102,7 @@ object Dto2Model { VKApiAttachment.TYPE_AUDIO_PLAYLIST -> attachments.prepareAudioPlaylists().add( transform(attachment as VKApiAudioPlaylist) ) - VKApiAttachment.TYPE_GRAFFITI -> attachments.prepareGraffity() + VKApiAttachment.TYPE_GRAFFITI -> attachments.prepareGraffiti() .add(transform(attachment as VKApiGraffiti)) VKApiAttachment.TYPE_POLL -> attachments.preparePolls() .add(transform(attachment as VKApiPoll)) diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/domain/mappers/Entity2Dto.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/domain/mappers/Entity2Dto.kt index f8142f31d..d78425a49 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/domain/mappers/Entity2Dto.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/domain/mappers/Entity2Dto.kt @@ -1,7 +1,7 @@ package dev.ragnarok.fenrir.domain.mappers import dev.ragnarok.fenrir.api.model.AttachmentsTokenCreator -import dev.ragnarok.fenrir.api.model.IAttachmentToken +import dev.ragnarok.fenrir.api.model.interfaces.IAttachmentToken import dev.ragnarok.fenrir.db.model.entity.* object Entity2Dto { @@ -42,7 +42,7 @@ object Entity2Dto { return AttachmentsTokenCreator.ofPhotoAlbum(dboEntity.id, dboEntity.ownerId) } is GraffitiDboEntity -> { - return AttachmentsTokenCreator.ofGraffity( + return AttachmentsTokenCreator.ofGraffiti( dboEntity.id, dboEntity.owner_id, dboEntity.access_key diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/domain/mappers/Entity2Model.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/domain/mappers/Entity2Model.kt index be8af6ee5..da67c233c 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/domain/mappers/Entity2Model.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/domain/mappers/Entity2Model.kt @@ -509,7 +509,7 @@ object Entity2Model { .setOut(dbo.isOut) .setStatus(dbo.status) .setDate(dbo.date) - .setHasAttachments(dbo.isHasAttachmens) + .setHasAttachments(dbo.isHasAttachments) .setForwardMessagesCount(dbo.forwardCount) .setDeleted(dbo.isDeleted) .setDeletedForAll(dbo.isDeletedForAll) @@ -581,7 +581,7 @@ object Entity2Model { return mapPhotoAlbum(dboEntity) } is GraffitiDboEntity -> { - return buildGraffityFromDbo(dboEntity) + return buildGraffitiFromDbo(dboEntity) } is AudioPlaylistDboEntity -> { return buildAudioPlaylistFromDbo(dboEntity) @@ -927,7 +927,7 @@ object Entity2Model { .setVideo(dbo.video?.let { buildVideoFromDbo(it) }) } - private fun buildGraffityFromDbo(dto: GraffitiDboEntity): Graffiti { + private fun buildGraffitiFromDbo(dto: GraffitiDboEntity): Graffiti { return Graffiti().setId(dto.id) .setOwner_id(dto.owner_id) .setAccess_key(dto.access_key) diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/domain/mappers/Model2Dto.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/domain/mappers/Model2Dto.kt index f63bd2550..31f6d80a8 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/domain/mappers/Model2Dto.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/domain/mappers/Model2Dto.kt @@ -1,7 +1,7 @@ package dev.ragnarok.fenrir.domain.mappers import dev.ragnarok.fenrir.api.model.AttachmentsTokenCreator -import dev.ragnarok.fenrir.api.model.IAttachmentToken +import dev.ragnarok.fenrir.api.model.interfaces.IAttachmentToken import dev.ragnarok.fenrir.model.* object Model2Dto { @@ -47,7 +47,7 @@ object Model2Dto { return AttachmentsTokenCreator.ofStory(model.id, model.ownerId, model.accessKey) } is Graffiti -> { - return AttachmentsTokenCreator.ofGraffity( + return AttachmentsTokenCreator.ofGraffiti( model.id, model.owner_id, model.access_key diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/domain/mappers/Model2Entity.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/domain/mappers/Model2Entity.kt index 784f8b6a8..0a1588dc5 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/domain/mappers/Model2Entity.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/domain/mappers/Model2Entity.kt @@ -63,7 +63,7 @@ object Model2Entity { .setDeleted(message.isDeleted) .setDeletedForAll(message.isDeletedForAll) .setForwardCount(message.forwardMessagesCount) - .setHasAttachmens(message.isHasAttachments) + .setHasAttachments(message.isHasAttachments) .setStatus(message.status) .setOriginalId(message.originalId) .setAction(message.action) @@ -179,8 +179,8 @@ object Model2Entity { entities ) mapAndAdd( - attachments.graffity, - { buildGraffityDbo(it) }, + attachments.graffiti, + { buildGraffitiDbo(it) }, entities ) mapAndAdd( @@ -274,7 +274,7 @@ object Model2Entity { entities.add(buildWallReplyDbo(model as WallReply)) } AbsModelType.MODEL_GRAFFITI -> { - entities.add(buildGraffityDbo(model as Graffiti)) + entities.add(buildGraffitiDbo(model as Graffiti)) } AbsModelType.MODEL_POLL -> { entities.add(buildPollDbo(model as Poll)) @@ -447,7 +447,7 @@ object Model2Entity { }) } - private fun buildGraffityDbo(dbo: Graffiti): GraffitiDboEntity { + private fun buildGraffitiDbo(dbo: Graffiti): GraffitiDboEntity { return GraffitiDboEntity().setId(dbo.id) .setOwner_id(dbo.owner_id) .setAccess_key(dbo.access_key) diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/attachments/absattachmentsedit/AttchmentsEditorAdapter.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/attachments/absattachmentsedit/AttchmentsEditorAdapter.kt index c7bf8be71..3e53ae8a2 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/attachments/absattachmentsedit/AttchmentsEditorAdapter.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/attachments/absattachmentsedit/AttchmentsEditorAdapter.kt @@ -175,7 +175,7 @@ class AttchmentsEditorAdapter( } private fun bindGraffiti(holder: ViewHolder, graffiti: Graffiti) { - holder.tvTitle.setText(R.string.graffity) + holder.tvTitle.setText(R.string.graffiti) val photoLink = graffiti.url if (photoLink.nonNullNoEmpty()) { with() diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/base/AttachmentsViewBinder.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/base/AttachmentsViewBinder.kt index c9b760f8c..67bcb34f8 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/base/AttachmentsViewBinder.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/base/AttachmentsViewBinder.kt @@ -56,7 +56,7 @@ class AttachmentsViewBinder( private val mNoactiveWaveFormColor: Int private val mVoiceSharedHolders: SharedHolders = SharedHolders(true) private val mAttachmentsActionCallback: OnAttachmentsActionCallback? - private val isNightStiker: Boolean + private val isNightSticker: Boolean private val expandVoiceTranscript: Boolean private var mVoiceActionListener: VoiceActionListener? = null private var mOnHashTagClickListener: EmojiconTextView.OnHashTagClickListener? = null @@ -308,7 +308,7 @@ class AttachmentsViewBinder( val sticker = stickers[0] val prefferedStickerSize = Utils.dpToPx(PREFFERED_STICKER_SIZE.toFloat(), mContext) .toInt() - val image = sticker.getImage(256, isNightStiker) + val image = sticker.getImage(256, isNightSticker) val horisontal = image.height.orZero() < image.width.orZero() val proporsion = image.width.orZero().toDouble() / image.height.toDouble() val finalWidth: Float @@ -324,7 +324,7 @@ class AttachmentsViewBinder( imageView.layoutParams.width = finalWidth.toInt() if (sticker.isAnimated) { imageView.fromNet( - sticker.getAnimationByType(if (isNightStiker) "dark" else "light"), + sticker.getAnimationByType(if (isNightSticker) "dark" else "light"), Utils.createOkHttp(5, true), finalWidth.toInt(), finalHeihgt.toInt() @@ -567,7 +567,7 @@ class AttachmentsViewBinder( val tvDetails = itemView.findViewById(R.id.item_document_ext_size) val tvPostText: EmojiconTextView = itemView.findViewById(R.id.item_message_text) val ivPhotoT: ShapeableImageView = itemView.findViewById(R.id.item_document_image) - val ivGraffity = itemView.findViewById(R.id.item_document_graffity) + val ivGraffiti = itemView.findViewById(R.id.item_document_graffiti) val ivPhoto_Post = itemView.findViewById(R.id.item_post_avatar_image) val ivType = itemView.findViewById(R.id.item_document_type) val tvShowMore = itemView.findViewById(R.id.item_post_show_more) @@ -651,7 +651,7 @@ class AttachmentsViewBinder( attachmentsRoot.visibility = View.GONE itemView.setOnClickListener { openDocLink(doc) } ivPhoto_Post.visibility = View.GONE - ivGraffity.visibility = View.GONE + ivGraffiti.visibility = View.GONE when (doc.type) { AttachmentsTypes.DOC -> if (imageUrl != null) { ivType.visibility = View.GONE @@ -662,12 +662,12 @@ class AttachmentsViewBinder( ivPhotoT.visibility = View.GONE ivType.setImageResource(R.drawable.file) } - AttachmentsTypes.GRAFFITY -> { + AttachmentsTypes.GRAFFITI -> { ivPhotoT.visibility = View.GONE if (imageUrl != null) { ivType.visibility = View.GONE - ivGraffity.visibility = View.VISIBLE - displayAvatar(ivGraffity, null, imageUrl, Constants.PICASSO_TAG) + ivGraffiti.visibility = View.VISIBLE + displayAvatar(ivGraffiti, null, imageUrl, Constants.PICASSO_TAG) } else { ivType.visibility = View.VISIBLE ivType.setImageResource(R.drawable.counter) @@ -1104,7 +1104,7 @@ class AttachmentsViewBinder( mAttachmentsActionCallback = attachmentsActionCallback mActiveWaveFormColor = CurrentTheme.getColorPrimary(mContext) mNoactiveWaveFormColor = Utils.adjustAlpha(mActiveWaveFormColor, 0.5f) - isNightStiker = + isNightSticker = Settings.get().ui().isStickers_by_theme && Settings.get().ui().isDarkModeEnabled( mContext ) diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/base/DocLink.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/base/DocLink.kt index 13d8fa659..38cff2b94 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/base/DocLink.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/base/DocLink.kt @@ -22,7 +22,7 @@ class DocLink(val attachment: AbsModel) { AttachmentsTypes.POST -> return (attachment as Post).authorPhoto AttachmentsTypes.EVENT -> return (attachment as Event).subjectPhoto AttachmentsTypes.WALL_REPLY -> return (attachment as WallReply).authorPhoto - AttachmentsTypes.GRAFFITY -> return (attachment as Graffiti).url + AttachmentsTypes.GRAFFITI -> return (attachment as Graffiti).url AttachmentsTypes.STORY -> return (attachment as Story).owner?.maxSquareAvatar AttachmentsTypes.ALBUM -> { val album = attachment as PhotoAlbum @@ -230,7 +230,7 @@ class DocLink(val attachment: AbsModel) { return AttachmentsTypes.AUDIO_PLAYLIST } AbsModelType.MODEL_GRAFFITI -> { - return AttachmentsTypes.GRAFFITY + return AttachmentsTypes.GRAFFITI } AbsModelType.MODEL_PHOTO_ALBUM -> { return AttachmentsTypes.ALBUM diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/communities/CommunitiesPresenter.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/communities/CommunitiesPresenter.kt index addad8229..9fa7c34d8 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/communities/CommunitiesPresenter.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/communities/CommunitiesPresenter.kt @@ -13,7 +13,7 @@ import dev.ragnarok.fenrir.util.Objects.safeEquals import dev.ragnarok.fenrir.util.Translit.cyr2lat import dev.ragnarok.fenrir.util.Translit.lat2cyr import dev.ragnarok.fenrir.util.Utils.getCauseIfRuntime -import dev.ragnarok.fenrir.util.Utils.indexOfOwner +import dev.ragnarok.fenrir.util.Utils.indexOf import dev.ragnarok.fenrir.util.rxutils.RxUtils.ignore import io.reactivex.rxjava3.core.Completable import io.reactivex.rxjava3.core.Single @@ -94,13 +94,13 @@ class CommunitiesPresenter(accountId: Int, private val userId: Int, savedInstanc if (do_scan && isNotFriendShow) { val not_communities = ArrayList() for (i in own.get()) { - if (indexOfOwner(communities, i.ownerId) == -1) { + if (indexOf(communities, i.ownerId) == -1) { not_communities.add(i) } } val add_communities = ArrayList() for (i in communities) { - if (indexOfOwner(own.get(), i.ownerId) == -1) { + if (indexOf(own.get(), i.ownerId) == -1) { add_communities.add(i) } } diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/communitycontrol/communitymembers/CommunityMembersPresenter.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/communitycontrol/communitymembers/CommunityMembersPresenter.kt index bb4ab1fcf..d4f37bfec 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/communitycontrol/communitymembers/CommunityMembersPresenter.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/communitycontrol/communitymembers/CommunityMembersPresenter.kt @@ -75,13 +75,13 @@ class CommunityMembersPresenter( if (do_scan && isNotFriendShow) { val not_members = ArrayList() for (i in mMembers) { - if (Utils.indexOfOwner(data, i.ownerId) == -1) { + if (Utils.indexOf(data, i.ownerId) == -1) { not_members.add(i) } } val add_members = ArrayList() for (i in data) { - if (Utils.indexOfOwner(mMembers, i.ownerId) == -1) { + if (Utils.indexOf(mMembers, i.ownerId) == -1) { add_members.add(i) } } diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/conversation/conversationdocs/ChatAttachmentDocsPresenter.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/conversation/conversationdocs/ChatAttachmentDocsPresenter.kt index f88593d82..6a48d34bc 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/conversation/conversationdocs/ChatAttachmentDocsPresenter.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/conversation/conversationdocs/ChatAttachmentDocsPresenter.kt @@ -3,8 +3,8 @@ package dev.ragnarok.fenrir.fragment.conversation.conversationdocs import android.os.Bundle import dev.ragnarok.fenrir.R import dev.ragnarok.fenrir.api.Apis.get -import dev.ragnarok.fenrir.api.model.VKApiAttachment import dev.ragnarok.fenrir.api.model.VKApiDoc +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.Document diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/conversation/conversationlinks/ChatAttachmentLinksPresenter.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/conversation/conversationlinks/ChatAttachmentLinksPresenter.kt index 47c2f48ac..4f47dc944 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/conversation/conversationlinks/ChatAttachmentLinksPresenter.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/conversation/conversationlinks/ChatAttachmentLinksPresenter.kt @@ -3,8 +3,8 @@ package dev.ragnarok.fenrir.fragment.conversation.conversationlinks import android.os.Bundle import dev.ragnarok.fenrir.R import dev.ragnarok.fenrir.api.Apis.get -import dev.ragnarok.fenrir.api.model.VKApiAttachment import dev.ragnarok.fenrir.api.model.VKApiLink +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.Link diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/conversation/conversationposts/ChatAttachmentPostsPresenter.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/conversation/conversationposts/ChatAttachmentPostsPresenter.kt index 01d4c66c7..a0c71988b 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/conversation/conversationposts/ChatAttachmentPostsPresenter.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/conversation/conversationposts/ChatAttachmentPostsPresenter.kt @@ -3,8 +3,8 @@ package dev.ragnarok.fenrir.fragment.conversation.conversationposts import android.os.Bundle import dev.ragnarok.fenrir.R import dev.ragnarok.fenrir.api.Apis.get -import dev.ragnarok.fenrir.api.model.VKApiAttachment import dev.ragnarok.fenrir.api.model.VKApiLink +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.Link diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/fave/favepages/FavePagesAdapter.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/fave/favepages/FavePagesAdapter.kt index e133a1e30..86a76c385 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/fave/favepages/FavePagesAdapter.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/fave/favepages/FavePagesAdapter.kt @@ -69,8 +69,8 @@ class FavePagesAdapter(private var data: List, private val context: Co holder.ivMonitor.visibility = View.VISIBLE holder.ivMonitor.fromRes( dev.ragnarok.fenrir_common.R.raw.eye, - Utils.dp(48f), - Utils.dp(48f), + Utils.dp(24f), + Utils.dp(24f), intArrayOf( 0x333333, Color.parseColor("#ffffff"), @@ -83,6 +83,7 @@ class FavePagesAdapter(private var data: List, private val context: Co holder.ivMonitor.visibility = View.GONE holder.ivMonitor.clearAnimationDrawable() } + holder.blacklisted.clearColorFilter() if (favePage.type == FavePageType.USER) { val user = favePage.user displayAvatar( @@ -110,13 +111,13 @@ class FavePagesAdapter(private var data: List, private val context: Co } else if (user?.isFriend == true && Utils.hasMarshmallow() && FenrirNative.isNativeLoaded) { holder.blacklisted.visibility = View.VISIBLE holder.blacklisted.fromRes( - dev.ragnarok.fenrir_common.R.raw.infinity, + dev.ragnarok.fenrir_common.R.raw.is_friend, Utils.dp(48f), Utils.dp(48f), intArrayOf( - 0x333333, + 0x000000, getColorPrimary(context), - 0x777777, + 0xffffff, getColorSecondary(context) ) ) diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/fave/favepages/FavePagesPresenter.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/fave/favepages/FavePagesPresenter.kt index 49ea3f8c7..db4a66a9f 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/fave/favepages/FavePagesPresenter.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/fave/favepages/FavePagesPresenter.kt @@ -179,7 +179,7 @@ class FavePagesPresenter(accountId: Int, isUser: Boolean, savedInstanceState: Bu } private fun onUserRemoved(accountId: Int, ownerId: Int) { - if (accountId != accountId) { + if (accountId != ownerId) { return } val index = findIndexById(pages, abs(ownerId)) @@ -285,4 +285,4 @@ class FavePagesPresenter(accountId: Int, isUser: Boolean, savedInstanceState: Bu searcher = FindPage(actualDataDisposable) loadAllCachedData() } -} \ No newline at end of file +} diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/friends/followers/FollowersFragment.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/friends/followers/FollowersFragment.kt index 428e87edd..900eed075 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/friends/followers/FollowersFragment.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/friends/followers/FollowersFragment.kt @@ -1,6 +1,8 @@ package dev.ragnarok.fenrir.fragment.friends.followers +import android.content.DialogInterface import android.os.Bundle +import com.google.android.material.dialog.MaterialAlertDialogBuilder import dev.ragnarok.fenrir.Extra import dev.ragnarok.fenrir.R import dev.ragnarok.fenrir.activity.DeltaOwnerActivity @@ -8,6 +10,7 @@ import dev.ragnarok.fenrir.fragment.absownerslist.AbsOwnersListFragment import dev.ragnarok.fenrir.fragment.base.core.IPresenterFactory import dev.ragnarok.fenrir.model.DeltaOwner import dev.ragnarok.fenrir.model.Owner +import dev.ragnarok.fenrir.util.Utils class FollowersFragment : AbsOwnersListFragment(), IFollowersView { @@ -30,6 +33,18 @@ class FollowersFragment : AbsOwnersListFragment + Utils.follower_kick_mode = true + presenter?.removeFollower(owner) + } + .setCancelable(true).show() + return true + } + presenter?.removeFollower( owner ) diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/friends/followers/FollowersPresenter.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/friends/followers/FollowersPresenter.kt index b23a250a3..68b7dc054 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/friends/followers/FollowersPresenter.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/friends/followers/FollowersPresenter.kt @@ -101,7 +101,7 @@ class FollowersPresenter(accountId: Int, private val userId: Int, savedInstanceS } val add_followers = ArrayList() for (i in users) { - if (indexOfOwner(data, i.getObjectId()) == -1) { + if (indexOf(data, i.getObjectId()) == -1) { add_followers.add(i) } } diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/groupwall/GroupWallFragment.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/groupwall/GroupWallFragment.kt index ec513e6a2..ca283e71d 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/groupwall/GroupWallFragment.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/groupwall/GroupWallFragment.kt @@ -47,8 +47,8 @@ import dev.ragnarok.fenrir.place.PlaceFactory.getDocumentsPlace import dev.ragnarok.fenrir.place.PlaceFactory.getGroupChatsPlace import dev.ragnarok.fenrir.place.PlaceFactory.getMarketAlbumPlace import dev.ragnarok.fenrir.place.PlaceFactory.getMarketPlace -import dev.ragnarok.fenrir.place.PlaceFactory.getShowComunityInfoPlace -import dev.ragnarok.fenrir.place.PlaceFactory.getShowComunityLinksInfoPlace +import dev.ragnarok.fenrir.place.PlaceFactory.getShowCommunityInfoPlace +import dev.ragnarok.fenrir.place.PlaceFactory.getShowCommunityLinksInfoPlace import dev.ragnarok.fenrir.place.PlaceFactory.getSingleURLPhotoPlace import dev.ragnarok.fenrir.place.PlaceFactory.getTopicsPlace import dev.ragnarok.fenrir.settings.AvatarStyle @@ -443,11 +443,11 @@ class GroupWallFragment : AbsWallFragment(), } override fun goToShowCommunityInfo(accountId: Int, community: Community) { - getShowComunityInfoPlace(accountId, community).tryOpenWith(requireActivity()) + getShowCommunityInfoPlace(accountId, community).tryOpenWith(requireActivity()) } override fun goToShowCommunityLinksInfo(accountId: Int, community: Community) { - getShowComunityLinksInfoPlace(accountId, community).tryOpenWith(requireActivity()) + getShowCommunityLinksInfoPlace(accountId, community).tryOpenWith(requireActivity()) } override fun goToShowCommunityAboutInfo(accountId: Int, details: CommunityDetails) { @@ -684,4 +684,4 @@ class GroupWallFragment : AbsWallFragment(), } } } -} \ No newline at end of file +} diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/messages/chat/ChatFragment.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/messages/chat/ChatFragment.kt index d44468249..d0bf876d1 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/messages/chat/ChatFragment.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/messages/chat/ChatFragment.kt @@ -205,7 +205,7 @@ class ChatFragment : PlaceSupportMvpFragment(), IChatV parentFragmentManager.setFragmentResultListener( MessageAttachmentsFragment.MESSAGE_CLOSE_ONLY, this - ) { _, _ -> presenter?.fireSendClickFromAttachmens() } + ) { _, _ -> presenter?.fireSendClickFromAttachments() } parentFragmentManager.setFragmentResultListener( MessageAttachmentsFragment.MESSAGE_SYNC_ATTACHMENTS, this diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/messages/chat/ChatPresenter.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/messages/chat/ChatPresenter.kt index 009b9b845..38a172d17 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/messages/chat/ChatPresenter.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/messages/chat/ChatPresenter.kt @@ -16,10 +16,10 @@ import androidx.work.OneTimeWorkRequest import androidx.work.WorkManager import dev.ragnarok.fenrir.* import dev.ragnarok.fenrir.activity.ActivityUtils -import dev.ragnarok.fenrir.api.model.AttachmentToken +import dev.ragnarok.fenrir.api.model.AttachmentTokens import dev.ragnarok.fenrir.api.model.AttachmentsTokenCreator -import dev.ragnarok.fenrir.api.model.IAttachmentToken import dev.ragnarok.fenrir.api.model.VKApiMessage +import dev.ragnarok.fenrir.api.model.interfaces.IAttachmentToken import dev.ragnarok.fenrir.crypt.AesKeyPair import dev.ragnarok.fenrir.crypt.KeyExchangeService import dev.ragnarok.fenrir.crypt.KeyLocationPolicy @@ -1381,7 +1381,7 @@ class ChatPresenter( private fun canEdit(message: Message): Boolean { return message.isOut && Unixtime.now() - message.date < 24 * 60 * 60 - && !message.isSticker && !message.isVoiceMessage && !message.isGraffity && !message.isCall + && !message.isSticker && !message.isVoiceMessage && !message.isGraffiti && !message.isCall } private fun canChangePin(): Boolean { @@ -2231,7 +2231,7 @@ class ChatPresenter( .fromIOToMain() .subscribe({ if (it.nonEmpty()) { - val kk = it.get() as AttachmentToken + val kk = it.get() as AttachmentTokens.AttachmentToken if (!file.isAnimated) { val graffiti = Graffiti().setId(kk.id).setOwner_id(kk.ownerId) .setAccess_key(kk.accessKey) @@ -2307,7 +2307,7 @@ class ChatPresenter( } } - fun fireSendClickFromAttachmens() { + fun fireSendClickFromAttachments() { fireSendClick() } diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/messages/chat/MessagesAdapter.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/messages/chat/MessagesAdapter.kt index db481b9c2..3252814d1 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/messages/chat/MessagesAdapter.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/messages/chat/MessagesAdapter.kt @@ -53,7 +53,7 @@ class MessagesAdapter( private val selectedDrawable: ShapeDrawable = ShapeDrawable(OvalShape()) private val unreadColor: Int private val disable_read: Boolean - private val isNightStiker: Boolean + private val isNightSticker: Boolean private val ownerLinkAdapter: OwnerLinkSpanFactory.ActionListener = object : LinkActionAdapter() { override fun onOwnerClick(ownerId: Int) { @@ -78,7 +78,7 @@ class MessagesAdapter( val message = getItem(position) when (type) { TYPE_SERVICE -> bindServiceHolder(viewHolder as ServiceMessageHolder, message, position) - TYPE_GRAFFITY_FRIEND, TYPE_GRAFFITY_MY, TYPE_MY_MESSAGE, TYPE_FRIEND_MESSAGE -> bindNormalMessage( + TYPE_GRAFFITI_FRIEND, TYPE_GRAFFITI_MY, TYPE_MY_MESSAGE, TYPE_FRIEND_MESSAGE -> bindNormalMessage( viewHolder as MessageHolder, message, position @@ -111,13 +111,13 @@ class MessagesAdapter( val sticker = message.attachments?.stickers?.get(0) if (sticker?.isAnimated == true) { holder.sticker.fromNet( - sticker.getAnimationByType(if (isNightStiker) "dark" else "light"), + sticker.getAnimationByType(if (isNightSticker) "dark" else "light"), Utils.createOkHttp(5, true), Utils.dp(128f), Utils.dp(128f) ) } else { - val image = sticker?.getImage(256, isNightStiker) + val image = sticker?.getImage(256, isNightSticker) image?.url.ifNonNullNoEmpty({ with() .load(it) @@ -300,7 +300,7 @@ class MessagesAdapter( message.body CryptStatus.DECRYPTED -> displayedBody = message.decryptedBody } - if (!message.isGraffity) { + if (!message.isGraffiti) { when (message.cryptStatus) { CryptStatus.ENCRYPTED, CryptStatus.DECRYPT_FAILED -> holder.bubble.setNonGradientColor( Color.parseColor("#D4ff0000") @@ -414,7 +414,7 @@ class MessagesAdapter( override fun viewHolder(view: View, type: Int): RecyclerView.ViewHolder { when (type) { - TYPE_GRAFFITY_FRIEND, TYPE_GRAFFITY_MY, TYPE_MY_MESSAGE, TYPE_FRIEND_MESSAGE -> return MessageHolder( + TYPE_GRAFFITI_FRIEND, TYPE_GRAFFITI_MY, TYPE_MY_MESSAGE, TYPE_FRIEND_MESSAGE -> return MessageHolder( view ) TYPE_SERVICE -> return ServiceMessageHolder(view) @@ -428,8 +428,8 @@ class MessagesAdapter( when (type) { TYPE_MY_MESSAGE -> return R.layout.item_message_my TYPE_FRIEND_MESSAGE -> return R.layout.item_message_friend - TYPE_GRAFFITY_MY -> return R.layout.item_message_graffity_my - TYPE_GRAFFITY_FRIEND -> return R.layout.item_message_graffity_friend + TYPE_GRAFFITI_MY -> return R.layout.item_message_graffiti_my + TYPE_GRAFFITI_FRIEND -> return R.layout.item_message_graffiti_friend TYPE_SERVICE -> return R.layout.item_service_message TYPE_STICKER_FRIEND -> return R.layout.item_message_friend_sticker TYPE_STICKER_MY -> return R.layout.item_message_my_sticker @@ -447,8 +447,8 @@ class MessagesAdapter( if (m.isSticker) { return if (m.isOut) TYPE_STICKER_MY else TYPE_STICKER_FRIEND } - if (m.isGraffity) { - return if (m.isOut) TYPE_GRAFFITY_MY else TYPE_GRAFFITY_FRIEND + if (m.isGraffiti) { + return if (m.isOut) TYPE_GRAFFITI_MY else TYPE_GRAFFITI_FRIEND } if (m.isGift) { return if (m.isOut) TYPE_GIFT_MY else TYPE_GIFT_FRIEND @@ -601,8 +601,8 @@ class MessagesAdapter( private const val TYPE_STICKER_FRIEND = 5 private const val TYPE_GIFT_MY = 6 private const val TYPE_GIFT_FRIEND = 7 - private const val TYPE_GRAFFITY_MY = 8 - private const val TYPE_GRAFFITY_FRIEND = 9 + private const val TYPE_GRAFFITI_MY = 8 + private const val TYPE_GRAFFITI_FRIEND = 9 private val DATE = Date() } @@ -610,7 +610,7 @@ class MessagesAdapter( selectedDrawable.paint.color = CurrentTheme.getColorPrimary(context) unreadColor = CurrentTheme.getMessageUnreadColor(context) this.disable_read = disable_read - isNightStiker = + isNightSticker = Settings.get().ui().isStickers_by_theme && Settings.get().ui().isDarkModeEnabled( context ) diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/messages/dialogs/DialogsAdapter.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/messages/dialogs/DialogsAdapter.kt index 2b934cb72..c3f8bd951 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/messages/dialogs/DialogsAdapter.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/messages/dialogs/DialogsAdapter.kt @@ -133,7 +133,7 @@ class DialogsAdapter(private val mContext: Context, private var mDialogs: List mContext.getString(R.string.call_message) MessageType.DOC -> mContext.getString(R.string.doc_message) MessageType.GIFT -> mContext.getString(R.string.gift_message) - MessageType.GRAFFITY -> mContext.getString(R.string.graffity_message) + MessageType.GRAFFITI -> mContext.getString(R.string.graffiti_message) MessageType.PHOTO -> mContext.getString(R.string.photo_message) MessageType.STICKER -> mContext.getString(R.string.sticker_message) MessageType.VIDEO -> mContext.getString(R.string.video_message) diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/messages/notreadmessages/NotReadMessagesPresenter.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/messages/notreadmessages/NotReadMessagesPresenter.kt index fdb96515b..87d49b12f 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/messages/notreadmessages/NotReadMessagesPresenter.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/messages/notreadmessages/NotReadMessagesPresenter.kt @@ -216,9 +216,9 @@ class NotReadMessagesPresenter( } } - private fun onMessagesDeleteSuccessfully(ids: Collection) { + private fun onMessagesDeleteSuccessfully(ids: Collection) { for (id in ids) { - val message = findById(id ?: return) + val message = findById(id) message?.setDeleted(true) } safeNotifyDataChanged() diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/sheet/AttachmentsBottomSheetAdapter.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/sheet/AttachmentsBottomSheetAdapter.kt index a74811d09..9baa0702c 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/sheet/AttachmentsBottomSheetAdapter.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/sheet/AttachmentsBottomSheetAdapter.kt @@ -169,7 +169,7 @@ class AttachmentsBottomSheetAdapter( } private fun bindGraffiti(holder: EntryHolder, graffiti: Graffiti) { - holder.title.setText(R.string.graffity) + holder.title.setText(R.string.graffiti) val photoLink = graffiti.url holder.progress.visibility = View.INVISIBLE holder.Retry.visibility = View.GONE diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/userbanned/UserBannedPresenter.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/userbanned/UserBannedPresenter.kt index e42776126..d33a233ea 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/userbanned/UserBannedPresenter.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/userbanned/UserBannedPresenter.kt @@ -11,7 +11,7 @@ import dev.ragnarok.fenrir.model.BannedPart import dev.ragnarok.fenrir.model.Owner import dev.ragnarok.fenrir.nonNullNoEmpty import dev.ragnarok.fenrir.util.Pair -import dev.ragnarok.fenrir.util.Utils.findOwnerIndexById +import dev.ragnarok.fenrir.util.Utils.findIndexById import dev.ragnarok.fenrir.util.Utils.getCauseIfRuntime class UserBannedPresenter(accountId: Int, savedInstanceState: Bundle?) : @@ -21,7 +21,7 @@ class UserBannedPresenter(accountId: Int, savedInstanceState: Bundle?) : private var endOfContent = false private var loadinNow = false private fun onOwnerRemoved(id: Int) { - val index = findOwnerIndexById(owners, id) + val index = findIndexById(owners, id) if (index != -1) { owners.removeAt(index) view?.notifyItemRemoved( diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/userdetails/UserDetailsPresenter.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/userdetails/UserDetailsPresenter.kt index 9da641c81..9774b75d7 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/userdetails/UserDetailsPresenter.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/fragment/userdetails/UserDetailsPresenter.kt @@ -314,14 +314,14 @@ class UserDetailsPresenter( details.getBooks() ) val beliefs = Section(Text(R.string.beliefs)) - if (getPolitivalViewRes(details.getPolitical()) != null) { + if (getPoliticalViewRes(details.getPolitical()) != null) { items.add( AdvancedItem(26, Text(R.string.political_views)) .setSection(beliefs) .setIcon(R.drawable.ic_profile_personal) .setSubtitle( Text( - getPolitivalViewRes( + getPoliticalViewRes( details.getPolitical() ) ) @@ -599,7 +599,7 @@ class UserDetailsPresenter( } } - internal fun getPolitivalViewRes(political: Int): Int? { + internal fun getPoliticalViewRes(political: Int): Int? { return when (political) { 1 -> R.string.political_views_communist 2 -> R.string.political_views_socialist @@ -660,4 +660,4 @@ class UserDetailsPresenter( .subscribe({ displayUserProfileAlbum(it) }, ignore()) ) } -} \ No newline at end of file +} diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/longpoll/UserLongpoll.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/longpoll/UserLongpoll.kt index f594004f2..c6a080b79 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/longpoll/UserLongpoll.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/longpoll/UserLongpoll.kt @@ -119,6 +119,9 @@ internal class UserLongpoll( private fun fixUpdates(updates: VkApiLongpollUpdates) { updates.add_message_updates.nonNullNoEmpty { for (update in it) { + if (update.peerId == accountId) { + update.isOut = true + } if (update.isOut) { update.from = accountId } diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/model/Account.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/model/Account.kt index 659f6ca37..f2c5f7e48 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/model/Account.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/model/Account.kt @@ -2,7 +2,7 @@ package dev.ragnarok.fenrir.model import android.os.Parcel import android.os.Parcelable -import dev.ragnarok.fenrir.api.model.Identificable +import dev.ragnarok.fenrir.api.model.interfaces.Identificable import dev.ragnarok.fenrir.readTypedObjectCompat import dev.ragnarok.fenrir.writeTypedObjectCompat diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/model/AppChatUser.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/model/AppChatUser.kt index 1a076b0bc..0ad39078a 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/model/AppChatUser.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/model/AppChatUser.kt @@ -2,7 +2,7 @@ package dev.ragnarok.fenrir.model import android.os.Parcel import android.os.Parcelable -import dev.ragnarok.fenrir.api.model.Identificable +import dev.ragnarok.fenrir.api.model.interfaces.Identificable import dev.ragnarok.fenrir.getBoolean import dev.ragnarok.fenrir.putBoolean import dev.ragnarok.fenrir.readTypedObjectCompat diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/model/Attachments.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/model/Attachments.kt index 14e144a44..17d9d3359 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/model/Attachments.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/model/Attachments.kt @@ -43,7 +43,7 @@ class Attachments : Parcelable, Cloneable { private set var audioPlaylists: ArrayList? = null private set - var graffity: ArrayList? = null + var graffiti: ArrayList? = null private set var photoAlbums: ArrayList? = null private set @@ -78,7 +78,7 @@ class Attachments : Parcelable, Cloneable { calls = parcel.createTypedArrayList(Call.CREATOR) geos = parcel.createTypedArrayList(Geo.CREATOR) audioPlaylists = parcel.createTypedArrayList(AudioPlaylist.CREATOR) - graffity = parcel.createTypedArrayList(Graffiti.CREATOR) + graffiti = parcel.createTypedArrayList(Graffiti.CREATOR) photoAlbums = parcel.createTypedArrayList(PhotoAlbum.CREATOR) notSupported = parcel.createTypedArrayList(NotSupported.CREATOR) events = parcel.createTypedArrayList(Event.CREATOR) @@ -105,7 +105,7 @@ class Attachments : Parcelable, Cloneable { dest.writeTypedList(calls) dest.writeTypedList(geos) dest.writeTypedList(audioPlaylists) - dest.writeTypedList(graffity) + dest.writeTypedList(graffiti) dest.writeTypedList(photoAlbums) dest.writeTypedList(notSupported) dest.writeTypedList(events) @@ -199,7 +199,7 @@ class Attachments : Parcelable, Cloneable { return } AbsModelType.MODEL_GRAFFITI -> { - prepareGraffity().add(model as Graffiti) + prepareGraffiti().add(model as Graffiti) return } AbsModelType.MODEL_POLL -> { @@ -279,7 +279,7 @@ class Attachments : Parcelable, Cloneable { wallReplies.nonNullNoEmpty { result.addAll(it) } - graffity.nonNullNoEmpty { + graffiti.nonNullNoEmpty { result.addAll(it) } polls.nonNullNoEmpty { @@ -406,11 +406,11 @@ class Attachments : Parcelable, Cloneable { return audioPlaylists!! } - fun prepareGraffity(): ArrayList { - if (graffity == null) { - graffity = ArrayList(1) + fun prepareGraffiti(): ArrayList { + if (graffiti == null) { + graffiti = ArrayList(1) } - return graffity!! + return graffiti!! } fun prepareDocs(): ArrayList { @@ -477,7 +477,7 @@ class Attachments : Parcelable, Cloneable { calls, geos, audioPlaylists, - graffity, + graffiti, polls, pages, voiceMessages, @@ -505,7 +505,7 @@ class Attachments : Parcelable, Cloneable { calls, geos, audioPlaylists, - graffity, + graffiti, polls, pages, voiceMessages, @@ -607,8 +607,8 @@ class Attachments : Parcelable, Cloneable { result.add(DocLink(playlist)) } } - if (graffity != null) { - for (graff in graffity.orEmpty()) { + if (graffiti != null) { + for (graff in graffiti.orEmpty()) { result.add(DocLink(graff)) } } @@ -666,7 +666,7 @@ class Attachments : Parcelable, Cloneable { clone.calls = cloneListAsArrayList(calls) clone.geos = cloneListAsArrayList(geos) clone.audioPlaylists = cloneListAsArrayList(audioPlaylists) - clone.graffity = cloneListAsArrayList(graffity) + clone.graffiti = cloneListAsArrayList(graffiti) clone.polls = cloneListAsArrayList(polls) clone.pages = cloneListAsArrayList(pages) clone.voiceMessages = cloneListAsArrayList(voiceMessages) @@ -720,8 +720,8 @@ class Attachments : Parcelable, Cloneable { if (audioPlaylists != null) { line = line + " audio_playlists=" + safeCountOf(audioPlaylists) } - if (graffity != null) { - line = line + " graffity=" + safeCountOf(graffity) + if (graffiti != null) { + line = line + " graffiti=" + safeCountOf(graffiti) } if (polls != null) { line = line + " polls=" + safeCountOf(polls) diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/model/Comment.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/model/Comment.kt index 63a28d26b..c340c1428 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/model/Comment.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/model/Comment.kt @@ -3,7 +3,7 @@ package dev.ragnarok.fenrir.model import android.os.Parcel import android.os.Parcelable import dev.ragnarok.fenrir.* -import dev.ragnarok.fenrir.api.model.Identificable +import dev.ragnarok.fenrir.api.model.interfaces.Identificable import dev.ragnarok.fenrir.model.ParcelableOwnerWrapper.Companion.readOwner import dev.ragnarok.fenrir.model.ParcelableOwnerWrapper.Companion.writeOwner diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/model/Community.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/model/Community.kt index 6fa0f8b92..500c4bfee 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/model/Community.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/model/Community.kt @@ -223,6 +223,10 @@ class Community : Owner { return 0 } + override fun getObjectId(): Int { + return -abs(id) + } + override val isDonated: Boolean get() = isValueAssigned(ownerId, CheckDonate.donatedOwnersLocal) @@ -260,4 +264,4 @@ class Community : Owner { } } -} \ No newline at end of file +} diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/model/Dialog.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/model/Dialog.kt index 37d6d55ff..88b3b3e82 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/model/Dialog.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/model/Dialog.kt @@ -4,7 +4,7 @@ import android.content.Context import android.os.Parcel import android.os.Parcelable import dev.ragnarok.fenrir.* -import dev.ragnarok.fenrir.api.model.Identificable +import dev.ragnarok.fenrir.api.model.interfaces.Identificable import dev.ragnarok.fenrir.settings.Settings.get import dev.ragnarok.fenrir.util.Utils.firstNonEmptyString diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/model/FavePage.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/model/FavePage.kt index a9db13fd6..be5a63e1c 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/model/FavePage.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/model/FavePage.kt @@ -1,6 +1,6 @@ package dev.ragnarok.fenrir.model -import dev.ragnarok.fenrir.api.model.Identificable +import dev.ragnarok.fenrir.api.model.interfaces.Identificable class FavePage(private val id: Int) : Identificable { var description: String? = null diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/model/FeedList.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/model/FeedList.kt index f66e8de8d..43701dfa5 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/model/FeedList.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/model/FeedList.kt @@ -1,6 +1,6 @@ package dev.ragnarok.fenrir.model -import dev.ragnarok.fenrir.api.model.Identificable +import dev.ragnarok.fenrir.api.model.interfaces.Identificable class FeedList(private val id: Int, val title: String?) : Identificable { override fun getObjectId(): Int { diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/model/ISomeones.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/model/ISomeones.kt index 4c4ae92bd..4665683a9 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/model/ISomeones.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/model/ISomeones.kt @@ -1,6 +1,6 @@ package dev.ragnarok.fenrir.model -import dev.ragnarok.fenrir.api.model.Identificable +import dev.ragnarok.fenrir.api.model.interfaces.Identificable interface ISomeones : Identificable { val ownerId: Int diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/model/IdOption.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/model/IdOption.kt index 1b6f9d662..3c88faaa0 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/model/IdOption.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/model/IdOption.kt @@ -2,7 +2,7 @@ package dev.ragnarok.fenrir.model import android.os.Parcel import android.os.Parcelable -import dev.ragnarok.fenrir.api.model.Identificable +import dev.ragnarok.fenrir.api.model.interfaces.Identificable class IdOption : Parcelable, Identificable { private val id: Int diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/model/Message.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/model/Message.kt index bd41301f4..45cde0904 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/model/Message.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/model/Message.kt @@ -4,7 +4,7 @@ import android.content.Context import android.os.Parcel import android.os.Parcelable import dev.ragnarok.fenrir.* -import dev.ragnarok.fenrir.api.model.Identificable +import dev.ragnarok.fenrir.api.model.interfaces.Identificable import dev.ragnarok.fenrir.util.ParcelUtils.readIntStringMap import dev.ragnarok.fenrir.util.ParcelUtils.writeIntStringMap import dev.ragnarok.fenrir.util.Utils.safeCountOf @@ -390,8 +390,8 @@ class Message : AbsModel, Identificable, ISelectable { get() = status == MessageStatus.SENT val isSticker: Boolean get() = safeCountOf(attachments?.stickers) > 0 - val isGraffity: Boolean - get() = safeCountOf(attachments?.graffity) > 0 + val isGraffiti: Boolean + get() = safeCountOf(attachments?.graffiti) > 0 val isCall: Boolean get() = safeCountOf(attachments?.calls) > 0 val isGift: Boolean @@ -412,8 +412,8 @@ class Message : AbsModel, Identificable, ISelectable { isSticker -> { return MessageType.STICKER } - isGraffity -> { - return MessageType.GRAFFITY + isGraffiti -> { + return MessageType.GRAFFITI } isCall -> { return MessageType.CALL diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/model/MessageType.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/model/MessageType.kt index 8752648ea..ffb0af32a 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/model/MessageType.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/model/MessageType.kt @@ -5,7 +5,7 @@ import androidx.annotation.IntDef @IntDef( MessageType.NO, MessageType.STICKER, - MessageType.GRAFFITY, + MessageType.GRAFFITI, MessageType.CALL, MessageType.GIFT, MessageType.VOICE, @@ -23,7 +23,7 @@ annotation class MessageType { companion object { const val NO = 0 const val STICKER = 1 - const val GRAFFITY = 2 + const val GRAFFITI = 2 const val CALL = 3 const val GIFT = 4 const val VOICE = 5 diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/model/News.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/model/News.kt index f9caccbe8..18d763e39 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/model/News.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/model/News.kt @@ -156,9 +156,6 @@ class News : AbsModel { var copyright: Copyright? = null private set - @Transient - var tag: Any? = null - private set var viewCount = 0 private set @@ -197,11 +194,6 @@ class News : AbsModel { return AbsModelType.MODEL_NEWS } - fun setTag(tag: Any?): News { - this.tag = tag - return this - } - fun setCopyright(copyright: Copyright?): News { this.copyright = copyright return this @@ -437,4 +429,4 @@ class News : AbsModel { return arrayOfNulls(size) } } -} \ No newline at end of file +} diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/model/Owner.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/model/Owner.kt index f0b19db6f..3c4e3ddc4 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/model/Owner.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/model/Owner.kt @@ -1,13 +1,14 @@ package dev.ragnarok.fenrir.model import android.os.Parcel +import dev.ragnarok.fenrir.api.model.interfaces.Identificable import dev.ragnarok.fenrir.module.parcel.ParcelNative import dev.ragnarok.fenrir.readTypedObjectCompat import dev.ragnarok.fenrir.writeTypedObjectCompat import kotlinx.serialization.Serializable @Serializable -sealed class Owner : AbsModel, ParcelNative.ParcelableNative { +sealed class Owner : AbsModel, Identificable, ParcelNative.ParcelableNative { @OwnerType val ownerType: Int @@ -88,4 +89,4 @@ sealed class Owner : AbsModel, ParcelNative.ParcelableNative { dest.writeTypedObjectCompat(owner, flags) } } -} \ No newline at end of file +} diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/model/ProxyConfig.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/model/ProxyConfig.kt index b7a1ae599..e43f55f9a 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/model/ProxyConfig.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/model/ProxyConfig.kt @@ -1,7 +1,7 @@ package dev.ragnarok.fenrir.model import androidx.annotation.Keep -import dev.ragnarok.fenrir.api.model.Identificable +import dev.ragnarok.fenrir.api.model.interfaces.Identificable import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/model/User.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/model/User.kt index ac26a6318..e6bd462ca 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/model/User.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/model/User.kt @@ -4,7 +4,6 @@ import android.os.Parcel import android.os.Parcelable import androidx.annotation.Keep import dev.ragnarok.fenrir.* -import dev.ragnarok.fenrir.api.model.Identificable import dev.ragnarok.fenrir.module.parcel.ParcelNative import dev.ragnarok.fenrir.settings.Settings.get import dev.ragnarok.fenrir.util.Utils.firstNonEmptyString @@ -16,7 +15,7 @@ import kotlin.math.abs @Keep @Serializable @SerialName("user") -class User : Owner, Identificable { +class User : Owner { private val id: Int var firstName: String? = null private set @@ -335,7 +334,7 @@ class User : Owner, Identificable { } override fun getObjectId(): Int { - return id + return abs(id) } override fun get100photoOrSmaller(): String? { @@ -371,4 +370,4 @@ class User : Owner, Identificable { } } -} \ No newline at end of file +} diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/model/WallReply.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/model/WallReply.kt index 236f9611b..bbf5224c8 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/model/WallReply.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/model/WallReply.kt @@ -2,7 +2,7 @@ package dev.ragnarok.fenrir.model import android.os.Parcel import android.os.Parcelable -import dev.ragnarok.fenrir.api.model.Identificable +import dev.ragnarok.fenrir.api.model.interfaces.Identificable import dev.ragnarok.fenrir.model.ParcelableOwnerWrapper.Companion.readOwner import dev.ragnarok.fenrir.model.ParcelableOwnerWrapper.Companion.writeOwner import dev.ragnarok.fenrir.nonNullNoEmpty diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/model/feedback/CommentFeedback.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/model/feedback/CommentFeedback.kt index a70c31d27..9c1b5777a 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/model/feedback/CommentFeedback.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/model/feedback/CommentFeedback.kt @@ -27,6 +27,10 @@ class CommentFeedback : Feedback { dest.writeTypedObjectCompat(comment, flags) } + override fun getModelType(): Int { + return FeedbackModelType.MODEL_COMMENT_FEEDBACK + } + override fun describeContents(): Int { return 0 } @@ -50,4 +54,4 @@ class CommentFeedback : Feedback { return arrayOfNulls(size) } } -} \ No newline at end of file +} diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/model/feedback/CopyFeedback.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/model/feedback/CopyFeedback.kt index 1b6b248aa..f341ce29b 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/model/feedback/CopyFeedback.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/model/feedback/CopyFeedback.kt @@ -27,6 +27,10 @@ class CopyFeedback : Feedback { writeOwners(dest, flags, owners) } + override fun getModelType(): Int { + return FeedbackModelType.MODEL_COPY_FEEDBACK + } + override fun describeContents(): Int { return 0 } @@ -50,4 +54,4 @@ class CopyFeedback : Feedback { return arrayOfNulls(size) } } -} \ No newline at end of file +} diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/model/feedback/Feedback.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/model/feedback/Feedback.kt index 3bf7beb64..0a98fb1a6 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/model/feedback/Feedback.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/model/feedback/Feedback.kt @@ -15,6 +15,9 @@ abstract class Feedback : Parcelable { var reply: Comment? = null private set + @FeedbackModelType + abstract fun getModelType(): Int + constructor(@FeedbackType type: Int) { this.type = type } @@ -45,4 +48,4 @@ abstract class Feedback : Parcelable { dest.writeLong(date) dest.writeTypedObjectCompat(reply, flags) } -} \ No newline at end of file +} diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/model/feedback/FeedbackModelType.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/model/feedback/FeedbackModelType.kt new file mode 100644 index 000000000..622a792d8 --- /dev/null +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/model/feedback/FeedbackModelType.kt @@ -0,0 +1,33 @@ +package dev.ragnarok.fenrir.model.feedback + +import androidx.annotation.IntDef + +@IntDef( + FeedbackModelType.MODEL_NULL_FEEDBACK, + FeedbackModelType.MODEL_COMMENT_FEEDBACK, + FeedbackModelType.MODEL_COPY_FEEDBACK, + FeedbackModelType.MODEL_LIKECOMMENT_FEEDBACK, + FeedbackModelType.MODEL_LIKE_FEEDBACK, + FeedbackModelType.MODEL_MENTIONCOMMENT_FEEDBACK, + FeedbackModelType.MODEL_MENTION_FEEDBACK, + FeedbackModelType.MODEL_POSTPUBLISH_FEEDBACK, + FeedbackModelType.MODEL_REPLYCOMMENT_FEEDBACK, + FeedbackModelType.MODEL_USERS_FEEDBACK +) +@Retention( + AnnotationRetention.SOURCE +) +annotation class FeedbackModelType { + companion object { + const val MODEL_NULL_FEEDBACK = 0 + const val MODEL_COMMENT_FEEDBACK = 1 + const val MODEL_COPY_FEEDBACK = 2 + const val MODEL_LIKECOMMENT_FEEDBACK = 3 + const val MODEL_LIKE_FEEDBACK = 4 + const val MODEL_MENTIONCOMMENT_FEEDBACK = 5 + const val MODEL_MENTION_FEEDBACK = 6 + const val MODEL_POSTPUBLISH_FEEDBACK = 7 + const val MODEL_REPLYCOMMENT_FEEDBACK = 8 + const val MODEL_USERS_FEEDBACK = 9 + } +} diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/model/feedback/LikeCommentFeedback.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/model/feedback/LikeCommentFeedback.kt index 905ff0526..d683dd959 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/model/feedback/LikeCommentFeedback.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/model/feedback/LikeCommentFeedback.kt @@ -28,6 +28,10 @@ class LikeCommentFeedback : Feedback { owners = readOwners(parcel) } + override fun getModelType(): Int { + return FeedbackModelType.MODEL_LIKECOMMENT_FEEDBACK + } + override fun writeToParcel(dest: Parcel, flags: Int) { super.writeToParcel(dest, flags) dest.writeTypedObjectCompat(liked, flags) @@ -63,4 +67,4 @@ class LikeCommentFeedback : Feedback { return arrayOfNulls(size) } } -} \ No newline at end of file +} diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/model/feedback/LikeFeedback.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/model/feedback/LikeFeedback.kt index a5c3cf5aa..431bdd15d 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/model/feedback/LikeFeedback.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/model/feedback/LikeFeedback.kt @@ -22,6 +22,10 @@ class LikeFeedback : Feedback { owners = readOwners(parcel) } + override fun getModelType(): Int { + return FeedbackModelType.MODEL_LIKE_FEEDBACK + } + override fun writeToParcel(dest: Parcel, flags: Int) { super.writeToParcel(dest, flags) writeModel(dest, flags, liked) @@ -51,4 +55,4 @@ class LikeFeedback : Feedback { return arrayOfNulls(size) } } -} \ No newline at end of file +} diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/model/feedback/MentionCommentFeedback.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/model/feedback/MentionCommentFeedback.kt index b592f8ceb..25cf4ca74 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/model/feedback/MentionCommentFeedback.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/model/feedback/MentionCommentFeedback.kt @@ -22,6 +22,10 @@ class MentionCommentFeedback : Feedback { commentOf = readModel(parcel) } + override fun getModelType(): Int { + return FeedbackModelType.MODEL_MENTIONCOMMENT_FEEDBACK + } + override fun writeToParcel(dest: Parcel, flags: Int) { super.writeToParcel(dest, flags) dest.writeTypedObjectCompat(where, flags) @@ -51,4 +55,4 @@ class MentionCommentFeedback : Feedback { return arrayOfNulls(size) } } -} \ No newline at end of file +} diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/model/feedback/MentionFeedback.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/model/feedback/MentionFeedback.kt index 668df0d68..a0eb0b99c 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/model/feedback/MentionFeedback.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/model/feedback/MentionFeedback.kt @@ -25,6 +25,10 @@ class MentionFeedback : Feedback { writeModel(dest, flags, where) } + override fun getModelType(): Int { + return FeedbackModelType.MODEL_MENTION_FEEDBACK + } + override fun describeContents(): Int { return 0 } @@ -43,4 +47,4 @@ class MentionFeedback : Feedback { return arrayOfNulls(size) } } -} \ No newline at end of file +} diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/model/feedback/ParcelableFeedbackWrapper.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/model/feedback/ParcelableFeedbackWrapper.kt index 0c1ffe49a..477c504fc 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/model/feedback/ParcelableFeedbackWrapper.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/model/feedback/ParcelableFeedbackWrapper.kt @@ -2,6 +2,7 @@ package dev.ragnarok.fenrir.model.feedback import android.os.Parcel import android.os.Parcelable +import android.util.ArrayMap import dev.ragnarok.fenrir.readTypedObjectCompat import dev.ragnarok.fenrir.writeTypedObjectCompat @@ -18,31 +19,27 @@ class ParcelableFeedbackWrapper : Parcelable { return arrayOfNulls(size) } } - private val TYPES: MutableList> = ArrayList(9) - private val LOADERS: MutableList<(parcel: Parcel) -> Feedback?> = ArrayList(25) + private val TYPES: ArrayMap Feedback?> = ArrayMap(9) init { - //Types - TYPES.add(CommentFeedback::class.java) - TYPES.add(CopyFeedback::class.java) - TYPES.add(LikeCommentFeedback::class.java) - TYPES.add(LikeFeedback::class.java) - TYPES.add(MentionCommentFeedback::class.java) - TYPES.add(MentionFeedback::class.java) - TYPES.add(PostPublishFeedback::class.java) - TYPES.add(ReplyCommentFeedback::class.java) - TYPES.add(UsersFeedback::class.java) - - //Loaders - LOADERS.add { it.readTypedObjectCompat(CommentFeedback.CREATOR) } - LOADERS.add { it.readTypedObjectCompat(CopyFeedback.CREATOR) } - LOADERS.add { it.readTypedObjectCompat(LikeCommentFeedback.CREATOR) } - LOADERS.add { it.readTypedObjectCompat(LikeFeedback.CREATOR) } - LOADERS.add { it.readTypedObjectCompat(MentionCommentFeedback.CREATOR) } - LOADERS.add { it.readTypedObjectCompat(MentionFeedback.CREATOR) } - LOADERS.add { it.readTypedObjectCompat(PostPublishFeedback.CREATOR) } - LOADERS.add { it.readTypedObjectCompat(ReplyCommentFeedback.CREATOR) } - LOADERS.add { it.readTypedObjectCompat(UsersFeedback.CREATOR) } + TYPES[FeedbackModelType.MODEL_COMMENT_FEEDBACK] = + { it.readTypedObjectCompat(CommentFeedback.CREATOR) } + TYPES[FeedbackModelType.MODEL_COPY_FEEDBACK] = + { it.readTypedObjectCompat(CopyFeedback.CREATOR) } + TYPES[FeedbackModelType.MODEL_LIKECOMMENT_FEEDBACK] = + { it.readTypedObjectCompat(LikeCommentFeedback.CREATOR) } + TYPES[FeedbackModelType.MODEL_LIKE_FEEDBACK] = + { it.readTypedObjectCompat(LikeFeedback.CREATOR) } + TYPES[FeedbackModelType.MODEL_MENTIONCOMMENT_FEEDBACK] = + { it.readTypedObjectCompat(MentionCommentFeedback.CREATOR) } + TYPES[FeedbackModelType.MODEL_MENTION_FEEDBACK] = + { it.readTypedObjectCompat(MentionFeedback.CREATOR) } + TYPES[FeedbackModelType.MODEL_POSTPUBLISH_FEEDBACK] = + { it.readTypedObjectCompat(PostPublishFeedback.CREATOR) } + TYPES[FeedbackModelType.MODEL_REPLYCOMMENT_FEEDBACK] = + { it.readTypedObjectCompat(ReplyCommentFeedback.CREATOR) } + TYPES[FeedbackModelType.MODEL_USERS_FEEDBACK] = + { it.readTypedObjectCompat(UsersFeedback.CREATOR) } } } @@ -54,7 +51,11 @@ class ParcelableFeedbackWrapper : Parcelable { internal constructor(parcel: Parcel) { val index = parcel.readInt() - feedback = LOADERS[index].invoke(parcel)!! + feedback = if (index == FeedbackModelType.MODEL_NULL_FEEDBACK) { + null + } else { + TYPES[index]!!.invoke(parcel)!! + } } override fun describeContents(): Int { @@ -62,15 +63,15 @@ class ParcelableFeedbackWrapper : Parcelable { } override fun writeToParcel(dest: Parcel, flags: Int) { - val index = TYPES.indexOf((feedback ?: return).javaClass) - if (index == -1) { - throw UnsupportedOperationException("Unsupported class: " + feedback.javaClass) + if (feedback == null || !TYPES.contains(feedback.getModelType())) { + dest.writeInt(FeedbackModelType.MODEL_NULL_FEEDBACK) + return } - dest.writeInt(index) + dest.writeInt(feedback.getModelType()) dest.writeTypedObjectCompat(feedback, flags) } fun get(): Feedback? { return feedback } -} \ No newline at end of file +} diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/model/feedback/PostPublishFeedback.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/model/feedback/PostPublishFeedback.kt index 15cc6b82a..00652ba03 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/model/feedback/PostPublishFeedback.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/model/feedback/PostPublishFeedback.kt @@ -20,6 +20,10 @@ class PostPublishFeedback : Feedback { dest.writeTypedObjectCompat(post, flags) } + override fun getModelType(): Int { + return FeedbackModelType.MODEL_POSTPUBLISH_FEEDBACK + } + override fun describeContents(): Int { return 0 } @@ -38,4 +42,4 @@ class PostPublishFeedback : Feedback { return arrayOfNulls(size) } } -} \ No newline at end of file +} diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/model/feedback/ReplyCommentFeedback.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/model/feedback/ReplyCommentFeedback.kt index 87c6b5882..50705e1e3 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/model/feedback/ReplyCommentFeedback.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/model/feedback/ReplyCommentFeedback.kt @@ -24,6 +24,10 @@ class ReplyCommentFeedback : Feedback { feedbackComment = parcel.readTypedObjectCompat(Comment.CREATOR) } + override fun getModelType(): Int { + return FeedbackModelType.MODEL_REPLYCOMMENT_FEEDBACK + } + override fun writeToParcel(dest: Parcel, flags: Int) { super.writeToParcel(dest, flags) writeModel(dest, flags, commentsOf) @@ -59,4 +63,4 @@ class ReplyCommentFeedback : Feedback { return arrayOfNulls(size) } } -} \ No newline at end of file +} diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/model/feedback/UsersFeedback.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/model/feedback/UsersFeedback.kt index 967524efa..3b3685003 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/model/feedback/UsersFeedback.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/model/feedback/UsersFeedback.kt @@ -20,6 +20,10 @@ class UsersFeedback : Feedback { writeOwners(dest, flags, owners) } + override fun getModelType(): Int { + return FeedbackModelType.MODEL_USERS_FEEDBACK + } + override fun describeContents(): Int { return 0 } @@ -38,4 +42,4 @@ class UsersFeedback : Feedback { return arrayOfNulls(size) } } -} \ No newline at end of file +} diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/place/PlaceFactory.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/place/PlaceFactory.kt index 109be9409..1f1618dc6 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/place/PlaceFactory.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/place/PlaceFactory.kt @@ -155,14 +155,14 @@ object PlaceFactory { } - fun getShowComunityInfoPlace(accountId: Int, community: Community?): Place { + fun getShowCommunityInfoPlace(accountId: Int, community: Community?): Place { return Place(Place.COMMUNITY_INFO) .withIntExtra(Extra.ACCOUNT_ID, accountId) .withParcelableExtra(Extra.OWNER, community) } - fun getShowComunityLinksInfoPlace(accountId: Int, community: Community?): Place { + fun getShowCommunityLinksInfoPlace(accountId: Int, community: Community?): Place { return Place(Place.COMMUNITY_INFO_LINKS) .withIntExtra(Extra.ACCOUNT_ID, accountId) .withParcelableExtra(Extra.OWNER, community) diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/realtime/TmpResult.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/realtime/TmpResult.kt index 0a52d3bcb..3b07d5ef1 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/realtime/TmpResult.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/realtime/TmpResult.kt @@ -1,7 +1,7 @@ package dev.ragnarok.fenrir.realtime -import dev.ragnarok.fenrir.api.model.Identificable import dev.ragnarok.fenrir.api.model.VKApiMessage +import dev.ragnarok.fenrir.api.model.interfaces.Identificable import dev.ragnarok.fenrir.model.Message class TmpResult(id: Int, accountId: Int, capacity: Int) { @@ -45,7 +45,7 @@ class TmpResult(id: Int, accountId: Int, capacity: Int) { return msg } - fun setMissingIds(ids: Collection): TmpResult { + fun setMissingIds(ids: Collection): TmpResult { for (msg in data) { msg.setAlreadyExists(!ids.contains(msg.getObjectId())) } diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/service/ChatDownloadWorker.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/service/ChatDownloadWorker.kt index 1dc0fc761..75719be50 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/service/ChatDownloadWorker.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/service/ChatDownloadWorker.kt @@ -90,8 +90,8 @@ class ChatDownloadWorker(context: Context, workerParams: WorkerParameters) : } else chat_title } - private fun getAvatarTag(PeerId: Int): String { - return "avatar_id_" + if (PeerId < 0) "club" else "" + abs(PeerId) + private fun getAvatarTag(peerId: Int): String { + return "avatar_id_" + if (peerId < 0) "club" else "" + abs(peerId) } private fun Build_Message(i: Message, isSub: Boolean): String { @@ -780,4 +780,4 @@ class ChatDownloadWorker(context: Context, workerParams: WorkerParameters) : } } -} \ No newline at end of file +} diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/service/ErrorLocalizer.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/service/ErrorLocalizer.kt index 732c6dc97..0130d207f 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/service/ErrorLocalizer.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/service/ErrorLocalizer.kt @@ -6,6 +6,7 @@ import dev.ragnarok.fenrir.api.ApiException import dev.ragnarok.fenrir.api.rest.HttpException import dev.ragnarok.fenrir.exception.NotFoundException import dev.ragnarok.fenrir.nonNullNoEmpty +import java.io.InterruptedIOException import java.net.ConnectException import java.net.SocketTimeoutException import java.net.UnknownHostException @@ -15,14 +16,21 @@ object ErrorLocalizer { fun localizeThrowable(context: Context, throwable: Throwable?): String { throwable ?: return "null" - if (throwable is ApiException) { - val error = throwable.error - return api().getMessage(context, error.errorCode, error.errorMsg) ?: "null" - } return when (throwable) { + is ApiException -> { + val error = throwable.error + api().getMessage(context, error.errorCode, error.errorMsg) ?: "null" + } is SocketTimeoutException -> { context.getString(R.string.error_timeout_message) } + is InterruptedIOException -> { + if ("timeout" == throwable.message || "executor rejected" == throwable.message) { + context.getString(R.string.error_timeout_message) + } else { + throwable.message.nonNullNoEmpty({ it }, { throwable.toString() }) + } + } is ConnectException, is UnknownHostException -> { context.getString(R.string.error_unknown_host) } diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/settings/AccountsSettings.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/settings/AccountsSettings.kt index 3358c2ae0..b3e4f90ae 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/settings/AccountsSettings.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/settings/AccountsSettings.kt @@ -209,7 +209,7 @@ internal class AccountsSettings @SuppressLint("UseSparseArrays") constructor(con companion object { private const val KEY_ACCOUNT_UIDS = "account_uids" - private const val KEY_CURRENT = "current_account_id" + private const val KEY_CURRENT = "current_account_id_int" internal fun tokenKeyFor(uid: Int): String { return "token$uid" } diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/settings/ISettings.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/settings/ISettings.kt index 8fd740bdb..9fe9d912d 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/settings/ISettings.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/settings/ISettings.kt @@ -130,9 +130,9 @@ interface ISettings { fun isEnable_dirs_files_count(): Boolean fun get_last_audio_sync(): Long fun set_last_audio_sync(time: Long) - fun get_last_stikers_sync(accountId: Int): Long - fun del_last_stikers_sync(accountId: Int) - fun set_last_stikers_sync(accountId: Int, time: Long) + fun get_last_stickers_sync(accountId: Int): Long + fun del_last_stickers_sync(accountId: Int) + fun set_last_stickers_sync(accountId: Int, time: Long) val isOngoing_player_notification: Boolean fun reloadOwnerChangesMonitor() fun isOwnerInChangesMonitor(ownerId: Int): Boolean @@ -269,8 +269,8 @@ interface ISettings { } interface IRecentChats { - operator fun get(acountid: Int): MutableList - fun store(accountid: Int, chats: List) + operator fun get(accountId: Int): MutableList + fun store(accountId: Int, chats: List) } interface IDrawerSettings { diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/settings/OtherSettings.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/settings/OtherSettings.kt index 58a04bfb5..f3cdbb624 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/settings/OtherSettings.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/settings/OtherSettings.kt @@ -344,16 +344,16 @@ internal class OtherSettings(context: Context) : IOtherSettings { getPreferences(app).edit().putLong("last_audio_sync", time).apply() } - override fun get_last_stikers_sync(accountId: Int): Long { - return getPreferences(app).getLong("last_stikers_sync_$accountId", -1) + override fun get_last_stickers_sync(accountId: Int): Long { + return getPreferences(app).getLong("last_stickers_sync_$accountId", -1) } - override fun del_last_stikers_sync(accountId: Int) { - getPreferences(app).edit().remove("last_stikers_sync_$accountId").apply() + override fun del_last_stickers_sync(accountId: Int) { + getPreferences(app).edit().remove("last_stickers_sync_$accountId").apply() } - override fun set_last_stikers_sync(accountId: Int, time: Long) { - getPreferences(app).edit().putLong("last_stikers_sync_$accountId", time).apply() + override fun set_last_stickers_sync(accountId: Int, time: Long) { + getPreferences(app).edit().putLong("last_stickers_sync_$accountId", time).apply() } override fun is_notification_force_link(): Boolean { diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/settings/RecentChatsSettings.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/settings/RecentChatsSettings.kt index 1f46735a3..a9ba04a1d 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/settings/RecentChatsSettings.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/settings/RecentChatsSettings.kt @@ -9,10 +9,10 @@ import dev.ragnarok.fenrir.settings.ISettings.IRecentChats internal class RecentChatsSettings(app: Context) : IRecentChats { private val app: Context = app.applicationContext - override fun get(acountid: Int): MutableList { + override fun get(accountId: Int): MutableList { val recentChats: MutableList = ArrayList() val stringSet = getPreferences(app) - .getStringSet(recentChatKeyFor(acountid), null) + .getStringSet(recentChatKeyFor(accountId), null) if (stringSet.nonNullNoEmpty()) { for (s in stringSet) { try { @@ -25,15 +25,15 @@ internal class RecentChatsSettings(app: Context) : IRecentChats { return recentChats } - override fun store(accountid: Int, chats: List) { + override fun store(accountId: Int, chats: List) { val target: MutableSet = LinkedHashSet() for (item in chats) { - if (item.aid != accountid) continue + if (item.aid != accountId) continue target.add(kJson.encodeToString(RecentChat.serializer(), item)) } getPreferences(app) .edit() - .putStringSet(recentChatKeyFor(accountid), target) + .putStringSet(recentChatKeyFor(accountId), target) .apply() } @@ -43,4 +43,4 @@ internal class RecentChatsSettings(app: Context) : IRecentChats { } } -} \ No newline at end of file +} diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/upload/Upload.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/upload/Upload.kt index cf572f6d3..1a002417b 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/upload/Upload.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/upload/Upload.kt @@ -3,7 +3,7 @@ package dev.ragnarok.fenrir.upload import android.net.Uri import android.os.Parcel import android.os.Parcelable -import dev.ragnarok.fenrir.api.model.Identificable +import dev.ragnarok.fenrir.api.model.interfaces.Identificable import dev.ragnarok.fenrir.model.AbsModel import dev.ragnarok.fenrir.model.AbsModelType import dev.ragnarok.fenrir.picasso.Content_Local diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/util/PostDownload.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/util/PostDownload.kt index 5f961da4e..70ac54510 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/util/PostDownload.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/util/PostDownload.kt @@ -62,8 +62,8 @@ class PostDownload(private val context: Context) { return if (owner.fullName.isNullOrEmpty()) "wall_${post.ownerId}_${post.vkid}" else owner.fullName + "_${post.ownerId}_${post.vkid}" } - private fun getAvatarTag(PeerId: Int): String { - return "avatar_id_" + if (PeerId < 0) "club" else "" + abs(PeerId) + private fun getAvatarTag(peerId: Int): String { + return "avatar_id_" + if (peerId < 0) "club" else "" + abs(peerId) } private fun Build_Post(accountId: Int, owner: Owner, i: Post, isSub: Boolean): String { diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/util/Utils.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/util/Utils.kt index 922c16fd1..32e8479d2 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/util/Utils.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/util/Utils.kt @@ -41,7 +41,7 @@ import dev.ragnarok.fenrir.activity.qr.CustomQRCodeWriter import dev.ragnarok.fenrir.api.HttpLoggerAndParser.toRequestBuilder import dev.ragnarok.fenrir.api.HttpLoggerAndParser.vkHeader import dev.ragnarok.fenrir.api.ProxyUtil.applyProxyConfig -import dev.ragnarok.fenrir.api.model.Identificable +import dev.ragnarok.fenrir.api.model.interfaces.Identificable import dev.ragnarok.fenrir.link.internal.LinkActionAdapter import dev.ragnarok.fenrir.link.internal.OwnerLinkSpanFactory import dev.ragnarok.fenrir.media.exo.OkHttpDataSource @@ -75,6 +75,7 @@ object Utils { private val reload_news: MutableList = LinkedList() private val reload_dialogs: MutableList = LinkedList() private val cachedMyStickers: MutableList = ArrayList() + var follower_kick_mode = false private val displaySize = Point() private var device_id: String? = null var density = 1f @@ -122,10 +123,10 @@ object Utils { fun needReloadStickers(account_id: Int): Boolean { - Settings.get().other().get_last_stikers_sync(account_id).let { + Settings.get().other().get_last_stickers_sync(account_id).let { if (it <= 0 || (System.currentTimeMillis() / 1000L) - it > 900) { Settings.get().other() - .set_last_stikers_sync(account_id, System.currentTimeMillis() / 1000L) + .set_last_stickers_sync(account_id, System.currentTimeMillis() / 1000L) return true } } @@ -499,16 +500,6 @@ object Utils { return -1 } - fun findOwnerIndexById(data: List?, id: Int): Int { - data ?: return -1 - for (i in data.indices) { - if (data[i].ownerId == id) { - return i - } - } - return -1 - } - fun findIndexById(data: List?, id: Int, ownerId: Int): Int { data ?: return -1 for (i in data.indices) { @@ -670,7 +661,6 @@ object Utils { return -1 } - fun indexOfOwner(data: List?, o: Owner?): Int { if (data == null || o == null) { return -1 @@ -683,17 +673,6 @@ object Utils { return -1 } - - fun indexOfOwner(data: List?, id: Int): Int { - data ?: return -1 - for (i in data.indices) { - if (data[i].ownerId == id) { - return i - } - } - return -1 - } - fun firstNonEmptyString(vararg array: String?): String? { for (s in array) { if (!s.isNullOrEmpty()) { diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/util/VKOwnIds.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/util/VKOwnIds.kt index a0d84d31c..1d9288f81 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/util/VKOwnIds.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/util/VKOwnIds.kt @@ -4,6 +4,7 @@ import dev.ragnarok.fenrir.api.model.* import dev.ragnarok.fenrir.api.model.feedback.Copies import dev.ragnarok.fenrir.api.model.feedback.UserArray import dev.ragnarok.fenrir.api.model.feedback.VKApiUsersFeedback +import dev.ragnarok.fenrir.api.model.interfaces.VKApiAttachment import dev.ragnarok.fenrir.model.Message import dev.ragnarok.fenrir.model.Peer import dev.ragnarok.fenrir.nonNullNoEmpty diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/view/emoji/StickersAdapter.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/view/emoji/StickersAdapter.kt index f08105b41..63c2bbc7f 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/view/emoji/StickersAdapter.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/view/emoji/StickersAdapter.kt @@ -18,7 +18,7 @@ import dev.ragnarok.fenrir.view.natives.rlottie.RLottieImageView class StickersAdapter(private val context: Context, private val stickers: StickerSet) : RecyclerView.Adapter() { - private val isNightStiker: Boolean = + private val isNightSticker: Boolean = Settings.get().ui().isStickers_by_theme && Settings.get().ui().isDarkModeEnabled( context ) @@ -66,7 +66,7 @@ class StickersAdapter(private val context: Context, private val stickers: Sticke TYPE_ANIMATED -> { val animatedHolder = holder as StickerAnimatedHolder animatedHolder.animation.fromNet( - item?.getAnimationByType(if (isNightStiker) "dark" else "light"), + item?.getAnimationByType(if (isNightSticker) "dark" else "light"), Utils.createOkHttp(5, true), Utils.dp(128f), Utils.dp(128f) @@ -86,7 +86,7 @@ class StickersAdapter(private val context: Context, private val stickers: Sticke TYPE_IMAGE -> { val normalHolder = holder as StickerHolder normalHolder.image.visibility = View.VISIBLE - val url = item?.getImage(256, isNightStiker)?.url + val url = item?.getImage(256, isNightSticker)?.url if (url.isNullOrEmpty()) { with().cancelRequest(normalHolder.image) normalHolder.image.setImageResource(R.drawable.ic_avatar_unknown) @@ -105,7 +105,7 @@ class StickersAdapter(private val context: Context, private val stickers: Sticke else -> { val animatedHolder = holder as StickerAnimatedHolder animatedHolder.animation.fromNet( - item?.getAnimationByType(if (isNightStiker) "dark" else "light"), + item?.getAnimationByType(if (isNightSticker) "dark" else "light"), Utils.createOkHttp(5, true), Utils.dp(128f), Utils.dp(128f) diff --git a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/view/emoji/StickersKeyWordsAdapter.kt b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/view/emoji/StickersKeyWordsAdapter.kt index 1fc6e9e54..97ce66074 100644 --- a/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/view/emoji/StickersKeyWordsAdapter.kt +++ b/app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/view/emoji/StickersKeyWordsAdapter.kt @@ -17,7 +17,7 @@ import java.lang.ref.WeakReference class StickersKeyWordsAdapter(private val context: Context, private var stickers: List) : RecyclerView.Adapter() { - private val isNightStiker: Boolean = + private val isNightSticker: Boolean = Settings.get().ui().isStickers_by_theme && Settings.get().ui().isDarkModeEnabled( context ) @@ -47,7 +47,7 @@ class StickersKeyWordsAdapter(private val context: Context, private var stickers val item = stickers[position] val normalHolder = holder as StickerHolder normalHolder.root.visibility = View.VISIBLE - val url = item.getImage(256, isNightStiker).url + val url = item.getImage(256, isNightSticker).url if (url.isNullOrEmpty()) { with().cancelRequest(normalHolder.root) normalHolder.root.setImageResource(R.drawable.ic_avatar_unknown) diff --git a/app_fenrir/src/main/res/layout/item_document.xml b/app_fenrir/src/main/res/layout/item_document.xml index 264b79e26..85b4135ae 100644 --- a/app_fenrir/src/main/res/layout/item_document.xml +++ b/app_fenrir/src/main/res/layout/item_document.xml @@ -28,7 +28,7 @@ app:shapeAppearanceOverlay="@style/ShapeAppearance.MediumRoundedPictures" /> diff --git a/app_fenrir/src/main/res/layout/item_message_graffity_friend.xml b/app_fenrir/src/main/res/layout/item_message_graffiti_friend.xml similarity index 100% rename from app_fenrir/src/main/res/layout/item_message_graffity_friend.xml rename to app_fenrir/src/main/res/layout/item_message_graffiti_friend.xml diff --git a/app_fenrir/src/main/res/layout/item_message_graffity_my.xml b/app_fenrir/src/main/res/layout/item_message_graffiti_my.xml similarity index 100% rename from app_fenrir/src/main/res/layout/item_message_graffity_my.xml rename to app_fenrir/src/main/res/layout/item_message_graffiti_my.xml diff --git a/app_fenrir/src/main/res/values-be/strings.xml b/app_fenrir/src/main/res/values-be/strings.xml index d06b6752c..9fc6aa4de 100644 --- a/app_fenrir/src/main/res/values-be/strings.xml +++ b/app_fenrir/src/main/res/values-be/strings.xml @@ -130,7 +130,7 @@ [званок] [дакумент] [падарунак] - [графіці] + [графіці] [фота] [відэа] [рэпост] @@ -1441,7 +1441,7 @@ Месца Выходны званок Уваходны званок - Графіці + Графіці Спампоўваць фота па доўгім націску Фота Альбом Другі колер выходнага паведамлення @@ -1715,4 +1715,5 @@ Уключыць Фатаграфіі з карыстальнікам Фатаграфіі на сцяне + Заблакаваць падпісчыка? Рэжым захавацца на сесію \ No newline at end of file diff --git a/app_fenrir/src/main/res/values-ru/strings.xml b/app_fenrir/src/main/res/values-ru/strings.xml index 7c41b75b5..ba3befd42 100644 --- a/app_fenrir/src/main/res/values-ru/strings.xml +++ b/app_fenrir/src/main/res/values-ru/strings.xml @@ -130,7 +130,7 @@ [звонок] [документ] [подарок] - [граффити] + [граффити] [фото] [видео] [репост] @@ -1443,7 +1443,7 @@ Место Исходящий звонок Входящий звонок - Граффити + Граффити Скачивать фото по долгому нажатию Фото Альбом Второй цвет исходящего сообщения @@ -1717,4 +1717,5 @@ Включить Фотографии с пользователем Фотографии на стене + Заблокировать подписчика? Режим сохраниться на сессию diff --git a/app_fenrir/src/main/res/values/strings.xml b/app_fenrir/src/main/res/values/strings.xml index b4fc70a3f..c34a2c3c8 100644 --- a/app_fenrir/src/main/res/values/strings.xml +++ b/app_fenrir/src/main/res/values/strings.xml @@ -292,7 +292,7 @@ [call] [document] [gift] - [graffiti] + [graffiti] [photo] [video] [repost] @@ -1688,7 +1688,7 @@ Geo Outgoing call Incoming call - Graffiti + Graffiti Download pictures by long press Photo Album Second color of outgoing message @@ -1962,4 +1962,5 @@ Turn on Photos with user Photos on Wall + Block a subscriber? Mode save per session diff --git a/app_filegallery/src/main/kotlin/dev/ragnarok/filegallery/Extra.kt b/app_filegallery/src/main/kotlin/dev/ragnarok/filegallery/Extra.kt index 9b9ee100b..a3910b0a9 100644 --- a/app_filegallery/src/main/kotlin/dev/ragnarok/filegallery/Extra.kt +++ b/app_filegallery/src/main/kotlin/dev/ragnarok/filegallery/Extra.kt @@ -1,22 +1,22 @@ package dev.ragnarok.filegallery object Extra { - const val PATH = "path" const val AUDIOS = "audios" - const val POSITION = "position" - const val SHUFFLE_MODE = "shuffle_mode" + const val EXT = "ext" + const val HIDE_TITLE = "hide_tittle" const val INDEX = "index" const val INVERT = "invert" - const val PLACE_TYPE = "place_type" - const val PTR = "ptr" + const val IS_OUT_OF_MEMORY = "is_out_of_memory" + const val METHOD = "method" const val NAME = "name" const val OWNER_ID = "owner_id" - const val EXT = "ext" - const val HIDE_TITLE = "hide_tittle" - const val TITLE = "tittle" - const val STACK_TRACE = "stack_trace" + const val PATH = "path" + const val PLACE_TYPE = "place_type" + const val POSITION = "position" + const val PTR = "ptr" const val SELECT = "select" - const val IS_OUT_OF_MEMORY = "is_out_of_memory" - const val METHOD = "method" + const val SHUFFLE_MODE = "shuffle_mode" + const val STACK_TRACE = "stack_trace" + const val TITLE = "tittle" const val URL = "url" } \ No newline at end of file diff --git a/app_filegallery/src/main/kotlin/dev/ragnarok/filegallery/util/ErrorLocalizer.kt b/app_filegallery/src/main/kotlin/dev/ragnarok/filegallery/util/ErrorLocalizer.kt index 6ac50b507..576587a98 100644 --- a/app_filegallery/src/main/kotlin/dev/ragnarok/filegallery/util/ErrorLocalizer.kt +++ b/app_filegallery/src/main/kotlin/dev/ragnarok/filegallery/util/ErrorLocalizer.kt @@ -4,6 +4,7 @@ import android.content.Context import dev.ragnarok.filegallery.R import dev.ragnarok.filegallery.api.rest.HttpException import dev.ragnarok.filegallery.nonNullNoEmpty +import java.io.InterruptedIOException import java.net.ConnectException import java.net.SocketTimeoutException import java.net.UnknownHostException @@ -15,6 +16,13 @@ object ErrorLocalizer { is SocketTimeoutException -> { context.getString(R.string.error_timeout_message) } + is InterruptedIOException -> { + if ("timeout" == throwable.message || "executor rejected" == throwable.message) { + context.getString(R.string.error_timeout_message) + } else { + throwable.message.nonNullNoEmpty({ it }, { throwable.toString() }) + } + } is ConnectException, is UnknownHostException -> { context.getString(R.string.error_unknown_host) } diff --git a/build.gradle b/build.gradle index 8360e3d62..0d3ddbb3b 100644 --- a/build.gradle +++ b/build.gradle @@ -15,9 +15,9 @@ buildscript { //androidx libraries ext.activityVersion = "1.6.1" ext.annotationVersion = "1.5.0" - ext.appcompatVersion = "1.6.0-rc01" + ext.appcompatVersion = "1.6.0" ext.biometricVersion = "1.2.0-alpha05" - ext.browserVersion = "1.5.0-alpha02" + ext.browserVersion = "1.5.0-beta01" ext.cameraVersion = "1.2.0" ext.cardviewVersion = "1.0.0" ext.collectionVersion = "1.3.0-alpha02" @@ -30,7 +30,7 @@ buildscript { ext.drawerlayoutVersion = "1.2.0-alpha01" ext.exifinterfaceVersion = "1.3.5" ext.fragmentVersion = "1.6.0-alpha04" - ext.lifecycleVersion = "2.6.0-alpha03" + ext.lifecycleVersion = "2.6.0-alpha04" ext.loaderVersion = "1.1.0" ext.mediaVersion = "1.6.0" ext.recyclerviewVersion = "1.3.0-beta02" @@ -39,7 +39,7 @@ buildscript { ext.tracingVersion = "1.1.0" ext.transitionVersion = "1.4.1" ext.vectordrawableVersion = "1.2.0-beta01" - ext.webkitVersion = "1.6.0-beta01" + ext.webkitVersion = "1.6.0-rc01" ext.workVersion = "2.8.0-rc01" //firebase libraries @@ -86,7 +86,7 @@ buildscript { mavenCentral() } dependencies { - classpath "com.android.tools.build:gradle:7.4.0-rc03" + classpath "com.android.tools.build:gradle:7.4.0" classpath "com.google.gms:google-services:4.3.14" classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" classpath "org.jetbrains.kotlin:kotlin-serialization:$kotlin_version" diff --git a/fenrir_common/src/main/res/raw/eye.json_lz4 b/fenrir_common/src/main/res/raw/eye.json_lz4 index fdb7769d8..ba39c5b2d 100644 Binary files a/fenrir_common/src/main/res/raw/eye.json_lz4 and b/fenrir_common/src/main/res/raw/eye.json_lz4 differ diff --git a/fenrir_common/src/main/res/raw/infinity.json_lz4 b/fenrir_common/src/main/res/raw/infinity.json_lz4 deleted file mode 100644 index 556a4817e..000000000 Binary files a/fenrir_common/src/main/res/raw/infinity.json_lz4 and /dev/null differ diff --git a/fenrir_common/src/main/res/raw/is_friend.json_lz4 b/fenrir_common/src/main/res/raw/is_friend.json_lz4 new file mode 100644 index 000000000..053be76c7 Binary files /dev/null and b/fenrir_common/src/main/res/raw/is_friend.json_lz4 differ