Skip to content

Commit

Permalink
Merge tag 'Version_2015'
Browse files Browse the repository at this point in the history
  • Loading branch information
FrPellissier committed Oct 4, 2023
2 parents 774430b + 0908b26 commit 5eeae29
Show file tree
Hide file tree
Showing 15 changed files with 332 additions and 77 deletions.
2 changes: 1 addition & 1 deletion app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ android {

// App versions
val versionMajor = 8
val versionMinor = 10
val versionMinor = 11
val versionPatch = "git rev-list HEAD --count".runCommand().toInt()
val versionBranchName = "git rev-parse --abbrev-ref HEAD".runCommand()
val versionCodeInt = (versionMajor * 100 + versionMinor) * 10000 + versionPatch % 10000
Expand Down
1 change: 1 addition & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,7 @@
android:resource="@xml/provider_paths" />
</provider>


<meta-data
android:name="com.google.firebase.messaging.default_notification_icon"
android:resource="@drawable/ic_entourage_logo_one_color" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -422,4 +422,5 @@ open class BaseEntourage : FeedItem, Serializable {
private const val serialVersionUID = -1228955044085412292L
const val NEWSFEED_TYPE = "Entourage"
}
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package social.entourage.android.groups.list
import android.os.Bundle
import android.text.Editable
import android.text.TextWatcher
import android.util.Log
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
Expand Down Expand Up @@ -69,8 +70,10 @@ class DiscoverGroupsListFragment : Fragment() {
private fun handleResponseGetGroupsSearch(allGroupsSearch: MutableList<Group>?) {
groupsListSearch.clear()
allGroupsSearch?.let { groupsListSearch.addAll(it) }
allGroupsSearch?.isEmpty()?.let { updateViewSearch(it) }
(binding.searchRecyclerView.adapter as? GroupsListAdapter)?.updateGroupsList(groupsList)
allGroupsSearch?.isEmpty()?.let {
Log.wtf("wtf", "isEmpty value : " + allGroupsSearch?.isEmpty())
updateViewSearch(it) }
(binding.searchRecyclerView.adapter as? GroupsListAdapter)?.updateGroupsList(groupsListSearch)
binding.progressBar.visibility = View.GONE
}

Expand All @@ -93,11 +96,14 @@ class DiscoverGroupsListFragment : Fragment() {
binding.subtitle.text = getString(R.string.group_list_search_empty_state_subtitle)
binding.arrow.visibility = View.GONE
binding.recyclerView.visibility = View.GONE
binding.list.visibility = View.VISIBLE

} else {
Log.wtf("wtf", "pased here")
binding.emptyStateLayout.visibility = View.GONE
binding.list.visibility = View.VISIBLE
binding.searchRecyclerView.visibility = View.VISIBLE
binding.recyclerView.visibility = View.GONE
}
}

Expand Down
87 changes: 82 additions & 5 deletions app/src/main/java/social/entourage/android/home/HomeFragment.kt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package social.entourage.android.home

import android.content.Context
import android.content.Intent
import android.graphics.drawable.GradientDrawable
import android.net.Uri
Expand Down Expand Up @@ -32,23 +33,31 @@ import social.entourage.android.api.model.HomeAction
import social.entourage.android.api.model.Summary
import social.entourage.android.api.model.SummaryAction
import social.entourage.android.api.model.User
import social.entourage.android.groups.GroupPresenter
import social.entourage.android.groups.details.feed.FeedActivity
import social.entourage.android.profile.ProfileActivity
import social.entourage.android.user.UserProfileActivity
import social.entourage.android.tools.utils.Const
import social.entourage.android.tools.utils.CustomAlertDialog
import social.entourage.android.tools.log.AnalyticsEvents
import social.entourage.android.tools.view.CommunicationRecoWebUrlHandlerViewModel
import social.entourage.android.user.UserPresenter
import social.entourage.android.welcome.WelcomeOneActivity
import social.entourage.android.welcome.WelcomeTestActivity
import social.entourage.android.welcome.WelcomeThreeActivity
import social.entourage.android.welcome.WelcomeTwoActivity
import timber.log.Timber
import java.time.LocalDate
import java.util.Calendar

class HomeFragment : Fragment() {
private var _binding: NewFragmentHomeBinding? = null
val binding: NewFragmentHomeBinding get() = _binding!!
private val homePresenter: HomePresenter by lazy { HomePresenter() }
private lateinit var actionsPresenter: ActionsPresenter
private val groupPresenter: GroupPresenter by lazy { GroupPresenter() }
private val userPresenter: UserPresenter by lazy { UserPresenter() }


private var user: User? = null
private var userSummary: Summary? = null
Expand All @@ -69,7 +78,6 @@ class HomeFragment : Fragment() {
actionsPresenter = ViewModelProvider(requireActivity()).get(ActionsPresenter::class.java)
homePresenter.summary.observe(requireActivity(), ::updateContributionsView)
isAlreadyLoadSummary = true
homePresenter.getSummary()

val viewModel = ViewModelProvider(requireActivity()).get(
CommunicationRecoWebUrlHandlerViewModel::class.java)
Expand All @@ -80,6 +88,8 @@ class HomeFragment : Fragment() {
handlePedagogicalContentButton()
homePresenter.unreadMessages.observe(requireActivity(), ::updateUnreadCount)
homePresenter.getUnreadCount()
groupPresenter.hasUserJoinedGroup.observe(viewLifecycleOwner, ::handleJoinResponse)

homePresenter.notifsCount.observe(requireActivity(), ::updateNotifsCount)
timer = object: CountDownTimer(2000, 1000) {
override fun onTick(millisUntilFinished: Long) {}
Expand All @@ -92,14 +102,19 @@ class HomeFragment : Fragment() {

override fun onResume() {
super.onResume()
homePresenter.getSummary()

reloadDatasFromRecos(true)
homePresenter.getNotificationsCount()
AnalyticsEvents.logEvent(AnalyticsEvents.Home_view_home)
showAlertForRugbyDay()
val id = EntourageApplication.me(requireContext())?.id!!
//userPresenter.updateLanguage(id, "fr")
//TODO : suppress this testing code
// var summary = Summary()
// var action = SummaryAction()
// action.title = "ma contrib/demande"
// action.actionType = "contribution"
// action.actionType = "solicitation"
// action.id = 10000
// summary.unclosedAction = action
// onActionUnclosed(summary)
Expand Down Expand Up @@ -199,7 +214,70 @@ class HomeFragment : Fragment() {
timer.start()
}
}
onActionUnclosed(summary)
//TODO TO RECONECT FOR UnclosedActions
//onActionUnclosed(summary)


}

private fun handleJoinResponse(hasJoined: Boolean) {
if(hasJoined){
//HERE GO TO GROUP SPORT efEKBnEVujAU
requireActivity().startActivity(
Intent(requireContext(), FeedActivity::class.java).putExtra(
Const.GROUP_ID,
44
)
)
}
}

fun showAlertForRugbyDay() {
val sharedPreferences = requireContext().getSharedPreferences("MyAppPreferences", Context.MODE_PRIVATE)

if (sharedPreferences.getBoolean("isPopupShown", false)) {
// Popup already shown, return
return
}

val currentCalendar = Calendar.getInstance()

// Date de début (27 août à 17h)
val startCalendar = Calendar.getInstance().apply {
set(Calendar.YEAR, 2023)
set(Calendar.MONTH, Calendar.AUGUST)
set(Calendar.DAY_OF_MONTH, 27)
set(Calendar.HOUR_OF_DAY, 17)
set(Calendar.MINUTE, 0)
set(Calendar.SECOND, 0)
set(Calendar.MILLISECOND, 0)
}

// Date de fin (28 août à 17h)
val endCalendar = Calendar.getInstance().apply {
set(Calendar.YEAR, 2023)
set(Calendar.MONTH, Calendar.AUGUST)
set(Calendar.DAY_OF_MONTH, 28)
set(Calendar.HOUR_OF_DAY, 17)
set(Calendar.MINUTE, 0)
set(Calendar.SECOND, 0)
set(Calendar.MILLISECOND, 0)
}

// Vérifier si la date actuelle est entre la date de début et la date de fin
if (currentCalendar.after(startCalendar) && currentCalendar.before(endCalendar)) {
CustomAlertDialog.showRugbyPopUpWithCancelFirst(
requireContext(),
getString(R.string.pop_up_rugby_france_title),
getString(R.string.pop_up_rugby_france_content),
getString(R.string.join),
) {
groupPresenter.joinGroup(44)
sharedPreferences.edit().putBoolean("isPopupShown", true).apply()

}
}

}

private fun onActionUnclosed(summary: Summary){
Expand All @@ -224,11 +302,10 @@ class HomeFragment : Fragment() {
(activity as MainActivity).goDemand()
AnalyticsEvents.logEvent(AnalyticsEvents.Clic__SeeDemand__Day10)
})

},
onYes = {
AnalyticsEvents.logEvent(AnalyticsEvents.Clic__StateDemandPop__Yes__Day10)
//actionsPresenter.cancelAction(summary.unclosedAction!!.id!!,true,true, "")
actionsPresenter.cancelAction(summary.unclosedAction!!.id!!,true,true, "")
AnalyticsEvents.logEvent(AnalyticsEvents.View__DeleteDemandPop__Day10)
CustomAlertDialog.showForLastActionThree(requireContext(),
getString(R.string.custom_dialog_action_title_three),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@ package social.entourage.android.notifications
import android.util.Log
import com.google.firebase.messaging.FirebaseMessagingService
import com.google.firebase.messaging.RemoteMessage
import com.google.gson.Gson
import social.entourage.android.EntourageApplication
import social.entourage.android.tools.log.AnalyticsEvents

class EntourageFirebaseMessagingService : FirebaseMessagingService() {
override fun onMessageReceived(remoteMessage: RemoteMessage) {

AnalyticsEvents.logEvent(AnalyticsEvents.EVENT_NOTIFICATION_RECEIVED)
if (remoteMessage.data.isNotEmpty()) {
//we always provide some extra data in our push notif
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,30 +19,11 @@ class NotificationActionReceiver : BroadcastReceiver() {
try {
val pushNotif = Gson().fromJson(notificationContent, PushNotificationContent::class.java)
val stage = pushNotif.extra?.stage
/*
NotificationReceived__OfferHelp__WDay1
NotificationReceived__OfferHelp__WDay2
NotificationReceived__OfferHelp__WDay5
NotificationReceived__OfferHelp__WDay8
NotificationReceived__OfferHelp__WDay11
* */
if(stage.equals("h1")){AnalyticsEvents.logEvent(AnalyticsEvents.NotificationClicked__OfferHelp__WDay1)}
if(stage.equals("j2")){AnalyticsEvents.logEvent(AnalyticsEvents.NotificationClicked__OfferHelp__WDay2)}
if(stage.equals("j5")){AnalyticsEvents.logEvent(AnalyticsEvents.NotificationClicked__OfferHelp__WDay5)}
if(stage.equals("j!")){AnalyticsEvents.logEvent(AnalyticsEvents.NotificationClicked__OfferHelp__WDay8)}
if(stage.equals("j11")){AnalyticsEvents.logEvent(AnalyticsEvents.NotificationClicked__OfferHelp__WDay11)}

}catch (e:Exception){

}

try {
val pushNotif = Gson().fromJson(notificationContent, PushNotificationContent::class.java)
val tracking = pushNotif.extra?.tracking
if(tracking != null) {
if(tracking.equals("join_request_on_create")){AnalyticsEvents.logEvent(AnalyticsEvents.NotificationClicked__MemberEvent)}
Expand All @@ -64,7 +45,6 @@ class NotificationActionReceiver : BroadcastReceiver() {
}catch (e:Exception){

}

}
ACTION_DISMISSED -> {

Expand Down
Loading

0 comments on commit 5eeae29

Please sign in to comment.