diff --git a/WOKA/Authentication/ViewModel/LoginVM.swift b/WOKA/Authentication/ViewModel/LoginVM.swift
index 180eedc..4332e59 100644
--- a/WOKA/Authentication/ViewModel/LoginVM.swift
+++ b/WOKA/Authentication/ViewModel/LoginVM.swift
@@ -184,10 +184,8 @@ class LoginVM{
Analytics.logEvent(K.AnalyticsEventKeys.guest_login_iOS, parameters: nil)
Analytics.logEvent(K.AnalyticsEventKeys.new_user_iOS, parameters: nil)
}
- self.vc.toast(msg: data.message ?? "Unrecognised error" , time: 2) {
- let userDataConverted = UserDataDM.ResultData(id: nil, username: dataUser.username, fullname: dataUser.fullname, genderData: nil, birthdate: nil, email: nil, avtar: nil, avtarURL: nil, userType: "3", languageMasterID: nil, lastLogin: nil, rememberToken: nil, childDetail: nil, language: nil, alreadyLoggedIn: nil, isDeactive: nil)
- AuthFunc.shareInstance.loginDefaults(data: userDataConverted)
- }
+ let userDataConverted = UserDataDM.ResultData(id: nil, username: dataUser.username, fullname: dataUser.fullname, genderData: nil, birthdate: nil, email: nil, avtar: nil, avtarURL: nil, userType: "3", languageMasterID: nil, lastLogin: nil, rememberToken: nil, childDetail: nil, language: nil, alreadyLoggedIn: nil, isDeactive: nil)
+ AuthFunc.shareInstance.loginDefaults(data: userDataConverted)
default:
break
}
diff --git a/WOKA/Games/Controller/GamesWebViewVC.swift b/WOKA/Games/Controller/GamesWebViewVC.swift
index 428291b..e5c61b0 100644
--- a/WOKA/Games/Controller/GamesWebViewVC.swift
+++ b/WOKA/Games/Controller/GamesWebViewVC.swift
@@ -93,7 +93,8 @@ class GamesWebViewVC: UIViewController, WKNavigationDelegate,UIGestureRecognizer
let sb = UIStoryboard(name: K.StoryBoard.customAlerts, bundle: nil)
let vcPush = sb.instantiateViewController(withIdentifier: K.StoryBoardID.CustomAlerts.yesNoAlertVC) as! YesNoAlertVC
vcPush.mainTitleText = "Warning"
- vcPush.contentLabel = "Clicking \"OK\" will exit you from the game. Are you sure you want to proceed?"
+// vcPush.contentLabel = "Clicking \"OK\" will exit you from the game. Are you sure you want to proceed?"
+ vcPush.contentLabel = "Are you sure you want to exit the game?"
vcPush.yesBtnText = "OK"
vcPush.noBtnText = "Cancel"
vcPush.onDoneBlock = { [weak self] mode in
diff --git a/WOKA/Karaoke/ViewModel/KaraokeListingVM.swift b/WOKA/Karaoke/ViewModel/KaraokeListingVM.swift
index e75aedf..a08aa3a 100644
--- a/WOKA/Karaoke/ViewModel/KaraokeListingVM.swift
+++ b/WOKA/Karaoke/ViewModel/KaraokeListingVM.swift
@@ -44,7 +44,6 @@ class KaraokeListingVM{
maxHeaderHeight = UIScreen.main.bounds.width * 0.55
vc.headerHeight.constant = maxHeaderHeight
- checkAds()
}
func setupCell(){
@@ -189,6 +188,7 @@ class KaraokeListingVM{
case 1:
if !isBtnClick{
getContinueWatching()
+ checkAds()
feedbackGenerator.impactOccurred()
}
diff --git a/WOKA/Network Adapter/APIEndPoints.swift b/WOKA/Network Adapter/APIEndPoints.swift
index 4fb95fb..e936a72 100644
--- a/WOKA/Network Adapter/APIEndPoints.swift
+++ b/WOKA/Network Adapter/APIEndPoints.swift
@@ -34,8 +34,8 @@ struct APIEndPoints {
}
struct BaseURL {
- static let staging = "https://wokastaging.in/api/"
static let development = "https://wokanative.betadelivery.com/api/"
+ static let staging = "https://wokastaging.in/api/"
static let production = "https://wokaland.com/secret-panel-10102023/hidden-admin-portal-20092023/api/"
static let appUrl = "https://apps.apple.com/in/app/woka/id6465305185"
diff --git a/WOKA/OnBoarding Module/ViewModel/OnBoardVM.swift b/WOKA/OnBoarding Module/ViewModel/OnBoardVM.swift
index 513f697..0fdb8aa 100644
--- a/WOKA/OnBoarding Module/ViewModel/OnBoardVM.swift
+++ b/WOKA/OnBoarding Module/ViewModel/OnBoardVM.swift
@@ -141,10 +141,8 @@ class OnBoardVM{
Analytics.logEvent(K.AnalyticsEventKeys.new_user_iOS, parameters: nil)
}
- self.vc.toast(msg: data.message ?? "Unrecognised error" , time: 2) {
- let userDataConverted = UserDataDM.ResultData(id: nil, username: dataUser.username, fullname: dataUser.fullname, genderData: nil, birthdate: nil, email: nil, avtar: nil, avtarURL: nil, userType: "3", languageMasterID: nil, lastLogin: nil, rememberToken: nil, childDetail: nil, language: nil, alreadyLoggedIn: nil, isDeactive: nil)
- AuthFunc.shareInstance.loginDefaults(data: userDataConverted)
- }
+ let userDataConverted = UserDataDM.ResultData(id: nil, username: dataUser.username, fullname: dataUser.fullname, genderData: nil, birthdate: nil, email: nil, avtar: nil, avtarURL: nil, userType: "3", languageMasterID: nil, lastLogin: nil, rememberToken: nil, childDetail: nil, language: nil, alreadyLoggedIn: nil, isDeactive: nil)
+ AuthFunc.shareInstance.loginDefaults(data: userDataConverted)
default:
break
}
diff --git a/WOKA/OnBoarding Module/ViewModel/SplashVM.swift b/WOKA/OnBoarding Module/ViewModel/SplashVM.swift
index a306f6e..84bb106 100644
--- a/WOKA/OnBoarding Module/ViewModel/SplashVM.swift
+++ b/WOKA/OnBoarding Module/ViewModel/SplashVM.swift
@@ -264,10 +264,8 @@ class SplashVM{
Analytics.logEvent(K.AnalyticsEventKeys.new_user_iOS, parameters: nil)
}
- self.vc.toast(msg: data.message ?? "Unrecognised error" , time: 2) {
- let userDataConverted = UserDataDM.ResultData(id: nil, username: dataUser.username, fullname: dataUser.fullname, genderData: nil, birthdate: nil, email: nil, avtar: nil, avtarURL: nil, userType: "3", languageMasterID: nil, lastLogin: nil, rememberToken: nil, childDetail: nil, language: nil, alreadyLoggedIn: nil, isDeactive: nil)
- AuthFunc.shareInstance.loginDefaults(data: userDataConverted)
- }
+ let userDataConverted = UserDataDM.ResultData(id: nil, username: dataUser.username, fullname: dataUser.fullname, genderData: nil, birthdate: nil, email: nil, avtar: nil, avtarURL: nil, userType: "3", languageMasterID: nil, lastLogin: nil, rememberToken: nil, childDetail: nil, language: nil, alreadyLoggedIn: nil, isDeactive: nil)
+ AuthFunc.shareInstance.loginDefaults(data: userDataConverted)
default:
break
}
diff --git a/WOKA/Shop/Controller/ShopProductsVC.swift b/WOKA/Shop/Controller/ShopProductsVC.swift
index 0275dd9..9b3df9c 100644
--- a/WOKA/Shop/Controller/ShopProductsVC.swift
+++ b/WOKA/Shop/Controller/ShopProductsVC.swift
@@ -94,16 +94,16 @@ extension ShopProductsVC : CollectionViewSRC{
}
}
- func collectionView(_ collectionView: UICollectionView, willDisplay cell: UICollectionViewCell, forItemAt indexPath: IndexPath) {
- if collectionView == productCV{
- if vm.stopFetch{return}
- if indexPath.row == productCV.numberOfItems(inSection: 0) - 1{
- spinnerView.startAnimating()
- vm.pageNo += 1
- vm.getShopProducts(subCategoryID: vm.selectedSubCategory)
- }
- }
- }
+// func collectionView(_ collectionView: UICollectionView, willDisplay cell: UICollectionViewCell, forItemAt indexPath: IndexPath) {
+// if collectionView == productCV{
+// if indexPath.row == productCV.numberOfItems(inSection: 0) - 1{
+// print("Next Page")
+// spinnerView.startAnimating()
+// vm.pageNo += 1
+// vm.getShopProducts(subCategoryID: vm.selectedSubCategory)
+// }
+// }
+// }
func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
switch collectionView{
@@ -144,7 +144,7 @@ extension ShopProductsVC : GADBannerViewDelegate{
func bannerViewDidReceiveAd(_ bannerView: GADBannerView) {
adView.isHidden = false
bannerView.alpha = 0
- bannerView.backgroundColor = #colorLiteral(red: 0.01960784314, green: 0, blue: 0.2196078431, alpha: 1)
+// bannerView.backgroundColor = #colorLiteral(red: 0.01960784314, green: 0, blue: 0.2196078431, alpha: 1)
UIView.animate(withDuration: 0.2, animations: {
bannerView.alpha = 1
})
diff --git a/WOKA/Shop/Shop.storyboard b/WOKA/Shop/Shop.storyboard
index 7bfe7ce..9fb9010 100644
--- a/WOKA/Shop/Shop.storyboard
+++ b/WOKA/Shop/Shop.storyboard
@@ -179,7 +179,7 @@
-
+
@@ -205,10 +205,10 @@
-
+
-
+
@@ -219,14 +219,14 @@
-
+
-
+
@@ -257,7 +257,7 @@
-
+
@@ -330,7 +330,7 @@
-
+
@@ -407,6 +407,7 @@
@@ -466,8 +467,8 @@
-
-
+
+
diff --git a/WOKA/Shop/ViewModel/ShopProductsVM.swift b/WOKA/Shop/ViewModel/ShopProductsVM.swift
index eb9233a..cc11305 100644
--- a/WOKA/Shop/ViewModel/ShopProductsVM.swift
+++ b/WOKA/Shop/ViewModel/ShopProductsVM.swift
@@ -19,8 +19,14 @@ class ShopProductsVM{
var selectedSubCategory = 0
var pageTitle : String?
+// var pageNo = 0
+// var stopFetch = false
+
+ // PAgination variables
var pageNo = 0
- var stopFetch = false
+ var isShopDataLoading = false
+ var totalDataCount = 0 // this will hold the total count from api
+
var cartButton: UIBarButtonItem!
var bottomBanner = GADBannerView()
@@ -92,10 +98,11 @@ class ShopProductsVM{
self.subCategoryData.append(contentsOf: data)
self.selectedSubCategory = -1
self.vc.subCategoryCV.reloadData()
- if let subCatID = data.first?.id{
- Utilities.startProgressHUD()
- self.getShopProducts(subCategoryID: subCatID)
- }
+// if let subCatID = data.first?.id{
+// }
+ Utilities.startProgressHUD()
+ self.getShopProducts(subCategoryID: selectedSubCategory)
+
self.vc.noDataStack.isHidden = true
default:
Utilities.dismissProgressHUD()
@@ -131,6 +138,7 @@ class ShopProductsVM{
case .success(let data):
guard let self else{
Utilities.dismissProgressHUD()
+ self?.isShopDataLoading = false
return
}
switch data.success{
@@ -140,7 +148,7 @@ class ShopProductsVM{
*/
Utilities.dismissProgressHUD()
vc.spinnerView.stopAnimating()
- if stopFetch == true { return}
+ self.isShopDataLoading = false
Utilities.alertWithBtnCompletion(title: "Error", msgBody: data.message ?? K.ConstantString.unRecognised, okBtnStr: "Retry?", vc: self.vc) { isDone in
if isDone{
self.getShopProducts(subCategoryID: subCategoryID)
@@ -149,15 +157,18 @@ class ShopProductsVM{
case 1:
Utilities.dismissProgressHUD()
vc.spinnerView.stopAnimating()
+ self.isShopDataLoading = false
guard let count = data.data?.totalRecords ,let data = data.data?.result else{return}
+ self.totalDataCount = count
+
if pageNo == 0{
self.shopProductsData.removeAll()
}
+
+ pageNo += 1
+
self.shopProductsData.append(contentsOf: data)
self.vc.productCV.reloadData()
- if self.shopProductsData.count == count{
- stopFetch = true
- }
/*
check for single product
@@ -174,27 +185,28 @@ class ShopProductsVM{
/*
If ads found then only load it or else directly append the data and reload
*/
- if let adsData = AuthFunc.shareInstance.adsData{
- // check if ads data contains ad for webseries
- if let shopSuperCatAd = adsData.result?.filter({$0.slug == AdsEnum.shop_super_category.rawValue}).first{
- if shopSuperCatAd.googleAd != nil{
- //setup google banner ads.
- AdReusable.sharedInstance.setupBannerAd(bannerView: self.bottomBanner, in: vc.adView, adUnitID: K.GoogleAdIDs.shop, viewController: self.vc, height: 8, width: 15)
- }
+ if bottomBanner.isHidden == false {return}
+ if let adsData = AuthFunc.shareInstance.adsData, let shopSuperCatAd = adsData.result?.filter({$0.slug == AdsEnum.shop_super_category.rawValue}).first {
+ if shopSuperCatAd.googleAd != nil{
+ //setup google banner ads.
+ AdReusable.sharedInstance.setupBannerAd(bannerView: self.bottomBanner, in: vc.adView, adUnitID: K.GoogleAdIDs.shop, viewController: self.vc, height: 8, width: 15)
}
}
default:
Utilities.dismissProgressHUD()
vc.spinnerView.stopAnimating()
+ self.isShopDataLoading = false
break
}
case .failure(let error):
guard let self else{
Utilities.dismissProgressHUD()
self?.vc.spinnerView.stopAnimating()
+ self?.isShopDataLoading = false
return
}
Utilities.dismissProgressHUD()
+ self.isShopDataLoading = false
vc.spinnerView.stopAnimating()
Utilities.alertWithBtnCompletion(title: "Error", msgBody: error.localizedDescription, okBtnStr: "Retry?", vc: self.vc) { isDone in
// if isDone{
@@ -206,6 +218,36 @@ class ShopProductsVM{
}
}
+// MARK: - Animating scrollView
+
+extension ShopProductsVC: UIScrollViewDelegate {
+
+ func scrollViewDidScroll(_ scrollView: UIScrollView) {
+ // dont do network call if the showdata count is same as the total count provided by api
+ // also check if already the api call is done
+ if vm.shopProductsData.count == vm.totalDataCount || vm.isShopDataLoading == true {return}
+
+ let contentHeight = scrollView.contentSize.height
+ let height = scrollView.frame.size.height
+ // Get the current vertical offset of the scroll view
+ let y = scrollView.contentOffset.y
+
+ // Check if the user scrolled to the bottom
+ if y > contentHeight - height * 1.6{
+
+ // check if internet is available
+ if CheckReachability.reachability?.isReachable == false{
+ return
+ }
+
+ spinnerView.startAnimating()
+ vm.isShopDataLoading = true
+ vm.getShopProducts(subCategoryID: vm.selectedSubCategory)
+ }
+ }
+
+}
+
class FooterSpinnerView: UICollectionReusableView {
override init(frame: CGRect) {