Making gender not required and sending 0 as default gender for registering user.
implemented GamePlayerActivity clicks onn webview. Implemented clicks events for common PlayerActivity.kt Implemented clicks for mylist and view all fragments of all modules. Integrated Firebase analytics. Tested by enabling debugger view. Integrated Firebase performance monitoring. Integrated Onesignal, initiated and tested. Sent onesignal id to backend from endpoints: guest_login, login, login_proceed and guest_login. Integrated v2/favorite_listing api with new data structure of show_data with split data for english and hindi category. Made the changes according at all places in mylist module. Started implementing flow for item being from fav view all activity for web shows: 1. reloading the whole list by resetting the pagination. 2. removing locally when user has loaded all the data already.
This commit is contained in:
@@ -4,6 +4,8 @@ plugins {
|
||||
id("kotlin-parcelize")
|
||||
alias(libs.plugins.navigationSafeArgs)
|
||||
alias(libs.plugins.ksp)
|
||||
id 'com.google.gms.google-services'
|
||||
id 'com.google.firebase.firebase-perf'
|
||||
}
|
||||
|
||||
android {
|
||||
@@ -115,6 +117,9 @@ dependencies {
|
||||
// audio mixer for karaoke
|
||||
implementation("com.github.ZeroOneZeroR:android_audio_mixer:v1.1")
|
||||
|
||||
// one-signal
|
||||
implementation(libs.onesignal)
|
||||
|
||||
// room-database
|
||||
def room_version = "2.6.1"
|
||||
implementation(libs.androidx.room.runtime)
|
||||
@@ -123,6 +128,9 @@ dependencies {
|
||||
// optional - Kotlin Extensions and Coroutines support for Room
|
||||
implementation(libs.room.ktx)
|
||||
|
||||
implementation libs.firebase.analytics
|
||||
implementation libs.firebase.perf
|
||||
|
||||
implementation libs.androidx.core.ktx
|
||||
implementation libs.androidx.appcompat
|
||||
implementation libs.material
|
||||
|
||||
30
app/google-services.json
Normal file
30
app/google-services.json
Normal file
@@ -0,0 +1,30 @@
|
||||
{
|
||||
"project_info": {
|
||||
"project_number": "15836861503",
|
||||
"project_id": "wokaga-19312",
|
||||
"storage_bucket": "wokaga-19312.appspot.com"
|
||||
},
|
||||
"client": [
|
||||
{
|
||||
"client_info": {
|
||||
"mobilesdk_app_id": "1:15836861503:android:3bb57b5699be379466548a",
|
||||
"android_client_info": {
|
||||
"package_name": "com.woka"
|
||||
}
|
||||
},
|
||||
"oauth_client": [],
|
||||
"api_key": [
|
||||
{
|
||||
"current_key": "AIzaSyDZuTUtZCL7fDKAiUgVt6IjytuH9Zz48Hg"
|
||||
}
|
||||
],
|
||||
"services": {
|
||||
"appinvite_service": {
|
||||
"other_platform_oauth_client": []
|
||||
}
|
||||
},
|
||||
"admob_app_id": "ca-app-pub-5699008063638916~5336678778"
|
||||
}
|
||||
],
|
||||
"configuration_version": "1"
|
||||
}
|
||||
@@ -48,7 +48,7 @@
|
||||
android:screenOrientation="portrait" />
|
||||
<activity
|
||||
android:name=".karaoke.player.KaraokePlayerActivity"
|
||||
android:configChanges="keyboard|keyboardHidden|orientation|screenSize|uiMode|fontScale"
|
||||
android:configChanges="keyboard|keyboardHidden|orientation|screenSize|uiMode|fontScale|fontWeightAdjustment|screenLayout"
|
||||
android:exported="false"
|
||||
android:launchMode="singleTask"
|
||||
android:screenOrientation="portrait"
|
||||
@@ -59,7 +59,7 @@
|
||||
android:screenOrientation="portrait" />
|
||||
<activity
|
||||
android:name=".wokagames.playerr.GamePlayerActivity"
|
||||
android:configChanges="keyboard|keyboardHidden|orientation|screenSize|uiMode"
|
||||
android:configChanges="keyboard|keyboardHidden|orientation|screenSize|uiMode|fontScale|fontWeightAdjustment|screenLayout"
|
||||
android:exported="false"
|
||||
android:launchMode="singleTask"
|
||||
android:supportsPictureInPicture="true"
|
||||
@@ -74,7 +74,7 @@
|
||||
android:screenOrientation="portrait" />
|
||||
<activity
|
||||
android:name=".players.views.PlayerActivity"
|
||||
android:configChanges="keyboard|keyboardHidden|orientation|screenSize|uiMode"
|
||||
android:configChanges="keyboard|keyboardHidden|orientation|screenSize|uiMode|fontScale|fontWeightAdjustment|screenLayout"
|
||||
android:exported="false"
|
||||
android:launchMode="singleTask"
|
||||
android:screenOrientation="sensorLandscape"
|
||||
|
||||
@@ -2,10 +2,18 @@ package com.woka
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.app.Application
|
||||
import android.util.Log
|
||||
import com.jwplayer.pub.api.license.LicenseUtil
|
||||
import com.onesignal.OneSignal
|
||||
import com.woka.database.AppDatabase
|
||||
import com.woka.streamingurls.StreamingUrlRepository
|
||||
import com.woka.userPreference.UserPreference
|
||||
import com.woka.utils.JW_PLAYER_LICENSE
|
||||
import com.woka.utils.ONESIGNAL_APP_ID
|
||||
import com.woka.utils.TAG
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.launch
|
||||
|
||||
class WokaApp: Application() {
|
||||
|
||||
@@ -18,10 +26,23 @@ class WokaApp: Application() {
|
||||
override fun onCreate() {
|
||||
super.onCreate()
|
||||
userPrefs = UserPreference(applicationContext)
|
||||
LicenseUtil().setLicenseKey(this, "LkYoNusv+gSIVJIrXa5Bf59iBNlUMxeg82PM/l8JWk+cD4BE")
|
||||
LicenseUtil().setLicenseKey(this, JW_PLAYER_LICENSE)
|
||||
|
||||
appDatabase = AppDatabase.getInstance(applicationContext)
|
||||
|
||||
StreamingUrlRepository.loadLiveStreamingUrls()
|
||||
|
||||
initOneSignal()
|
||||
}
|
||||
|
||||
private fun initOneSignal(){
|
||||
// OneSignal Initialization
|
||||
OneSignal.initWithContext(this, ONESIGNAL_APP_ID)
|
||||
|
||||
// requestPermission will show the native Android notification permission prompt.
|
||||
// NOTE: It's recommended to use a OneSignal In-App Message to prompt instead.
|
||||
CoroutineScope(Dispatchers.IO).launch {
|
||||
OneSignal.Notifications.requestPermission(false)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -29,6 +29,7 @@ import com.woka.databinding.ActivityAudioBooksBinding
|
||||
import com.woka.databinding.DialogModuleShowerBinding
|
||||
import com.woka.networking.ApiResult
|
||||
import com.woka.players.models.VideoPlayList
|
||||
import com.woka.players.models.VideoViewRequestData
|
||||
import com.woka.players.views.PlayerActivity
|
||||
import com.woka.userPreference.UserType
|
||||
import com.woka.utils.NoSignInDialog
|
||||
@@ -99,9 +100,10 @@ class AudioBooksActivity : WokaBaseActivity() {
|
||||
}
|
||||
}
|
||||
|
||||
override fun onDestroy() {
|
||||
super.onDestroy()
|
||||
|
||||
@Suppress("DEPRECATION")
|
||||
@Deprecated("Deprecated in Java")
|
||||
override fun onBackPressed() {
|
||||
super.onBackPressed()
|
||||
ClicksHelper.upsertClickEvent(ContentType.OTHERS)
|
||||
}
|
||||
|
||||
@@ -148,6 +150,7 @@ class AudioBooksActivity : WokaBaseActivity() {
|
||||
binding.apply {
|
||||
toolbar.backBtn.setOnClickListener {
|
||||
onBackPressedDispatcher.onBackPressed()
|
||||
ClicksHelper.upsertClickEvent(ContentType.OTHERS)
|
||||
}
|
||||
|
||||
retryBtn.setOnClickListener {
|
||||
@@ -374,7 +377,10 @@ class AudioBooksActivity : WokaBaseActivity() {
|
||||
.build()
|
||||
)
|
||||
},
|
||||
null
|
||||
mutableListOf(VideoViewRequestData(
|
||||
audioBookData.id,
|
||||
ContentType.AUDIO
|
||||
))
|
||||
)
|
||||
)
|
||||
putExtra(PlayerActivity.EXTRA_PLAY_INDEX, 0)
|
||||
|
||||
@@ -18,24 +18,25 @@ import com.woka.utils.TAG
|
||||
@Dao
|
||||
interface ClicksDao {
|
||||
|
||||
@Query("UPDATE click_events SET clicks_count = clicks_count + 1 WHERE id = :clickId")
|
||||
suspend fun updateAndGetRowCount(clickId: String): Int
|
||||
@Query("UPDATE click_events SET clicks_count = clicks_count + :clicksCount WHERE id = :clickId")
|
||||
suspend fun updateAndGetRowCount(clickId: String, clicksCount: Int): Int
|
||||
|
||||
@Insert(onConflict = OnConflictStrategy.IGNORE)
|
||||
suspend fun insert(vararg clickEvent: ClickEvent)
|
||||
|
||||
@Transaction
|
||||
suspend fun upsertClickEvent(contentType: ContentType, postId: Int = 0, categoryId: Int = 0){
|
||||
suspend fun upsertClickEvent(contentType: ContentType, postId: Int = 0, categoryId: Int = 0, clicksCount: Int = 1){
|
||||
val clickId = "${contentType.id}_${postId}_${categoryId}"
|
||||
|
||||
val count = updateAndGetRowCount(clickId)
|
||||
val count = updateAndGetRowCount(clickId, clicksCount)
|
||||
if (count == 0){
|
||||
insert(
|
||||
ClickEvent(
|
||||
clickId,
|
||||
postId,
|
||||
contentType.id,
|
||||
categoryId
|
||||
categoryId,
|
||||
clicksCount
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
@@ -10,14 +10,14 @@ import kotlinx.coroutines.launch
|
||||
object ClicksHelper {
|
||||
private val clicksDao: ClicksDao? = appDatabase?.clicksDao()
|
||||
|
||||
fun upsertClickEvent(contentType: ContentType, postId: Int? = 0, categoryId: String? = null){
|
||||
fun upsertClickEvent(contentType: ContentType, postId: Int? = 0, categoryId: String? = null, clicksCount: Int = 1){
|
||||
CoroutineScope(Dispatchers.IO).launch {
|
||||
val categoryInt = try {
|
||||
categoryId?.toIntOrNull()?:0
|
||||
}catch (e: Exception){
|
||||
0
|
||||
}
|
||||
clicksDao?.upsertClickEvent(contentType, postId?:0, categoryInt)
|
||||
clicksDao?.upsertClickEvent(contentType, postId?:0, categoryInt, clicksCount)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -20,6 +20,7 @@ import com.woka.home.views.FMActivity
|
||||
import com.woka.karaoke.views.KaraokeActivity
|
||||
import com.woka.networking.ApiResult
|
||||
import com.woka.players.models.VideoPlayList
|
||||
import com.woka.players.models.VideoViewRequestData
|
||||
import com.woka.players.views.LiveStreamPlayerActivity
|
||||
import com.woka.players.views.PlayerActivity
|
||||
import com.woka.shop.views.ShopActivity
|
||||
@@ -154,7 +155,10 @@ class Home2Fragment : Fragment() {
|
||||
.build()
|
||||
)
|
||||
},
|
||||
null
|
||||
mutableListOf(VideoViewRequestData(
|
||||
0,
|
||||
ContentType.TEASER
|
||||
))
|
||||
)
|
||||
)
|
||||
putExtra(PlayerActivity.EXTRA_PLAY_INDEX, 0)
|
||||
|
||||
@@ -51,6 +51,7 @@ import com.woka.karaoke.player.KaraokePlayerData
|
||||
import com.woka.networking.ApiResult
|
||||
import com.woka.onboard.views.OnboardActivity
|
||||
import com.woka.players.models.VideoPlayList
|
||||
import com.woka.players.models.VideoViewRequestData
|
||||
import com.woka.players.views.PlayerActivity
|
||||
import com.woka.userPreference.UserType
|
||||
import com.woka.userdata.UserRepository
|
||||
@@ -191,6 +192,8 @@ class MyListFragment : Fragment() {
|
||||
putExtra(EXTRA_FAVORITE_CONTENT_TYPE, ContentType.SERIES.id)
|
||||
putExtra(EXTRA_FAVORITE_WEB_SERIES_IS_ENGLISH, true)
|
||||
})
|
||||
|
||||
ClicksHelper.upsertClickEvent(ContentType.OTHERS)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -207,6 +210,8 @@ class MyListFragment : Fragment() {
|
||||
putExtra(EXTRA_FAVORITE_CONTENT_TYPE, ContentType.SERIES.id)
|
||||
putExtra(EXTRA_FAVORITE_WEB_SERIES_IS_ENGLISH, false)
|
||||
})
|
||||
|
||||
ClicksHelper.upsertClickEvent(ContentType.OTHERS)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -219,6 +224,8 @@ class MyListFragment : Fragment() {
|
||||
putExtra(EXTRA_FAVORITE_CONTENT_TYPE, ContentType.AUDIO.id)
|
||||
}
|
||||
)
|
||||
|
||||
ClicksHelper.upsertClickEvent(ContentType.OTHERS)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -231,6 +238,8 @@ class MyListFragment : Fragment() {
|
||||
putExtra(EXTRA_FAVORITE_CONTENT_TYPE, ContentType.GAME.id)
|
||||
}
|
||||
)
|
||||
|
||||
ClicksHelper.upsertClickEvent(ContentType.OTHERS)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -243,6 +252,8 @@ class MyListFragment : Fragment() {
|
||||
putExtra(EXTRA_FAVORITE_CONTENT_TYPE, ContentType.KARAOKE_VIDEO.id)
|
||||
}
|
||||
)
|
||||
|
||||
ClicksHelper.upsertClickEvent(ContentType.OTHERS)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -258,22 +269,18 @@ class MyListFragment : Fragment() {
|
||||
|
||||
@Suppress("DEPRECATION")
|
||||
result?.data?.getParcelableExtra<ShowData>(EXTRA_SHOW_DATA)?.let { showData ->
|
||||
val hPos =
|
||||
webSeriesHAdapter.currentList.indexOfFirst { it.id == showData.id }
|
||||
val hPos = webSeriesHAdapter.currentList.indexOfFirst { it.id == showData.id }
|
||||
if (hPos >= 0 && hPos < webSeriesHAdapter.currentList.size) {
|
||||
webSeriesHAdapter.currentList[hPos].likes_count = showData.likes_count
|
||||
webSeriesHAdapter.currentList[hPos].is_liked = showData.is_liked
|
||||
webSeriesHAdapter.currentList[hPos].bookmark_category_ids =
|
||||
showData.favourite_category_ids
|
||||
webSeriesHAdapter.currentList[hPos].bookmark_category_ids = showData.favourite_category_ids
|
||||
}
|
||||
|
||||
val ePos =
|
||||
webSeriesEAdapter.currentList.indexOfFirst { it.id == showData.id }
|
||||
val ePos = webSeriesEAdapter.currentList.indexOfFirst { it.id == showData.id }
|
||||
if (ePos >= 0 && ePos < webSeriesEAdapter.currentList.size) {
|
||||
webSeriesEAdapter.currentList[ePos].likes_count = showData.likes_count
|
||||
webSeriesEAdapter.currentList[ePos].is_liked = showData.is_liked
|
||||
webSeriesEAdapter.currentList[hPos].bookmark_category_ids =
|
||||
showData.favourite_category_ids
|
||||
webSeriesEAdapter.currentList[ePos].bookmark_category_ids = showData.favourite_category_ids
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -324,53 +331,29 @@ class MyListFragment : Fragment() {
|
||||
progressBar.hide()
|
||||
|
||||
result.show_data?.let { showData ->
|
||||
if (showData.isNotEmpty()) {
|
||||
val engList = mutableListOf<BookmarkedShowData>()
|
||||
val hinList = mutableListOf<BookmarkedShowData>()
|
||||
|
||||
for (show in showData) {
|
||||
if (show.bookmark_category_ids?.isEmpty() == true) continue
|
||||
|
||||
val ids = show.bookmark_category_ids?.split(",")
|
||||
ids?.let { bIds ->
|
||||
if (bIds.isNotEmpty()) {
|
||||
when (bIds.size) {
|
||||
1 -> if (bIds[0] == "1") engList.add(show) else hinList.add(
|
||||
show
|
||||
)
|
||||
|
||||
else -> {
|
||||
engList.add(show)
|
||||
hinList.add(show)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
showData.english?.let {engList ->
|
||||
if (engList.isNotEmpty()) {
|
||||
webSeriesEnglishView.show()
|
||||
dataLoaded = true
|
||||
webSeriesEAdapter.submitList(engList)
|
||||
webSeriesEAdapter.submitList(ArrayList(engList))
|
||||
|
||||
webSeriesEngViewAll.setVisibility(showData.size >= 3)
|
||||
webSeriesEngViewAll.setVisibility(engList.size >= 3)
|
||||
} else {
|
||||
onListGotEmpty(PostType.WEB_SERIES, true)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
showData.hindi?.let {hinList ->
|
||||
if (hinList.isNotEmpty()) {
|
||||
webSeriesHindiView.show()
|
||||
dataLoaded = true
|
||||
webSeriesHAdapter.submitList(hinList)
|
||||
webSeriesHAdapter.submitList(ArrayList(hinList))
|
||||
|
||||
webSeriesHinViewAll.setVisibility(showData.size >= 3)
|
||||
webSeriesHinViewAll.setVisibility(hinList.size >= 3)
|
||||
} else {
|
||||
onListGotEmpty(PostType.WEB_SERIES, false)
|
||||
}
|
||||
|
||||
} else {
|
||||
webSeriesEnglishView.hide()
|
||||
webSeriesHindiView.hide()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -542,31 +525,43 @@ class MyListFragment : Fragment() {
|
||||
onListGotEmpty(PostType.WEB_SERIES, false)
|
||||
}
|
||||
|
||||
MyListRepository.updateSeriesList(Collections.emptyList())
|
||||
MyListRepository.updateSeriesList(Collections.emptyList(), showCategory)
|
||||
}
|
||||
|
||||
is ApiResult.Loading -> {}
|
||||
is ApiResult.Success -> {
|
||||
response.data?.result?.show_data?.let {
|
||||
if (showCategory == "1") {
|
||||
if (it.isNotEmpty()) {
|
||||
webSeriesEAdapter.submitList(it)
|
||||
} else {
|
||||
onListGotEmpty(PostType.WEB_SERIES, true)
|
||||
when (showCategory){
|
||||
"1" -> {
|
||||
it.english?.let {engList ->
|
||||
if (engList.isNotEmpty()) {
|
||||
webSeriesEAdapter.submitList(engList)
|
||||
} else {
|
||||
onListGotEmpty(PostType.WEB_SERIES, true)
|
||||
}
|
||||
|
||||
binding.webSeriesEngViewAll.setVisibility(engList.size >= 3)
|
||||
|
||||
MyListRepository.updateSeriesList(engList, showCategory)
|
||||
}
|
||||
}
|
||||
|
||||
binding.webSeriesEngViewAll.setVisibility(it.size >= 3)
|
||||
} else if (showCategory == "18") {
|
||||
if (it.isNotEmpty()) {
|
||||
webSeriesHAdapter.submitList(it)
|
||||
} else {
|
||||
onListGotEmpty(PostType.WEB_SERIES, false)
|
||||
"18" -> {
|
||||
it.hindi?.let {hinList ->
|
||||
if (hinList.isNotEmpty()) {
|
||||
webSeriesHAdapter.submitList(hinList)
|
||||
} else {
|
||||
onListGotEmpty(PostType.WEB_SERIES, false)
|
||||
}
|
||||
|
||||
binding.webSeriesHinViewAll.setVisibility(hinList.size >= 3)
|
||||
|
||||
MyListRepository.updateSeriesList(hinList, showCategory)
|
||||
}
|
||||
}
|
||||
|
||||
binding.webSeriesHinViewAll.setVisibility(it.size >= 3)
|
||||
else -> {}
|
||||
}
|
||||
|
||||
MyListRepository.updateSeriesList(it)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -657,6 +652,8 @@ class MyListFragment : Fragment() {
|
||||
|
||||
like.isSelected = !like.isSelected
|
||||
likeCount.text = "${audioBookData.likes_count}"
|
||||
|
||||
clickHelper.upsertClickEvent(ContentType.AUDIO, audioBookData.id)
|
||||
}
|
||||
|
||||
fav.setOnClickListener {
|
||||
@@ -672,6 +669,8 @@ class MyListFragment : Fragment() {
|
||||
|
||||
fav.isSelected = !fav.isSelected
|
||||
itemRemovedFromDialog = !fav.isSelected
|
||||
|
||||
clickHelper.upsertClickEvent(ContentType.AUDIO, audioBookData.id)
|
||||
}
|
||||
|
||||
close.setOnClickListener {
|
||||
@@ -686,6 +685,8 @@ class MyListFragment : Fragment() {
|
||||
// item was not at last removed
|
||||
MyListRepository.setLoadNewDataFlag(false)
|
||||
}
|
||||
|
||||
clickHelper.upsertClickEvent(ContentType.AUDIO, audioBookData.id)
|
||||
}
|
||||
|
||||
itemRemovedFromDialog = false
|
||||
@@ -761,7 +762,12 @@ class MyListFragment : Fragment() {
|
||||
.build()
|
||||
)
|
||||
},
|
||||
null
|
||||
mutableListOf(
|
||||
VideoViewRequestData(
|
||||
audioBookData.id,
|
||||
ContentType.AUDIO
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
putExtra(PlayerActivity.EXTRA_PLAY_INDEX, 0)
|
||||
@@ -842,7 +848,11 @@ class MyListFragment : Fragment() {
|
||||
startActivity(Intent(activity, GamePlayerActivity::class.java).apply {
|
||||
putExtra(
|
||||
GamePlayerActivity.EXTRA_GAME_PLAYER_DATA,
|
||||
GamePlayerData(it, gameData.screen_orientation == "Landscape")
|
||||
GamePlayerData(
|
||||
gameData.id,
|
||||
it,
|
||||
gameData.screen_orientation == "Landscape"
|
||||
)
|
||||
)
|
||||
})
|
||||
|
||||
@@ -867,6 +877,8 @@ class MyListFragment : Fragment() {
|
||||
|
||||
like.isSelected = !like.isSelected
|
||||
likeCount.text = "${gameData.likes_count}"
|
||||
|
||||
clickHelper.upsertClickEvent(ContentType.GAME, gameData.id)
|
||||
}
|
||||
|
||||
fav.setOnClickListener {
|
||||
@@ -882,6 +894,8 @@ class MyListFragment : Fragment() {
|
||||
|
||||
fav.isSelected = !fav.isSelected
|
||||
itemRemovedFromDialog = !fav.isSelected
|
||||
|
||||
clickHelper.upsertClickEvent(ContentType.GAME, gameData.id)
|
||||
}
|
||||
|
||||
close.setOnClickListener {
|
||||
@@ -896,6 +910,8 @@ class MyListFragment : Fragment() {
|
||||
// item was not at last removed
|
||||
MyListRepository.setLoadNewDataFlag(false)
|
||||
}
|
||||
|
||||
clickHelper.upsertClickEvent(ContentType.GAME, gameData.id)
|
||||
}
|
||||
|
||||
itemRemovedFromDialog = false
|
||||
@@ -984,12 +1000,19 @@ class MyListFragment : Fragment() {
|
||||
).apply {
|
||||
putExtra(
|
||||
KaraokePlayerActivity.EXTRA_KARAOKE_DATA,
|
||||
KaraokePlayerData(it, karaokeData.title)
|
||||
KaraokePlayerData(
|
||||
it,
|
||||
karaokeData.title,
|
||||
karaokeData.id
|
||||
)
|
||||
)
|
||||
})
|
||||
}
|
||||
}
|
||||
clickHelper.upsertClickEvent(ContentType.KARAOKE_VIDEO, karaokeData.id)
|
||||
clickHelper.upsertClickEvent(
|
||||
ContentType.KARAOKE_VIDEO,
|
||||
karaokeData.id
|
||||
)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@@ -1012,12 +1035,19 @@ class MyListFragment : Fragment() {
|
||||
).apply {
|
||||
putExtra(
|
||||
KaraokePlayerActivity.EXTRA_KARAOKE_DATA,
|
||||
KaraokePlayerData(it, karaokeData.title)
|
||||
KaraokePlayerData(
|
||||
it,
|
||||
karaokeData.title,
|
||||
karaokeData.id
|
||||
)
|
||||
)
|
||||
})
|
||||
}
|
||||
}
|
||||
clickHelper.upsertClickEvent(ContentType.KARAOKE_VIDEO, karaokeData.id)
|
||||
clickHelper.upsertClickEvent(
|
||||
ContentType.KARAOKE_VIDEO,
|
||||
karaokeData.id
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1054,6 +1084,8 @@ class MyListFragment : Fragment() {
|
||||
|
||||
like.isSelected = !like.isSelected
|
||||
likeCount.text = "${karaokeData.likes_count}"
|
||||
|
||||
clickHelper.upsertClickEvent(ContentType.KARAOKE_VIDEO, karaokeData.id)
|
||||
}
|
||||
|
||||
fav.setOnClickListener {
|
||||
@@ -1069,6 +1101,8 @@ class MyListFragment : Fragment() {
|
||||
|
||||
fav.isSelected = !fav.isSelected
|
||||
itemRemovedFromDialog = !fav.isSelected
|
||||
|
||||
clickHelper.upsertClickEvent(ContentType.KARAOKE_VIDEO, karaokeData.id)
|
||||
}
|
||||
|
||||
close.setOnClickListener {
|
||||
@@ -1083,6 +1117,8 @@ class MyListFragment : Fragment() {
|
||||
// item was not at last removed
|
||||
MyListRepository.setLoadNewDataFlag(false)
|
||||
}
|
||||
|
||||
clickHelper.upsertClickEvent(ContentType.KARAOKE_VIDEO, karaokeData.id)
|
||||
}
|
||||
|
||||
itemRemovedFromDialog = false
|
||||
|
||||
@@ -6,6 +6,7 @@ import com.woka.home.mylist.models.FavGameData
|
||||
import com.woka.home.mylist.models.FavKaraokeData
|
||||
import com.woka.home.mylist.models.MyListResponse
|
||||
import com.woka.home.mylist.models.Result
|
||||
import com.woka.home.mylist.models.ShowDataResponse
|
||||
import com.woka.networking.ApiResult
|
||||
import com.woka.userdata.UserRepository
|
||||
|
||||
@@ -14,7 +15,7 @@ object MyListRepository {
|
||||
private var myFavData: MyListResponse = MyListResponse(Result(
|
||||
ArrayList(),
|
||||
ArrayList(),
|
||||
ArrayList(),
|
||||
ShowDataResponse(ArrayList(), ArrayList()),
|
||||
ArrayList(),
|
||||
ArrayList(),
|
||||
0
|
||||
@@ -34,7 +35,8 @@ object MyListRepository {
|
||||
fun clearData(){
|
||||
shallLoadNewData = true
|
||||
myFavData.result?.let {
|
||||
it.show_data?.clear()
|
||||
it.show_data?.hindi?.clear()
|
||||
it.show_data?.english?.clear()
|
||||
it.game_data?.clear()
|
||||
it.audio_data?.clear()
|
||||
it.sing_karaoke_data?.clear()
|
||||
@@ -64,9 +66,17 @@ object MyListRepository {
|
||||
}
|
||||
}
|
||||
|
||||
fun updateSeriesList(bookmarkedShowData: MutableList<BookmarkedShowData>) {
|
||||
myFavData.result?.show_data?.clear()
|
||||
myFavData.result?.show_data?.addAll(bookmarkedShowData)
|
||||
fun updateSeriesList(bookmarkedShowData: MutableList<BookmarkedShowData>, categoryId: String) {
|
||||
when (categoryId){
|
||||
"1" -> {
|
||||
myFavData.result?.show_data?.english?.clear()
|
||||
myFavData.result?.show_data?.english?.addAll(bookmarkedShowData)
|
||||
}
|
||||
"18" -> {
|
||||
myFavData.result?.show_data?.hindi?.clear()
|
||||
myFavData.result?.show_data?.hindi?.addAll(bookmarkedShowData)
|
||||
}
|
||||
}
|
||||
|
||||
shallLoadNewData = false
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ package com.woka.home.mylist.models
|
||||
data class Result(
|
||||
val audio_data: ArrayList<FavAudioBookData>?,
|
||||
val game_data: ArrayList<FavGameData>?,
|
||||
val show_data: ArrayList<BookmarkedShowData>?,
|
||||
val show_data: ShowDataResponse?,
|
||||
val sing_karaoke_data: ArrayList<FavKaraokeData>?,
|
||||
val video_data: ArrayList<Any>?,
|
||||
val total_records: Int?
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
package com.woka.home.mylist.models
|
||||
|
||||
data class ShowDataResponse(
|
||||
val english: ArrayList<BookmarkedShowData>?,
|
||||
val hindi: ArrayList<BookmarkedShowData>?
|
||||
)
|
||||
@@ -9,6 +9,7 @@ import androidx.core.view.WindowInsetsCompat
|
||||
import androidx.fragment.app.Fragment
|
||||
import androidx.lifecycle.ViewModelProvider
|
||||
import com.woka.R
|
||||
import com.woka.database.helpers.ClicksHelper
|
||||
import com.woka.database.models.clicks.ContentType
|
||||
import com.woka.databinding.ActivityFavoritesBinding
|
||||
import com.woka.home.mylist.view.fragments.FavAudioFragment
|
||||
@@ -60,6 +61,13 @@ class FavoritesActivity : AppCompatActivity() {
|
||||
initFragment()
|
||||
}
|
||||
|
||||
@Suppress("DEPRECATION")
|
||||
@Deprecated("Deprecated in Java")
|
||||
override fun onBackPressed() {
|
||||
super.onBackPressed()
|
||||
ClicksHelper.upsertClickEvent(ContentType.OTHERS)
|
||||
}
|
||||
|
||||
private fun initViews(){
|
||||
binding.apply {
|
||||
title.text = favTitle
|
||||
@@ -70,6 +78,7 @@ class FavoritesActivity : AppCompatActivity() {
|
||||
binding.apply {
|
||||
backBtn.setOnClickListener {
|
||||
onBackPressedDispatcher.onBackPressed()
|
||||
ClicksHelper.upsertClickEvent(ContentType.OTHERS)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,6 +28,7 @@ import com.woka.home.mylist.MyListRepository
|
||||
import com.woka.home.mylist.viewmodel.FavoriteViewModel
|
||||
import com.woka.networking.ApiResult
|
||||
import com.woka.players.models.VideoPlayList
|
||||
import com.woka.players.models.VideoViewRequestData
|
||||
import com.woka.players.views.PlayerActivity
|
||||
import com.woka.utils.hide
|
||||
import com.woka.utils.isNetworkConnected
|
||||
@@ -59,7 +60,8 @@ class FavAudioFragment : Fragment() {
|
||||
): View {
|
||||
binding = FragmentFavoritesBinding.inflate(inflater, container, false)
|
||||
viewModel = ViewModelProvider(requireActivity())[FavoriteViewModel::class.java]
|
||||
adapter = AudioBooksAdapter(requireContext(), ::onAudioBookClicked, ::onBookChanged, false){}
|
||||
adapter =
|
||||
AudioBooksAdapter(requireContext(), ::onAudioBookClicked, ::onBookChanged, false) {}
|
||||
return binding.root
|
||||
}
|
||||
|
||||
@@ -79,22 +81,23 @@ class FavAudioFragment : Fragment() {
|
||||
|
||||
setObservers()
|
||||
|
||||
if (!viewModel.favoritesLiveData.isInitialized || viewModel.favoritesLiveData.value !is ApiResult.Success){
|
||||
if (!viewModel.favoritesLiveData.isInitialized || viewModel.favoritesLiveData.value !is ApiResult.Success) {
|
||||
viewModel.loadFavorites(ContentType.AUDIO)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private fun initViews(){
|
||||
private fun initViews() {
|
||||
binding.apply {
|
||||
rvFavorites.adapter = adapter
|
||||
}
|
||||
}
|
||||
|
||||
private fun clickEvents(){
|
||||
private fun clickEvents() {
|
||||
binding.apply {
|
||||
loadMoreBtn.setOnClickListener {
|
||||
viewModel.loadFavorites(ContentType.AUDIO)
|
||||
ClicksHelper.upsertClickEvent(ContentType.OTHERS)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -129,16 +132,16 @@ class FavAudioFragment : Fragment() {
|
||||
}
|
||||
}
|
||||
|
||||
private fun setObservers(){
|
||||
viewModel.favoritesLiveData.observe(viewLifecycleOwner){
|
||||
private fun setObservers() {
|
||||
viewModel.favoritesLiveData.observe(viewLifecycleOwner) {
|
||||
binding.apply {
|
||||
when (it){
|
||||
when (it) {
|
||||
is ApiResult.Error -> {
|
||||
if (adapter.itemCount == 0){
|
||||
if (adapter.itemCount == 0) {
|
||||
// no orders at all
|
||||
dataView.hide()
|
||||
noData.show()
|
||||
}else{
|
||||
} else {
|
||||
// load more orders failed
|
||||
dataView.show()
|
||||
shimmer.hide()
|
||||
@@ -147,6 +150,7 @@ class FavAudioFragment : Fragment() {
|
||||
loadMoreBtn.show()
|
||||
}
|
||||
}
|
||||
|
||||
is ApiResult.Loading -> {
|
||||
noData.hide()
|
||||
|
||||
@@ -155,8 +159,9 @@ class FavAudioFragment : Fragment() {
|
||||
|
||||
loadMoreBtn.hide()
|
||||
}
|
||||
|
||||
is ApiResult.Success -> {
|
||||
it.data?.result?.audio_data?.let {audioList ->
|
||||
it.data?.result?.audio_data?.let { audioList ->
|
||||
noData.hide()
|
||||
|
||||
dataView.show()
|
||||
@@ -173,9 +178,7 @@ class FavAudioFragment : Fragment() {
|
||||
}
|
||||
}
|
||||
|
||||
private fun onBookChanged(i: Int, audioBookData: AudioBookData) {
|
||||
|
||||
}
|
||||
private fun onBookChanged(i: Int, audioBookData: AudioBookData) {}
|
||||
|
||||
private fun onAudioBookClicked(audioBookData: AudioBookData) {
|
||||
dialogBinding.apply {
|
||||
@@ -260,6 +263,8 @@ class FavAudioFragment : Fragment() {
|
||||
|
||||
like.isSelected = !like.isSelected
|
||||
likeCount.text = "${audioBookData.likes_count}"
|
||||
|
||||
clickHelper.upsertClickEvent(ContentType.AUDIO, audioBookData.id)
|
||||
}
|
||||
|
||||
fav.setOnClickListener {
|
||||
@@ -276,6 +281,8 @@ class FavAudioFragment : Fragment() {
|
||||
audioBookData.mark_as_favourite = !fav.isSelected
|
||||
fav.isSelected = !fav.isSelected
|
||||
itemRemovedFromDialog = !fav.isSelected
|
||||
|
||||
clickHelper.upsertClickEvent(ContentType.AUDIO, audioBookData.id)
|
||||
}
|
||||
|
||||
close.setOnClickListener {
|
||||
@@ -290,6 +297,8 @@ class FavAudioFragment : Fragment() {
|
||||
// item was not at last removed
|
||||
MyListRepository.setLoadNewDataFlag(false)
|
||||
}
|
||||
|
||||
clickHelper.upsertClickEvent(ContentType.AUDIO, audioBookData.id)
|
||||
}
|
||||
|
||||
itemRemovedFromDialog = false
|
||||
@@ -336,7 +345,12 @@ class FavAudioFragment : Fragment() {
|
||||
.build()
|
||||
)
|
||||
},
|
||||
null
|
||||
mutableListOf(
|
||||
VideoViewRequestData(
|
||||
audioBookData.id,
|
||||
ContentType.AUDIO
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
putExtra(PlayerActivity.EXTRA_PLAY_INDEX, 0)
|
||||
|
||||
@@ -125,6 +125,7 @@ class FavGameFragment : Fragment() {
|
||||
binding.apply {
|
||||
loadMoreBtn.setOnClickListener {
|
||||
viewModel.loadFavorites(ContentType.GAME)
|
||||
ClicksHelper.upsertClickEvent(ContentType.OTHERS)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -242,7 +243,7 @@ class FavGameFragment : Fragment() {
|
||||
startActivity(Intent(activity, GamePlayerActivity::class.java).apply {
|
||||
putExtra(
|
||||
GamePlayerActivity.EXTRA_GAME_PLAYER_DATA,
|
||||
GamePlayerData(it, gameData.screen_orientation == "Landscape")
|
||||
GamePlayerData(gameData.id, it, gameData.screen_orientation == "Landscape")
|
||||
)
|
||||
})
|
||||
|
||||
@@ -267,6 +268,8 @@ class FavGameFragment : Fragment() {
|
||||
|
||||
like.isSelected = !like.isSelected
|
||||
likeCount.text = "${gameData.likes_count}"
|
||||
|
||||
clickHelper.upsertClickEvent(ContentType.GAME, gameData.id)
|
||||
}
|
||||
|
||||
fav.setOnClickListener {
|
||||
@@ -283,6 +286,8 @@ class FavGameFragment : Fragment() {
|
||||
gameData.mark_as_favourite = !fav.isSelected
|
||||
fav.isSelected = !fav.isSelected
|
||||
itemRemovedFromDialog = !fav.isSelected
|
||||
|
||||
clickHelper.upsertClickEvent(ContentType.GAME, gameData.id)
|
||||
}
|
||||
|
||||
close.setOnClickListener {
|
||||
@@ -297,6 +302,8 @@ class FavGameFragment : Fragment() {
|
||||
// item was not at last removed
|
||||
MyListRepository.setLoadNewDataFlag(false)
|
||||
}
|
||||
|
||||
clickHelper.upsertClickEvent(ContentType.GAME, gameData.id)
|
||||
}
|
||||
|
||||
itemRemovedFromDialog = false
|
||||
|
||||
@@ -124,6 +124,7 @@ class FavKaraokeFragment : Fragment() {
|
||||
binding.apply {
|
||||
loadMoreBtn.setOnClickListener {
|
||||
viewModel.loadFavorites(ContentType.KARAOKE_VIDEO)
|
||||
ClicksHelper.upsertClickEvent(ContentType.OTHERS)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -172,9 +173,7 @@ class FavKaraokeFragment : Fragment() {
|
||||
}
|
||||
}
|
||||
|
||||
private fun onKaraokeChanged(i: Int, b: Boolean, karaokeData: KaraokeData) {
|
||||
|
||||
}
|
||||
private fun onKaraokeChanged(i: Int, b: Boolean, karaokeData: KaraokeData) {}
|
||||
|
||||
private fun onKaraokeClicked(karaokeData: KaraokeData) {
|
||||
dialogBinding.apply {
|
||||
@@ -223,7 +222,7 @@ class FavKaraokeFragment : Fragment() {
|
||||
).apply {
|
||||
putExtra(
|
||||
KaraokePlayerActivity.EXTRA_KARAOKE_DATA,
|
||||
KaraokePlayerData(it, karaokeData.title)
|
||||
KaraokePlayerData(it, karaokeData.title, karaokeData.id)
|
||||
)
|
||||
})
|
||||
}
|
||||
@@ -251,7 +250,7 @@ class FavKaraokeFragment : Fragment() {
|
||||
).apply {
|
||||
putExtra(
|
||||
KaraokePlayerActivity.EXTRA_KARAOKE_DATA,
|
||||
KaraokePlayerData(it, karaokeData.title)
|
||||
KaraokePlayerData(it, karaokeData.title, karaokeData.id)
|
||||
)
|
||||
})
|
||||
}
|
||||
@@ -293,6 +292,8 @@ class FavKaraokeFragment : Fragment() {
|
||||
|
||||
like.isSelected = !like.isSelected
|
||||
likeCount.text = "${karaokeData.likes_count}"
|
||||
|
||||
clickHelper.upsertClickEvent(ContentType.KARAOKE_VIDEO, karaokeData.id)
|
||||
}
|
||||
|
||||
fav.setOnClickListener {
|
||||
@@ -309,6 +310,8 @@ class FavKaraokeFragment : Fragment() {
|
||||
karaokeData.mark_as_favourite = !fav.isSelected
|
||||
fav.isSelected = !fav.isSelected
|
||||
itemRemovedFromDialog = !fav.isSelected
|
||||
|
||||
clickHelper.upsertClickEvent(ContentType.KARAOKE_VIDEO, karaokeData.id)
|
||||
}
|
||||
|
||||
close.setOnClickListener {
|
||||
@@ -323,6 +326,8 @@ class FavKaraokeFragment : Fragment() {
|
||||
// item was not at last removed
|
||||
MyListRepository.setLoadNewDataFlag(false)
|
||||
}
|
||||
|
||||
clickHelper.upsertClickEvent(ContentType.KARAOKE_VIDEO, karaokeData.id)
|
||||
}
|
||||
|
||||
itemRemovedFromDialog = false
|
||||
|
||||
@@ -73,6 +73,7 @@ class FavSeriesFragment : Fragment() {
|
||||
binding.apply {
|
||||
loadMoreBtn.setOnClickListener {
|
||||
viewModel.loadFavorites(ContentType.SERIES, if (viewModel.webSeriesIsEnglish) "1" else "18")
|
||||
ClicksHelper.upsertClickEvent(ContentType.OTHERS)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -104,7 +105,7 @@ class FavSeriesFragment : Fragment() {
|
||||
loadMoreBtn.hide()
|
||||
}
|
||||
is ApiResult.Success -> {
|
||||
it.data?.result?.show_data?.let {showList ->
|
||||
it.data?.result?.show_data?.let {showData ->
|
||||
noData.hide()
|
||||
|
||||
dataView.show()
|
||||
@@ -113,7 +114,15 @@ class FavSeriesFragment : Fragment() {
|
||||
loadMoreBtn.text = getString(R.string.load_more)
|
||||
loadMoreBtn.setVisibility(!viewModel.lastPage)
|
||||
|
||||
adapter.submitListShowList(showList.map { ShowData(it) }, if (viewModel.webSeriesIsEnglish) "1" else "18")
|
||||
if (viewModel.webSeriesIsEnglish){
|
||||
showData.english?.let {engList ->
|
||||
adapter.submitListShowList(engList.map { ShowData(it) }, "1")
|
||||
}
|
||||
}else{
|
||||
showData.hindi?.let {hinList ->
|
||||
adapter.submitListShowList(hinList.map { ShowData(it) }, "18")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -132,16 +141,37 @@ class FavSeriesFragment : Fragment() {
|
||||
adapter.showList[hPos].likes_count = showData.likes_count
|
||||
adapter.showList[hPos].is_liked = showData.is_liked
|
||||
adapter.showList[hPos].favourite_category_ids = showData.favourite_category_ids
|
||||
|
||||
result.data?.getStringExtra(EXTRA_SHOW_CATEGORY)?.let { showCategory ->
|
||||
onWebShowItemChanged(hPos, showCategory)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun onShowCommonDataChanged(showData: ShowData, categoryId: String) {
|
||||
private fun onWebShowItemChanged(position: Int, showCategory: String) {
|
||||
if (viewModel.lastPage){
|
||||
if (position >= 0 && position < adapter.showList.size){
|
||||
val list = adapter.showList.toMutableList()
|
||||
list.removeAt(position)
|
||||
|
||||
if (list.isNotEmpty()){
|
||||
adapter.submitListShowList(list, showCategory)
|
||||
}else{
|
||||
binding.noData.show()
|
||||
binding.rvFavorites.hide()
|
||||
}
|
||||
}
|
||||
}else{
|
||||
viewModel.resetPagination()
|
||||
viewModel.loadFavorites(ContentType.SERIES, showCategory)
|
||||
}
|
||||
}
|
||||
|
||||
private fun onShowCommonDataChanged(showData: ShowData, categoryId: String) {}
|
||||
|
||||
// web show
|
||||
private fun onWebShowClicked(showData: ShowData, categoryId: String) {
|
||||
webShowIntentLauncher?.launch(Intent(context, WebSeriesActivity::class.java).apply {
|
||||
|
||||
@@ -7,6 +7,7 @@ import androidx.lifecycle.viewModelScope
|
||||
import com.woka.database.models.clicks.ContentType
|
||||
import com.woka.home.mylist.models.MyListResponse
|
||||
import com.woka.home.mylist.models.Result
|
||||
import com.woka.home.mylist.models.ShowDataResponse
|
||||
import com.woka.networking.ApiResult
|
||||
import com.woka.userdata.UserRepository
|
||||
import kotlinx.coroutines.launch
|
||||
@@ -24,7 +25,7 @@ class FavoriteViewModel : ViewModel() {
|
||||
|
||||
private val myListResponse = MyListResponse(
|
||||
Result(
|
||||
ArrayList(), ArrayList(), ArrayList(), ArrayList(), ArrayList(), 0
|
||||
ArrayList(), ArrayList(), ShowDataResponse(ArrayList(), ArrayList()), ArrayList(), ArrayList(), 0
|
||||
)
|
||||
)
|
||||
|
||||
@@ -50,18 +51,38 @@ class FavoriteViewModel : ViewModel() {
|
||||
value.data?.let {
|
||||
when (contentType) {
|
||||
ContentType.SERIES -> {
|
||||
it.result?.show_data?.let { newList ->
|
||||
it.result?.show_data?.let { showData ->
|
||||
when (categoryId){
|
||||
"1" -> {
|
||||
showData.english?.let {newList ->
|
||||
myListResponse.result?.show_data?.english?.addAll(newList)
|
||||
|
||||
myListResponse.result?.show_data?.addAll(newList)
|
||||
lastPage = myListResponse.result?.show_data?.english?.size == it.result.total_records
|
||||
|
||||
lastPage = myListResponse.result?.show_data?.size == it.result.total_records
|
||||
_favoritesLiveData.postValue(
|
||||
ApiResult.Success(
|
||||
myListResponse
|
||||
)
|
||||
)
|
||||
nextPageToLoad++
|
||||
}
|
||||
}
|
||||
"18" -> {
|
||||
showData.hindi?.let {newList ->
|
||||
myListResponse.result?.show_data?.hindi?.addAll(newList)
|
||||
|
||||
_favoritesLiveData.postValue(
|
||||
ApiResult.Success(
|
||||
myListResponse
|
||||
)
|
||||
)
|
||||
nextPageToLoad++
|
||||
lastPage = myListResponse.result?.show_data?.hindi?.size == it.result.total_records
|
||||
|
||||
_favoritesLiveData.postValue(
|
||||
ApiResult.Success(
|
||||
myListResponse
|
||||
)
|
||||
)
|
||||
nextPageToLoad++
|
||||
}
|
||||
}
|
||||
else -> {}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -122,4 +143,9 @@ class FavoriteViewModel : ViewModel() {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun resetPagination() {
|
||||
nextPageToLoad = 0
|
||||
lastPage = false
|
||||
}
|
||||
}
|
||||
@@ -49,6 +49,7 @@ class AboutActivity : WokaBaseActivity() {
|
||||
binding.apply {
|
||||
backBtn.setOnClickListener {
|
||||
onBackPressedDispatcher.onBackPressed()
|
||||
ClicksHelper.upsertClickEvent(ContentType.OTHERS)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -83,6 +83,7 @@ class FaqActivity : AppCompatActivity() {
|
||||
binding.apply {
|
||||
backBtn.setOnClickListener {
|
||||
onBackPressedDispatcher.onBackPressed()
|
||||
ClicksHelper.upsertClickEvent(ContentType.OTHERS)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,6 +9,8 @@ import androidx.recyclerview.widget.DiffUtil
|
||||
import androidx.recyclerview.widget.ListAdapter
|
||||
import androidx.recyclerview.widget.RecyclerView.ViewHolder
|
||||
import com.woka.R
|
||||
import com.woka.database.helpers.ClicksHelper
|
||||
import com.woka.database.models.clicks.ContentType
|
||||
import com.woka.databinding.FaqViewHolderBinding
|
||||
import com.woka.modules.faqs.models.Faq
|
||||
import com.woka.utils.hide
|
||||
@@ -84,6 +86,7 @@ class FaqsAdapter(config: AsyncDifferConfig<Faq>) :
|
||||
openedFaq = position
|
||||
}
|
||||
|
||||
ClicksHelper.upsertClickEvent(ContentType.OTHERS)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -85,6 +85,7 @@ class UserProfileActivity : WokaBaseActivity() {
|
||||
|
||||
backBtn.setOnClickListener {
|
||||
onBackPressedDispatcher.onBackPressed()
|
||||
ClicksHelper.upsertClickEvent(ContentType.OTHERS)
|
||||
}
|
||||
|
||||
update.setOnClickListener {
|
||||
|
||||
@@ -153,6 +153,7 @@ class SupportActivity : WokaBaseActivity() {
|
||||
binding.apply {
|
||||
backBtn.setOnClickListener {
|
||||
onBackPressedDispatcher.onBackPressed()
|
||||
ClicksHelper.upsertClickEvent(ContentType.OTHERS)
|
||||
}
|
||||
|
||||
submit.setOnClickListener {
|
||||
|
||||
@@ -145,6 +145,8 @@ class HomeActivity : WokaBaseActivity(),
|
||||
|
||||
decisionDialog.show()
|
||||
}
|
||||
|
||||
ClicksHelper.upsertClickEvent(ContentType.OTHERS)
|
||||
}
|
||||
|
||||
override fun onDestroy() {
|
||||
|
||||
@@ -28,6 +28,7 @@ import com.woka.modules.wokasongs.WokaSongsAdapter
|
||||
import com.woka.modules.wokasongs.WokaSongsRepository
|
||||
import com.woka.networking.ApiResult
|
||||
import com.woka.players.models.VideoPlayList
|
||||
import com.woka.players.models.VideoViewRequestData
|
||||
import com.woka.players.views.PlayerActivity
|
||||
import com.woka.utils.WokaBaseActivity
|
||||
import com.woka.utils.hide
|
||||
@@ -138,7 +139,12 @@ class MoreHomeActivity : WokaBaseActivity() {
|
||||
.build()
|
||||
)
|
||||
},
|
||||
null
|
||||
mutableListOf(
|
||||
VideoViewRequestData(
|
||||
0,
|
||||
ContentType.TEASER
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
putExtra(PlayerActivity.EXTRA_PLAY_INDEX, 0)
|
||||
|
||||
@@ -102,9 +102,10 @@ class KaraokeActivity : WokaBaseActivity() {
|
||||
}
|
||||
}
|
||||
|
||||
override fun onDestroy() {
|
||||
super.onDestroy()
|
||||
|
||||
@Suppress("DEPRECATION")
|
||||
@Deprecated("Deprecated in Java")
|
||||
override fun onBackPressed() {
|
||||
super.onBackPressed()
|
||||
ClicksHelper.upsertClickEvent(ContentType.OTHERS)
|
||||
}
|
||||
|
||||
@@ -158,6 +159,7 @@ class KaraokeActivity : WokaBaseActivity() {
|
||||
binding.apply {
|
||||
toolbar.backBtn.setOnClickListener {
|
||||
onBackPressedDispatcher.onBackPressed()
|
||||
ClicksHelper.upsertClickEvent(ContentType.OTHERS)
|
||||
}
|
||||
|
||||
retryBtn.setOnClickListener {
|
||||
|
||||
@@ -27,6 +27,7 @@ class DisclaimerActivity : WokaBaseActivity() {
|
||||
|
||||
binding.backBtn.setOnClickListener {
|
||||
onBackPressedDispatcher.onBackPressed()
|
||||
ClicksHelper.upsertClickEvent(ContentType.OTHERS)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -74,6 +74,7 @@ class WebViewActivity : WokaBaseActivity() {
|
||||
|
||||
override fun onSupportNavigateUp(): Boolean {
|
||||
onBackPressedDispatcher.onBackPressed()
|
||||
ClicksHelper.upsertClickEvent(ContentType.OTHERS)
|
||||
return true
|
||||
}
|
||||
|
||||
|
||||
@@ -99,10 +99,6 @@ class GetMoreInfoFragment : Fragment() {
|
||||
}
|
||||
|
||||
next.setOnClickListener {
|
||||
if (viewModel.selectedGender == Gender.NONE) {
|
||||
toast(getString(R.string.select_a_gender))
|
||||
return@setOnClickListener
|
||||
}
|
||||
if (isUnder16 && viewModel.interestTopics.isEmpty()){
|
||||
toast(getString(R.string.please_select_your_interests))
|
||||
return@setOnClickListener
|
||||
|
||||
@@ -12,6 +12,8 @@ import androidx.fragment.app.Fragment
|
||||
import androidx.lifecycle.ViewModelProvider
|
||||
import androidx.navigation.fragment.findNavController
|
||||
import com.google.android.material.tabs.TabLayoutMediator
|
||||
import com.google.firebase.analytics.ktx.analytics
|
||||
import com.google.firebase.ktx.Firebase
|
||||
import com.woka.R
|
||||
import com.woka.WokaApp.Companion.userPrefs
|
||||
import com.woka.database.helpers.ClicksHelper
|
||||
@@ -21,8 +23,10 @@ import com.woka.home.views.HomeActivity
|
||||
import com.woka.networking.ApiResult
|
||||
import com.woka.onboard.adapters.OnboardingAdapter
|
||||
import com.woka.onboard.mvvm.OnboardViewModel
|
||||
import com.woka.utils.ProgressView
|
||||
import com.woka.userPreference.UserType
|
||||
import com.woka.utils.ANALYTICS_GUEST_LOGIN
|
||||
import com.woka.utils.ANALYTICS_NEW_USER
|
||||
import com.woka.utils.ProgressView
|
||||
import com.woka.utils.toast
|
||||
|
||||
class OnboardFragment : Fragment() {
|
||||
@@ -77,6 +81,11 @@ class OnboardFragment : Fragment() {
|
||||
userPrefs?.userType = UserType.GUEST
|
||||
userPrefs?.guestUserName = data.fullname
|
||||
|
||||
if (data.new_guest == true){
|
||||
Firebase.analytics.logEvent(ANALYTICS_GUEST_LOGIN, null)
|
||||
Firebase.analytics.logEvent(ANALYTICS_NEW_USER, null)
|
||||
}
|
||||
|
||||
activity?.let { activity->
|
||||
startActivity(Intent(activity, HomeActivity::class.java).apply {
|
||||
addFlags(Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_CLEAR_TASK)
|
||||
|
||||
@@ -2,12 +2,15 @@ package com.woka.onboard.fragments
|
||||
|
||||
import android.content.Intent
|
||||
import android.os.Bundle
|
||||
import androidx.fragment.app.Fragment
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import androidx.fragment.app.Fragment
|
||||
import androidx.lifecycle.ViewModelProvider
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
import com.google.firebase.analytics.ktx.analytics
|
||||
import com.google.firebase.ktx.Firebase
|
||||
import com.onesignal.OneSignal
|
||||
import com.woka.R
|
||||
import com.woka.WokaApp.Companion.userPrefs
|
||||
import com.woka.database.helpers.ClicksHelper
|
||||
@@ -19,10 +22,12 @@ import com.woka.onboard.adapters.AvatarAdapter
|
||||
import com.woka.onboard.fragments.GetEmailFragment.Companion.IS_UNDER_16
|
||||
import com.woka.onboard.models.RegisterRequestData
|
||||
import com.woka.onboard.mvvm.OnboardViewModel
|
||||
import com.woka.userPreference.UserType
|
||||
import com.woka.userdata.UserRepository
|
||||
import com.woka.utils.ANALYTICS_NEW_USER
|
||||
import com.woka.utils.ANALYTICS_USER_SIGN_UP
|
||||
import com.woka.utils.Gender
|
||||
import com.woka.utils.ProgressView
|
||||
import com.woka.userPreference.UserType
|
||||
import com.woka.utils.toast
|
||||
import kotlinx.coroutines.launch
|
||||
import java.text.SimpleDateFormat
|
||||
@@ -86,13 +91,14 @@ class SelectAvatarFragment : Fragment() {
|
||||
birthdate = SimpleDateFormat("yyyy-MM-dd", Locale.getDefault()).format(selectedDOB.time),
|
||||
email = email,
|
||||
full_name = name,
|
||||
gender = if (selectedGender == Gender.MALE) "2" else "1",
|
||||
gender = if (selectedGender == Gender.MALE) "2" else if (selectedGender == Gender.FEMALE)"1" else "0",
|
||||
guardian_email = if (isUnder16) email else null,
|
||||
language_id = if (userPrefs?.appLanguage == "en") "1" else "2",
|
||||
password = password,
|
||||
user_type = if (isUnder16) "1" else "2",
|
||||
username = userName,
|
||||
interest_topic_id = if (isUnder16) interestTopics.toList() else null
|
||||
interest_topic_id = if (isUnder16) interestTopics.toList() else null,
|
||||
one_signal_player_id = OneSignal.User.onesignalId
|
||||
)
|
||||
}
|
||||
|
||||
@@ -158,6 +164,9 @@ class SelectAvatarFragment : Fragment() {
|
||||
UserRepository.logout()
|
||||
}
|
||||
|
||||
Firebase.analytics.logEvent(ANALYTICS_USER_SIGN_UP, null)
|
||||
Firebase.analytics.logEvent(ANALYTICS_NEW_USER, null)
|
||||
|
||||
// saving to user prefs
|
||||
userPrefs?.accessToken = result.remember_token?:"no_token_received"
|
||||
userPrefs?.userType = UserType.createUserType(result.user_type)
|
||||
|
||||
@@ -3,13 +3,15 @@ package com.woka.onboard.fragments
|
||||
import android.content.Intent
|
||||
import android.graphics.Color
|
||||
import android.os.Bundle
|
||||
import androidx.fragment.app.Fragment
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.view.WindowManager
|
||||
import androidx.fragment.app.Fragment
|
||||
import androidx.lifecycle.ViewModelProvider
|
||||
import androidx.navigation.fragment.findNavController
|
||||
import com.google.firebase.analytics.ktx.analytics
|
||||
import com.google.firebase.ktx.Firebase
|
||||
import com.woka.R
|
||||
import com.woka.WokaApp.Companion.userPrefs
|
||||
import com.woka.database.helpers.ClicksHelper
|
||||
@@ -19,9 +21,11 @@ import com.woka.home.views.HomeActivity
|
||||
import com.woka.networking.ApiResult
|
||||
import com.woka.onboard.fragments.GetEmailFragment.Companion.IS_RESET_PASSWORD_INTENT
|
||||
import com.woka.onboard.mvvm.OnboardViewModel
|
||||
import com.woka.userPreference.UserType
|
||||
import com.woka.utils.ANALYTICS_GUEST_LOGIN
|
||||
import com.woka.utils.ANALYTICS_NEW_USER
|
||||
import com.woka.utils.DecisionDialog
|
||||
import com.woka.utils.ProgressView
|
||||
import com.woka.userPreference.UserType
|
||||
import com.woka.utils.toast
|
||||
|
||||
class SignInFragment : Fragment() {
|
||||
@@ -86,7 +90,7 @@ class SignInFragment : Fragment() {
|
||||
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
viewModel.loginLiveData.observe(viewLifecycleOwner){ it ->
|
||||
viewModel.loginLiveData.observe(viewLifecycleOwner){
|
||||
when(it){
|
||||
is ApiResult.Error -> {
|
||||
progressView.hide()
|
||||
@@ -160,6 +164,11 @@ class SignInFragment : Fragment() {
|
||||
userPrefs?.userType = UserType.GUEST
|
||||
userPrefs?.guestUserName = data.fullname
|
||||
|
||||
if (data.new_guest == true){
|
||||
Firebase.analytics.logEvent(ANALYTICS_GUEST_LOGIN, null)
|
||||
Firebase.analytics.logEvent(ANALYTICS_NEW_USER, null)
|
||||
}
|
||||
|
||||
activity?.let { activity->
|
||||
startActivity(Intent(activity, HomeActivity::class.java).apply {
|
||||
addFlags(Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_CLEAR_TASK)
|
||||
|
||||
@@ -12,5 +12,6 @@ data class RegisterRequestData(
|
||||
val password: String?,
|
||||
val user_type: String?,
|
||||
val username: String?,
|
||||
val interest_topic_id: List<Int>?
|
||||
val interest_topic_id: List<Int>?,
|
||||
val one_signal_player_id: String?
|
||||
)
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.woka.onboard.mvvm
|
||||
|
||||
import com.onesignal.OneSignal
|
||||
import com.woka.WokaApp
|
||||
import com.woka.networking.ApiResult
|
||||
import com.woka.networking.RetrofitHelper.handleApiCall
|
||||
@@ -22,6 +23,7 @@ class OnboardRepository(private val apiService: OnboardApiService) {
|
||||
FormBody.Builder()
|
||||
.add("username", userName)
|
||||
.add("password", password)
|
||||
.add("one_signal_player_id", OneSignal.User.onesignalId)
|
||||
.build()
|
||||
)
|
||||
}
|
||||
@@ -33,6 +35,7 @@ class OnboardRepository(private val apiService: OnboardApiService) {
|
||||
FormBody.Builder()
|
||||
.add("username", userName)
|
||||
.add("password", password)
|
||||
.add("one_signal_player_id", OneSignal.User.onesignalId)
|
||||
.add("is_activate", if (isActivate) "1" else "0")
|
||||
.build()
|
||||
)
|
||||
@@ -151,7 +154,7 @@ class OnboardRepository(private val apiService: OnboardApiService) {
|
||||
FormBody.Builder()
|
||||
.add("language_id", if (WokaApp.userPrefs?.appLanguage == "hi") "2" else "1")
|
||||
.add("user_type", "3")
|
||||
.add("one_signal_player_id", "test")
|
||||
.add("one_signal_player_id", OneSignal.User.onesignalId)
|
||||
.add("device_type", "1")
|
||||
.build()
|
||||
)
|
||||
|
||||
@@ -9,6 +9,8 @@ import androidx.navigation.NavOptions
|
||||
import androidx.navigation.fragment.NavHostFragment
|
||||
import com.woka.R
|
||||
import com.woka.WokaApp.Companion.userPrefs
|
||||
import com.woka.database.helpers.ClicksHelper
|
||||
import com.woka.database.models.clicks.ContentType
|
||||
import com.woka.onboard.fragments.GetCodeFragment.Companion.EMAIL_ARG
|
||||
import com.woka.onboard.fragments.GetEmailFragment.Companion.IS_UNDER_16
|
||||
import com.woka.onboard.fragments.SignUpFragment.Companion.ADD_CHILD_EVENT
|
||||
@@ -66,6 +68,13 @@ class OnboardActivity : WokaBaseActivity() {
|
||||
}
|
||||
}
|
||||
|
||||
@Suppress("DEPRECATION")
|
||||
@Deprecated("Deprecated in Java")
|
||||
override fun onBackPressed() {
|
||||
super.onBackPressed()
|
||||
ClicksHelper.upsertClickEvent(ContentType.OTHERS)
|
||||
}
|
||||
|
||||
override fun onStart() {
|
||||
super.onStart()
|
||||
player?.start()
|
||||
|
||||
@@ -7,5 +7,5 @@ import kotlinx.parcelize.Parcelize
|
||||
@Parcelize
|
||||
data class VideoPlayList(
|
||||
val playlist: ArrayList<PlaylistItem>,
|
||||
val videoViewRequestDataList: ArrayList<VideoViewRequestData>? = null
|
||||
val videoViewRequestDataList: MutableList<VideoViewRequestData>
|
||||
): Parcelable
|
||||
@@ -1,12 +1,13 @@
|
||||
package com.woka.players.models
|
||||
|
||||
import android.os.Parcelable
|
||||
import com.woka.database.models.clicks.ContentType
|
||||
import kotlinx.parcelize.Parcelize
|
||||
|
||||
@Parcelize
|
||||
data class VideoViewRequestData(
|
||||
val post_id: Int?,
|
||||
val post_type: String,
|
||||
var total_watched_duration: String? = null,
|
||||
val category_id: String? = null
|
||||
val id: Int?,
|
||||
val contentType: ContentType,
|
||||
val categoryId: String? = null,
|
||||
var watchedDuration: String? = null
|
||||
) : Parcelable
|
||||
|
||||
@@ -4,6 +4,7 @@ import android.net.ConnectivityManager
|
||||
import android.net.Network
|
||||
import android.net.NetworkRequest
|
||||
import android.os.Bundle
|
||||
import android.util.Log
|
||||
import android.view.ViewGroup
|
||||
import androidx.activity.enableEdgeToEdge
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
@@ -11,14 +12,19 @@ import androidx.core.view.ViewCompat
|
||||
import androidx.core.view.WindowCompat
|
||||
import androidx.core.view.WindowInsetsCompat
|
||||
import com.jwplayer.pub.api.JWPlayer
|
||||
import com.jwplayer.pub.api.PauseReason
|
||||
import com.jwplayer.pub.api.PlayReason
|
||||
import com.jwplayer.pub.api.configuration.PlayerConfig
|
||||
import com.jwplayer.pub.api.events.EventType
|
||||
import com.jwplayer.pub.api.events.listeners.VideoPlayerEvents
|
||||
import com.jwplayer.pub.api.fullscreen.FullscreenHandler
|
||||
import com.woka.database.helpers.ClicksHelper
|
||||
import com.woka.database.models.clicks.ContentType
|
||||
import com.woka.databinding.ActivityPlayerBinding
|
||||
import com.woka.players.KeepScreenOnHandler
|
||||
import com.woka.players.models.PlayBackState
|
||||
import com.woka.players.models.VideoPlayList
|
||||
import com.woka.utils.TAG
|
||||
import com.woka.utils.hide
|
||||
import com.woka.utils.show
|
||||
|
||||
@@ -96,10 +102,12 @@ class PlayerActivity : AppCompatActivity(), FullscreenHandler {
|
||||
binding.playerView.show()
|
||||
binding.errorView.hide()
|
||||
configAndPlay()
|
||||
ClicksHelper.upsertClickEvent(ContentType.OTHERS)
|
||||
}
|
||||
|
||||
closeBtn.setOnClickListener {
|
||||
onBackPressedDispatcher.onBackPressed()
|
||||
ClicksHelper.upsertClickEvent(ContentType.OTHERS)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -133,9 +141,37 @@ class PlayerActivity : AppCompatActivity(), FullscreenHandler {
|
||||
playbackState = PlayBackState.PLAY
|
||||
binding.playerView.show()
|
||||
binding.errorView.hide()
|
||||
|
||||
if (it.playReason == PlayReason.INTERACTION){
|
||||
videoPlayList?.videoViewRequestDataList?.let {playlistData ->
|
||||
if (playingIndex >= 0 && playingIndex < playlistData.size){
|
||||
with(playlistData[playingIndex]){
|
||||
ClicksHelper.upsertClickEvent(
|
||||
contentType,
|
||||
id,
|
||||
categoryId
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
player.addListener(EventType.PAUSE, VideoPlayerEvents.OnPauseListener {
|
||||
playbackState = PlayBackState.PAUSED
|
||||
|
||||
if (it.pauseReason == PauseReason.INTERACTION){
|
||||
videoPlayList?.videoViewRequestDataList?.let {playlistData ->
|
||||
if (playingIndex >= 0 && playingIndex < playlistData.size){
|
||||
with(playlistData[playingIndex]){
|
||||
ClicksHelper.upsertClickEvent(
|
||||
contentType,
|
||||
id,
|
||||
categoryId
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
player.addListener(EventType.ERROR, VideoPlayerEvents.OnErrorListener {
|
||||
if (player.position != 0.0){
|
||||
@@ -148,6 +184,22 @@ class PlayerActivity : AppCompatActivity(), FullscreenHandler {
|
||||
|
||||
player.addListener(EventType.PLAYLIST_ITEM, VideoPlayerEvents.OnPlaylistItemListener {
|
||||
playingIndex = it.index
|
||||
|
||||
videoPlayList?.videoViewRequestDataList?.let {playlistData ->
|
||||
if (playingIndex >= 0 && playingIndex < playlistData.size){
|
||||
with(playlistData[playingIndex]){
|
||||
ClicksHelper.upsertClickEvent(
|
||||
contentType,
|
||||
id,
|
||||
categoryId
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
player.addListener(EventType.SEEK, VideoPlayerEvents.OnSeekListener {
|
||||
Log.d(TAG, "addListeners: ")
|
||||
})
|
||||
|
||||
(getSystemService(CONNECTIVITY_SERVICE) as ConnectivityManager).registerNetworkCallback(
|
||||
@@ -165,6 +217,7 @@ class PlayerActivity : AppCompatActivity(), FullscreenHandler {
|
||||
windowInsetsController.show(WindowInsetsCompat.Type.systemBars())
|
||||
|
||||
onBackPressedDispatcher.onBackPressed()
|
||||
ClicksHelper.upsertClickEvent(ContentType.OTHERS)
|
||||
}
|
||||
|
||||
override fun onAllowRotationChanged(allowRotation: Boolean) {}
|
||||
|
||||
@@ -51,6 +51,7 @@ class AddressActivity : WokaBaseActivity() {
|
||||
binding.apply {
|
||||
toolbar.backBtn.setOnClickListener {
|
||||
onBackPressedDispatcher.onBackPressed()
|
||||
ClicksHelper.upsertClickEvent(ContentType.OTHERS)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,6 +39,7 @@ class CartActivity : WokaBaseActivity() {
|
||||
setObservers()
|
||||
}
|
||||
|
||||
@Suppress("DEPRECATION")
|
||||
@Deprecated("Deprecated in Java")
|
||||
override fun onBackPressed() {
|
||||
super.onBackPressed()
|
||||
@@ -49,6 +50,7 @@ class CartActivity : WokaBaseActivity() {
|
||||
binding.apply {
|
||||
toolbar.backBtn.setOnClickListener {
|
||||
onBackPressedDispatcher.onBackPressed()
|
||||
ClicksHelper.upsertClickEvent(ContentType.OTHERS)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -99,6 +99,7 @@ class MyOrdersActivity : WokaBaseActivity() {
|
||||
binding.apply {
|
||||
backBtn.setOnClickListener {
|
||||
onBackPressedDispatcher.onBackPressed()
|
||||
ClicksHelper.upsertClickEvent(ContentType.OTHERS)
|
||||
}
|
||||
|
||||
cart.setOnClickListener {
|
||||
|
||||
@@ -74,6 +74,7 @@ class ShopActivity : WokaBaseActivity() {
|
||||
binding.apply {
|
||||
backBtn.setOnClickListener {
|
||||
onBackPressedDispatcher.onBackPressed()
|
||||
ClicksHelper.upsertClickEvent(ContentType.OTHERS)
|
||||
}
|
||||
|
||||
cart.setOnClickListener {
|
||||
|
||||
@@ -27,6 +27,6 @@ interface UserApiService {
|
||||
@GET("get_user_notifications")
|
||||
suspend fun getNotifications(): Response<ApiResponse<List<NotificationData>>>
|
||||
|
||||
@POST("favourite_listing")
|
||||
@POST("v2/favourite_listing")
|
||||
suspend fun getMyFavList(@Body formBody: FormBody): Response<ApiResponse<MyListResponse>>
|
||||
}
|
||||
@@ -19,5 +19,15 @@ const val TERMS_N_CONDITIONS_URL = "https://www.wokaland.com/terms/"
|
||||
const val PRIVACY_N_POLICY_URL = "https://www.wokaland.com/privacy-policy/"
|
||||
|
||||
// other urls
|
||||
const val PLAY_STORE_URL = "https://play.google.com/store/apps/details?id=com.woka"
|
||||
|
||||
const val PLAY_STORE_URL = "https://play.google.com/store/apps/details?id=com.woka"
|
||||
// JW Player
|
||||
const val JW_PLAYER_LICENSE = "LkYoNusv+gSIVJIrXa5Bf59iBNlUMxeg82PM/l8JWk+cD4BE"
|
||||
|
||||
// one signal
|
||||
const val ONESIGNAL_APP_ID = "f9674e6f-75fb-49e8-8379-4f2ed2a880b8"
|
||||
|
||||
// analytics constants
|
||||
const val ANALYTICS_GUEST_LOGIN = "guest_login_android"
|
||||
const val ANALYTICS_USER_SIGN_UP = "user_signup_android"
|
||||
const val ANALYTICS_NEW_USER = "new_user_android"
|
||||
@@ -5,9 +5,11 @@ import androidx.lifecycle.MutableLiveData
|
||||
import androidx.lifecycle.ViewModel
|
||||
import androidx.lifecycle.viewModelScope
|
||||
import com.jwplayer.pub.api.media.playlists.PlaylistItem
|
||||
import com.woka.database.models.clicks.ContentType
|
||||
import com.woka.modules.categorymodels.CategoriesResponse
|
||||
import com.woka.networking.ApiResult
|
||||
import com.woka.players.models.VideoPlayList
|
||||
import com.woka.players.models.VideoViewRequestData
|
||||
import com.woka.utils.PagingData
|
||||
import com.woka.webseries.WebSeriesRepository
|
||||
import com.woka.webseries.models.ContinueEpisodeResponse
|
||||
@@ -265,6 +267,13 @@ class WebSeriesViewModel : ViewModel() {
|
||||
.image(episode.thumbnail_path)
|
||||
.build()
|
||||
)
|
||||
|
||||
currentPlayListHin.videoViewRequestDataList.add(
|
||||
VideoViewRequestData(
|
||||
episode.id,
|
||||
ContentType.EPISODE
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -276,6 +285,13 @@ class WebSeriesViewModel : ViewModel() {
|
||||
.image(episode.thumbnail_path)
|
||||
.build()
|
||||
)
|
||||
|
||||
currentPlayListEng.videoViewRequestDataList.add(
|
||||
VideoViewRequestData(
|
||||
episode.id,
|
||||
ContentType.EPISODE
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -358,6 +374,13 @@ class WebSeriesViewModel : ViewModel() {
|
||||
.image(teaser.thumbnail_path)
|
||||
.build()
|
||||
)
|
||||
|
||||
currentPlayListHin.videoViewRequestDataList.add(
|
||||
VideoViewRequestData(
|
||||
teaser.id,
|
||||
ContentType.TEASER
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -369,6 +392,13 @@ class WebSeriesViewModel : ViewModel() {
|
||||
.image(teaser.thumbnail_path)
|
||||
.build()
|
||||
)
|
||||
|
||||
currentPlayListEng.videoViewRequestDataList.add(
|
||||
VideoViewRequestData(
|
||||
teaser.id,
|
||||
ContentType.TEASER
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -106,6 +106,8 @@ class WebSeriesFragment : Fragment() {
|
||||
binding.apply {
|
||||
toolbar.backBtn.setOnClickListener {
|
||||
activity?.onBackPressedDispatcher?.onBackPressed()
|
||||
|
||||
ClicksHelper.upsertClickEvent(ContentType.OTHERS)
|
||||
}
|
||||
|
||||
retryBtn.setOnClickListener {
|
||||
@@ -141,7 +143,12 @@ class WebSeriesFragment : Fragment() {
|
||||
.build()
|
||||
)
|
||||
},
|
||||
null
|
||||
mutableListOf(
|
||||
VideoViewRequestData(
|
||||
0,
|
||||
ContentType.TEASER
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
putExtra(EXTRA_PLAY_INDEX, 0)
|
||||
@@ -442,12 +449,11 @@ class WebSeriesFragment : Fragment() {
|
||||
.build()
|
||||
)
|
||||
|
||||
videoPlayList.videoViewRequestDataList?.add(
|
||||
videoPlayList.videoViewRequestDataList.add(
|
||||
VideoViewRequestData(
|
||||
episodeData.id,
|
||||
"3",
|
||||
null,
|
||||
category_id = "18"
|
||||
ContentType.EPISODE,
|
||||
"18"
|
||||
)
|
||||
)
|
||||
|
||||
@@ -461,11 +467,10 @@ class WebSeriesFragment : Fragment() {
|
||||
.build()
|
||||
)
|
||||
|
||||
videoPlayList.videoViewRequestDataList?.add(
|
||||
videoPlayList.videoViewRequestDataList.add(
|
||||
VideoViewRequestData(
|
||||
episodeData.id,
|
||||
"3",
|
||||
null,
|
||||
ContentType.EPISODE,
|
||||
"1"
|
||||
)
|
||||
)
|
||||
|
||||
@@ -27,6 +27,7 @@ import com.woka.databinding.DialogEpisodeBinding
|
||||
import com.woka.databinding.FragmentWebShowBinding
|
||||
import com.woka.networking.ApiResult
|
||||
import com.woka.players.models.VideoPlayList
|
||||
import com.woka.players.models.VideoViewRequestData
|
||||
import com.woka.players.views.PlayerActivity
|
||||
import com.woka.userPreference.UserType
|
||||
import com.woka.utils.NoSignInDialog
|
||||
@@ -160,6 +161,8 @@ class WebShowFragment : Fragment(), TabLayout.OnTabSelectedListener {
|
||||
binding.apply {
|
||||
backBtn.setOnClickListener {
|
||||
activity?.onBackPressedDispatcher?.onBackPressed()
|
||||
|
||||
ClicksHelper.upsertClickEvent(ContentType.OTHERS)
|
||||
}
|
||||
|
||||
watchCard.setOnClickListener {
|
||||
@@ -265,8 +268,6 @@ class WebShowFragment : Fragment(), TabLayout.OnTabSelectedListener {
|
||||
|
||||
seasonData.season_more_details?.let { moreDetailsList ->
|
||||
if (moreDetailsList.isNotEmpty()) {
|
||||
val videoPlayList = VideoPlayList(ArrayList())
|
||||
|
||||
val playlistItem = PlaylistItem.Builder()
|
||||
|
||||
if (categoryId == "18" && moreDetailsList.size > 1) {
|
||||
@@ -283,6 +284,12 @@ class WebShowFragment : Fragment(), TabLayout.OnTabSelectedListener {
|
||||
}
|
||||
}
|
||||
|
||||
val videoPlayList = VideoPlayList(ArrayList(), mutableListOf(
|
||||
VideoViewRequestData(
|
||||
seasonData.id,
|
||||
ContentType.SEASON
|
||||
)
|
||||
))
|
||||
videoPlayList.playlist.add(playlistItem.build())
|
||||
|
||||
activity?.let {
|
||||
|
||||
@@ -4,12 +4,15 @@ import android.annotation.SuppressLint
|
||||
import android.content.pm.ActivityInfo
|
||||
import android.os.Build
|
||||
import android.os.Bundle
|
||||
import android.view.MotionEvent
|
||||
import android.view.WindowManager
|
||||
import android.webkit.WebSettings
|
||||
import android.webkit.WebViewClient
|
||||
import androidx.core.view.WindowCompat
|
||||
import androidx.core.view.WindowInsetsCompat
|
||||
import com.woka.R
|
||||
import com.woka.database.helpers.ClicksHelper
|
||||
import com.woka.database.models.clicks.ContentType
|
||||
import com.woka.databinding.ActivityGamePlayerBinding
|
||||
import com.woka.utils.DecisionDialog
|
||||
import com.woka.utils.WokaBaseActivity
|
||||
@@ -25,6 +28,9 @@ class GamePlayerActivity : WokaBaseActivity() {
|
||||
|
||||
private var gamePlayerData: GamePlayerData? = null
|
||||
|
||||
private var clicksCount = 0
|
||||
|
||||
@SuppressLint("ClickableViewAccessibility")
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
binding = ActivityGamePlayerBinding.inflate(layoutInflater)
|
||||
@@ -49,6 +55,13 @@ class GamePlayerActivity : WokaBaseActivity() {
|
||||
}
|
||||
initWebView(it.gameUrl)
|
||||
}
|
||||
|
||||
binding.webView.setOnTouchListener { _, event ->
|
||||
if (event.action == MotionEvent.ACTION_DOWN){
|
||||
clicksCount++
|
||||
}
|
||||
return@setOnTouchListener false
|
||||
}
|
||||
}
|
||||
|
||||
override fun onStart() {
|
||||
@@ -74,6 +87,8 @@ class GamePlayerActivity : WokaBaseActivity() {
|
||||
override fun onDestroy() {
|
||||
super.onDestroy()
|
||||
binding.webView.destroy()
|
||||
|
||||
ClicksHelper.upsertClickEvent(ContentType.GAME, gamePlayerData?.id, null, clicksCount)
|
||||
}
|
||||
|
||||
@SuppressLint("SetJavaScriptEnabled")
|
||||
|
||||
@@ -5,6 +5,7 @@ import kotlinx.parcelize.Parcelize
|
||||
|
||||
@Parcelize
|
||||
data class GamePlayerData(
|
||||
val id: Int?,
|
||||
val gameUrl: String,
|
||||
val landscape: Boolean = false
|
||||
): Parcelable
|
||||
@@ -95,8 +95,10 @@ class GamesActivity : WokaBaseActivity() {
|
||||
}
|
||||
}
|
||||
|
||||
override fun onDestroy() {
|
||||
super.onDestroy()
|
||||
@Suppress("DEPRECATION")
|
||||
@Deprecated("Deprecated in Java")
|
||||
override fun onBackPressed() {
|
||||
super.onBackPressed()
|
||||
ClicksHelper.upsertClickEvent(ContentType.OTHERS)
|
||||
}
|
||||
|
||||
@@ -143,6 +145,7 @@ class GamesActivity : WokaBaseActivity() {
|
||||
binding.apply {
|
||||
toolbar.backBtn.setOnClickListener {
|
||||
onBackPressedDispatcher.onBackPressed()
|
||||
ClicksHelper.upsertClickEvent(ContentType.OTHERS)
|
||||
}
|
||||
|
||||
retryBtn.setOnClickListener {
|
||||
@@ -190,7 +193,7 @@ class GamesActivity : WokaBaseActivity() {
|
||||
trailerBtn.setOnClickListener {
|
||||
gameData.game_url?.let {
|
||||
startActivity(Intent(this@GamesActivity, GamePlayerActivity::class.java).apply {
|
||||
putExtra(EXTRA_GAME_PLAYER_DATA, GamePlayerData(it, gameData.screen_orientation == "Landscape"))
|
||||
putExtra(EXTRA_GAME_PLAYER_DATA, GamePlayerData(gameData.id, it, gameData.screen_orientation == "Landscape"))
|
||||
})
|
||||
}
|
||||
|
||||
@@ -271,7 +274,7 @@ class GamesActivity : WokaBaseActivity() {
|
||||
watchCard.setOnClickListener {
|
||||
gameData.game_url?.let {
|
||||
startActivity(Intent(this@GamesActivity, GamePlayerActivity::class.java).apply {
|
||||
putExtra(EXTRA_GAME_PLAYER_DATA, GamePlayerData(it, gameData.screen_orientation == "Landscape"))
|
||||
putExtra(EXTRA_GAME_PLAYER_DATA, GamePlayerData(gameData.id, it, gameData.screen_orientation == "Landscape"))
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,10 @@
|
||||
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
||||
buildscript {
|
||||
dependencies {
|
||||
classpath libs.google.services
|
||||
classpath libs.gradle
|
||||
classpath libs.perf.plugin
|
||||
}
|
||||
}// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
||||
plugins {
|
||||
alias(libs.plugins.androidApplication) apply false
|
||||
alias(libs.plugins.jetbrainsKotlinAndroid) apply false
|
||||
|
||||
@@ -12,9 +12,15 @@ constraintlayout = "2.1.4"
|
||||
navigationFragmentKtx = "2.7.7"
|
||||
navigationUiKtx = "2.7.7"
|
||||
navigationSafeArgs = "2.7.7"
|
||||
onesignal = "5.1.20"
|
||||
roomKtx = "2.6.1"
|
||||
roomRuntime = "2.6.1"
|
||||
ksp = "2.0.0-1.0.24"
|
||||
googleServices = "4.4.2"
|
||||
firebaseAnalytics = "22.0.2"
|
||||
firebasePerf = "21.0.1"
|
||||
gradle = "8.1.0"
|
||||
perfPlugin = "1.4.2"
|
||||
|
||||
[libraries]
|
||||
androidx-core-ktx = { group = "androidx.core", name = "core-ktx", version.ref = "coreKtx" }
|
||||
@@ -28,7 +34,13 @@ androidx-activity = { group = "androidx.activity", name = "activity", version.re
|
||||
androidx-constraintlayout = { group = "androidx.constraintlayout", name = "constraintlayout", version.ref = "constraintlayout" }
|
||||
androidx-navigation-fragment-ktx = { group = "androidx.navigation", name = "navigation-fragment-ktx", version.ref = "navigationFragmentKtx" }
|
||||
androidx-navigation-ui-ktx = { group = "androidx.navigation", name = "navigation-ui-ktx", version.ref = "navigationUiKtx" }
|
||||
onesignal = { module = "com.onesignal:OneSignal", version.ref = "onesignal" }
|
||||
room-ktx = { module = "androidx.room:room-ktx", version.ref = "roomKtx" }
|
||||
google-services = { group = "com.google.gms", name = "google-services", version.ref = "googleServices" }
|
||||
firebase-analytics = { group = "com.google.firebase", name = "firebase-analytics", version.ref = "firebaseAnalytics" }
|
||||
firebase-perf = { group = "com.google.firebase", name = "firebase-perf", version.ref = "firebasePerf" }
|
||||
gradle = { group = "com.android.tools.build", name = "gradle", version.ref = "gradle" }
|
||||
perf-plugin = { group = "com.google.firebase", name = "perf-plugin", version.ref = "perfPlugin" }
|
||||
|
||||
[plugins]
|
||||
androidApplication = { id = "com.android.application", version.ref = "agp" }
|
||||
|
||||
Reference in New Issue
Block a user