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

feat: Resume from my tickets after LOGIN #563

Merged
merged 1 commit into from Sep 20, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -12,6 +12,7 @@ import org.fossasia.openevent.general.auth.LAUNCH_ATTENDEE
import org.fossasia.openevent.general.auth.ProfileFragment
import org.fossasia.openevent.general.event.EventsFragment
import org.fossasia.openevent.general.favorite.FavoriteFragment
import org.fossasia.openevent.general.order.LAUNCH_TICKETS
import org.fossasia.openevent.general.order.OrdersUnderUserFragment
import org.fossasia.openevent.general.order.TICKETS
import org.fossasia.openevent.general.search.SearchFragment
Expand Down Expand Up @@ -82,7 +83,7 @@ class MainActivity : AppCompatActivity() {
openEventsFragment = false
}

if (bundle != null && bundle.getBoolean(TICKETS)) {
if (bundle != null && (bundle.getBoolean(TICKETS) || bundle.getBoolean(LAUNCH_TICKETS))) {
loadFragment(OrdersUnderUserFragment())
supportActionBar?.title = "Tickets"
navigation.selectedItemId = R.id.navigation_tickets
Expand Down
Expand Up @@ -14,6 +14,7 @@ import kotlinx.android.synthetic.main.fragment_login.*
import kotlinx.android.synthetic.main.fragment_login.view.*
import org.fossasia.openevent.general.MainActivity
import org.fossasia.openevent.general.R
import org.fossasia.openevent.general.order.LAUNCH_TICKETS
import org.fossasia.openevent.general.ticket.EVENT_ID
import org.fossasia.openevent.general.ticket.TICKET_ID_AND_QTY
import org.fossasia.openevent.general.utils.Utils
Expand All @@ -31,7 +32,7 @@ class LoginFragment : Fragment() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
val bundle = this.arguments
if (bundle != null) {
if (bundle != null && !bundle.getBoolean(LAUNCH_TICKETS)) {
id = bundle.getLong(EVENT_ID, -1)
ticketIdAndQty = bundle.getSerializable(TICKET_ID_AND_QTY) as List<Pair<Int, Int>>
}
Expand Down Expand Up @@ -108,8 +109,10 @@ class LoginFragment : Fragment() {

private fun redirectToMain(bundle: Bundle?) {
val intent = Intent(activity, MainActivity::class.java)
if (((bundle != null) && !id.equals(-1)) && (ticketIdAndQty != null)) {
intent.putExtra(LAUNCH_ATTENDEE, true)
if (bundle != null) {
if (!id.equals(-1) && ticketIdAndQty != null) {
intent.putExtra(LAUNCH_ATTENDEE, true)
}
intent.putExtras(bundle)
}
startActivity(intent)
Expand Down
Expand Up @@ -19,6 +19,7 @@ import org.koin.android.architecture.ext.viewModel
import timber.log.Timber

const val ORDERS: String = "orders"
const val LAUNCH_TICKETS: String = "LAUNCH_TICKETS"

class OrdersUnderUserFragment : Fragment() {

Expand Down Expand Up @@ -87,6 +88,9 @@ class OrdersUnderUserFragment : Fragment() {
}

private fun redirectToLogin() {
startActivity(Intent(activity, AuthActivity::class.java))
val authIntent = Intent(activity, AuthActivity::class.java)
val redirectFromTickets = true
authIntent.putExtra(LAUNCH_TICKETS, redirectFromTickets)
startActivity(authIntent)
}
}