Skip to content

Commit

Permalink
16
Browse files Browse the repository at this point in the history
16
  • Loading branch information
umerov1999 committed Mar 20, 2023
1 parent 06b1472 commit 9a9cb3d
Show file tree
Hide file tree
Showing 893 changed files with 5,451 additions and 3,020 deletions.
1 change: 1 addition & 0 deletions app_fenrir/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ android {
exclude("META-INF/LICENSE")
exclude("META-INF/NOTICE")
exclude("META-INF/*.version")
exclude("META-INF/versions/**")
}

dependenciesInfo {
Expand Down
8 changes: 8 additions & 0 deletions app_fenrir/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -401,6 +401,14 @@
android:theme="@style/App.DayNight.Swipes"
android:windowSoftInputMode="adjustResize|stateHidden" />

<activity
android:name="dev.ragnarok.fenrir.activity.shortvideopager.ShortVideoPagerActivity"
android:configChanges="keyboardHidden|orientation"
android:exported="true"
android:label="@string/clips"
android:theme="@style/App.DayNight.Swipes"
android:windowSoftInputMode="adjustResize|stateHidden" />

<activity
android:name="dev.ragnarok.fenrir.activity.SinglePhotoActivity"
android:configChanges="keyboardHidden|orientation"
Expand Down
4 changes: 2 additions & 2 deletions app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/Constants.kt
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package dev.ragnarok.fenrir

import android.content.res.Resources
import java.util.*

object Constants {
const val API_VERSION = "5.131"
const val AUTH_VERSION = "5.131"
const val AUTH_VERSION = API_VERSION

const val DATABASE_FENRIR_VERSION = 27
const val DATABASE_TEMPORARY_VERSION = 5
const val EXPORT_SETTINGS_FORMAT = 1
Expand Down
1 change: 1 addition & 0 deletions app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/Extra.kt
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ object Extra {
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
2 changes: 1 addition & 1 deletion app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/Includes.kt
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ object Includes {
}

val validationProvider: IValidateProvider by lazy {
ValidateProvider(provideApplicationContext(), provideMainThreadScheduler())
ValidateProvider(provideApplicationContext())
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import dev.ragnarok.fenrir.Extra
import dev.ragnarok.fenrir.R
import dev.ragnarok.fenrir.activity.gifpager.GifPagerActivity
import dev.ragnarok.fenrir.activity.photopager.PhotoPagerActivity.Companion.newInstance
import dev.ragnarok.fenrir.activity.shortvideopager.ShortVideoPagerActivity
import dev.ragnarok.fenrir.activity.slidr.Slidr.attach
import dev.ragnarok.fenrir.activity.slidr.model.SlidrConfig
import dev.ragnarok.fenrir.activity.storypager.StoryPagerActivity
Expand Down Expand Up @@ -100,6 +101,11 @@ class ChatActivity : NoMainActivity(), PlaceProvider, AppStyleable {
StoryPagerActivity.newInstance(this, args)
)

Place.SHORT_VIDEOS -> place.launchActivityForResult(
this,
ShortVideoPagerActivity.newInstance(this, args)
)

Place.SINGLE_PHOTO -> place.launchActivityForResult(
this,
SinglePhotoActivity.newInstance(this, args)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import dev.ragnarok.fenrir.Extra
import dev.ragnarok.fenrir.R
import dev.ragnarok.fenrir.activity.gifpager.GifPagerActivity
import dev.ragnarok.fenrir.activity.photopager.PhotoPagerActivity.Companion.newInstance
import dev.ragnarok.fenrir.activity.shortvideopager.ShortVideoPagerActivity
import dev.ragnarok.fenrir.activity.slidr.Slidr.attach
import dev.ragnarok.fenrir.activity.slidr.model.SlidrConfig
import dev.ragnarok.fenrir.activity.slidr.model.SlidrListener
Expand Down Expand Up @@ -115,6 +116,11 @@ class ChatActivityBubbles : NoMainActivity(), PlaceProvider, AppStyleable {
StoryPagerActivity.newInstance(this, args)
)

Place.SHORT_VIDEOS -> place.launchActivityForResult(
this,
ShortVideoPagerActivity.newInstance(this, args)
)

Place.GIF_PAGER -> place.launchActivityForResult(
this,
GifPagerActivity.newInstance(this, args)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import dev.ragnarok.fenrir.Extra
import dev.ragnarok.fenrir.R
import dev.ragnarok.fenrir.activity.gifpager.GifPagerActivity
import dev.ragnarok.fenrir.activity.photopager.PhotoPagerActivity.Companion.newInstance
import dev.ragnarok.fenrir.activity.shortvideopager.ShortVideoPagerActivity
import dev.ragnarok.fenrir.activity.storypager.StoryPagerActivity
import dev.ragnarok.fenrir.fragment.audio.AudioPlayerFragment
import dev.ragnarok.fenrir.fragment.audio.AudioPlayerFragment.Companion.newInstance
Expand Down Expand Up @@ -100,6 +101,11 @@ class LocalJsonToChatActivity : NoMainActivity(), PlaceProvider, AppStyleable {
StoryPagerActivity.newInstance(this, args)
)

Place.SHORT_VIDEOS -> place.launchActivityForResult(
this,
ShortVideoPagerActivity.newInstance(this, args)
)

Place.SINGLE_PHOTO -> place.launchActivityForResult(
this,
SinglePhotoActivity.newInstance(this, args)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ class LoginActivity : AppCompatActivity() {
setContentView(R.layout.activity_login)
val webview = findViewById<WebView>(R.id.vkontakteview)
webview.settings.javaScriptEnabled = true
webview.settings.domStorageEnabled = true
webview.settings.blockNetworkLoads = false
webview.settings.blockNetworkImage = false
webview.settings.databaseEnabled = true
webview.clearCache(true)
webview.settings.userAgentString = getUserAgentByType(Constants.DEFAULT_ACCOUNT_TYPE)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ import dev.ragnarok.fenrir.activity.EnterPinActivity.Companion.getClass
import dev.ragnarok.fenrir.activity.gifpager.GifPagerActivity
import dev.ragnarok.fenrir.activity.photopager.PhotoPagerActivity.Companion.newInstance
import dev.ragnarok.fenrir.activity.qr.CameraScanActivity
import dev.ragnarok.fenrir.activity.shortvideopager.ShortVideoPagerActivity
import dev.ragnarok.fenrir.activity.storypager.StoryPagerActivity
import dev.ragnarok.fenrir.db.Stores
import dev.ragnarok.fenrir.dialog.ResolveDomainDialog
Expand Down Expand Up @@ -86,6 +87,7 @@ 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
Expand Down Expand Up @@ -615,31 +617,49 @@ open class MainActivity : AppCompatActivity(), NavigationDrawerCallbacks, OnSect
val menus = ModalBottomSheetDialogFragment.Builder()
menus.add(
OptionRequest(
R.id.button_ok,
0,
getString(R.string.set_offline),
R.drawable.offline,
true
)
)
menus.add(
OptionRequest(
R.id.button_cancel,
1,
getString(R.string.open_clipboard_url),
R.drawable.web,
false
)
)
menus.add(
OptionRequest(
R.id.action_preferences,
2,
getString(R.string.stories),
R.drawable.story_outline,
true
)
)
if (Utils.isOfficialVKCurrent) {
menus.add(
OptionRequest(
3,
getString(R.string.clips),
R.drawable.clip_outline,
true
)
)
}
menus.add(
OptionRequest(
4,
getString(R.string.settings),
R.drawable.preferences,
true
)
)
menus.add(
OptionRequest(
R.id.button_camera,
5,
getString(R.string.scan_qr),
R.drawable.qr_code,
false
Expand All @@ -650,8 +670,8 @@ open class MainActivity : AppCompatActivity(), NavigationDrawerCallbacks, OnSect
"left_options",
object : ModalBottomSheetDialogFragment.Listener {
override fun onModalOptionSelected(option: Option) {
when {
option.id == R.id.button_ok -> {
when (option.id) {
0 -> {
mCompositeDisposable.add(InteractorFactory.createAccountInteractor()
.setOffline(
Settings.get().accounts().current
Expand All @@ -664,7 +684,7 @@ open class MainActivity : AppCompatActivity(), NavigationDrawerCallbacks, OnSect
})
}

option.id == R.id.button_cancel -> {
1 -> {
val clipBoard =
getSystemService(CLIPBOARD_SERVICE) as ClipboardManager?
if (clipBoard != null && clipBoard.primaryClip != null && (clipBoard.primaryClip?.itemCount
Expand All @@ -682,12 +702,42 @@ open class MainActivity : AppCompatActivity(), NavigationDrawerCallbacks, OnSect
}
}

option.id == R.id.action_preferences -> {
2 -> {
mCompositeDisposable.add(InteractorFactory.createStoriesInteractor()
.getStory(
Settings.get().accounts().current,
null
)
.fromIOToMain()
.subscribe({
if (it.isEmpty()) {
createCustomToast(this@MainActivity).showToastError(
R.string.list_is_empty
)
}
PlaceFactory.getHistoryVideoPreviewPlace(
mAccountId,
ArrayList(it),
0
).tryOpenWith(this@MainActivity)
}) {
createCustomToast(this@MainActivity).showToastThrowable(
it
)
})
}

3 -> {
PlaceFactory.getShortVideoPlace(mAccountId, null)
.tryOpenWith(this@MainActivity)
}

4 -> {
PlaceFactory.getPreferencesPlace(mAccountId)
.tryOpenWith(this@MainActivity)
}

option.id == R.id.button_camera && FenrirNative.isNativeLoaded -> {
5 -> {
val intent =
Intent(
this@MainActivity,
Expand Down Expand Up @@ -1284,6 +1334,11 @@ open class MainActivity : AppCompatActivity(), NavigationDrawerCallbacks, OnSect
StoryPagerActivity.newInstance(this, args)
)

Place.SHORT_VIDEOS -> place.launchActivityForResult(
this,
ShortVideoPagerActivity.newInstance(this, args)
)

Place.FRIENDS_AND_FOLLOWERS -> attachToFront(FriendsTabsFragment.newInstance(args))
Place.EXTERNAL_LINK -> attachToFront(BrowserFragment.newInstance(args))
Place.DOC_PREVIEW -> {
Expand Down Expand Up @@ -1480,6 +1535,7 @@ open class MainActivity : AppCompatActivity(), NavigationDrawerCallbacks, OnSect

Place.NOTIFICATION_SETTINGS -> attachToFront(NotificationPreferencesFragment())
Place.LIKES_AND_COPIES -> attachToFront(LikesFragment.newInstance(args))
Place.STORIES_VIEWS -> attachToFront(StoriesViewFragment.newInstance(args))
Place.CREATE_PHOTO_ALBUM, Place.EDIT_PHOTO_ALBUM -> {
val createPhotoAlbumFragment = CreatePhotoAlbumFragment.newInstance(args)
attachToFront(createPhotoAlbumFragment)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import dev.ragnarok.fenrir.Extra
import dev.ragnarok.fenrir.R
import dev.ragnarok.fenrir.activity.gifpager.GifPagerActivity
import dev.ragnarok.fenrir.activity.photopager.PhotoPagerActivity.Companion.newInstance
import dev.ragnarok.fenrir.activity.shortvideopager.ShortVideoPagerActivity
import dev.ragnarok.fenrir.activity.slidr.Slidr.attach
import dev.ragnarok.fenrir.activity.slidr.model.SlidrConfig
import dev.ragnarok.fenrir.activity.slidr.model.SlidrListener
Expand Down Expand Up @@ -115,6 +116,11 @@ class NotReadMessagesActivity : NoMainActivity(), PlaceProvider, AppStyleable {
StoryPagerActivity.newInstance(this, args)
)

Place.SHORT_VIDEOS -> place.launchActivityForResult(
this,
ShortVideoPagerActivity.newInstance(this, args)
)

Place.SINGLE_PHOTO -> place.launchActivityForResult(
this,
SinglePhotoActivity.newInstance(this, args)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ import java.io.File
import java.lang.ref.WeakReference
import java.text.DateFormat
import java.text.SimpleDateFormat
import java.util.*
import java.util.Calendar
import java.util.Date
import java.util.concurrent.TimeUnit

class SinglePhotoActivity : NoMainActivity(), PlaceProvider, AppStyleable {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,10 @@ class ValidateActivity : AppCompatActivity() {
)
val webview = findViewById<WebView>(R.id.vkontakteview)
webview.settings.javaScriptEnabled = true
webview.settings.domStorageEnabled = true
webview.settings.blockNetworkLoads = false
webview.settings.blockNetworkImage = false
webview.settings.databaseEnabled = true
webview.clearCache(true)
webview.settings.userAgentString = UserAgentTool.getAccountUserAgent(accountId)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ import java.io.PrintWriter
import java.io.StringWriter
import java.text.DateFormat
import java.text.SimpleDateFormat
import java.util.*
import java.util.Date
import java.util.Locale

object CrashUtils {
private const val TAG = "CrashUtils"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ import dev.ragnarok.fenrir.view.natives.rlottie.RLottieImageView
import dev.ragnarok.fenrir.view.pager.WeakPicassoLoadCallback
import io.reactivex.rxjava3.core.Completable
import io.reactivex.rxjava3.disposables.Disposable
import java.util.*
import java.util.concurrent.TimeUnit

class PhotoPagerActivity : BaseMvpActivity<PhotoPagerPresenter, IPhotoPagerView>(), IPhotoPagerView,
Expand Down Expand Up @@ -569,7 +568,7 @@ class PhotoPagerActivity : BaseMvpActivity<PhotoPagerPresenter, IPhotoPagerView>
override fun displayPhotos(photos: List<Photo>, initialIndex: Int) {
if (bShowPhotosLine) {
if (photos.size <= 1) {
mAdapterRecycler.setData(Collections.emptyList())
mAdapterRecycler.setData(emptyList())
mAdapterRecycler.notifyDataSetChanged()
} else {
mAdapterRecycler.setData(photos)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ import dev.ragnarok.fenrir.util.AppPerms
import dev.ragnarok.fenrir.util.AppPerms.requestPermissionsResultAbs
import dev.ragnarok.fenrir.util.Utils
import java.nio.ByteBuffer
import java.util.*
import java.util.EnumMap
import java.util.EnumSet

class CameraScanActivity : NoMainActivity() {
private lateinit var textureView: PreviewView
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import com.google.zxing.WriterException
import com.google.zxing.qrcode.decoder.ErrorCorrectionLevel
import com.google.zxing.qrcode.encoder.ByteMatrix
import com.google.zxing.qrcode.encoder.Encoder
import java.util.*
import java.util.Arrays
import kotlin.math.roundToInt

class CustomQRCodeWriter {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import dev.ragnarok.fenrir.model.Owner
import dev.ragnarok.fenrir.model.User
import dev.ragnarok.fenrir.picasso.PicassoInstance.Companion.with
import dev.ragnarok.fenrir.settings.CurrentTheme
import java.util.EventListener

class SelectedProfilesAdapter(private val mContext: Context, private val mData: List<Owner>) :
RecyclerView.Adapter<RecyclerView.ViewHolder>() {
Expand Down Expand Up @@ -99,7 +98,7 @@ class SelectedProfilesAdapter(private val mContext: Context, private val mData:
notifyItemChanged(0)
}

interface ActionListener : EventListener {
interface ActionListener {
fun onClick(adapterPosition: Int, owner: Owner)
fun onCheckClick()
}
Expand Down
Loading

0 comments on commit 9a9cb3d

Please sign in to comment.