Files
Woka_Native_iOS/WOKA/Theme/CommonNwCall.swift
BilalKhanWDI 1d6add0322 - Added DropDown
- Added api for show listing , made data model, updated the dropdown
- Added api for category, made data model
- Made the dynamic height tableview to show all the shows
- On fav add remove , will refresh the mylist screen
- Added default load on hindi
- On category selection change, updating the show list data
- Handled the fav category id as int, string , string seeprated with “,”
- Modifying my list with bookmark id with above
2024-06-19 20:07:47 +05:30

50 lines
1.7 KiB
Swift

//
// CommonNwCall.swift
// WOKA
//
// Created by MacBook Pro on 13/06/24.
//
import UIKit
import Alamofire
class CommonNwCall{
static let shareInstance = CommonNwCall()
var userNotification = [UserNotificationDM]()
func getUserNotification(vc : UIViewController , isRefreshing : Bool? = nil, completion : @escaping (Bool) -> Void){
if isRefreshing == false || isRefreshing == nil{
Utilities.startProgressHUD()
}
let headers : HTTPHeaders = ["access-token" : AuthFunc.shareInstance.getAccessToken()]
NetworkManager.shareInstance.apiRequest(url: APIEndPoints.Home.get_user_notifications, method: .get,headers : headers) {(result : Result<BaseResponseModel<[UserNotificationDM]>, NetworkManager.APIError>) in
switch result{
case .success(let data):
switch data.success{
case 0:
/*
Error
*/
Utilities.dismissProgressHUD()
vc.toast(msg: data.message ?? "Unrecognised error" , time: 2)
completion(false)
case 1:
Utilities.dismissProgressHUD()
guard let data = data.data else{return}
self.userNotification.removeAll()
self.userNotification.append(contentsOf: data)
//Fetched Blogs
completion(true)
default:
completion(false)
}
case .failure(let error):
Utilities.dismissProgressHUD()
vc.toast(msg: error.localizedDescription , time: 2)
completion(false)
}
}
}
}