Skip to content

Commit

Permalink
27
Browse files Browse the repository at this point in the history
27
  • Loading branch information
umerov1999 committed May 17, 2023
1 parent 4f63242 commit fef2b85
Show file tree
Hide file tree
Showing 435 changed files with 9,199 additions and 5,368 deletions.
4 changes: 3 additions & 1 deletion app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/Extra.kt
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ object Extra {
const val INDEX = "index"
const val INVERT = "invert"
const val IS_BOARD = "is_board"
const val IS_CHAT = "is_chat"
const val IS_EDIT = "is_edit"
const val IS_OUT_OF_MEMORY = "is_out_of_memory"
const val ITEM_ID = "item_id"
const val KEY = "key"
Expand All @@ -60,12 +62,12 @@ object Extra {
const val MESSAGE_ID = "message_id"
const val METHOD = "method"
const val NEW = "new"
const val NO_OWNER_ID = "no_owner_id"
const val OLD = "old"
const val OUTGOING = "outgoing"
const val OWNER = "owner"
const val OWNERS = "owners"
const val OWNER_ID = "owner_id"
const val NO_OWNER_ID = "no_owner_id"
const val PASSWORD = "password"
const val PATH = "path"
const val PEER = "peer"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ class FcmListenerService : FirebaseMessagingService() {
.notify(accountId)

PushType.POST -> WallPostFCMMessage.fromRemoteMessage(message)
?.nofify(context, accountId)
?.notify(context, accountId)

PushType.COMMENT -> CommentFCMMessage.fromRemoteMessage(message)
?.notify(context, accountId)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package dev.ragnarok.fenrir.activity

import android.os.Bundle
import dev.ragnarok.fenrir.R
import dev.ragnarok.fenrir.fragment.createpin.CreatePinFragment
import dev.ragnarok.fenrir.fragment.pin.createpin.CreatePinFragment

class CreatePinActivity : NoMainActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ import android.os.Bundle
import dev.ragnarok.fenrir.Extra
import dev.ragnarok.fenrir.R
import dev.ragnarok.fenrir.fragment.DualTabPhotosFragment
import dev.ragnarok.fenrir.fragment.localphotos.LocalPhotosFragment
import dev.ragnarok.fenrir.fragment.vkphotos.IVKPhotosView
import dev.ragnarok.fenrir.fragment.vkphotos.VKPhotosFragment
import dev.ragnarok.fenrir.fragment.photos.localphotos.LocalPhotosFragment
import dev.ragnarok.fenrir.fragment.photos.vkphotos.IVKPhotosView
import dev.ragnarok.fenrir.fragment.photos.vkphotos.VKPhotosFragment
import dev.ragnarok.fenrir.getParcelableCompat
import dev.ragnarok.fenrir.getParcelableExtraCompat
import dev.ragnarok.fenrir.model.LocalImageAlbum
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package dev.ragnarok.fenrir.activity
import android.content.Context
import android.os.Bundle
import dev.ragnarok.fenrir.R
import dev.ragnarok.fenrir.fragment.enterpin.EnterPinFragment
import dev.ragnarok.fenrir.fragment.pin.enterpin.EnterPinFragment
import dev.ragnarok.fenrir.util.Utils

open class EnterPinActivity : NoMainActivity() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ import dev.ragnarok.fenrir.domain.InteractorFactory
import dev.ragnarok.fenrir.domain.impl.CountersInteractor
import dev.ragnarok.fenrir.fragment.*
import dev.ragnarok.fenrir.fragment.PreferencesFragment.Companion.cleanCache
import dev.ragnarok.fenrir.fragment.abswall.AbsWallFragment
import dev.ragnarok.fenrir.fragment.attachments.commentcreate.CommentCreateFragment
import dev.ragnarok.fenrir.fragment.attachments.commentedit.CommentEditFragment
import dev.ragnarok.fenrir.fragment.attachments.postcreate.PostCreateFragment
Expand All @@ -64,37 +63,35 @@ import dev.ragnarok.fenrir.fragment.audio.catalog_v2.lists.CatalogV2ListFragment
import dev.ragnarok.fenrir.fragment.audio.catalog_v2.sections.CatalogV2SectionFragment
import dev.ragnarok.fenrir.fragment.comments.CommentsFragment
import dev.ragnarok.fenrir.fragment.communities.CommunitiesFragment
import dev.ragnarok.fenrir.fragment.communitycontrol.CommunityControlFragment
import dev.ragnarok.fenrir.fragment.communitycontrol.communityban.CommunityBanEditFragment
import dev.ragnarok.fenrir.fragment.communitycontrol.communityinfocontacts.CommunityInfoContactsFragment
import dev.ragnarok.fenrir.fragment.communitycontrol.communityinfolinks.CommunityInfoLinksFragment
import dev.ragnarok.fenrir.fragment.communitycontrol.communitymanageredit.CommunityManagerEditFragment
import dev.ragnarok.fenrir.fragment.communitycontrol.communitymembers.CommunityMembersFragment
import dev.ragnarok.fenrir.fragment.conversation.ConversationFragmentFactory
import dev.ragnarok.fenrir.fragment.createphotoalbum.CreatePhotoAlbumFragment
import dev.ragnarok.fenrir.fragment.createpin.CreatePinFragment
import dev.ragnarok.fenrir.fragment.createpoll.CreatePollFragment
import dev.ragnarok.fenrir.fragment.communities.communitycontrol.CommunityControlFragment
import dev.ragnarok.fenrir.fragment.communities.communitycontrol.communityban.CommunityBanEditFragment
import dev.ragnarok.fenrir.fragment.communities.communitycontrol.communityinfocontacts.CommunityInfoContactsFragment
import dev.ragnarok.fenrir.fragment.communities.communitycontrol.communityinfolinks.CommunityInfoLinksFragment
import dev.ragnarok.fenrir.fragment.communities.communitycontrol.communitymanageredit.CommunityManagerEditFragment
import dev.ragnarok.fenrir.fragment.communities.communitycontrol.communitymembers.CommunityMembersFragment
import dev.ragnarok.fenrir.fragment.communities.groupchats.GroupChatsFragment
import dev.ragnarok.fenrir.fragment.docs.DocsFragment
import dev.ragnarok.fenrir.fragment.docs.DocsListPresenter
import dev.ragnarok.fenrir.fragment.fave.FaveTabsFragment
import dev.ragnarok.fenrir.fragment.feed.FeedFragment
import dev.ragnarok.fenrir.fragment.feed.feedbanned.FeedBannedFragment
import dev.ragnarok.fenrir.fragment.feed.newsfeedcomments.NewsfeedCommentsFragment
import dev.ragnarok.fenrir.fragment.feed.newsfeedmentions.NewsfeedMentionsFragment
import dev.ragnarok.fenrir.fragment.feedback.FeedbackFragment
import dev.ragnarok.fenrir.fragment.feedbackvkofficial.FeedbackVKOfficialFragment
import dev.ragnarok.fenrir.fragment.feedbanned.FeedBannedFragment
import dev.ragnarok.fenrir.fragment.feedback.feedbackvkofficial.FeedbackVKOfficialFragment
import dev.ragnarok.fenrir.fragment.friends.birthday.BirthDayFragment
import dev.ragnarok.fenrir.fragment.friends.friendsbyphones.FriendsByPhonesFragment
import dev.ragnarok.fenrir.fragment.friends.friendstabs.FriendsTabsFragment
import dev.ragnarok.fenrir.fragment.gifts.GiftsFragment
import dev.ragnarok.fenrir.fragment.groupchats.GroupChatsFragment
import dev.ragnarok.fenrir.fragment.likes.LikesFragment
import dev.ragnarok.fenrir.fragment.likes.storiesview.StoriesViewFragment
import dev.ragnarok.fenrir.fragment.localserver.filemanagerremote.FileManagerRemoteFragment
import dev.ragnarok.fenrir.fragment.localserver.photoslocalserver.PhotosLocalServerFragment
import dev.ragnarok.fenrir.fragment.logs.LogsFragment
import dev.ragnarok.fenrir.fragment.marketview.MarketViewFragment
import dev.ragnarok.fenrir.fragment.messages.chat.ChatFragment
import dev.ragnarok.fenrir.fragment.messages.chat.ChatFragment.Companion.newInstance
import dev.ragnarok.fenrir.fragment.messages.chatmembers.ChatMembersFragment
import dev.ragnarok.fenrir.fragment.messages.conversationattachments.ConversationFragmentFactory
import dev.ragnarok.fenrir.fragment.messages.dialogs.DialogsFragment
import dev.ragnarok.fenrir.fragment.messages.fwds.FwdsFragment
import dev.ragnarok.fenrir.fragment.messages.importantmessages.ImportantMessagesFragment
Expand All @@ -103,13 +100,19 @@ import dev.ragnarok.fenrir.fragment.messages.notreadmessages.NotReadMessagesFrag
import dev.ragnarok.fenrir.fragment.narratives.NarrativesFragment
import dev.ragnarok.fenrir.fragment.navigationedit.DrawerEditFragment
import dev.ragnarok.fenrir.fragment.navigationedit.SideDrawerEditFragment
import dev.ragnarok.fenrir.fragment.newsfeedcomments.NewsfeedCommentsFragment
import dev.ragnarok.fenrir.fragment.newsfeedmentions.NewsfeedMentionsFragment
import dev.ragnarok.fenrir.fragment.ownerarticles.OwnerArticlesFragment
import dev.ragnarok.fenrir.fragment.photoallcomment.PhotoAllCommentFragment
import dev.ragnarok.fenrir.fragment.photos.createphotoalbum.CreatePhotoAlbumFragment
import dev.ragnarok.fenrir.fragment.photos.photoallcomment.PhotoAllCommentFragment
import dev.ragnarok.fenrir.fragment.photos.vkphotoalbums.VKPhotoAlbumsFragment
import dev.ragnarok.fenrir.fragment.photos.vkphotos.IVKPhotosView
import dev.ragnarok.fenrir.fragment.photos.vkphotos.VKPhotosFragment
import dev.ragnarok.fenrir.fragment.pin.createpin.CreatePinFragment
import dev.ragnarok.fenrir.fragment.poll.PollFragment
import dev.ragnarok.fenrir.fragment.productalbums.ProductAlbumsFragment
import dev.ragnarok.fenrir.fragment.poll.createpoll.CreatePollFragment
import dev.ragnarok.fenrir.fragment.poll.voters.VotersFragment
import dev.ragnarok.fenrir.fragment.products.ProductsFragment
import dev.ragnarok.fenrir.fragment.products.marketview.MarketViewFragment
import dev.ragnarok.fenrir.fragment.products.productalbums.ProductAlbumsFragment
import dev.ragnarok.fenrir.fragment.requestexecute.RequestExecuteFragment
import dev.ragnarok.fenrir.fragment.search.AudioSearchTabsFragment
import dev.ragnarok.fenrir.fragment.search.SearchTabsFragment
Expand All @@ -119,19 +122,16 @@ import dev.ragnarok.fenrir.fragment.shortedlinks.ShortedLinksFragment
import dev.ragnarok.fenrir.fragment.theme.ThemeFragment
import dev.ragnarok.fenrir.fragment.topics.TopicsFragment
import dev.ragnarok.fenrir.fragment.userbanned.UserBannedFragment
import dev.ragnarok.fenrir.fragment.userdetails.UserDetailsFragment.Companion.newInstance
import dev.ragnarok.fenrir.fragment.videoalbumsbyvideo.VideoAlbumsByVideoFragment
import dev.ragnarok.fenrir.fragment.videopreview.VideoPreviewFragment
import dev.ragnarok.fenrir.fragment.videos.IVideosListView
import dev.ragnarok.fenrir.fragment.videos.VideosFragment
import dev.ragnarok.fenrir.fragment.videos.VideosTabsFragment
import dev.ragnarok.fenrir.fragment.vkphotoalbums.VKPhotoAlbumsFragment
import dev.ragnarok.fenrir.fragment.vkphotos.IVKPhotosView
import dev.ragnarok.fenrir.fragment.vkphotos.VKPhotosFragment
import dev.ragnarok.fenrir.fragment.voters.VotersFragment
import dev.ragnarok.fenrir.fragment.wallattachments.WallAttachmentsFragmentFactory
import dev.ragnarok.fenrir.fragment.wallattachments.wallsearchcommentsattachments.WallSearchCommentsAttachmentsFragment
import dev.ragnarok.fenrir.fragment.wallpost.WallPostFragment
import dev.ragnarok.fenrir.fragment.videos.videoalbumsbyvideo.VideoAlbumsByVideoFragment
import dev.ragnarok.fenrir.fragment.videos.videopreview.VideoPreviewFragment
import dev.ragnarok.fenrir.fragment.wall.AbsWallFragment
import dev.ragnarok.fenrir.fragment.wall.userdetails.UserDetailsFragment.Companion.newInstance
import dev.ragnarok.fenrir.fragment.wall.wallattachments.WallAttachmentsFragmentFactory
import dev.ragnarok.fenrir.fragment.wall.wallattachments.wallsearchcommentsattachments.WallSearchCommentsAttachmentsFragment
import dev.ragnarok.fenrir.fragment.wall.wallpost.WallPostFragment
import dev.ragnarok.fenrir.link.LinkHelper
import dev.ragnarok.fenrir.listener.*
import dev.ragnarok.fenrir.media.music.MusicPlaybackController
Expand Down Expand Up @@ -1404,11 +1404,8 @@ open class MainActivity : AppCompatActivity(), NavigationDrawerCallbacks, OnSect
Place.EDIT_COMMENT -> {
val comment: Comment? = args.getParcelableCompat(Extra.COMMENT)
val accountId = args.getLong(Extra.ACCOUNT_ID)
val commemtId = args.getInt(Extra.COMMENT_ID)
val commentEditFragment =
CommentEditFragment.newInstance(accountId, comment, commemtId)
place.applyFragmentListener(commentEditFragment, supportFragmentManager)
attachToFront(commentEditFragment)
val commentId = args.getInt(Extra.COMMENT_ID)
attachToFront(CommentEditFragment.newInstance(accountId, comment, commentId))
}

Place.EDIT_POST -> {
Expand Down Expand Up @@ -1570,9 +1567,7 @@ open class MainActivity : AppCompatActivity(), NavigationDrawerCallbacks, OnSect
Place.UNREAD_MESSAGES -> attachToFront(NotReadMessagesFragment.newInstance(args))
Place.SECURITY -> attachToFront(SecurityPreferencesFragment())
Place.CREATE_POLL -> {
val createPollFragment = CreatePollFragment.newInstance(args)
place.applyFragmentListener(createPollFragment, supportFragmentManager)
attachToFront(createPollFragment)
attachToFront(CreatePollFragment.newInstance(args))
}

Place.COMMENT_CREATE -> openCommentCreatePlace(place)
Expand Down Expand Up @@ -1764,7 +1759,6 @@ open class MainActivity : AppCompatActivity(), NavigationDrawerCallbacks, OnSect
args.getLong(Extra.OWNER_ID),
args.getString(Extra.BODY)
)
place.applyFragmentListener(fragment, supportFragmentManager)
attachToFront(fragment)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package dev.ragnarok.fenrir.activity
import android.os.Bundle
import dev.ragnarok.fenrir.Extra
import dev.ragnarok.fenrir.R
import dev.ragnarok.fenrir.fragment.vkphotoalbums.VKPhotoAlbumsFragment
import dev.ragnarok.fenrir.fragment.vkphotos.VKPhotosFragment
import dev.ragnarok.fenrir.fragment.photos.vkphotoalbums.VKPhotoAlbumsFragment
import dev.ragnarok.fenrir.fragment.photos.vkphotos.VKPhotosFragment
import dev.ragnarok.fenrir.place.Place
import dev.ragnarok.fenrir.place.PlaceProvider

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package dev.ragnarok.fenrir.activity
import android.os.Bundle
import dev.ragnarok.fenrir.Extra
import dev.ragnarok.fenrir.R
import dev.ragnarok.fenrir.fragment.localimagealbums.LocalImageAlbumsFragment
import dev.ragnarok.fenrir.fragment.localphotos.LocalPhotosFragment
import dev.ragnarok.fenrir.fragment.photos.localimagealbums.LocalImageAlbumsFragment
import dev.ragnarok.fenrir.fragment.photos.localphotos.LocalPhotosFragment
import dev.ragnarok.fenrir.getParcelableCompat
import dev.ragnarok.fenrir.model.LocalImageAlbum
import dev.ragnarok.fenrir.place.Place
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ import dev.ragnarok.fenrir.activity.slidr.Slidr.attach
import dev.ragnarok.fenrir.activity.slidr.model.SlidrConfig
import dev.ragnarok.fenrir.activity.slidr.model.SlidrListener
import dev.ragnarok.fenrir.activity.slidr.model.SlidrPosition
import dev.ragnarok.fenrir.fragment.absdocumentpreview.AbsDocumentPreviewActivity
import dev.ragnarok.fenrir.fragment.audio.AudioPlayerFragment
import dev.ragnarok.fenrir.fragment.base.core.IPresenterFactory
import dev.ragnarok.fenrir.fragment.docs.absdocumentpreview.AbsDocumentPreviewActivity
import dev.ragnarok.fenrir.getParcelableArrayListCompat
import dev.ragnarok.fenrir.listener.AppStyleable
import dev.ragnarok.fenrir.model.Document
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import android.os.Bundle
import android.view.View
import com.google.android.material.snackbar.BaseTransientBottomBar
import dev.ragnarok.fenrir.R
import dev.ragnarok.fenrir.fragment.absdocumentpreview.BaseDocumentPresenter
import dev.ragnarok.fenrir.fragment.docs.absdocumentpreview.BaseDocumentPresenter
import dev.ragnarok.fenrir.model.Document
import dev.ragnarok.fenrir.util.AppPerms.hasReadWriteStoragePermission
import dev.ragnarok.fenrir.util.DownloadWorkUtils.doDownloadDoc
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package dev.ragnarok.fenrir.activity.gifpager

import androidx.annotation.StringRes
import dev.ragnarok.fenrir.fragment.absdocumentpreview.IBasicDocumentView
import dev.ragnarok.fenrir.fragment.docs.absdocumentpreview.IBasicDocumentView
import dev.ragnarok.fenrir.model.Document

interface IGifPagerView : IBasicDocumentView {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ internal class PollsApi(accountId: Long, provider: IServiceProvider) :
question: String?,
isAnonymous: Boolean?,
isMultiple: Boolean?,
disableUnvote: Boolean,
backgroundId: Int?,
ownerId: Long,
addAnswers: List<String>
): Single<VKApiPoll> {
Expand All @@ -29,6 +31,8 @@ internal class PollsApi(accountId: Long, provider: IServiceProvider) :
question,
integerFromBoolean(isAnonymous),
integerFromBoolean(isMultiple),
integerFromBoolean(disableUnvote),
backgroundId,
ownerId,
Json.encodeToString(ListSerializer(String.serializer()), addAnswers)
)
Expand Down Expand Up @@ -72,6 +76,14 @@ internal class PollsApi(accountId: Long, provider: IServiceProvider) :
}
}

override fun getBackgrounds(): Single<List<VKApiPoll.Background>> {
return provideService(IPollsService(), TokenType.USER)
.flatMap { service ->
service.getBackgrounds()
.map(extractResponseWithErrorHandling())
}
}

override fun getVoters(
ownerId: Long,
pollId: Int,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ interface IPollsApi {
question: String?,
isAnonymous: Boolean?,
isMultiple: Boolean?,
disableUnvote: Boolean,
backgroundId: Int?,
ownerId: Long,
addAnswers: List<String>
): Single<VKApiPoll>
Expand All @@ -37,4 +39,7 @@ interface IPollsApi {
answer_ids: List<Long>,
offset: Int?, count: Int?
): Single<List<VKApiUser>>

@CheckResult
fun getBackgrounds(): Single<List<VKApiPoll.Background>>
}
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ class VKApiPoll
var end_date: Long = 0
var multiple = false
var photo: Photo? = null
var background: Background? = null
override fun getType(): String {
return VKApiAttachment.TYPE_POLL
}
Expand Down Expand Up @@ -94,6 +95,21 @@ class VKApiPoll
var rate = 0.0
}

@Serializable
class Background {
var type: String? = null
var id = 0
var angle = 0
var name: String? = null
var points: List<BackgroundPoint>? = null
}

@Serializable
class BackgroundPoint {
var color: String? = null
var position = 0.0f
}

@Serializable
class Photo {
var color: String? = null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ class IPollsService : IServiceRest() {
question: String?,
isAnonymous: Int?,
isMultiple: Int?,
disableUnvote: Int?,
backgroundId: Int?,
ownerId: Long?,
addAnswers: String?
): Single<BaseResponse<VKApiPoll>> {
Expand All @@ -19,6 +21,8 @@ class IPollsService : IServiceRest() {
"question" to question,
"is_anonymous" to isAnonymous,
"is_multiple" to isMultiple,
"disable_unvote" to disableUnvote,
"background_id" to backgroundId,
"owner_id" to ownerId,
"add_answers" to addAnswers
), base(VKApiPoll.serializer())
Expand Down Expand Up @@ -96,4 +100,10 @@ class IPollsService : IServiceRest() {
), baseList(PollUsersResponse.serializer())
)
}

fun getBackgrounds(): Single<BaseResponse<List<VKApiPoll.Background>>> {
return rest.request(
"polls.getBackgrounds", null, baseList(VKApiPoll.Background.serializer())
)
}
}
Loading

0 comments on commit fef2b85

Please sign in to comment.