Skip to content

Commit

Permalink
added premiumSubreddit
Browse files Browse the repository at this point in the history
  • Loading branch information
KirkBushman committed Feb 12, 2022
1 parent eb55851 commit d3a88d2
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 14 deletions.
14 changes: 7 additions & 7 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,24 @@
buildscript {

ext {
android_gradle_ver = '7.0.4'
android_gradle_ver = '7.1.1'

compile_sdk_ver = 31
build_tools_ver = '31.0.0'

min_sdk_ver = 21
compile_sdk_ver = 31

version_code = 6
version_name = "1.1.0-beta01"
version_code = 7
version_name = "1.1.0-beta02"

java_target = JavaVersion.VERSION_11
jvm_target = '11'

kotlin_ver = '1.6.0'
kotlin_ver = '1.6.10'
coroutines_ver = '1.6.0'

ksp_ver = '1.6.0-1.0.1'
ksp_ver = '1.6.10-1.0.2'

hilt_ver = "2.40.5"
ax_hilt_ver = "1.0.0"
Expand All @@ -30,7 +30,7 @@ buildscript {
ax_annot_ver = '1.3.0'
ax_browser_ver = '1.4.0'

constr_ver = '2.1.2'
constr_ver = '2.1.3'

retrofit_ver = '2.9.0'
moshi_ver = '1.13.0'
Expand All @@ -47,7 +47,7 @@ buildscript {
espresso_ver = '3.4.0'
junit_ver = '1.1.3'
leakcanary_ver = '2.8.1'
mockito_ver = '4.2.0'
mockito_ver = '4.3.1'
arch_core_ver = '2.1.0'
orchestrator_ver = '1.3.0'

Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.2-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-all.zip
49 changes: 49 additions & 0 deletions lib/src/main/java/com/kirkbushman/araw/models/PremiumSubreddit.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
package com.kirkbushman.araw.models

import android.os.Parcelable
import com.kirkbushman.araw.models.base.SubredditData
import com.squareup.moshi.Json
import com.squareup.moshi.JsonClass
import kotlinx.parcelize.Parcelize

@JsonClass(generateAdapter = true)
@Parcelize
data class PremiumSubreddit(

@Json(name = "id")
override val id: String,

@Json(name = "name")
override val fullname: String,

@Json(name = "community_icon")
val communityIcon: String,

@Json(name = "created")
override val created: Long,

@Json(name = "created_utc")
override val createdUtc: Long,

@Json(name = "display_name")
override val displayName: String,

@Json(name = "display_name_prefixed")
override val displayNamePrefixed: String,

@Json(name = "public_description")
val publicDescription: String,

@Json(name = "public_description_html")
val publicDescriptionHtml: String?,

@Json(name = "subreddit_type")
override val subredditType: String,

@Json(name = "title")
override val title: String,

@Json(name = "url")
override val url: String

) : SubredditData, Parcelable
9 changes: 3 additions & 6 deletions lib/src/main/java/com/kirkbushman/araw/utils/Utils.kt
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,7 @@ import com.kirkbushman.araw.http.EnvelopedRedditor
import com.kirkbushman.araw.http.EnvelopedSubmission
import com.kirkbushman.araw.http.EnvelopedSubreddit
import com.kirkbushman.araw.http.base.EnvelopeKind
import com.kirkbushman.araw.models.PrivateSubreddit
import com.kirkbushman.araw.models.Redditor
import com.kirkbushman.araw.models.Subreddit
import com.kirkbushman.araw.models.SuspendedRedditor
import com.kirkbushman.araw.models.*
import com.kirkbushman.araw.models.base.RedditorData
import com.kirkbushman.araw.models.base.SubredditData
import com.squareup.moshi.Moshi
Expand Down Expand Up @@ -58,8 +55,8 @@ object Utils {
)
.add(
PolymorphicJsonAdapterFactory.of(SubredditData::class.java, "subreddit_type")
.withSubtype(Subreddit::class.java, "gold_only")
.withSubtype(Subreddit::class.java, "gold_restricted")
.withSubtype(PremiumSubreddit::class.java, "gold_only")
.withSubtype(PremiumSubreddit::class.java, "gold_restricted")
.withSubtype(Subreddit::class.java, "archived")
.withSubtype(Subreddit::class.java, "public")
.withSubtype(Subreddit::class.java, "restricted")
Expand Down

0 comments on commit d3a88d2

Please sign in to comment.