Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/UnblockComunnity' into UnblockCo…
Browse files Browse the repository at this point in the history
…munnity
  • Loading branch information
Schoolkid1 committed Aug 13, 2023
2 parents 7233236 + b8f2332 commit dd3b031
Show file tree
Hide file tree
Showing 24 changed files with 418 additions and 77 deletions.
16 changes: 8 additions & 8 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ android {
compose = true
}
composeOptions {
kotlinCompilerExtensionVersion = "1.4.7"
kotlinCompilerExtensionVersion = "1.5.1"
}
}

Expand All @@ -121,7 +121,7 @@ dependencies {
implementation("com.google.accompanist:accompanist-systemuicontroller:$accompanistVersion")

// LiveData
implementation("androidx.compose.runtime:runtime-livedata:1.4.3")
implementation("androidx.compose.runtime:runtime-livedata:1.5.0")
implementation("androidx.lifecycle:lifecycle-runtime-compose:2.6.1")

// Images
Expand Down Expand Up @@ -151,19 +151,19 @@ dependencies {
// optional - Paging 3 Integration
implementation("androidx.room:room-paging:2.5.2")

implementation("io.arrow-kt:arrow-core:1.1.5")
implementation("io.arrow-kt:arrow-core:1.2.0")
// Unfortunately, ui tooling, and the markdown thing, still brings in the other material2 dependencies
implementation("androidx.compose.material3:material3:1.1.1")
implementation("androidx.compose.material3:material3-window-size-class:1.1.1")

implementation("org.ocpsoft.prettytime:prettytime:5.0.6.Final")
implementation("androidx.navigation:navigation-compose:2.7.0-rc01")
testImplementation("org.jetbrains.kotlinx:kotlinx-coroutines-test:1.7.1")
implementation("androidx.navigation:navigation-compose:2.7.0")
testImplementation("org.jetbrains.kotlinx:kotlinx-coroutines-test:1.7.3")
testImplementation("androidx.arch.core:core-testing:2.2.0")
implementation("com.squareup.retrofit2:retrofit:2.9.0")
implementation("com.squareup.retrofit2:converter-gson:2.9.0")

val composeVersion = "1.5.0-rc01"
val composeVersion = "1.5.0"
implementation("androidx.compose.ui:ui:$composeVersion")
implementation("androidx.compose.ui:ui-tooling-preview:$composeVersion")
androidTestImplementation("androidx.compose.ui:ui-test-junit4:$composeVersion")
Expand All @@ -177,9 +177,9 @@ dependencies {
androidTestImplementation("androidx.test.espresso:espresso-core:3.5.1")

testImplementation("org.mockito:mockito-core:5.4.0")
testImplementation("org.mockito.kotlin:mockito-kotlin:5.0.0")
testImplementation("org.mockito.kotlin:mockito-kotlin:5.1.0")

implementation("androidx.browser:browser:1.5.0")
implementation("androidx.browser:browser:1.6.0")

implementation("androidx.profileinstaller:profileinstaller:1.3.1")
baselineProfile(project(":benchmarks"))
Expand Down
246 changes: 246 additions & 0 deletions app/schemas/com.jerboa.db.AppDB/25.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,246 @@
{
"formatVersion": 1,
"database": {
"version": 25,
"identityHash": "e7e957b63c2297483c5e9aeb1e263a1f",
"entities": [
{
"tableName": "Account",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `current` INTEGER NOT NULL, `instance` TEXT NOT NULL, `name` TEXT NOT NULL, `jwt` TEXT NOT NULL, `default_listing_type` INTEGER NOT NULL DEFAULT 0, `default_sort_type` INTEGER NOT NULL DEFAULT 0, `verification_state` INTEGER NOT NULL DEFAULT 0, PRIMARY KEY(`id`))",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "current",
"columnName": "current",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "instance",
"columnName": "instance",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "name",
"columnName": "name",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "jwt",
"columnName": "jwt",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "defaultListingType",
"columnName": "default_listing_type",
"affinity": "INTEGER",
"notNull": true,
"defaultValue": "0"
},
{
"fieldPath": "defaultSortType",
"columnName": "default_sort_type",
"affinity": "INTEGER",
"notNull": true,
"defaultValue": "0"
},
{
"fieldPath": "verificationState",
"columnName": "verification_state",
"affinity": "INTEGER",
"notNull": true,
"defaultValue": "0"
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"id"
]
},
"indices": [],
"foreignKeys": []
},
{
"tableName": "AppSettings",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `font_size` INTEGER NOT NULL DEFAULT 16, `theme` INTEGER NOT NULL DEFAULT 0, `theme_color` INTEGER NOT NULL DEFAULT 0, `viewed_changelog` INTEGER NOT NULL DEFAULT 0, `post_view_mode` INTEGER NOT NULL DEFAULT 0, `show_bottom_nav` INTEGER NOT NULL DEFAULT 1, `show_collapsed_comment_content` INTEGER NOT NULL DEFAULT 0, `show_comment_action_bar_by_default` INTEGER NOT NULL DEFAULT 1, `show_voting_arrows_in_list_view` INTEGER NOT NULL DEFAULT 1, `show_parent_comment_navigation_buttons` INTEGER NOT NULL DEFAULT 0, `navigate_parent_comments_with_volume_buttons` INTEGER NOT NULL DEFAULT 0, `use_custom_tabs` INTEGER NOT NULL DEFAULT 1, `use_private_tabs` INTEGER NOT NULL DEFAULT 0, `secure_window` INTEGER NOT NULL DEFAULT 0, `blur_nsfw` INTEGER NOT NULL DEFAULT 1, `show_text_descriptions_in_navbar` INTEGER NOT NULL DEFAULT 1, `markAsReadOnScroll` INTEGER NOT NULL DEFAULT 0, `backConfirmationMode` INTEGER NOT NULL DEFAULT 1, `show_post_link_previews` INTEGER NOT NULL DEFAULT 1, `post_actionbar_mode` INTEGER NOT NULL DEFAULT 0, `auto_play_gifs` INTEGER NOT NULL DEFAULT 0)",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "fontSize",
"columnName": "font_size",
"affinity": "INTEGER",
"notNull": true,
"defaultValue": "16"
},
{
"fieldPath": "theme",
"columnName": "theme",
"affinity": "INTEGER",
"notNull": true,
"defaultValue": "0"
},
{
"fieldPath": "themeColor",
"columnName": "theme_color",
"affinity": "INTEGER",
"notNull": true,
"defaultValue": "0"
},
{
"fieldPath": "viewedChangelog",
"columnName": "viewed_changelog",
"affinity": "INTEGER",
"notNull": true,
"defaultValue": "0"
},
{
"fieldPath": "postViewMode",
"columnName": "post_view_mode",
"affinity": "INTEGER",
"notNull": true,
"defaultValue": "0"
},
{
"fieldPath": "showBottomNav",
"columnName": "show_bottom_nav",
"affinity": "INTEGER",
"notNull": true,
"defaultValue": "1"
},
{
"fieldPath": "showCollapsedCommentContent",
"columnName": "show_collapsed_comment_content",
"affinity": "INTEGER",
"notNull": true,
"defaultValue": "0"
},
{
"fieldPath": "showCommentActionBarByDefault",
"columnName": "show_comment_action_bar_by_default",
"affinity": "INTEGER",
"notNull": true,
"defaultValue": "1"
},
{
"fieldPath": "showVotingArrowsInListView",
"columnName": "show_voting_arrows_in_list_view",
"affinity": "INTEGER",
"notNull": true,
"defaultValue": "1"
},
{
"fieldPath": "showParentCommentNavigationButtons",
"columnName": "show_parent_comment_navigation_buttons",
"affinity": "INTEGER",
"notNull": true,
"defaultValue": "0"
},
{
"fieldPath": "navigateParentCommentsWithVolumeButtons",
"columnName": "navigate_parent_comments_with_volume_buttons",
"affinity": "INTEGER",
"notNull": true,
"defaultValue": "0"
},
{
"fieldPath": "useCustomTabs",
"columnName": "use_custom_tabs",
"affinity": "INTEGER",
"notNull": true,
"defaultValue": "1"
},
{
"fieldPath": "usePrivateTabs",
"columnName": "use_private_tabs",
"affinity": "INTEGER",
"notNull": true,
"defaultValue": "0"
},
{
"fieldPath": "secureWindow",
"columnName": "secure_window",
"affinity": "INTEGER",
"notNull": true,
"defaultValue": "0"
},
{
"fieldPath": "blurNSFW",
"columnName": "blur_nsfw",
"affinity": "INTEGER",
"notNull": true,
"defaultValue": "1"
},
{
"fieldPath": "showTextDescriptionsInNavbar",
"columnName": "show_text_descriptions_in_navbar",
"affinity": "INTEGER",
"notNull": true,
"defaultValue": "1"
},
{
"fieldPath": "markAsReadOnScroll",
"columnName": "markAsReadOnScroll",
"affinity": "INTEGER",
"notNull": true,
"defaultValue": "0"
},
{
"fieldPath": "backConfirmationMode",
"columnName": "backConfirmationMode",
"affinity": "INTEGER",
"notNull": true,
"defaultValue": "1"
},
{
"fieldPath": "showPostLinkPreviews",
"columnName": "show_post_link_previews",
"affinity": "INTEGER",
"notNull": true,
"defaultValue": "1"
},
{
"fieldPath": "postActionbarMode",
"columnName": "post_actionbar_mode",
"affinity": "INTEGER",
"notNull": true,
"defaultValue": "0"
},
{
"fieldPath": "autoPlayGifs",
"columnName": "auto_play_gifs",
"affinity": "INTEGER",
"notNull": true,
"defaultValue": "0"
}
],
"primaryKey": {
"autoGenerate": true,
"columnNames": [
"id"
]
},
"indices": [],
"foreignKeys": []
}
],
"views": [],
"setupQueries": [
"CREATE TABLE IF NOT EXISTS room_master_table (id INTEGER PRIMARY KEY,identity_hash TEXT)",
"INSERT OR REPLACE INTO room_master_table (id,identity_hash) VALUES(42, 'e7e957b63c2297483c5e9aeb1e263a1f')"
]
}
}
10 changes: 7 additions & 3 deletions app/src/main/java/com/jerboa/JerboaApplication.kt
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@ import com.jerboa.util.downloadprogress.DownloadProgress

class JerboaApplication : Application(), ImageLoaderFactory {
lateinit var container: AppDBContainer
lateinit var imageViewLoader: ImageLoader
lateinit var imageViewerLoader: ImageLoader
lateinit var imageLoader: ImageLoader
lateinit var imageGifLoader: ImageLoader
override fun onCreate() {
super.onCreate()
container = AppDBContainer(this)
Expand All @@ -28,8 +29,7 @@ class JerboaApplication : Application(), ImageLoaderFactory {
}
.build()

imageViewLoader = imageLoader.newBuilder()
.okHttpClient(DownloadProgress.downloadProgressHttpClient)
imageGifLoader = imageLoader.newBuilder()
.components {
if (Build.VERSION.SDK_INT >= 28) {
add(ImageDecoderDecoder.Factory())
Expand All @@ -38,6 +38,10 @@ class JerboaApplication : Application(), ImageLoaderFactory {
}
}
.build()

imageViewerLoader = imageGifLoader.newBuilder()
.okHttpClient(DownloadProgress.downloadProgressHttpClient)
.build()
}

override fun newImageLoader(): ImageLoader = imageLoader
Expand Down
9 changes: 8 additions & 1 deletion app/src/main/java/com/jerboa/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import androidx.navigation.navArgument
import androidx.navigation.navDeepLink
import androidx.navigation.navigation
import arrow.core.Either
import coil.Coil
import com.jerboa.api.API
import com.jerboa.api.ApiState
import com.jerboa.api.MINIMUM_API_VERSION
Expand Down Expand Up @@ -120,6 +121,12 @@ class MainActivity : AppCompatActivity() {
triggerRebirth(ctx)
}

if (appSettings.autoPlayGifs) {
Coil.setImageLoader((ctx.applicationContext as JerboaApplication).imageGifLoader)
} else {
Coil.setImageLoader(ctx.applicationContext as JerboaApplication)
}

JerboaTheme(
appSettings = appSettings,
) {
Expand All @@ -132,7 +139,7 @@ class MainActivity : AppCompatActivity() {
}

DisposableEffect(appSettings.backConfirmationMode) {
when (BackConfirmationMode.values()[appSettings.backConfirmationMode]) {
when (BackConfirmationMode.entries[appSettings.backConfirmationMode]) {
BackConfirmationMode.Toast -> {
this@MainActivity.addConfirmationToast(appState.navController, ctx)
}
Expand Down
3 changes: 2 additions & 1 deletion app/src/main/java/com/jerboa/db/AppDB.kt
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,11 @@ val APP_SETTINGS_DEFAULT = AppSettings(
markAsReadOnScroll = false,
showPostLinkPreviews = true,
postActionbarMode = 0,
autoPlayGifs = false,
)

@Database(
version = 24,
version = 25,
entities = [Account::class, AppSettings::class],
exportSchema = true,
)
Expand Down
Loading

0 comments on commit dd3b031

Please sign in to comment.