[go: nahoru, domu]

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not merge - Only here to trigger CI on PR - https://github.com/wordpress-mobile/WordPress-Android/pull/20980 #20994

Merged
merged 6 commits into from
Jun 20, 2024
Prev Previous commit
Next Next commit
Replaced !! to ? and Refactored : naming convention
  • Loading branch information
neeldoshii committed Jun 13, 2024
commit 0ebd5d5d07932c7bd1e5db01bf6f9bea11198754
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import org.wordpress.android.util.ToastUtils
import javax.inject.Inject

class AddCategoryFragment : AppCompatDialogFragment() {
private var mSite: SiteModel? = null
private var site: SiteModel? = null
private var binding: AddCategoryBinding? = null

@set:Inject
Expand Down Expand Up @@ -50,7 +50,7 @@ class AddCategoryFragment : AppCompatDialogFragment() {

@Suppress("Deprecation")
private fun initSite(savedInstanceState: Bundle?) {
mSite = if (savedInstanceState == null) {
site = if (savedInstanceState == null) {
if (arguments != null) {
requireArguments().getSerializable(WordPress.SITE) as SiteModel?
} else {
Expand All @@ -60,7 +60,7 @@ class AddCategoryFragment : AppCompatDialogFragment() {
savedInstanceState.getSerializable(WordPress.SITE) as SiteModel?
}

if (mSite == null) {
if (site == null) {
ToastUtils.showToast(
requireActivity(),
R.string.blog_not_found,
Expand All @@ -71,8 +71,8 @@ class AddCategoryFragment : AppCompatDialogFragment() {
}

private fun addCategory(): Boolean {
val categoryName = binding!!.categoryName.text.toString()
val selectedCategory = binding!!.parentCategory.selectedItem as CategoryNode
val categoryName = binding?.categoryName?.text.toString()
val selectedCategory = binding?.parentCategory?.selectedItem as CategoryNode
val parentId = selectedCategory.categoryId

if (categoryName.replace(" ".toRegex(), "") == "") {
Expand All @@ -92,7 +92,7 @@ class AddCategoryFragment : AppCompatDialogFragment() {
private fun loadCategories() {
val rootCategory = CategoryNode.createCategoryTreeFromList(
mTaxonomyStore!!.getCategoriesForSite(
mSite!!
site!!
)
)
val categoryLevels = CategoryNode.getSortedListOfCategoriesFromRoot(rootCategory)
Expand All @@ -110,7 +110,7 @@ class AddCategoryFragment : AppCompatDialogFragment() {

override fun onSaveInstanceState(outState: Bundle) {
super.onSaveInstanceState(outState)
outState.putSerializable(WordPress.SITE, mSite)
outState.putSerializable(WordPress.SITE, site)
}

override fun onDestroy() {
Expand Down
Loading