Skip to content

Commit

Permalink
[no-jira] hotfix for 3.26.0 release - crashes in discovery fragment w…
Browse files Browse the repository at this point in the history
…hen context is null (#2154)
  • Loading branch information
leighdouglas authored and Leigh Douglas committed Oct 21, 2024
1 parent 8dec85c commit b7ac3cc
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 19 deletions.
2 changes: 1 addition & 1 deletion app/external_version_code.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2014150918
2014150919
2 changes: 1 addition & 1 deletion app/internal_version_code.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2014150918
2014150919
51 changes: 34 additions & 17 deletions app/src/main/java/com/kickstarter/ui/fragments/DiscoveryFragment.kt
Original file line number Diff line number Diff line change
Expand Up @@ -262,17 +262,28 @@ class DiscoveryFragment : Fragment() {
}

private fun startActivityFeedActivity() {
startActivity(Intent(activity, ActivityFeedActivity::class.java))
context?.let {
startActivity(Intent(context, ActivityFeedActivity::class.java))
}
}

private fun startSetPasswordActivity(email: String) {
val intent = Intent().getSetPasswordActivity(requireContext(), email)
startActivityForResult(intent, ActivityRequestCodes.LOGIN_FLOW)
TransitionUtils.transition(requireContext(), TransitionUtils.fadeIn())
context?.let {
val intent = Intent().getSetPasswordActivity(requireContext(), email)
startActivityForResult(intent, ActivityRequestCodes.LOGIN_FLOW)
TransitionUtils.transition(requireContext(), TransitionUtils.fadeIn())
}
}

private fun showStarToast() {
ViewUtils.showToastFromTop(requireContext(), getString(this.projectStarConfirmationString), 0, resources.getDimensionPixelSize(R.dimen.grid_8))
context?.let {
ViewUtils.showToastFromTop(
requireContext(),
getString(this.projectStarConfirmationString),
0,
resources.getDimensionPixelSize(R.dimen.grid_8)
)
}
}

private fun startEditorialActivity(editorial: Editorial) {
Expand All @@ -288,21 +299,27 @@ class DiscoveryFragment : Fragment() {
}

private fun startLoginToutActivity() {
val intent = Intent(activity, LoginToutActivity::class.java)
.putExtra(IntentKey.LOGIN_REASON, LoginReason.DEFAULT)
startActivityForResult(intent, ActivityRequestCodes.LOGIN_FLOW)
context?.let {
val intent = Intent(context, LoginToutActivity::class.java)
.putExtra(IntentKey.LOGIN_REASON, LoginReason.DEFAULT)
startActivityForResult(intent, ActivityRequestCodes.LOGIN_FLOW)
TransitionUtils.transition(it, TransitionUtils.fadeIn())
}
}

private fun startPreLaunchProjectActivity(project: Project, refTag: RefTag) {
val intent = Intent().getPreLaunchProjectActivity(requireContext(), project.slug())
.putExtra(IntentKey.REF_TAG, refTag)
.putExtra(IntentKey.PREVIOUS_SCREEN, ThirdPartyEventValues.ScreenName.DISCOVERY.value)
startActivity(intent)
TransitionUtils.transition(requireContext(), TransitionUtils.slideInFromRight())
context?.let {
val intent = Intent().getPreLaunchProjectActivity(requireContext(), project.slug())
.putExtra(IntentKey.REF_TAG, refTag)
.putExtra(
IntentKey.PREVIOUS_SCREEN,
ThirdPartyEventValues.ScreenName.DISCOVERY.value
)
startActivity(intent)
TransitionUtils.transition(requireContext(), TransitionUtils.slideInFromRight())
}
}

private fun startProjectActivity(project: Project, refTag: RefTag) {
context?.let {
val intent = Intent().getProjectIntent(it)
Expand All @@ -315,11 +332,11 @@ class DiscoveryFragment : Fragment() {
}

private fun startUpdateActivity(activity: Activity) {
val intent = Intent(getActivity(), UpdateActivity::class.java)
.putExtra(IntentKey.PROJECT, activity.project())
.putExtra(IntentKey.UPDATE, activity.update())
startActivity(intent)
context?.let {
val intent = Intent(context, UpdateActivity::class.java)
.putExtra(IntentKey.PROJECT, activity.project())
.putExtra(IntentKey.UPDATE, activity.update())
startActivity(intent)
TransitionUtils.transition(it, TransitionUtils.slideInFromRight())
}
}
Expand Down

0 comments on commit b7ac3cc

Please sign in to comment.