Skip to content

Commit

Permalink
remove help viewmodel, does nothing (#1876)
Browse files Browse the repository at this point in the history
  • Loading branch information
mtgriego committed Oct 17, 2023
1 parent d5e16c5 commit 5fd3f36
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 22 deletions.
36 changes: 21 additions & 15 deletions app/src/main/java/com/kickstarter/ui/activities/HelpActivity.kt
Expand Up @@ -2,17 +2,16 @@ package com.kickstarter.ui.activities

import android.net.Uri
import android.os.Bundle
import androidx.activity.ComponentActivity
import androidx.annotation.IntDef
import com.kickstarter.databinding.HelpLayoutBinding
import com.kickstarter.libs.BaseActivity
import com.kickstarter.libs.qualifiers.RequiresActivityViewModel
import com.kickstarter.libs.Environment
import com.kickstarter.libs.qualifiers.WebEndpoint
import com.kickstarter.viewmodels.HelpViewModel
import com.kickstarter.libs.utils.extensions.getEnvironment
import java.lang.annotation.Retention
import java.lang.annotation.RetentionPolicy

@RequiresActivityViewModel(HelpViewModel::class)
open class HelpActivity : BaseActivity<HelpViewModel>() {
open class HelpActivity : ComponentActivity() {
@IntDef(HELP_TYPE_TERMS, HELP_TYPE_PRIVACY, HELP_TYPE_HOW_IT_WORKS, HELP_TYPE_COOKIE_POLICY, HELP_TYPE_ACCESSIBILITY)
@Retention(RetentionPolicy.SOURCE)
annotation class HelpType
Expand All @@ -21,7 +20,9 @@ open class HelpActivity : BaseActivity<HelpViewModel>() {
private var helpType = 0

@WebEndpoint
private lateinit var webEndpoint: String
private var webEndpoint: String? = null

private var environment: Environment? = null

protected fun helpType(@HelpType helpType: Int) {
this.helpType = helpType
Expand Down Expand Up @@ -54,7 +55,8 @@ open class HelpActivity : BaseActivity<HelpViewModel>() {
private lateinit var binding: HelpLayoutBinding
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
webEndpoint = environment().webEndpoint()
environment = this.getEnvironment()
webEndpoint = environment?.webEndpoint()
binding = HelpLayoutBinding.inflate(layoutInflater)

setContentView(binding.root)
Expand All @@ -65,15 +67,19 @@ open class HelpActivity : BaseActivity<HelpViewModel>() {
}

private fun getUrlForHelpType(@HelpType helpType: Int): String? {
val builder = Uri.parse(webEndpoint).buildUpon()
when (helpType) {
HELP_TYPE_TERMS -> builder.appendEncodedPath(TERMS_OF_USE)
HELP_TYPE_PRIVACY -> builder.appendEncodedPath(PRIVACY)
HELP_TYPE_HOW_IT_WORKS -> builder.appendEncodedPath(HELLO)
HELP_TYPE_COOKIE_POLICY -> builder.appendEncodedPath(COOKIES)
HELP_TYPE_ACCESSIBILITY -> builder.appendEncodedPath(ACCESSIBILITY)
webEndpoint?.let {
val builder = Uri.parse(it).buildUpon()
when (helpType) {
HELP_TYPE_TERMS -> builder.appendEncodedPath(TERMS_OF_USE)
HELP_TYPE_PRIVACY -> builder.appendEncodedPath(PRIVACY)
HELP_TYPE_HOW_IT_WORKS -> builder.appendEncodedPath(HELLO)
HELP_TYPE_COOKIE_POLICY -> builder.appendEncodedPath(COOKIES)
HELP_TYPE_ACCESSIBILITY -> builder.appendEncodedPath(ACCESSIBILITY)
}
return builder.toString()
} ?: run {
return null
}
return builder.toString()
}

companion object {
Expand Down
7 changes: 0 additions & 7 deletions app/src/main/java/com/kickstarter/viewmodels/HelpViewModel.kt

This file was deleted.

0 comments on commit 5fd3f36

Please sign in to comment.