- Added default placeholder

- added functionality for unique user and finalised the work
This commit is contained in:
2024-10-10 19:30:22 +05:30
parent 447aa52b33
commit a78c459f8d
16 changed files with 113 additions and 10 deletions

View File

@@ -0,0 +1,6 @@
{
"info" : {
"author" : "xcode",
"version" : 1
}
}

View File

@@ -0,0 +1,21 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "Frame 219.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 626 KiB

View File

@@ -0,0 +1,21 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "Frame 220.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 150 KiB

View File

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 10 KiB

View File

@@ -27,6 +27,7 @@ struct UserDataDM: Codable {
let language: Language?
let alreadyLoggedIn: Bool?
let isDeactive : Bool?
var isUniqueUser : Bool?
enum CodingKeys: String, CodingKey {
case id, username, fullname, birthdate, email, avtar
case avtarURL = "avtar_url"
@@ -39,6 +40,7 @@ struct UserDataDM: Codable {
case language
case alreadyLoggedIn = "already_logged_in"
case isDeactive = "is_deactive"
case isUniqueUser = "is_unique_user"
}
}

View File

@@ -12,6 +12,7 @@ extension K{
static var guest_login_iOS = "guest_login_iOS"
static var user_signup_iOS = "user_signup_iOS"
static var new_user_iOS = "new_user_iOS"
static var engaged_users = "engaged_users"
}
}

View File

@@ -35,7 +35,7 @@ extension UIImageView {
case .homeAvatar:
self.image = UIImage(named: "DefaultAvatar")
case .none:
self.image = UIImage(named: "WokaLogo")
self.image = UIImage(named: "EpisodePlaceHolder")
break
}

View File

@@ -160,6 +160,7 @@ struct APIEndPoints {
static let user_video_view = makeURL(path: "user_video_view")
static let get_ad_data = makeURL(path: "v2/get_ad_data")
static let update_ad_count = makeURL(path: "update_ad_count")
static let unique_click_store = makeURL(path: "unique_click_store")
}
// Helper method to construct full URL from base URL and path

View File

@@ -7,9 +7,57 @@
import UIKit
import Alamofire
import FirebaseAnalytics
//class CommonNwCall{
//
class CommonNwCallTheme{
static let shareInstance = CommonNwCallTheme()
/*
Update our DB for the user not unique now.
Logic is if user is newly registered and if he clicks on FM, Webseries, LiveTV , Shop, Karaoke, AudioBooks, Games from theme 1 or 2, he will not be unique. Mark our DB to make him isUnnique to false
*/
func updateUniqueUser(){
let headers : HTTPHeaders = ["device-id" : AuthFunc.shareInstance.getDeviceUUID(),
"access-token" : AuthFunc.shareInstance.getAccessToken()]
let params : Parameters = ["post_type" : "1",
"is_clicked" : "1",
"device_type" : "2"] // 1 - android, 2- iOS
NetworkManager.shareInstance.apiRequest(url: APIEndPoints.Analytics.unique_click_store, method: .post, parameters: params,headers : headers) {(result : Result<CommonResponseModel, NetworkManager.APIError>) in
switch result{
case .success(let data):
switch data.success{
case 0:
/*
Error
*/
print("Error Unique User")
case 1:
print("Success Unique User")
// update local user data && trigger firebase analytics for engaged_users
AuthFunc.shareInstance.userData?.isUniqueUser = false
Analytics.logEvent(K.AnalyticsEventKeys.engaged_users, parameters: nil)
default:
break
}
case .failure(_):
print("Failure Unique User")
}
}
}
//check for unique user
func checkUniqueUser(){
guard let data = AuthFunc.shareInstance.userData, let uniqueUser = data.isUniqueUser else{return}
if uniqueUser{ // do the network call and update the annalytics, this means user is unique
print("User is Unique")
CommonNwCallTheme.shareInstance.updateUniqueUser()
}else{ // do nothing.
print("User is Not Unique")
}
}
}
//
// static let shareInstance = CommonNwCall()
// var userNotification = [UserNotificationDM]()
//

View File

@@ -164,7 +164,7 @@ class ThemeOneVC: UIViewController {
@IBAction func radioBtnTapped(_ sender: UIButton) {
PersistentStorage.shared.addRadioCount()
CommonNwCallTheme.shareInstance.checkUniqueUser()
let sb = UIStoryboard(name: K.StoryBoard.wokaFM, bundle: nil)
let vcPush = sb.instantiateViewController(withIdentifier: K.StoryBoardID.WokaFM.wokaFMVC) as! WokaFMVC
vcPush.modalPresentationStyle = .overCurrentContext

View File

@@ -210,6 +210,7 @@ extension ThemeTwoVC : CollectionViewSRC{
}
func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
CommonNwCallTheme.shareInstance.checkUniqueUser()
switch indexPath.row{
case 0:
PersistentStorage.shared.addRadioCount()

View File

@@ -251,7 +251,7 @@ class ThemeOneVM{
//WebSeries
vc.webSeriesView.addTapGesture {
PersistentStorage.shared.addOthersCount()
CommonNwCallTheme.shareInstance.checkUniqueUser()
ViewButtonAnimation.sharedInstance.btnTapped(in: self.vc, view: self.vc.webSeriesView) { [weak self] in
guard let self else{return}
self.checkType(action: .webseries)
@@ -260,7 +260,7 @@ class ThemeOneVM{
vc.audioBooksView.addTapGesture {
PersistentStorage.shared.addOthersCount()
CommonNwCallTheme.shareInstance.checkUniqueUser()
ViewButtonAnimation.sharedInstance.btnTapped(in: self.vc, view: self.vc.audioBooksView) { [weak self] in
guard let self else{return}
self.checkType(action: .audioBooks)
@@ -269,7 +269,7 @@ class ThemeOneVM{
vc.gamesView.addTapGesture {
PersistentStorage.shared.addOthersCount()
CommonNwCallTheme.shareInstance.checkUniqueUser()
ViewButtonAnimation.sharedInstance.btnTapped(in: self.vc, view: self.vc.gamesView) { [weak self] in
guard let self else{return}
self.checkType(action: .games)
@@ -278,7 +278,7 @@ class ThemeOneVM{
vc.karaokeView.addTapGesture { [self] in
PersistentStorage.shared.addOthersCount()
CommonNwCallTheme.shareInstance.checkUniqueUser()
ViewButtonAnimation.sharedInstance.btnTapped(in: self.vc, view: self.vc.karaokeView) { [weak self] in
guard let self else{return}
self.checkType(action: .karaoke)
@@ -287,7 +287,7 @@ class ThemeOneVM{
vc.shopView.addTapGesture {
PersistentStorage.shared.addOthersCount()
CommonNwCallTheme.shareInstance.checkUniqueUser()
ViewButtonAnimation.sharedInstance.btnTapped(in: self.vc, view: self.vc.shopView) { [weak self] in
guard let self else{return}
self.checkType(action: .shop)
@@ -296,7 +296,7 @@ class ThemeOneVM{
vc.liveTVIcon.addTapGesture {
PersistentStorage.shared.addLiveTVCount()
CommonNwCallTheme.shareInstance.checkUniqueUser()
ViewButtonAnimation.sharedInstance.btnTapped(in: self.vc, view: self.vc.liveTVIcon) { [weak self] in
guard let self else{return}
self.checkType(action: .liveTV)
@@ -498,6 +498,7 @@ class ThemeOneVM{
// function which is triggered when handleTap on livetv is called
@objc func handleTap(_ sender: UITapGestureRecognizer) {
PersistentStorage.shared.addLiveTVCount()
CommonNwCallTheme.shareInstance.checkUniqueUser()
DispatchQueue.main.async {
Utilities.startProgressHUD(msg: "Loading...")
}

View File

@@ -49,6 +49,7 @@ class ThemeTwoVM{
handleNotificationCenter()
vc.liveTvView.addTapGesture { [weak self] in
PersistentStorage.shared.addOthersCount()
CommonNwCallTheme.shareInstance.checkUniqueUser()
guard let self else{return}
self.playLiveTV()
}