diff --git a/app/src/main/java/it/bz/noi/community/MainActivity.kt b/app/src/main/java/it/bz/noi/community/MainActivity.kt index e0f969a..648cdff 100644 --- a/app/src/main/java/it/bz/noi/community/MainActivity.kt +++ b/app/src/main/java/it/bz/noi/community/MainActivity.kt @@ -24,19 +24,17 @@ import androidx.navigation.findNavController import androidx.navigation.ui.AppBarConfiguration import androidx.navigation.ui.setupActionBarWithNavController import androidx.navigation.ui.setupWithNavController -import it.bz.noi.community.ui.onboarding.OnboardingActivity.Companion.LOGOUT_REQUEST -import it.bz.noi.community.databinding.ActivityMainBinding import it.bz.noi.community.data.repository.AccountsManager +import it.bz.noi.community.databinding.ActivityMainBinding +import it.bz.noi.community.notifications.MessagingService import it.bz.noi.community.oauth.AuthManager import it.bz.noi.community.oauth.AuthStateStatus -import it.bz.noi.community.notifications.MessagingService -import it.bz.noi.community.storage.getWelcomeUnderstood import it.bz.noi.community.ui.WebViewFragment import it.bz.noi.community.ui.onboarding.OnboardingActivity +import it.bz.noi.community.ui.onboarding.OnboardingActivity.Companion.LOGOUT_REQUEST import it.bz.noi.community.utils.Utils import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.launch -import kotlinx.coroutines.runBlocking import net.openid.appauth.AuthorizationException class MainActivity : AppCompatActivity() { @@ -93,7 +91,7 @@ class MainActivity : AppCompatActivity() { setupActionBarWithNavController(navController, appBarConfiguration) binding.navView.setupWithNavController(navController) - navController.addOnDestinationChangedListener { controller, destination, arguments -> + navController.addOnDestinationChangedListener { _, destination, arguments -> when (destination.id) { R.id.navigation_more -> { supportActionBar?.hide() diff --git a/app/src/main/java/it/bz/noi/community/data/api/OpendatahubApiService.kt b/app/src/main/java/it/bz/noi/community/data/api/OpendatahubApiService.kt index 52b37c3..224adb7 100644 --- a/app/src/main/java/it/bz/noi/community/data/api/OpendatahubApiService.kt +++ b/app/src/main/java/it/bz/noi/community/data/api/OpendatahubApiService.kt @@ -27,7 +27,7 @@ interface OpendatahubApiService { @GET("v1/EventShort/{id}") suspend fun getEventDetails( @Path("id") eventID: String, - ): EventsResponse.Event + ): Event /*@GET("v1/EventShort/Detail/{id}") suspend fun getEventDetails( diff --git a/app/src/main/java/it/bz/noi/community/data/models/Event.kt b/app/src/main/java/it/bz/noi/community/data/models/Event.kt index a65765e..52b101e 100644 --- a/app/src/main/java/it/bz/noi/community/data/models/Event.kt +++ b/app/src/main/java/it/bz/noi/community/data/models/Event.kt @@ -4,53 +4,60 @@ package it.bz.noi.community.data.models +import android.os.Parcelable +import androidx.annotation.Keep import com.google.gson.annotations.SerializedName -import java.util.* +import kotlinx.parcelize.Parcelize +import java.util.Date + data class EventsResponse( @SerializedName("Items") val events: List -) { - data class Event( - @SerializedName("Id") - val eventId: String? = null, - @SerializedName("EventDescription") - val name: String? = null, - @SerializedName("EventDescriptionEN") - val nameEN: String? = null, - @SerializedName("EventDescriptionIT") - val nameIT: String? = null, - @SerializedName("EventDescriptionDE") - val nameDE: String? = null, - @SerializedName("EventTextEN") - val descriptionEN: String? = null, - @SerializedName("EventTextIT") - val descriptionIT: String? = null, - @SerializedName("EventTextDE") - val descriptionDE: String? = null, - @SerializedName("AnchorVenue") - val location: String? = null, - @SerializedName("Display5") - val eventOrganizer: String? = null, - @SerializedName("CompanyName") - val eventOrganizerFallback: String? = null, - @SerializedName("StartDate") - val startDate: Date, - @SerializedName("EndDate") - val endDate: Date, - @SerializedName("TechnologyFields") - val technologyFields: List? = null, - @SerializedName("ImageGallery") - val imageGallery: List? = null, - @SerializedName("AnchorVenueRoomMapping") - val roomName: String? = null, - @SerializedName("WebAddress") - val webAddress: String? = null - ) { - data class ImageGallery( - @SerializedName("ImageUrl") - val imageUrl: String? = null - ) - } -} +) +@Keep +@Parcelize +data class Event( + @SerializedName("Id") + val eventId: String? = null, + @SerializedName("EventDescription") + val name: String? = null, + @SerializedName("EventDescriptionEN") + val nameEN: String? = null, + @SerializedName("EventDescriptionIT") + val nameIT: String? = null, + @SerializedName("EventDescriptionDE") + val nameDE: String? = null, + @SerializedName("EventTextEN") + val descriptionEN: String? = null, + @SerializedName("EventTextIT") + val descriptionIT: String? = null, + @SerializedName("EventTextDE") + val descriptionDE: String? = null, + @SerializedName("AnchorVenue") + val location: String? = null, + @SerializedName("Display5") + val eventOrganizer: String? = null, + @SerializedName("CompanyName") + val eventOrganizerFallback: String? = null, + @SerializedName("StartDate") + val startDate: Date, + @SerializedName("EndDate") + val endDate: Date, + @SerializedName("TechnologyFields") + val technologyFields: List? = null, + @SerializedName("ImageGallery") + val imageGallery: List? = null, + @SerializedName("AnchorVenueRoomMapping") + val roomName: String? = null, + @SerializedName("WebAddress") + val webAddress: String? = null +) : Parcelable { + @Keep + @Parcelize + data class ImageGallery( + @SerializedName("ImageUrl") + val imageUrl: String? = null + ) : Parcelable +} diff --git a/app/src/main/java/it/bz/noi/community/ui/MainViewModel.kt b/app/src/main/java/it/bz/noi/community/ui/MainViewModel.kt index 308ea2c..bed3fb9 100644 --- a/app/src/main/java/it/bz/noi/community/ui/MainViewModel.kt +++ b/app/src/main/java/it/bz/noi/community/ui/MainViewModel.kt @@ -137,7 +137,7 @@ class MainViewModel( /** * mediator live data that emits the events to the observers */ - val mediatorEvents = MediatorLiveData>>() + val mediatorEvents = MediatorLiveData>>() init { mediatorEvents.addSource(events) { diff --git a/app/src/main/java/it/bz/noi/community/ui/eventDetails/EventDetailsFragment.kt b/app/src/main/java/it/bz/noi/community/ui/eventDetails/EventDetailsFragment.kt index b95b2c4..1ba6d07 100644 --- a/app/src/main/java/it/bz/noi/community/ui/eventDetails/EventDetailsFragment.kt +++ b/app/src/main/java/it/bz/noi/community/ui/eventDetails/EventDetailsFragment.kt @@ -25,11 +25,9 @@ import androidx.core.view.isVisible import androidx.fragment.app.Fragment import androidx.fragment.app.activityViewModels import androidx.fragment.app.viewModels -import androidx.lifecycle.Observer import androidx.lifecycle.asLiveData import androidx.navigation.fragment.FragmentNavigatorExtras import androidx.navigation.fragment.findNavController -import androidx.navigation.fragment.navArgs import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.LinearLayoutManager.HORIZONTAL import androidx.transition.TransitionInflater @@ -42,7 +40,7 @@ import com.google.android.material.card.MaterialCardView import it.bz.noi.community.R import it.bz.noi.community.data.api.ApiHelper import it.bz.noi.community.data.api.RetrofitBuilder -import it.bz.noi.community.data.models.EventsResponse +import it.bz.noi.community.data.models.Event import it.bz.noi.community.data.repository.JsonFilterRepository import it.bz.noi.community.databinding.FragmentEventDetailsBinding import it.bz.noi.community.ui.MainViewModel @@ -59,14 +57,12 @@ import it.bz.noi.community.utils.Utils.getEventOrganizer import it.bz.noi.community.utils.Utils.getImageUrl import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.ExperimentalCoroutinesApi -import java.util.* +import java.util.Date @OptIn(ExperimentalCoroutinesApi::class) class EventDetailsFragment : Fragment(), EventClickListener { private lateinit var binding: FragmentEventDetailsBinding - private val args: EventDetailsFragmentArgs by navArgs() - private val mainViewModel: MainViewModel by activityViewModels(factoryProducer = { ViewModelFactory( ApiHelper(RetrofitBuilder.opendatahubApiService, RetrofitBuilder.communityApiService), @@ -79,11 +75,9 @@ class EventDetailsFragment : Fragment(), EventClickListener { this@EventDetailsFragment) }) - private lateinit var allEvents: ArrayList - - private lateinit var selectedEvent: EventsResponse.Event + private lateinit var allEvents: ArrayList - private val suggestedEvents = arrayListOf() + private val suggestedEvents = arrayListOf() private val suggestedEventsAdapter by lazy { EventsAdapter( @@ -124,110 +118,29 @@ class EventDetailsFragment : Fragment(), EventClickListener { } } + eventViewModel.eventFlow.asLiveData(Dispatchers.Main).observe(viewLifecycleOwner) { + when(it.status) { + Status.SUCCESS -> { + binding.progressBarLoading.isVisible = false + val event = it.data!! + loadEventData(event) + } + Status.ERROR -> { + binding.progressBarLoading.isVisible = false + Toast.makeText(requireContext(), it.message, Toast.LENGTH_LONG).show() + } + Status.LOADING -> { + binding.progressBarLoading.isVisible = true + } + } + } mainViewModel.mediatorEvents.observe(viewLifecycleOwner) { when (it.status) { Status.SUCCESS -> { val events = it.data if (!events.isNullOrEmpty()) { - allEvents = events as ArrayList - selectedEvent = events.firstOrNull { event -> event.eventId == args.eventId } - ?: events.first() - - (requireActivity() as AppCompatActivity).supportActionBar?.title = - getEventName(selectedEvent) - - setTransitionNames(selectedEvent.eventId!!) - loadEventImage(getImageUrl(selectedEvent)) - - setDate(selectedEvent.startDate, selectedEvent.endDate) - - if (selectedEvent.webAddress != null) { - binding.addToCalendarOrSignup.text = getString(R.string.btn_sign_up) - binding.addToCalendarOrSignup.setIconResource(R.drawable.ic_sign_up) - binding.addToCalendarOrSignup.setOnClickListener { - val browserIntent = - Intent(Intent.ACTION_VIEW, Uri.parse(selectedEvent.webAddress)) - startActivity(browserIntent) - } - } else { - binding.addToCalendarOrSignup.text = - getString(R.string.btn_add_to_calendar) - binding.addToCalendarOrSignup.setIconResource(R.drawable.ic_add_to_calendar) - binding.addToCalendarOrSignup.setOnClickListener { - val beginTime = selectedEvent.startDate.time - val endTime = selectedEvent.endDate.time - - val intent: Intent = Intent(Intent.ACTION_INSERT) - .setData(Events.CONTENT_URI) - .putExtra( - CalendarContract.EXTRA_EVENT_BEGIN_TIME, - beginTime - ) - .putExtra( - CalendarContract.EXTRA_EVENT_END_TIME, - endTime - ) - .putExtra(Events.TITLE, getEventName(selectedEvent)) - .putExtra( - Events.DESCRIPTION, - getEventDescription(selectedEvent) - ) - .putExtra(Events.EVENT_LOCATION, selectedEvent.location) - .putExtra(Events.AVAILABILITY, Events.AVAILABILITY_BUSY) - - startActivity(intent) - } - } - - binding.findOnMaps.setOnClickListener { - mainViewModel.getRoomMapping().observe(viewLifecycleOwner, Observer { - when (it.status) { - Status.SUCCESS -> { - binding.progressBarLoading.isVisible = false - - val mapTitle = selectedEvent.location - val mapUrl = it.data?.get(selectedEvent.roomName) - ?: resources.getString(R.string.url_map) - - findNavController().navigate( - R.id.action_global_webViewFragment, bundleOf( - WebViewFragment.TITLE_ARG to mapTitle, - WebViewFragment.URL_ARG to Utils.addParamsToUrl( - mapUrl, - fullview = true, - hidezoom = true - ) - ) - ) - } - - Status.LOADING -> { - binding.progressBarLoading.isVisible = true - } - - Status.ERROR -> { - binding.progressBarLoading.isVisible = false - Toast.makeText( - requireContext(), - it.message, - Toast.LENGTH_LONG - ).show() - } - } - }) - } - - binding.tvEventName.text = getEventName(selectedEvent) - binding.tvEventLocation.text = selectedEvent.location - binding.tvEventOrganizer.text = getEventOrganizer(selectedEvent) - if (getEventDescription(selectedEvent).isNullOrEmpty()) { - binding.tvAboutLabel.isVisible = false - binding.tvEventDescription.isVisible = false - } else - binding.tvEventDescription.text = getEventDescription(selectedEvent) - - populateSuggestedEvents(events) + allEvents = events as ArrayList } else { binding.tvInterestingForYou.isVisible = false } @@ -241,29 +154,109 @@ class EventDetailsFragment : Fragment(), EventClickListener { } } + } -/* eventViewModel.eventFlow.asLiveData(Dispatchers.Main).observe(viewLifecycleOwner) { - when(it.status) { - Status.SUCCESS -> { - binding.progressBarLoading.isVisible = false - val event = it.data!! - //loadEventData(event) - } - Status.ERROR -> { - binding.progressBarLoading.isVisible = false - Toast.makeText(requireContext(), it.message, Toast.LENGTH_LONG).show() - } - Status.LOADING -> { - binding.progressBarLoading.isVisible = true + private fun loadEventData(event: Event) { + (requireActivity() as AppCompatActivity).supportActionBar?.title = + getEventName(event) + + setTransitionNames(event.eventId!!) + loadEventImage(getImageUrl(event)) + + setDate(event.startDate, event.endDate) + + if (event.webAddress != null) { + binding.addToCalendarOrSignup.text = getString(R.string.btn_sign_up) + binding.addToCalendarOrSignup.setIconResource(R.drawable.ic_sign_up) + binding.addToCalendarOrSignup.setOnClickListener { + val browserIntent = + Intent(Intent.ACTION_VIEW, Uri.parse(event.webAddress)) + startActivity(browserIntent) + } + } else { + binding.addToCalendarOrSignup.text = + getString(R.string.btn_add_to_calendar) + binding.addToCalendarOrSignup.setIconResource(R.drawable.ic_add_to_calendar) + binding.addToCalendarOrSignup.setOnClickListener { + val beginTime = event.startDate.time + val endTime = event.endDate.time + + val intent: Intent = Intent(Intent.ACTION_INSERT) + .setData(Events.CONTENT_URI) + .putExtra( + CalendarContract.EXTRA_EVENT_BEGIN_TIME, + beginTime + ) + .putExtra( + CalendarContract.EXTRA_EVENT_END_TIME, + endTime + ) + .putExtra(Events.TITLE, getEventName(event)) + .putExtra( + Events.DESCRIPTION, + getEventDescription(event) + ) + .putExtra(Events.EVENT_LOCATION, event.location) + .putExtra(Events.AVAILABILITY, Events.AVAILABILITY_BUSY) + + startActivity(intent) + } + } + + binding.findOnMaps.setOnClickListener { + mainViewModel.getRoomMapping().observe(viewLifecycleOwner) { + when (it.status) { + Status.SUCCESS -> { + binding.progressBarLoading.isVisible = false + + val mapTitle = event.location + val mapUrl = it.data?.get(event.roomName) + ?: resources.getString(R.string.url_map) + + findNavController().navigate( + R.id.action_global_webViewFragment, bundleOf( + WebViewFragment.TITLE_ARG to mapTitle, + WebViewFragment.URL_ARG to Utils.addParamsToUrl( + mapUrl, + fullview = true, + hidezoom = true + ) + ) + ) + } + + Status.LOADING -> { + binding.progressBarLoading.isVisible = true + } + + Status.ERROR -> { + binding.progressBarLoading.isVisible = false + Toast.makeText( + requireContext(), + it.message, + Toast.LENGTH_LONG + ).show() + } } } - }*/ + } + + binding.tvEventName.text = getEventName(event) + binding.tvEventLocation.text = event.location + binding.tvEventOrganizer.text = getEventOrganizer(event) + if (getEventDescription(event).isNullOrEmpty()) { + binding.tvAboutLabel.isVisible = false + binding.tvEventDescription.isVisible = false + } else + binding.tvEventDescription.text = getEventDescription(event) + + populateSuggestedEvents(allEvents, event) } /** * populate the UI of the suggested filters */ - private fun populateSuggestedEvents(events: List) { + private fun populateSuggestedEvents(events: List, selectedEvent: Event) { suggestedEvents.clear() for (event in events) { if (suggestedEvents.size == 3) @@ -339,7 +332,7 @@ class EventDetailsFragment : Fragment(), EventClickListener { * Clicking on suggested event will result in open another EventDetailsFragment instance */ override fun onEventClick( - event: EventsResponse.Event, + event: Event, cardEvent: MaterialCardView, cardDate: CardView, eventName: TextView, @@ -363,7 +356,8 @@ class EventDetailsFragment : Fragment(), EventClickListener { findNavController().navigate( EventDetailsFragmentDirections.actionEventDetailsFragmentSelf( - event.eventId, + null, + event ), extras ) diff --git a/app/src/main/java/it/bz/noi/community/ui/eventDetails/EventDetailsViewModel.kt b/app/src/main/java/it/bz/noi/community/ui/eventDetails/EventDetailsViewModel.kt index a17b6b7..196095c 100644 --- a/app/src/main/java/it/bz/noi/community/ui/eventDetails/EventDetailsViewModel.kt +++ b/app/src/main/java/it/bz/noi/community/ui/eventDetails/EventDetailsViewModel.kt @@ -9,7 +9,7 @@ import androidx.lifecycle.AbstractSavedStateViewModelFactory import androidx.lifecycle.SavedStateHandle import androidx.lifecycle.ViewModel import it.bz.noi.community.data.api.ApiHelper -import it.bz.noi.community.data.models.EventsResponse +import it.bz.noi.community.data.models.Event import it.bz.noi.community.data.repository.MainRepository import it.bz.noi.community.utils.Resource import kotlinx.coroutines.flow.Flow @@ -26,10 +26,10 @@ class EventDetailsViewModel( private const val EVENT_ARG = "event" } - private val event = MutableStateFlow(savedStateHandle[EVENT_ARG]) + private val event = MutableStateFlow(savedStateHandle[EVENT_ARG]) private val eventId = MutableStateFlow(savedStateHandle[EVENT_ID_ARG]) - val eventFlow: Flow> = event.combine(eventId) { _event, _eventId -> + val eventFlow: Flow> = event.combine(eventId) { _event, _eventId -> Resource.loading(null) when { _event != null -> { diff --git a/app/src/main/java/it/bz/noi/community/ui/today/TodayViewModel.kt b/app/src/main/java/it/bz/noi/community/ui/today/TodayViewModel.kt index eb6fed8..74d67ee 100644 --- a/app/src/main/java/it/bz/noi/community/ui/today/TodayViewModel.kt +++ b/app/src/main/java/it/bz/noi/community/ui/today/TodayViewModel.kt @@ -5,8 +5,8 @@ package it.bz.noi.community.ui.today import androidx.lifecycle.ViewModel -import it.bz.noi.community.data.models.EventsResponse +import it.bz.noi.community.data.models.Event class TodayViewModel : ViewModel() { - val events = arrayListOf() + val events = arrayListOf() } diff --git a/app/src/main/java/it/bz/noi/community/ui/today/events/EventsAdapter.kt b/app/src/main/java/it/bz/noi/community/ui/today/events/EventsAdapter.kt index a316094..709192c 100644 --- a/app/src/main/java/it/bz/noi/community/ui/today/events/EventsAdapter.kt +++ b/app/src/main/java/it/bz/noi/community/ui/today/events/EventsAdapter.kt @@ -16,7 +16,7 @@ import com.bumptech.glide.Glide import com.bumptech.glide.request.RequestOptions import com.google.android.material.card.MaterialCardView import it.bz.noi.community.R -import it.bz.noi.community.data.models.EventsResponse +import it.bz.noi.community.data.models.Event import it.bz.noi.community.utils.DateUtils.getDateIntervalString import it.bz.noi.community.utils.DateUtils.getHoursIntervalString import it.bz.noi.community.utils.Utils @@ -28,7 +28,7 @@ import it.bz.noi.community.utils.Utils.getEventName */ interface EventClickListener { fun onEventClick( - event: EventsResponse.Event, + event: Event, cardEvent: MaterialCardView, cardDate: CardView, eventName: TextView, @@ -47,7 +47,7 @@ interface EventClickListener { * fragment parameter to avoid clicked view to have the fade out animation */ class EventsAdapter( - private val events: List, + private val events: List, private val listener: EventClickListener, private val isSuggestedEvents: Boolean = false ) : @@ -82,7 +82,7 @@ class EventsAdapter( private val locationIcon = view.findViewById(R.id.ivLocation) private val timeIcon = view.findViewById(R.id.ivTime) - private lateinit var event: EventsResponse.Event + private lateinit var event: Event init { view.rootView.setOnClickListener { @@ -101,7 +101,7 @@ class EventsAdapter( } } - fun bind(event: EventsResponse.Event) { + fun bind(event: Event) { this.event = event eventName.text = getEventName(event) diff --git a/app/src/main/java/it/bz/noi/community/ui/today/events/EventsFragment.kt b/app/src/main/java/it/bz/noi/community/ui/today/events/EventsFragment.kt index 210e48b..48430a3 100644 --- a/app/src/main/java/it/bz/noi/community/ui/today/events/EventsFragment.kt +++ b/app/src/main/java/it/bz/noi/community/ui/today/events/EventsFragment.kt @@ -23,7 +23,7 @@ import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.LinearLayoutManager.HORIZONTAL import com.google.android.material.card.MaterialCardView import it.bz.noi.community.R -import it.bz.noi.community.data.models.EventsResponse +import it.bz.noi.community.data.models.Event import it.bz.noi.community.data.models.TimeFilter import it.bz.noi.community.data.models.TimeRange import it.bz.noi.community.databinding.FragmentEventsBinding @@ -162,7 +162,7 @@ class EventsFragment : Fragment(), EventClickListener, TimeFilterClickListener { } } - private fun retrieveList(events: List) { + private fun retrieveList(events: List) { todayViewModel.events.apply { clear() addAll(events) @@ -171,7 +171,7 @@ class EventsFragment : Fragment(), EventClickListener, TimeFilterClickListener { } override fun onEventClick( - event: EventsResponse.Event, + event: Event, cardEvent: MaterialCardView, cardDate: CardView, eventName: TextView, @@ -194,7 +194,8 @@ class EventsFragment : Fragment(), EventClickListener, TimeFilterClickListener { ) findNavController().navigate( TodayFragmentDirections.actionNavigationTodayToEventDetailsFragment( - event.eventId, + null, + event ), extras ) diff --git a/app/src/main/java/it/bz/noi/community/utils/Utils.kt b/app/src/main/java/it/bz/noi/community/utils/Utils.kt index 3c9a063..b70199a 100644 --- a/app/src/main/java/it/bz/noi/community/utils/Utils.kt +++ b/app/src/main/java/it/bz/noi/community/utils/Utils.kt @@ -4,7 +4,6 @@ package it.bz.noi.community.utils -import android.content.ActivityNotFoundException import android.content.Context import android.content.Intent import android.net.Uri @@ -12,7 +11,7 @@ import androidx.lifecycle.SavedStateHandle import com.google.android.material.dialog.MaterialAlertDialogBuilder import it.bz.noi.community.BuildConfig import it.bz.noi.community.R -import it.bz.noi.community.data.models.EventsResponse +import it.bz.noi.community.data.models.Event import java.net.URLEncoder import java.text.Normalizer import java.util.* @@ -43,7 +42,7 @@ object Utils { return null } - fun getEventDescription(event: EventsResponse.Event): String? { + fun getEventDescription(event: Event): String? { return when (Locale.getDefault().language) { ITALIAN -> { event.descriptionIT @@ -59,7 +58,7 @@ object Utils { } } - fun getEventName(event: EventsResponse.Event, fallback: String = "N/D"): String { + fun getEventName(event: Event, fallback: String = "N/D"): String { return when (Locale.getDefault().language) { ITALIAN -> { event.nameIT ?: event.name ?: fallback @@ -75,14 +74,14 @@ object Utils { } } - fun getEventOrganizer(event: EventsResponse.Event, fallback: String = "N/D"): String { + fun getEventOrganizer(event: Event, fallback: String = "N/D"): String { return if (event.eventOrganizer.isNullOrEmpty()) event.eventOrganizerFallback ?: fallback else event.eventOrganizer } - fun getImageUrl(event: EventsResponse.Event): String? { + fun getImageUrl(event: Event): String? { var eventImageUrl = event.imageGallery?.firstOrNull { it.imageUrl != null }?.imageUrl if (eventImageUrl?.startsWith(HTTP_PREFIX) == true) { diff --git a/app/src/main/res/navigation/mobile_navigation.xml b/app/src/main/res/navigation/mobile_navigation.xml index 96b72af..8b1db55 100644 --- a/app/src/main/res/navigation/mobile_navigation.xml +++ b/app/src/main/res/navigation/mobile_navigation.xml @@ -72,6 +72,10 @@ SPDX-License-Identifier: CC0-1.0 android:name="eventId" app:argType="string" app:nullable="true" /> +