Skip to content

Commit

Permalink
72
Browse files Browse the repository at this point in the history
72
  • Loading branch information
umerov1999 committed Oct 20, 2024
1 parent 7d41e97 commit 2f5c432
Show file tree
Hide file tree
Showing 908 changed files with 7,603 additions and 7,628 deletions.
32 changes: 14 additions & 18 deletions app_fenrir/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ android {
buildConfigField("String", "SERVICE_TOKEN", asStringVar(vk_service_token))
buildConfigField("String", "FAKE_ABI", asStringVar(fake_abi))
buildConfigField("String", "FAKE_DEVICE", asStringVar(fake_device))
buildConfigField("boolean", "MANAGE_SCOPED_STORAGE", "true")
buildConfigField("Integer", "TARGET_SDK", appTargetSDK.toString())
buildConfigField("boolean", "FORCE_DEVELOPER_MODE", is_developer_build ? "true" : "false")

ndk {
Expand All @@ -56,16 +56,13 @@ android {
}

compileOptions {
// Flag to enable support for the new language APIs
coreLibraryDesugaringEnabled = appMinSDK < 26

sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
sourceCompatibility = JavaVersion.VERSION_21
targetCompatibility = JavaVersion.VERSION_21
encoding = "utf-8"
}

kotlinOptions {
jvmTarget = "1.8"
jvmTarget = "21"
freeCompilerArgs = ["-opt-in=kotlin.contracts.ExperimentalContracts",
"-opt-in=kotlinx.serialization.ExperimentalSerializationApi",
"-opt-in=kotlinx.coroutines.ExperimentalCoroutinesApi",
Expand Down Expand Up @@ -110,15 +107,14 @@ static def asStringVar(String str) {
}

dependencies {
implementation fileTree(include: "*.aar", dir: "../compiled_native")
implementation fileTree('../compiled_native') { include '*.aar' }
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version")
implementation("org.jetbrains.kotlin:kotlin-parcelize-runtime:$kotlin_version")
implementation("org.jetbrains.kotlin:kotlin-android-extensions-runtime:$kotlin_version")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:$kotlin_coroutines")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:$kotlin_coroutines")
compileOnly("org.jetbrains.kotlin:kotlin-annotations-jvm:$kotlin_version")
implementation("com.google.guava:guava:$guavaVersion")
coreLibraryDesugaring("com.android.tools:desugar_jdk_libs:$desugarLibraryVersion")
implementation("androidx.core:core-ktx:$coreVersion")
implementation("androidx.lifecycle:lifecycle-runtime-ktx:$lifecycleVersion")
implementation("androidx.lifecycle:lifecycle-viewmodel-ktx:$lifecycleVersion")
Expand All @@ -136,15 +132,15 @@ dependencies {
implementation("com.google.firebase:firebase-messaging:$firebaseMessagingVersion") {
exclude group: "com.google.firebase", module: "firebase-installations"
}
//implementation project(path: ":libfenrir")
implementation project(path: ":fenrir_common")
implementation project(path: ":firebase-installations")
implementation project(path: ":picasso3")
implementation project(path: ":image")
implementation project(path: ":recyclerview")
implementation project(path: ":material")
implementation project(path: ":preference")
implementation project(path: ":camera2")
//implementation project(":libfenrir")
implementation project(":fenrir_common")
implementation project(":firebase-installations")
implementation project(":picasso3")
implementation project(":image")
implementation project(":recyclerview")
implementation project(":material")
implementation project(":preference")
implementation project(":camera2")
implementation("com.squareup.okhttp3:okhttp-android:$okhttpLibraryVersion")
//implementation("com.squareup.okhttp3:logging-interceptor:$okhttpLibraryVersion")
implementation("com.squareup.okio:okio:$okioVersion")
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
File renamed without changes.
Binary file removed app_fenrir/src/kate/res/mipmap-hdpi/ic_launcher.png
Binary file not shown.
Binary file not shown.
Binary file removed app_fenrir/src/kate/res/mipmap-mdpi/ic_launcher.png
Binary file not shown.
Binary file not shown.
Binary file removed app_fenrir/src/kate/res/mipmap-xhdpi/ic_launcher.png
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
7 changes: 0 additions & 7 deletions app_fenrir/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -104,13 +104,6 @@
android:theme="@style/App.DayNight"
tools:ignore="DiscouragedApi,LockedOrientationActivity" />

<activity
android:name="dev.ragnarok.fenrir.activity.QuickAnswerActivity"
android:excludeFromRecents="true"
android:taskAffinity=""
android:theme="@style/QuickReply"
android:windowSoftInputMode="adjustResize" />

<activity
android:name="dev.ragnarok.fenrir.activity.ChatActivityBubbles"
android:allowEmbedded="true"
Expand Down
6 changes: 3 additions & 3 deletions app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/Extensions.kt
Original file line number Diff line number Diff line change
Expand Up @@ -217,14 +217,14 @@ inline fun <reified T : CharSequence> T?.trimmedIsNullOrEmpty(): Boolean {
contract {
returns(false) implies (this@trimmedIsNullOrEmpty != null)
}
return this == null || this.trim { it <= ' ' }.isEmpty()
return this == null || this.trim().isEmpty()
}

inline fun <reified T : CharSequence> T?.trimmedNonNullNoEmpty(): Boolean {
contract {
returns(true) implies (this@trimmedNonNullNoEmpty != null)
}
return this != null && this.trim { it <= ' ' }.isNotEmpty()
return this != null && this.trim().isNotEmpty()
}

inline fun <reified T : CharSequence> T?.nonNullNoEmpty(block: (T) -> Unit) {
Expand Down Expand Up @@ -272,7 +272,7 @@ inline fun <reified T, reified E : Collection<*>> E?.nonNullNoEmptyOr(

inline fun <reified T : CharSequence> T?.trimmedNonNullNoEmpty(block: (T) -> Unit) {
this?.let {
if (trim { it <= ' ' }.isNotEmpty()) {
if (trim().isNotEmpty()) {
apply(block)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,10 @@ class FcmListenerService : FirebaseMessagingService() {
?.notify(context, accountId)

PushType.NEW_POST -> NewPostPushMessage.fromRemoteMessage(accountId, message)
.notifyIfNeed(context)
.notify(context)

PushType.LIKE -> LikeFCMMessage.fromRemoteMessage(accountId, message)
?.notifyIfNeed(context)
?.notify(context)

PushType.REPLY -> ReplyFCMMessage.fromRemoteMessage(message)
?.notify(context, accountId)
Expand Down
4 changes: 0 additions & 4 deletions app_fenrir/src/main/kotlin/dev/ragnarok/fenrir/Includes.kt
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,6 @@ object Includes {
networkInterfaces
)
}


val uploadManager: IUploadManager by lazy {
UploadManagerImpl(
instance, networkInterfaces,
Expand All @@ -68,8 +66,6 @@ object Includes {
val validationProvider: IValidateProvider by lazy {
ValidateProvider(provideApplicationContext())
}


val attachmentsRepository: IAttachmentsRepository by lazy {
AttachmentsRepository(stores.attachments(), owners)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,6 @@ object ActivityUtils {
) == true
}


fun supportToolbarFor(fragment: Fragment): ActionBar? {
return if (fragment.activity == null) {
null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import android.content.ServiceConnection
import android.graphics.Color
import android.os.Bundle
import android.os.IBinder
import android.view.WindowManager
import android.view.inputmethod.InputMethodManager
import androidx.core.view.WindowInsetsControllerCompat
import androidx.fragment.app.Fragment
Expand Down Expand Up @@ -34,7 +33,7 @@ import dev.ragnarok.fenrir.place.PlaceProvider
import dev.ragnarok.fenrir.settings.CurrentTheme
import dev.ragnarok.fenrir.util.Logger
import dev.ragnarok.fenrir.util.Utils
import dev.ragnarok.fenrir.util.Utils.hasVanillaIceCream
import dev.ragnarok.fenrir.util.Utils.hasVanillaIceCreamTarget
import dev.ragnarok.fenrir.util.ViewUtils

class ChatActivity : NoMainActivity(), PlaceProvider, AppStyleable, ServiceConnection {
Expand Down Expand Up @@ -114,7 +113,7 @@ class ChatActivity : NoMainActivity(), PlaceProvider, AppStyleable, ServiceConne
window.decorView.rootView.windowToken,
InputMethodManager.HIDE_NOT_ALWAYS
)
} catch (ignored: Exception) {
} catch (_: Exception) {
}
}

Expand Down Expand Up @@ -212,7 +211,7 @@ class ChatActivity : NoMainActivity(), PlaceProvider, AppStyleable, ServiceConne
@Suppress("DEPRECATION")
override fun setStatusbarColored(colored: Boolean, invertIcons: Boolean) {
val w = window
if (!hasVanillaIceCream()) {
if (!hasVanillaIceCreamTarget()) {
w.statusBarColor =
if (colored) CurrentTheme.getStatusBarColor(this) else CurrentTheme.getStatusBarNonColored(
this
Expand All @@ -223,11 +222,6 @@ class ChatActivity : NoMainActivity(), PlaceProvider, AppStyleable, ServiceConne
val ins = WindowInsetsControllerCompat(w, w.decorView)
ins.isAppearanceLightStatusBars = invertIcons
ins.isAppearanceLightNavigationBars = invertIcons

if (!Utils.hasMarshmallow()) {
w.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS)
w.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS)
}
}

companion object {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import android.content.ServiceConnection
import android.graphics.Color
import android.os.Bundle
import android.os.IBinder
import android.view.WindowManager
import android.view.inputmethod.InputMethodManager
import androidx.core.view.WindowInsetsControllerCompat
import androidx.fragment.app.Fragment
Expand Down Expand Up @@ -38,7 +37,7 @@ import dev.ragnarok.fenrir.place.PlaceProvider
import dev.ragnarok.fenrir.settings.CurrentTheme
import dev.ragnarok.fenrir.util.Logger
import dev.ragnarok.fenrir.util.Utils
import dev.ragnarok.fenrir.util.Utils.hasVanillaIceCream
import dev.ragnarok.fenrir.util.Utils.hasVanillaIceCreamTarget
import dev.ragnarok.fenrir.util.ViewUtils

class ChatActivityBubbles : NoMainActivity(), PlaceProvider, AppStyleable, ServiceConnection {
Expand Down Expand Up @@ -124,7 +123,7 @@ class ChatActivityBubbles : NoMainActivity(), PlaceProvider, AppStyleable, Servi
window.decorView.rootView.windowToken,
InputMethodManager.HIDE_NOT_ALWAYS
)
} catch (ignored: Exception) {
} catch (_: Exception) {
}
}

Expand Down Expand Up @@ -233,7 +232,7 @@ class ChatActivityBubbles : NoMainActivity(), PlaceProvider, AppStyleable, Servi
@Suppress("DEPRECATION")
override fun setStatusbarColored(colored: Boolean, invertIcons: Boolean) {
val w = window
if (!hasVanillaIceCream()) {
if (!hasVanillaIceCreamTarget()) {
w.statusBarColor =
if (colored) CurrentTheme.getStatusBarColor(this) else CurrentTheme.getStatusBarNonColored(
this
Expand All @@ -244,11 +243,6 @@ class ChatActivityBubbles : NoMainActivity(), PlaceProvider, AppStyleable, Servi
val ins = WindowInsetsControllerCompat(w, w.decorView)
ins.isAppearanceLightStatusBars = invertIcons
ins.isAppearanceLightNavigationBars = invertIcons

if (!Utils.hasMarshmallow()) {
w.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS)
w.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS)
}
}

companion object {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.view.WindowManager
import android.widget.ImageView
import android.widget.TextView
import androidx.appcompat.app.AppCompatActivity
Expand Down Expand Up @@ -49,7 +48,7 @@ import dev.ragnarok.fenrir.settings.theme.ThemesController
import dev.ragnarok.fenrir.util.AppTextUtils.getDateFromUnixTime
import dev.ragnarok.fenrir.util.DownloadWorkUtils
import dev.ragnarok.fenrir.util.Utils
import dev.ragnarok.fenrir.util.Utils.hasVanillaIceCream
import dev.ragnarok.fenrir.util.Utils.hasVanillaIceCreamTarget
import dev.ragnarok.fenrir.util.coroutines.CancelableJob
import dev.ragnarok.fenrir.util.coroutines.CoroutinesUtils.fromIOToMain
import dev.ragnarok.fenrir.util.serializeble.json.Json
Expand Down Expand Up @@ -182,7 +181,7 @@ class DeltaOwnerActivity : AppCompatActivity(), PlaceProvider, AppStyleable {
EmptyAvatar.visibility = View.VISIBLE
var name: String = owner.owner.fullName.orEmpty()
if (name.length > 2) name = name.substring(0, 2)
name = name.trim { it <= ' ' }
name = name.trim()
EmptyAvatar.text = name
} else {
EmptyAvatar.visibility = View.GONE
Expand Down Expand Up @@ -216,13 +215,8 @@ class DeltaOwnerActivity : AppCompatActivity(), PlaceProvider, AppStyleable {
tab.text = adapter.DeltaOwner.content[position].name
}.attach()

if (!hasVanillaIceCream()) {
if (!hasVanillaIceCreamTarget()) {
val w = window
if (!Utils.hasMarshmallow()) {
w.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS)
w.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS)
}

w.statusBarColor = getStatusBarColor(this)
w.navigationBarColor = getNavigationBarColor(this)
}
Expand Down Expand Up @@ -291,7 +285,7 @@ class DeltaOwnerActivity : AppCompatActivity(), PlaceProvider, AppStyleable {
@Suppress("DEPRECATION")
override fun setStatusbarColored(colored: Boolean, invertIcons: Boolean) {
val w = window
if (!hasVanillaIceCream()) {
if (!hasVanillaIceCreamTarget()) {
w.statusBarColor =
if (colored) getStatusBarColor(this) else getStatusBarNonColored(
this
Expand All @@ -302,11 +296,6 @@ class DeltaOwnerActivity : AppCompatActivity(), PlaceProvider, AppStyleable {
val ins = WindowInsetsControllerCompat(w, w.decorView)
ins.isAppearanceLightStatusBars = invertIcons
ins.isAppearanceLightNavigationBars = invertIcons

if (!Utils.hasMarshmallow()) {
w.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS)
w.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS)
}
}

companion object {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import android.content.ServiceConnection
import android.graphics.Color
import android.os.Bundle
import android.os.IBinder
import android.view.WindowManager
import android.view.inputmethod.InputMethodManager
import androidx.core.view.WindowInsetsControllerCompat
import androidx.fragment.app.Fragment
Expand All @@ -32,7 +31,7 @@ import dev.ragnarok.fenrir.settings.ISettings
import dev.ragnarok.fenrir.settings.Settings
import dev.ragnarok.fenrir.util.Logger
import dev.ragnarok.fenrir.util.Utils
import dev.ragnarok.fenrir.util.Utils.hasVanillaIceCream
import dev.ragnarok.fenrir.util.Utils.hasVanillaIceCreamTarget
import dev.ragnarok.fenrir.util.ViewUtils

class LocalJsonToChatActivity : NoMainActivity(), PlaceProvider, AppStyleable, ServiceConnection {
Expand Down Expand Up @@ -112,7 +111,7 @@ class LocalJsonToChatActivity : NoMainActivity(), PlaceProvider, AppStyleable, S
window.decorView.rootView.windowToken,
InputMethodManager.HIDE_NOT_ALWAYS
)
} catch (ignored: Exception) {
} catch (_: Exception) {
}
}

Expand Down Expand Up @@ -200,7 +199,7 @@ class LocalJsonToChatActivity : NoMainActivity(), PlaceProvider, AppStyleable, S
@Suppress("DEPRECATION")
override fun setStatusbarColored(colored: Boolean, invertIcons: Boolean) {
val w = window
if (!hasVanillaIceCream()) {
if (!hasVanillaIceCreamTarget()) {
w.statusBarColor =
if (colored) CurrentTheme.getStatusBarColor(this) else CurrentTheme.getStatusBarNonColored(
this
Expand All @@ -211,10 +210,5 @@ class LocalJsonToChatActivity : NoMainActivity(), PlaceProvider, AppStyleable, S
val ins = WindowInsetsControllerCompat(w, w.decorView)
ins.isAppearanceLightStatusBars = invertIcons
ins.isAppearanceLightNavigationBars = invertIcons

if (!Utils.hasMarshmallow()) {
w.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS)
w.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ class LoginActivity : AppCompatActivity() {
try {
val tokens = tryExtractAccessTokens(url)
intent.putParcelableArrayListExtra("group_tokens", tokens)
} catch (e: Exception) {
} catch (_: Exception) {
val accessToken = tryExtractAccessToken(url)
val userId = tryExtractUserId(url)
intent.putExtra(Extra.TOKEN, accessToken)
Expand Down Expand Up @@ -137,7 +137,6 @@ class LoginActivity : AppCompatActivity() {
.putExtra(EXTRA_SAVE, isSave)
}


fun createIntent(
context: Context?,
clientId: String?,
Expand Down
Loading

0 comments on commit 2f5c432

Please sign in to comment.