- contact apple developer, now if enrolling for a organisation account, same domain website is compulsary

- Completed the blogs detail screen, also handled the language change.
- added a nsnotification to handle the sidebar only on home an my list
- Added api for like , unlike , fav remove, with data models.
- handled the like unlike realtime, without the extra network call.
- added realtime language change will update the fav cells.
This commit is contained in:
Bilal
2024-06-14 21:27:18 +05:30
parent 3754a7f75b
commit a8f0b7b662
27 changed files with 1098 additions and 80 deletions

View File

@@ -57,12 +57,6 @@
525954302BEA394400191286 /* CustomAlerts.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 5259542F2BEA394300191286 /* CustomAlerts.storyboard */; };
525954322BEA39D200191286 /* AddTapGesture.swift in Sources */ = {isa = PBXBuildFile; fileRef = 525954312BEA39D200191286 /* AddTapGesture.swift */; };
525954342BEA620800191286 /* IntrestTopicDM.swift in Sources */ = {isa = PBXBuildFile; fileRef = 525954332BEA620800191286 /* IntrestTopicDM.swift */; };
525954352BEB4B3B00191286 /* Exo2-Thin.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 9C56E8312BDBC3EF00E4CA14 /* Exo2-Thin.ttf */; };
525954362BEB4B3B00191286 /* Exo2-Medium.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 9C56E82F2BDBC3EF00E4CA14 /* Exo2-Medium.ttf */; };
525954372BEB4B3B00191286 /* Exo2-Bold.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 9C56E82E2BDBC3EF00E4CA14 /* Exo2-Bold.ttf */; };
525954382BEB4B3B00191286 /* Exo2-Regular.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 9C56E8332BDBC3EF00E4CA14 /* Exo2-Regular.ttf */; };
525954392BEB4B3B00191286 /* Exo2-ExtraBold.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 9C56E8322BDBC3EF00E4CA14 /* Exo2-ExtraBold.ttf */; };
5259543A2BEB4B3B00191286 /* Exo2-SemiBold.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 9C56E8302BDBC3EF00E4CA14 /* Exo2-SemiBold.ttf */; };
525954512BEB5EB700191286 /* SkeletonView in Frameworks */ = {isa = PBXBuildFile; productRef = 525954502BEB5EB700191286 /* SkeletonView */; };
5259545A2BEB67D200191286 /* DateFormatterLib.swift in Sources */ = {isa = PBXBuildFile; fileRef = 525954592BEB67D200191286 /* DateFormatterLib.swift */; };
5259545C2BEBB80400191286 /* AvatarDM.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5259545B2BEBB80400191286 /* AvatarDM.swift */; };
@@ -176,6 +170,26 @@
9C7939152C0F23AA00F5D6E6 /* NsNotificationExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9C7939142C0F23AA00F5D6E6 /* NsNotificationExtension.swift */; };
9C7939172C0F23E900F5D6E6 /* LinkTypeEnum.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9C7939162C0F23E900F5D6E6 /* LinkTypeEnum.swift */; };
9C7939192C0F345000F5D6E6 /* ContactSupportVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9C7939182C0F345000F5D6E6 /* ContactSupportVC.swift */; };
9C834EC62C1C1D9500B29A9C /* BlogDetailsVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9C834EC52C1C1D9500B29A9C /* BlogDetailsVC.swift */; };
9C834EC72C1C1F9000B29A9C /* Exo2-SemiBold.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 9C56E8302BDBC3EF00E4CA14 /* Exo2-SemiBold.ttf */; };
9C834EC82C1C1F9000B29A9C /* Exo2-Medium.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 9C56E82F2BDBC3EF00E4CA14 /* Exo2-Medium.ttf */; };
9C834EC92C1C1F9000B29A9C /* Exo2-Bold.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 9C56E82E2BDBC3EF00E4CA14 /* Exo2-Bold.ttf */; };
9C834ECA2C1C1F9000B29A9C /* Exo2-ExtraBold.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 9C56E8322BDBC3EF00E4CA14 /* Exo2-ExtraBold.ttf */; };
9C834ECB2C1C1F9000B29A9C /* Exo2-Regular.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 9C56E8332BDBC3EF00E4CA14 /* Exo2-Regular.ttf */; };
9C834ECC2C1C1F9000B29A9C /* Exo2-Thin.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 9C56E8312BDBC3EF00E4CA14 /* Exo2-Thin.ttf */; };
9C834ECD2C1C1F9000B29A9C /* Exo2-SemiBold.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 9C56E8302BDBC3EF00E4CA14 /* Exo2-SemiBold.ttf */; };
9C834ECE2C1C1F9000B29A9C /* Exo2-Medium.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 9C56E82F2BDBC3EF00E4CA14 /* Exo2-Medium.ttf */; };
9C834ECF2C1C1F9000B29A9C /* Exo2-Bold.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 9C56E82E2BDBC3EF00E4CA14 /* Exo2-Bold.ttf */; };
9C834ED02C1C1F9000B29A9C /* Exo2-ExtraBold.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 9C56E8322BDBC3EF00E4CA14 /* Exo2-ExtraBold.ttf */; };
9C834ED12C1C1F9000B29A9C /* Exo2-Regular.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 9C56E8332BDBC3EF00E4CA14 /* Exo2-Regular.ttf */; };
9C834ED22C1C1F9000B29A9C /* Exo2-Thin.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 9C56E8312BDBC3EF00E4CA14 /* Exo2-Thin.ttf */; };
9C834ED32C1C1F9200B29A9C /* Exo2-SemiBold.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 9C56E8302BDBC3EF00E4CA14 /* Exo2-SemiBold.ttf */; };
9C834ED42C1C1F9200B29A9C /* Exo2-Medium.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 9C56E82F2BDBC3EF00E4CA14 /* Exo2-Medium.ttf */; };
9C834ED52C1C1F9200B29A9C /* Exo2-Bold.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 9C56E82E2BDBC3EF00E4CA14 /* Exo2-Bold.ttf */; };
9C834ED62C1C1F9200B29A9C /* Exo2-ExtraBold.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 9C56E8322BDBC3EF00E4CA14 /* Exo2-ExtraBold.ttf */; };
9C834ED72C1C1F9200B29A9C /* Exo2-Regular.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 9C56E8332BDBC3EF00E4CA14 /* Exo2-Regular.ttf */; };
9C834ED82C1C1F9200B29A9C /* Exo2-Thin.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 9C56E8312BDBC3EF00E4CA14 /* Exo2-Thin.ttf */; };
9C834EDC2C1C26CD00B29A9C /* HtmlText.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9C834EDB2C1C26CD00B29A9C /* HtmlText.swift */; };
9C8C4FAE2C1315410017DD3B /* WebViewVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9C8C4FAD2C1315410017DD3B /* WebViewVC.swift */; };
9C8C4FB02C1328060017DD3B /* Disclaimer.rtf in Resources */ = {isa = PBXBuildFile; fileRef = 9C8C4FAF2C1328060017DD3B /* Disclaimer.rtf */; };
9C9BEEC72BEE1BBF004ECC2F /* CollectionViewCenteredFlowLayout.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9C9BEEC62BEE1BBF004ECC2F /* CollectionViewCenteredFlowLayout.swift */; };
@@ -396,6 +410,9 @@
9C7939142C0F23AA00F5D6E6 /* NsNotificationExtension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NsNotificationExtension.swift; sourceTree = "<group>"; };
9C7939162C0F23E900F5D6E6 /* LinkTypeEnum.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LinkTypeEnum.swift; sourceTree = "<group>"; };
9C7939182C0F345000F5D6E6 /* ContactSupportVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContactSupportVC.swift; sourceTree = "<group>"; };
9C834EC52C1C1D9500B29A9C /* BlogDetailsVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BlogDetailsVC.swift; sourceTree = "<group>"; };
9C834ED92C1C20EC00B29A9C /* WOKA.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = WOKA.entitlements; sourceTree = "<group>"; };
9C834EDB2C1C26CD00B29A9C /* HtmlText.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HtmlText.swift; sourceTree = "<group>"; };
9C8C4FAD2C1315410017DD3B /* WebViewVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WebViewVC.swift; sourceTree = "<group>"; };
9C8C4FAF2C1328060017DD3B /* Disclaimer.rtf */ = {isa = PBXFileReference; lastKnownFileType = text.rtf; path = Disclaimer.rtf; sourceTree = "<group>"; };
9C9BEEC62BEE1BBF004ECC2F /* CollectionViewCenteredFlowLayout.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CollectionViewCenteredFlowLayout.swift; sourceTree = "<group>"; };
@@ -567,6 +584,7 @@
523ED25C2BDA2BC700CFED02 /* WOKA */ = {
isa = PBXGroup;
children = (
9C834ED92C1C20EC00B29A9C /* WOKA.entitlements */,
523ED26B2BDA2BC900CFED02 /* Info.plist */,
9C9BEEC62BEE1BBF004ECC2F /* CollectionViewCenteredFlowLayout.swift */,
5259541E2BE8E93500191286 /* Config.xcconfig */,
@@ -824,6 +842,7 @@
52C8B0512BDA4B51003B51D0 /* Helpers */ = {
isa = PBXGroup;
children = (
9C834EDA2C1C26C000B29A9C /* HTML */,
527AC6FF2C182D1700434FB7 /* Timer */,
9CBE1B3E2C0F37B200CA6E61 /* DropDown */,
9C535DB62C0089A700DA6DCD /* Animation */,
@@ -990,6 +1009,7 @@
52BC3BED2C16FBDB002FACA6 /* MoreVC.swift */,
522D655F2C1ACD8C0021E505 /* UserNotificationVC.swift */,
52CCD7AF2C1AF0F80078BD65 /* RadioVC.swift */,
9C834EC52C1C1D9500B29A9C /* BlogDetailsVC.swift */,
);
path = Controller;
sourceTree = "<group>";
@@ -1087,6 +1107,14 @@
path = ViewModel;
sourceTree = "<group>";
};
9C834EDA2C1C26C000B29A9C /* HTML */ = {
isa = PBXGroup;
children = (
9C834EDB2C1C26CD00B29A9C /* HtmlText.swift */,
);
path = HTML;
sourceTree = "<group>";
};
9CBCB2A62BE5104F007D7934 /* Home */ = {
isa = PBXGroup;
children = (
@@ -1275,22 +1303,22 @@
527AC6FE2C173A5100434FB7 /* SongListCell.xib in Resources */,
523ED26A2BDA2BC900CFED02 /* Base in Resources */,
52C8B05B2BDA5924003B51D0 /* WokaSplashSound.m4a in Resources */,
525954352BEB4B3B00191286 /* Exo2-Thin.ttf in Resources */,
527AC6F82C171C8F00434FB7 /* BlogsCell.xib in Resources */,
52A981D82C1B0E27000E0BEC /* FavouriteCell.xib in Resources */,
52C1A4E82C05C95D007BAA50 /* Theme.storyboard in Resources */,
525954362BEB4B3B00191286 /* Exo2-Medium.ttf in Resources */,
522D65652C1ACE9C0021E505 /* UserNotificationCell.xib in Resources */,
525954372BEB4B3B00191286 /* Exo2-Bold.ttf in Resources */,
525954382BEB4B3B00191286 /* Exo2-Regular.ttf in Resources */,
525954392BEB4B3B00191286 /* Exo2-ExtraBold.ttf in Resources */,
5259543A2BEB4B3B00191286 /* Exo2-SemiBold.ttf in Resources */,
9C535DC52C00BF2400DA6DCD /* HomeExploreCell.xib in Resources */,
9CBE1B422C0F37B300CA6E61 /* DropDownCell.xib in Resources */,
52A3F6A92BECBF2A0000BB0B /* LinkedChildCell.xib in Resources */,
523ED2652BDA2BC700CFED02 /* Base in Resources */,
52BC3BE62C0E0326002FACA6 /* FaqCell.xib in Resources */,
52C6E01C2BE383C000E22D59 /* YourIntrestCell.xib in Resources */,
9C834ED32C1C1F9200B29A9C /* Exo2-SemiBold.ttf in Resources */,
9C834ED42C1C1F9200B29A9C /* Exo2-Medium.ttf in Resources */,
9C834ED52C1C1F9200B29A9C /* Exo2-Bold.ttf in Resources */,
9C834ED62C1C1F9200B29A9C /* Exo2-ExtraBold.ttf in Resources */,
9C834ED72C1C1F9200B29A9C /* Exo2-Regular.ttf in Resources */,
9C834ED82C1C1F9200B29A9C /* Exo2-Thin.ttf in Resources */,
52C6E0262BE3B46A00E22D59 /* SelectAvatarCell.xib in Resources */,
52C8B0712BDA7512003B51D0 /* PassingCloud.json in Resources */,
9C8C4FB02C1328060017DD3B /* Disclaimer.rtf in Resources */,
@@ -1301,6 +1329,12 @@
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
9C834EC72C1C1F9000B29A9C /* Exo2-SemiBold.ttf in Resources */,
9C834EC82C1C1F9000B29A9C /* Exo2-Medium.ttf in Resources */,
9C834EC92C1C1F9000B29A9C /* Exo2-Bold.ttf in Resources */,
9C834ECA2C1C1F9000B29A9C /* Exo2-ExtraBold.ttf in Resources */,
9C834ECB2C1C1F9000B29A9C /* Exo2-Regular.ttf in Resources */,
9C834ECC2C1C1F9000B29A9C /* Exo2-Thin.ttf in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -1308,6 +1342,12 @@
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
9C834ECD2C1C1F9000B29A9C /* Exo2-SemiBold.ttf in Resources */,
9C834ECE2C1C1F9000B29A9C /* Exo2-Medium.ttf in Resources */,
9C834ECF2C1C1F9000B29A9C /* Exo2-Bold.ttf in Resources */,
9C834ED02C1C1F9000B29A9C /* Exo2-ExtraBold.ttf in Resources */,
9C834ED12C1C1F9000B29A9C /* Exo2-Regular.ttf in Resources */,
9C834ED22C1C1F9000B29A9C /* Exo2-Thin.ttf in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -1410,6 +1450,7 @@
52C6E01B2BE383C000E22D59 /* YourIntrestCell.swift in Sources */,
525954142BE8C87300191286 /* ExtensionVCToastAlert.swift in Sources */,
52B8D4D92C04A25E00ED65F3 /* UIViewController+Container.swift in Sources */,
9C834EDC2C1C26CD00B29A9C /* HtmlText.swift in Sources */,
527AC6F72C171C8F00434FB7 /* BlogsCell.swift in Sources */,
523ED25E2BDA2BC700CFED02 /* AppDelegate.swift in Sources */,
9C7939132C0EFCAE00F5D6E6 /* FaqVM.swift in Sources */,
@@ -1421,6 +1462,7 @@
9CBE1B402C0F37B300CA6E61 /* DPDKeyboardListener.swift in Sources */,
52A3F6AB2BECBF550000BB0B /* LinkedChildVC.swift in Sources */,
52FDBA7B2BFF2712009D7AC7 /* AuthFuncTimeHandling.swift in Sources */,
9C834EC62C1C1D9500B29A9C /* BlogDetailsVC.swift in Sources */,
9CBCB2A52BE50D49007D7934 /* NewPasswordVC.swift in Sources */,
9CBCB29F2BE4E13A007D7934 /* ValidatorClass.swift in Sources */,
9CBCB29B2BE4D614007D7934 /* LoginVC.swift in Sources */,
@@ -1730,6 +1772,7 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_ENTITLEMENTS = WOKA/WOKA.entitlements;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_TEAM = 4S9A74ZB6H;
@@ -1768,6 +1811,7 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_ENTITLEMENTS = WOKA/WOKA.entitlements;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_TEAM = 4S9A74ZB6H;

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

View File

@@ -0,0 +1,26 @@
{
"images" : [
{
"filename" : "CloseIconEmpty.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "CloseIconEmpty@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "CloseIconEmpty@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
},
"properties" : {
"template-rendering-intent" : "template"
}
}

View File

@@ -25,8 +25,8 @@ class LoginVC: UIViewController {
vm.vc = self
vm.initView()
self.userNameTF.text = "rizwan"
self.passwordTF.text = "Rizwan@123"
self.userNameTF.text = "child1"
self.passwordTF.text = "Admin@123"
}
@IBAction func loginBtnTapped(_ sender: LocalisedElementsButton) {

View File

@@ -11,6 +11,7 @@ extension K{
struct GVar{
// static var localized = K.LocalizedEnum.english
static var reloadMyList = false
}
}

View File

@@ -44,6 +44,7 @@ extension K{
static let themeTwoVC = "ThemeTwoVC"
static let moreVC = "MoreVC"
static let radioVC = "RadioVC"
static let blogDetailsVC = "BlogDetailsVC"
}
struct SideBarNav{

View File

@@ -0,0 +1,218 @@
//
// HtmlText.swift
// WOKA
//
// Created by Bilal on 14/06/2024.
//
import Foundation
import UIKit
//MARK : - html Data to Swift Readable
extension String {
var htmlToAttributedString: NSAttributedString? {
guard let data = data(using: .utf8) else { return nil }
do {
return try NSAttributedString(data: data, options: [.documentType: NSAttributedString.DocumentType.html, .characterEncoding:String.Encoding.utf8.rawValue], documentAttributes: nil)
} catch {
return nil
}
}
var htmlToString: String {
return htmlToAttributedString?.string ?? ""
}
}
//MARK : - changing attributed text size without losing html attributes
extension NSMutableAttributedString {
func setFontFace(font: UIFont, color: UIColor? = nil) {
beginEditing()
self.enumerateAttribute(.font,in: NSRange(location: 0, length: self.length)) { (value, range, stop) in
if let f = value as? UIFont,
let newFontDescriptor = f.fontDescriptor.withFamily(font.familyName).withSymbolicTraits(f.fontDescriptor.symbolicTraits) {
let newFont = UIFont(descriptor: newFontDescriptor,size: font.pointSize)
removeAttribute(.font, range: range)
addAttribute(.font, value: newFont, range: range)
if let color = color {
removeAttribute(.foregroundColor,range: range)
addAttribute(.foregroundColor,value: color, range: range)
}
}
}
endEditing()
}
}
class AttibutedStringSize {
static let shareInstance = AttibutedStringSize()
// func generateAttributedString(targetString: NSAttributedString, selectedNsRange : [NSRange]) -> NSAttributedString? {
// let attributedString = NSMutableAttributedString(attributedString: targetString)
// for range in selectedNsRange{
// attributedString.addAttribute(NSAttributedString.Key.foregroundColor, value: UIColor.red, range: range)
// }
// return attributedString
// }
//
// func changeFontSize(targetString: NSAttributedString,fontSize : CGFloat) -> NSAttributedString? {
// let attributedString = NSMutableAttributedString(attributedString: targetString)
// attributedString.addAttribute(NSAttributedString.Key.font, value: UIFont.boldSystemFont(ofSize: fontSize), range: NSRange(location: 0, length: targetString.string.utf16.count))
// return attributedString
// }
func changeDarkOrLightMode(targetString: NSAttributedString,color : UIColor ,selectedNsRange : [NSRange]) -> NSAttributedString? {
let attributedString = NSMutableAttributedString(attributedString: targetString)
attributedString.addAttribute(NSAttributedString.Key.foregroundColor, value: color, range: NSRange(location: 0, length: targetString.string.utf16.count))
for range in selectedNsRange{
attributedString.addAttribute(NSAttributedString.Key.foregroundColor, value: UIColor.red, range: range)
}
return attributedString
}
func generateFullyAttributedString(targetString: NSAttributedString, selectedNsRange : [NSRange],selectedLinkNsRange : [NSRange],linkURL:String ,textColor : UIColor , fontSize : CGFloat) -> NSAttributedString?{
let attributedString = NSMutableAttributedString(attributedString: targetString)
let range = NSRange(location: 0, length: targetString.string.utf16.count)
//MARK : - color
attributedString.addAttribute(NSAttributedString.Key.foregroundColor, value: textColor, range: range)
//MARK : - for selected range with link and underline
for range1 in selectedLinkNsRange{
attributedString.addAttribute(.link, value: linkURL, range:range1)
attributedString.addAttribute(NSAttributedString.Key.underlineStyle, value: NSUnderlineStyle.single.rawValue, range: range1)
attributedString.addAttribute(NSAttributedString.Key.foregroundColor, value: UIColor.blue, range: range1)
}
//MARK : - for highlight the text saved RED Color
for range2 in selectedNsRange{
attributedString.addAttribute(NSAttributedString.Key.foregroundColor, value: UIColor.red, range: range2)
}
//MARK : - for font family and size
attributedString.setFontFace(font: UIFont.systemFont(ofSize: fontSize))
return attributedString
}
func attributedStringSearch(with searchTerm: String, targetString: NSAttributedString) -> NSAttributedString? {
let attributedString = NSMutableAttributedString(attributedString: targetString)
do {
let regex = try NSRegularExpression(pattern: NSRegularExpression.escapedPattern(for: searchTerm).trimmingCharacters(in: .whitespacesAndNewlines).folding(options: .regularExpression, locale: .current), options: .caseInsensitive)
let range = NSRange(location: 0, length: targetString.string.utf16.count)
attributedString.addAttribute(NSAttributedString.Key.backgroundColor, value: UIColor.clear, range: range)
for match in regex.matches(in: targetString.string.folding(options: .regularExpression, locale: .current), options: .withTransparentBounds, range: range) {
attributedString.addAttribute(NSAttributedString.Key.backgroundColor, value: UIColor.green, range: match.range)
}
return attributedString
} catch {
NSLog("Error creating regular expresion: \(error)")
return nil
}
}
// func generateAttributedStringSearch(with searchTerm: String, targetString: NSAttributedString) -> NSAttributedString? {
// let attributedString = NSMutableAttributedString(attributedString: targetString)
// do {
// let regex = try NSRegularExpression(pattern: NSRegularExpression.escapedPattern(for: searchTerm).trimmingCharacters(in: .whitespacesAndNewlines).folding(options: .regularExpression, locale: .current), options: .caseInsensitive)
// let range = NSRange(location: 0, length: targetString.string.utf16.count)
// attributedString.addAttribute(NSAttributedString.Key.backgroundColor, value: UIColor.clear, range: range)
// for match in regex.matches(in: targetString.string.folding(options: .regularExpression, locale: .current), options: .withTransparentBounds, range: range) {
// attributedString.addAttribute(NSAttributedString.Key.backgroundColor, value: UIColor.green, range: match.range)
// }
// return attributedString
// } catch {
// NSLog("Error creating regular expresion: \(error)")
// return nil
// }
// }
// func generateAttributedStringColor(targetString: NSAttributedString, color : UIColor) -> NSAttributedString? {
// let attributedString = NSMutableAttributedString(attributedString: targetString)
// let range = NSRange(location: 0, length: targetString.string.utf16.count)
// attributedString.addAttribute(NSAttributedString.Key.backgroundColor, value: color, range: range)
// return attributedString
// }
// func generateAttributedStringDarkLight(targetString: NSAttributedString, selectedNsRange : [NSRange], color : UIColor,fontSize : CGFloat) -> NSAttributedString? {
// let attributedString = NSMutableAttributedString(attributedString: targetString)
// let fullRange = NSRange(location: 0, length: targetString.string.utf16.count)
// attributedString.addAttribute(NSAttributedString.Key.font, value: UIFont(name: "Arial", size: fontSize)!, range: fullRange)
// attributedString.addAttribute(NSAttributedString.Key.foregroundColor, value: color, range: fullRange)
// for range in selectedNsRange{
// attributedString.addAttribute(NSAttributedString.Key.foregroundColor, value: UIColor.red, range: range)
// }
// return attributedString
// }
// func generateLink(targetString: NSAttributedString ,selectedNsRange : [NSRange], linkURL:String) -> NSAttributedString? {
// let attributedString = NSMutableAttributedString(attributedString: targetString)
// for range in selectedNsRange{
// attributedString.addAttribute(.link, value: linkURL, range:range)
// attributedString.addAttribute(NSAttributedString.Key.underlineStyle, value: NSUnderlineStyle.single.rawValue, range: range)
// attributedString.addAttribute(NSAttributedString.Key.foregroundColor, value: UIColor.blue, range: range)
// }
// return attributedString
// }
//MARK : - for highlight and hyperlink
// func fullyAttributed(targetString: NSAttributedString ,selectedHighlightRange : [NSRange],selectedLinkRange : [NSRange] ,linkURL:String) -> NSAttributedString? {
// let attributedString = NSMutableAttributedString(attributedString: targetString)
// for range in selectedHighlightRange{
// attributedString.addAttribute(NSAttributedString.Key.foregroundColor, value: UIColor.red, range: range)
// }
// for range in selectedLinkRange{
// attributedString.addAttribute(.link, value: linkURL, range:range)
// attributedString.addAttribute(NSAttributedString.Key.underlineStyle, value: NSUnderlineStyle.single.rawValue, range: range)
// attributedString.addAttribute(NSAttributedString.Key.foregroundColor, value: UIColor.blue, range: range)
// }
//
// return attributedString
// }
//MARK : - searchControl
}
//MARK : - attStr To Html
//extension String {
// func attributedStringWithColor(_ strings: [String], color: UIColor, characterSpacing: UInt? = nil) -> NSAttributedString {
// let attributedString = NSMutableAttributedString(string: self)
// for string in strings {
// let range = (self as NSString).range(of: string)
// attributedString.addAttribute(NSAttributedString.Key.foregroundColor, value: color, range: range)
// }
//
// guard let characterSpacing = characterSpacing else {return attributedString}
//
// attributedString.addAttribute(NSAttributedString.Key.kern, value: characterSpacing, range: NSRange(location: 0, length: attributedString.length))
//
// return attributedString
// }
//}
//
//extension String {
// public var convertHtmlToNSAttributedString: NSAttributedString? {
// guard let data = data(using: .utf8) else {
// return nil
// }
// do {
// return try NSAttributedString(data: data,options: [.documentType: NSAttributedString.DocumentType.html,.characterEncoding: String.Encoding.utf8.rawValue], documentAttributes: nil)
// }
// catch {
// print(error.localizedDescription)
// return nil
// }
// }
//
// public func convertHtmlToAttributedStringWithCSS(font: UIFont? , csscolor: String , lineheight: Int, csstextalign: String) -> NSAttributedString? {
// guard let font = font else {
// return convertHtmlToNSAttributedString
// }
// let modifiedString = "<style>body{font-family: '\(font.fontName)'; font-size:\(font.pointSize)px; color: \(csscolor); line-height: \(lineheight)px; text-align: \(csstextalign); }</style>\(self)";
// guard let data = modifiedString.data(using: .utf8) else {
// return nil
// }
// do {
// return try NSAttributedString(data: data, options: [.documentType: NSAttributedString.DocumentType.html, .characterEncoding: String.Encoding.utf8.rawValue], documentAttributes: nil)
// }
// catch {
// print(error)
// return nil
// }
// }
//}

View File

@@ -10,4 +10,5 @@ import Foundation
extension Notification.Name {
static let languageDidChange = Notification.Name("languageDidChange")
static let linkPush = Notification.Name("linkPush")
static let enableDisableSideBar = Notification.Name("enableDisableSideBar")
}

View File

@@ -24,17 +24,48 @@ class MyListVC: UIViewController {
@IBOutlet weak var gamesCV: UICollectionView!
@IBOutlet weak var gamesStack: UIStackView!
@IBOutlet weak var noDataStack: UIStackView!
@IBOutlet weak var scrollView: UIScrollView!
var vm = MyListVM()
override func viewDidLoad() {
super.viewDidLoad()
vm.vc = self
vm.initView()
vm.refreshControl.attributedTitle = NSAttributedString(string: "Refreshing...",attributes: [.foregroundColor: UIColor.appColor(.TextDarkBlue)!])
vm.refreshControl.tintColor = UIColor.appColor(.TextDarkBlue)!
vm.refreshControl.addTarget(self, action: #selector(self.refresh(_:)), for: .valueChanged)
scrollView.addSubview(vm.refreshControl)
}
@objc func refresh(_ sender: AnyObject) {
Timer.scheduledTimer(withTimeInterval: 1, repeats: false) { [unowned self] _ in
vm.getFavouriteListing()
}
}
override func viewWillAppear(_ animated: Bool) {
}
override func viewWillDisappear(_ animated: Bool) {
}
override func viewDidAppear(_ animated: Bool) {
if K.GVar.reloadMyList{
K.GVar.reloadMyList = false
vm.getFavouriteListing()
}
}
@IBAction func sideBarBtnTapped(_ sender: UIButton) {
self.sideMenuController?.revealMenu()
}
@IBAction func backBtntapped(_ sender: UIButton) {
self.tabBarController?.selectedIndex = 0
}
@@ -48,35 +79,35 @@ extension MyListVC : CollectionViewSRC{
func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
switch collectionView{
case webSeriesCV:
if vm.favListingData?.showData?.count == 0{
if vm.favListingData?.showData?.count == 0 || vm.favListingData == nil{
webSeriesEnglishStack.isHidden = true
}else{
webSeriesEnglishStack.isHidden = false
}
return vm.favListingData?.showData?.count ?? 0
case audioBooksCV:
if vm.favListingData?.audioData?.count == 0{
if vm.favListingData?.audioData?.count == 0 || vm.favListingData == nil{
audioBooksStack.isHidden = true
}else{
audioBooksStack.isHidden = false
}
return vm.favListingData?.audioData?.count ?? 0
case karaokeCV:
if vm.favListingData?.singKaraokeData?.count == 0{
if vm.favListingData?.singKaraokeData?.count == 0 || vm.favListingData == nil{
karaokeStack.isHidden = true
}else{
karaokeStack.isHidden = false
}
return vm.favListingData?.singKaraokeData?.count ?? 0
case gamesCV:
if vm.favListingData?.gameData?.count == 0{
if vm.favListingData?.gameData?.count == 0 || vm.favListingData == nil{
gamesStack.isHidden = true
}else{
gamesStack.isHidden = false
}
return vm.favListingData?.gameData?.count ?? 0
case webSeriesHindiCV:
if vm.webSeriesHindi.count == 0{
if vm.webSeriesHindi.count == 0 || vm.favListingData == nil{
webSeriesHindiStack.isHidden = true
}else{
webSeriesHindiStack.isHidden = false
@@ -115,8 +146,202 @@ extension MyListVC : CollectionViewSRC{
cell.setData(data: data)
}
}
cell.btnTapped = { [self] (type) -> Void in
updateFavLikes(cv: collectionView, type: type, index: indexPath.row)
}
return cell
}
func updateFavLikes(cv : UICollectionView , type : FavCellCLick, index : Int){
switch cv{
case webSeriesCV:
guard let data = vm.favListingData?.showData?[index] else{return}
switch type {
case .favourite:
guard let isFav = data.markAsFavourite ,let postID = data.id,let postType = data.contentMoreDetails?.first?.postType,let categoryID = data.bookmarkCategoryIDS else{return}
if isFav{
vm.removeFavourite(postID: postID, postType: postType, categoryID: categoryID, index: index) { [unowned self] isDone in
if isDone{
vm.favListingData?.showData?.remove(at: index)
webSeriesCV.reloadData()
}
}
}
case .liked:
guard let isLiked = data.isLiked ,let postID = data.id,let postType = data.contentMoreDetails?.first?.postType else{return}
if isLiked{
vm.unlikePost(postID: postID, postType: postType, index: index) { [unowned self] isDone in
if isDone{
vm.favListingData?.showData?[index].isLiked = false
vm.favListingData?.showData?[index].likesCount! -= 1
webSeriesCV.reloadItems(at: [IndexPath(row: index, section: 0)])
}
}
}else{
vm.likePost(postID: postID, postType: postType, index: index){ [unowned self] isDone in
if isDone{
vm.favListingData?.showData?[index].isLiked = true
vm.favListingData?.showData?[index].likesCount! += 1
webSeriesCV.reloadItems(at: [IndexPath(row: index, section: 0)])
}
}
}
}
case webSeriesHindiCV:
let data = vm.webSeriesHindi[index]
switch type {
case .favourite:
guard let isFav = data.markAsFavourite ,let postID = data.id,let postType = data.contentMoreDetails?.first?.postType,let categoryID = data.bookmarkCategoryIDS else{return}
if isFav{
vm.removeFavourite(postID: postID, postType: postType, categoryID: categoryID, index: index) { [unowned self] isDone in
if isDone{
vm.webSeriesHindi.remove(at: index)
webSeriesHindiCV.reloadData()
vm.checkNil()
}
}
}
case .liked:
guard let isLiked = data.isLiked ,let postID = data.id,let postType = data.contentMoreDetails?.first?.postType,let categoryID = data.bookmarkCategoryIDS else{return}
if isLiked{
vm.unlikePost(postID: postID, postType: postType, index: index) { [unowned self] isDone in
if isDone{
vm.webSeriesHindi[index].isLiked = false
vm.webSeriesHindi[index].likesCount! -= 1
webSeriesHindiCV.reloadItems(at: [IndexPath(row: index, section: 0)])
vm.checkNil()
}
}
}else{
vm.likePost(postID: postID, postType: postType, index: index){ [unowned self] isDone in
if isDone{
vm.webSeriesHindi[index].isLiked = true
vm.webSeriesHindi[index].likesCount! += 1
webSeriesHindiCV.reloadItems(at: [IndexPath(row: index, section: 0)])
vm.checkNil()
}
}
}
}
case audioBooksCV:
guard let data = vm.favListingData?.audioData?[index] else{return}
switch type {
case .favourite:
guard let isFav = data.markAsFavourite ,let postID = data.id,let postType = data.contentMoreDetails?.first?.postType else{return}
if isFav{
vm.removeFavourite(postID: postID, postType: postType, categoryID: "", index: index) { [unowned self] isDone in
if isDone{
vm.favListingData?.audioData?.remove(at: index)
audioBooksCV.reloadData()
vm.checkNil()
}
}
}
case .liked:
guard let isLiked = data.isLiked ,let postID = data.id,let postType = data.contentMoreDetails?.first?.postType else{return}
if isLiked{
vm.unlikePost(postID: postID, postType: postType, index: index) { [unowned self] isDone in
if isDone{
vm.favListingData?.audioData?[index].isLiked = false
vm.favListingData?.audioData?[index].likesCount! -= 1
audioBooksCV.reloadItems(at: [IndexPath(row: index, section: 0)])
vm.checkNil()
}
}
}else{
vm.likePost(postID: postID, postType: postType, index: index){ [unowned self] isDone in
if isDone{
vm.favListingData?.audioData?[index].isLiked = true
vm.favListingData?.audioData?[index].likesCount! += 1
audioBooksCV.reloadItems(at: [IndexPath(row: index, section: 0)])
vm.checkNil()
}
}
}
}
case karaokeCV:
guard let data = vm.favListingData?.singKaraokeData?[index] else{return}
switch type {
case .favourite:
guard let isFav = data.markAsFavourite ,let postID = data.id,let postType = data.contentMoreDetails?.first?.postType else{return}
if isFav{
vm.removeFavourite(postID: postID, postType: postType, categoryID: "", index: index) { [unowned self] isDone in
if isDone{
vm.favListingData?.singKaraokeData?.remove(at: index)
karaokeCV.reloadData()
vm.checkNil()
}
}
}
case .liked:
guard let isLiked = data.isLiked ,let postID = data.id,let postType = data.contentMoreDetails?.first?.postType else{return}
if isLiked{
vm.unlikePost(postID: postID, postType: postType, index: index) { [unowned self] isDone in
if isDone{
vm.favListingData?.singKaraokeData?[index].isLiked = false
vm.favListingData?.singKaraokeData?[index].likesCount! -= 1
karaokeCV.reloadItems(at: [IndexPath(row: index, section: 0)])
vm.checkNil()
}
}
}else{
vm.likePost(postID: postID, postType: postType, index: index){ [unowned self] isDone in
if isDone{
vm.favListingData?.singKaraokeData?[index].isLiked = true
vm.favListingData?.singKaraokeData?[index].likesCount! += 1
karaokeCV.reloadItems(at: [IndexPath(row: index, section: 0)])
vm.checkNil()
}
}
}
}
case gamesCV:
guard let data = vm.favListingData?.gameData?[index] else{return}
switch type {
case .favourite:
guard let isFav = data.markAsFavourite ,let postID = data.id,let postType = data.contentMoreDetails?.first?.postType else{return}
if isFav{
vm.removeFavourite(postID: postID, postType: postType, categoryID: "", index: index) { [unowned self] isDone in
if isDone{
vm.favListingData?.gameData?.remove(at: index)
gamesCV.reloadData()
vm.checkNil()
}
}
}
case .liked:
guard let isLiked = data.isLiked ,let postID = data.id,let postType = data.contentMoreDetails?.first?.postType else{return}
if isLiked{
vm.unlikePost(postID: postID, postType: postType, index: index) { [unowned self] isDone in
if isDone{
vm.favListingData?.gameData?[index].isLiked = false
vm.favListingData?.gameData?[index].likesCount! -= 1
gamesCV.reloadItems(at: [IndexPath(row: index, section: 0)])
vm.checkNil()
}
}
}else{
vm.likePost(postID: postID, postType: postType, index: index){ [unowned self] isDone in
if isDone{
vm.favListingData?.gameData?[index].isLiked = true
vm.favListingData?.gameData?[index].likesCount! += 1
gamesCV.reloadItems(at: [IndexPath(row: index, section: 0)])
vm.checkNil()
}
}
}
}
default:
break
}
}
}

View File

@@ -899,6 +899,20 @@
<action selector="backBtntapped:" destination="55l-Gk-Npk" eventType="touchUpInside" id="qKE-a6-87A"/>
</connections>
</button>
<stackView hidden="YES" opaque="NO" contentMode="scaleToFill" axis="vertical" spacing="10" translatesAutoresizingMaskIntoConstraints="NO" id="QHo-nZ-miK">
<rect key="frame" x="88" y="330.5" width="238" height="200"/>
<subviews>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="SupportGirlImage" translatesAutoresizingMaskIntoConstraints="NO" id="JYi-oS-NUV">
<rect key="frame" x="0.0" y="0.0" width="238" height="166"/>
</imageView>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Browse to add favourites" textAlignment="center" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="RAL-v1-4Dn" customClass="LocalisedElementsLabel" customModule="WOKA" customModuleProvider="target">
<rect key="frame" x="0.0" y="176" width="238" height="24"/>
<fontDescription key="fontDescription" name="Exo2-Bold" family="Exo 2" pointSize="20"/>
<color key="textColor" name="TextDarkBlue"/>
<nil key="highlightedColor"/>
</label>
</subviews>
</stackView>
<scrollView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" showsHorizontalScrollIndicator="NO" showsVerticalScrollIndicator="NO" translatesAutoresizingMaskIntoConstraints="NO" id="SyC-Qw-kzE">
<rect key="frame" x="0.0" y="108" width="414" height="705"/>
<subviews>
@@ -908,12 +922,18 @@
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" translatesAutoresizingMaskIntoConstraints="NO" id="vZT-j7-NyY">
<rect key="frame" x="0.0" y="0.0" width="414" height="252"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text=" WebSeries (English)" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="xht-7u-pAV" customClass="LocalisedElementsLabel" customModule="WOKA" customModuleProvider="target">
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" translatesAutoresizingMaskIntoConstraints="NO" id="isb-Eg-K2k">
<rect key="frame" x="0.0" y="0.0" width="414" height="22"/>
<fontDescription key="fontDescription" name="Exo2-Bold" family="Exo 2" pointSize="18"/>
<color key="textColor" name="TextDarkBlue"/>
<nil key="highlightedColor"/>
</label>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="WebSeries (English)" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="xht-7u-pAV" customClass="LocalisedElementsLabel" customModule="WOKA" customModuleProvider="target">
<rect key="frame" x="15" y="0.0" width="399" height="22"/>
<fontDescription key="fontDescription" name="Exo2-Bold" family="Exo 2" pointSize="18"/>
<color key="textColor" name="TextDarkBlue"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<edgeInsets key="layoutMargins" top="0.0" left="15" bottom="0.0" right="0.0"/>
</stackView>
<collectionView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" showsHorizontalScrollIndicator="NO" showsVerticalScrollIndicator="NO" dataMode="prototypes" translatesAutoresizingMaskIntoConstraints="NO" id="6Y6-vJ-OYT">
<rect key="frame" x="0.0" y="22" width="414" height="230"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
@@ -933,12 +953,18 @@
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" translatesAutoresizingMaskIntoConstraints="NO" id="h1g-o9-Qbb">
<rect key="frame" x="0.0" y="262" width="414" height="252"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text=" WebSeries (Hindi)" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="UTS-hr-ix6" customClass="LocalisedElementsLabel" customModule="WOKA" customModuleProvider="target">
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" translatesAutoresizingMaskIntoConstraints="NO" id="5FA-pO-H2O">
<rect key="frame" x="0.0" y="0.0" width="414" height="22"/>
<fontDescription key="fontDescription" name="Exo2-Bold" family="Exo 2" pointSize="18"/>
<color key="textColor" name="TextDarkBlue"/>
<nil key="highlightedColor"/>
</label>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="WebSeries (Hindi)" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="UTS-hr-ix6" customClass="LocalisedElementsLabel" customModule="WOKA" customModuleProvider="target">
<rect key="frame" x="15" y="0.0" width="399" height="22"/>
<fontDescription key="fontDescription" name="Exo2-Bold" family="Exo 2" pointSize="18"/>
<color key="textColor" name="TextDarkBlue"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<edgeInsets key="layoutMargins" top="0.0" left="15" bottom="0.0" right="0.0"/>
</stackView>
<collectionView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" showsHorizontalScrollIndicator="NO" showsVerticalScrollIndicator="NO" dataMode="prototypes" translatesAutoresizingMaskIntoConstraints="NO" id="aW7-x8-HRh">
<rect key="frame" x="0.0" y="22" width="414" height="230"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
@@ -958,12 +984,18 @@
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" translatesAutoresizingMaskIntoConstraints="NO" id="G4a-BA-Nw8">
<rect key="frame" x="0.0" y="524" width="414" height="252"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text=" Audio Books" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="uOV-bc-Z6x" customClass="LocalisedElementsLabel" customModule="WOKA" customModuleProvider="target">
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" translatesAutoresizingMaskIntoConstraints="NO" id="xQU-Hb-duc">
<rect key="frame" x="0.0" y="0.0" width="414" height="22"/>
<fontDescription key="fontDescription" name="Exo2-Bold" family="Exo 2" pointSize="18"/>
<color key="textColor" name="TextDarkBlue"/>
<nil key="highlightedColor"/>
</label>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Audio Books" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="uOV-bc-Z6x" customClass="LocalisedElementsLabel" customModule="WOKA" customModuleProvider="target">
<rect key="frame" x="15" y="0.0" width="399" height="22"/>
<fontDescription key="fontDescription" name="Exo2-Bold" family="Exo 2" pointSize="18"/>
<color key="textColor" name="TextDarkBlue"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<edgeInsets key="layoutMargins" top="0.0" left="15" bottom="0.0" right="0.0"/>
</stackView>
<collectionView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" showsHorizontalScrollIndicator="NO" showsVerticalScrollIndicator="NO" dataMode="prototypes" translatesAutoresizingMaskIntoConstraints="NO" id="ABR-no-OBf">
<rect key="frame" x="0.0" y="22" width="414" height="230"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
@@ -983,12 +1015,18 @@
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" translatesAutoresizingMaskIntoConstraints="NO" id="jE2-WP-tD4">
<rect key="frame" x="0.0" y="786" width="414" height="252"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text=" Karaoke" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="JBX-qP-uJM" customClass="LocalisedElementsLabel" customModule="WOKA" customModuleProvider="target">
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" translatesAutoresizingMaskIntoConstraints="NO" id="YGM-QR-sbm">
<rect key="frame" x="0.0" y="0.0" width="414" height="22"/>
<fontDescription key="fontDescription" name="Exo2-Bold" family="Exo 2" pointSize="18"/>
<color key="textColor" name="TextDarkBlue"/>
<nil key="highlightedColor"/>
</label>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Karaoke" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="JBX-qP-uJM" customClass="LocalisedElementsLabel" customModule="WOKA" customModuleProvider="target">
<rect key="frame" x="15" y="0.0" width="399" height="22"/>
<fontDescription key="fontDescription" name="Exo2-Bold" family="Exo 2" pointSize="18"/>
<color key="textColor" name="TextDarkBlue"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<edgeInsets key="layoutMargins" top="0.0" left="15" bottom="0.0" right="0.0"/>
</stackView>
<collectionView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" showsHorizontalScrollIndicator="NO" showsVerticalScrollIndicator="NO" dataMode="prototypes" translatesAutoresizingMaskIntoConstraints="NO" id="Grz-ok-w2U">
<rect key="frame" x="0.0" y="22" width="414" height="230"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
@@ -1008,12 +1046,18 @@
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" translatesAutoresizingMaskIntoConstraints="NO" id="Cgp-Ok-Imj">
<rect key="frame" x="0.0" y="1048" width="414" height="252"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text=" Games" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Qph-Fh-w3E" customClass="LocalisedElementsLabel" customModule="WOKA" customModuleProvider="target">
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" translatesAutoresizingMaskIntoConstraints="NO" id="V6u-Uf-Yc7">
<rect key="frame" x="0.0" y="0.0" width="414" height="22"/>
<fontDescription key="fontDescription" name="Exo2-Bold" family="Exo 2" pointSize="18"/>
<color key="textColor" name="TextDarkBlue"/>
<nil key="highlightedColor"/>
</label>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Games" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Qph-Fh-w3E" customClass="LocalisedElementsLabel" customModule="WOKA" customModuleProvider="target">
<rect key="frame" x="15" y="0.0" width="399" height="22"/>
<fontDescription key="fontDescription" name="Exo2-Bold" family="Exo 2" pointSize="18"/>
<color key="textColor" name="TextDarkBlue"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<edgeInsets key="layoutMargins" top="0.0" left="15" bottom="0.0" right="0.0"/>
</stackView>
<collectionView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" showsHorizontalScrollIndicator="NO" showsVerticalScrollIndicator="NO" dataMode="prototypes" translatesAutoresizingMaskIntoConstraints="NO" id="5ff-Y7-nit">
<rect key="frame" x="0.0" y="22" width="414" height="230"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
@@ -1065,9 +1109,11 @@
<constraint firstItem="5ML-g4-686" firstAttribute="leading" secondItem="23B-pX-ODs" secondAttribute="leading" constant="5" id="Na5-Wr-DSa"/>
<constraint firstItem="SyC-Qw-kzE" firstAttribute="top" secondItem="a7Y-B6-f0Q" secondAttribute="bottom" constant="10" id="Nyh-j8-zuL"/>
<constraint firstItem="fPD-rO-ZgU" firstAttribute="trailing" secondItem="fTK-nk-bN9" secondAttribute="trailing" id="XRW-xO-sGx"/>
<constraint firstItem="QHo-nZ-miK" firstAttribute="centerX" secondItem="fPD-rO-ZgU" secondAttribute="centerX" id="ZkK-bD-6Ys"/>
<constraint firstItem="5ML-g4-686" firstAttribute="centerY" secondItem="a7Y-B6-f0Q" secondAttribute="centerY" id="aC4-mQ-heC"/>
<constraint firstItem="SyC-Qw-kzE" firstAttribute="leading" secondItem="fPD-rO-ZgU" secondAttribute="leading" id="cd5-Pg-diL"/>
<constraint firstItem="jbL-QO-JJl" firstAttribute="centerY" secondItem="5ML-g4-686" secondAttribute="centerY" constant="-1" id="h8B-5o-mja"/>
<constraint firstItem="QHo-nZ-miK" firstAttribute="centerY" secondItem="fPD-rO-ZgU" secondAttribute="centerY" id="npC-Cx-MHl"/>
<constraint firstItem="fPD-rO-ZgU" firstAttribute="bottom" secondItem="fTK-nk-bN9" secondAttribute="bottom" constant="-20" id="vmC-a4-Yy3"/>
</constraints>
</view>
@@ -1080,6 +1126,8 @@
<outlet property="gamesStack" destination="Cgp-Ok-Imj" id="63D-lB-0lW"/>
<outlet property="karaokeCV" destination="Grz-ok-w2U" id="vAr-XE-2Ne"/>
<outlet property="karaokeStack" destination="jE2-WP-tD4" id="azr-yq-sDA"/>
<outlet property="noDataStack" destination="QHo-nZ-miK" id="mA1-FT-iQl"/>
<outlet property="scrollView" destination="SyC-Qw-kzE" id="0xd-Wb-TU1"/>
<outlet property="webSeriesCV" destination="6Y6-vJ-OYT" id="FRf-D2-kxM"/>
<outlet property="webSeriesEnglishStack" destination="vZT-j7-NyY" id="HG5-LW-alT"/>
<outlet property="webSeriesHindiCV" destination="aW7-x8-HRh" id="eJM-QC-gIw"/>
@@ -1153,6 +1201,7 @@
<image name="OrderBottom" width="570.66668701171875" height="294.66665649414062"/>
<image name="ShopIcon" width="38" height="39"/>
<image name="SideMenu" width="44" height="44"/>
<image name="SupportGirlImage" width="166" height="166"/>
<image name="Theme1" width="106" height="160"/>
<image name="Theme2" width="106" height="160"/>
<image name="WebSeriesIcon" width="33" height="30"/>

View File

@@ -14,8 +14,8 @@ struct FavouriteListingDM: Codable {
// MARK: - Result
struct ResultData: Codable {
var showData: [ShowDatum]?
let videoData: [Datum]?
let gameData, audioData, singKaraokeData: [Datum]?
var videoData: [Datum]?
var gameData, audioData, singKaraokeData: [Datum]?
enum CodingKeys: String, CodingKey {
case showData = "show_data"
@@ -35,8 +35,8 @@ struct FavouriteListingDM: Codable {
let languageMasterID: Int?
let genderMasterID, audioDuration, mediaID: String?
let contentMoreDetails: [ContentMoreDetail]?
let markAsFavourite, isLiked: Bool?
let viewsCount, likesCount, bookmarkCount: Int?
var markAsFavourite, isLiked: Bool?
var viewsCount, likesCount, bookmarkCount: Int?
let bookmarkCategoryIDS: String?
let gameURL: String?
let screenOrientation: String?
@@ -95,8 +95,9 @@ struct FavouriteListingDM: Codable {
let totalSeasons, totalEpisodes: Int?
let categoryMasterID, ageRangeMasterID, genderMasterID: String?
let contentMoreDetails: [ContentMoreDetail]?
let markAsFavourite, isLiked: Bool?
let viewsCount, likesCount, bookmarkCount: Int?
var markAsFavourite, isLiked: Bool?
var likesCount : Int?
let viewsCount, bookmarkCount: Int?
let bookmarkCategoryIDS: String?
enum CodingKeys: String, CodingKey {

View File

@@ -7,6 +7,11 @@
import UIKit
enum FavCellCLick{
case favourite
case liked
}
class FavouriteCell: UICollectionViewCell {
@IBOutlet weak var cellImage: UIImageView!
@@ -15,15 +20,35 @@ class FavouriteCell: UICollectionViewCell {
@IBOutlet weak var favBtnn: UIButton!
@IBOutlet weak var totalLikes: UILabel!
typealias btnTappedBlock = ( _ from : FavCellCLick) -> Void // 0 - plus 1 - minus
var btnTapped : btnTappedBlock!
override func awakeFromNib() {
super.awakeFromNib()
// Initialization code
}
@IBAction func favouriteBtnTapped(_ sender: UIButton) {
if btnTapped != nil {
btnTapped( .favourite)
}
}
@IBAction func likeBtnTapped(_ sender: UIButton) {
if btnTapped != nil {
btnTapped( .liked)
}
}
func setData(data : FavouriteListingDM.ResultData.ShowDatum){
//heart.fill , heart , hand.thumbsup.fill , hand.thumbsup
cellTitle.text = data.title
if AuthFunc.shareInstance.getDefaultLanguage() == .english{
cellTitle.text = data.contentMoreDetails?.filter({$0.languageMasterID == 1}).first?.title
}else{
cellTitle.text = data.contentMoreDetails?.filter({$0.languageMasterID == 2}).first?.title
}
totalLikes.text = data.likesCount?.toString() ?? "0"
if let url = data.thumbnailPath{
cellImage.imageURL(url)
}
@@ -50,7 +75,11 @@ class FavouriteCell: UICollectionViewCell {
func setOtherData(data : FavouriteListingDM.ResultData.Datum){
//heart.fill , heart , hand.thumbsup.fill , hand.thumbsup
cellTitle.text = data.title
if AuthFunc.shareInstance.getDefaultLanguage() == .english{
cellTitle.text = data.contentMoreDetails?.filter({$0.languageMasterID == 1}).first?.title
}else{
cellTitle.text = data.contentMoreDetails?.filter({$0.languageMasterID == 2}).first?.title
}
totalLikes.text = data.likesCount?.toString() ?? "0"
if let url = data.thumbnailPath{
cellImage.imageURL(url)

View File

@@ -6,6 +6,7 @@
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="22685"/>
<capability name="Named colors" minToolsVersion="9.0"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="System colors in document resources" minToolsVersion="11.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<customFonts key="customFonts">
@@ -38,57 +39,70 @@
</userDefinedRuntimeAttribute>
</userDefinedRuntimeAttributes>
</imageView>
<stackView opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" distribution="equalSpacing" alignment="bottom" translatesAutoresizingMaskIntoConstraints="NO" id="5Fg-kv-VfG">
<rect key="frame" x="10" y="210" width="444" height="35"/>
<stackView opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" distribution="equalSpacing" alignment="center" translatesAutoresizingMaskIntoConstraints="NO" id="5Fg-kv-VfG">
<rect key="frame" x="10" y="210" width="444" height="40"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="oRP-Fz-UDh">
<rect key="frame" x="0.0" y="19.333333333333343" width="34" height="15.666666666666664"/>
<rect key="frame" x="0.0" y="12.333333333333343" width="34" height="15.666666666666664"/>
<fontDescription key="fontDescription" name="Exo2-Bold" family="Exo 2" pointSize="13"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<stackView opaque="NO" contentMode="scaleToFill" alignment="bottom" spacing="7" translatesAutoresizingMaskIntoConstraints="NO" id="HGJ-7n-Ypy">
<rect key="frame" x="385.33333333333331" y="13" width="58.666666666666686" height="22"/>
<rect key="frame" x="312.33333333333331" y="0.0" width="131.66666666666669" height="40"/>
<subviews>
<stackView opaque="NO" contentMode="scaleToFill" spacing="2" translatesAutoresizingMaskIntoConstraints="NO" id="8wE-gW-chr">
<rect key="frame" x="0.0" y="0.0" width="29.666666666666668" height="22"/>
<rect key="frame" x="0.0" y="0.0" width="131.66666666666666" height="40"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="hAN-DL-3jn">
<rect key="frame" x="0.0" y="0.0" width="40" height="40"/>
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
<constraints>
<constraint firstAttribute="width" secondItem="hAN-DL-3jn" secondAttribute="height" multiplier="1:1" id="wBd-5X-hLN"/>
</constraints>
</view>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="oMw-mq-dfy">
<rect key="frame" x="0.0" y="0.0" width="22" height="22"/>
<rect key="frame" x="42" y="0.0" width="40" height="40"/>
<constraints>
<constraint firstAttribute="width" secondItem="oMw-mq-dfy" secondAttribute="height" multiplier="1:1" id="NJb-wA-wkp"/>
</constraints>
<color key="tintColor" name="TextDarkBlue"/>
<inset key="imageEdgeInsets" minX="0.0" minY="0.0" maxX="2.2250738585072014e-308" maxY="0.0"/>
<state key="normal" image="hand.thumbsup.fill" catalog="system"/>
<connections>
<action selector="likeBtnTapped:" destination="gTV-IL-0wX" eventType="touchUpInside" id="aLn-wm-aOE"/>
</connections>
</button>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="1" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="CoX-fq-NYx">
<rect key="frame" x="24" y="0.0" width="5.6666666666666679" height="22"/>
<rect key="frame" x="84" y="0.0" width="5.6666666666666714" height="40"/>
<fontDescription key="fontDescription" name="Exo2-Bold" family="Exo 2" pointSize="13"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="DPV-BO-ggp">
<rect key="frame" x="91.666666666666686" y="0.0" width="40" height="40"/>
<constraints>
<constraint firstAttribute="width" secondItem="DPV-BO-ggp" secondAttribute="height" multiplier="1:1" id="4MG-wK-TWP"/>
</constraints>
<color key="tintColor" name="TextDarkBlue"/>
<inset key="imageEdgeInsets" minX="0.0" minY="0.0" maxX="2.2250738585072014e-308" maxY="0.0"/>
<state key="normal" image="heart.fill" catalog="system"/>
<connections>
<action selector="favouriteBtnTapped:" destination="gTV-IL-0wX" eventType="touchUpInside" id="zp8-Ry-tIJ"/>
</connections>
</button>
</subviews>
</stackView>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="DPV-BO-ggp">
<rect key="frame" x="36.666666666666686" y="0.0" width="22" height="22"/>
<constraints>
<constraint firstAttribute="width" secondItem="DPV-BO-ggp" secondAttribute="height" multiplier="1:1" id="4MG-wK-TWP"/>
</constraints>
<color key="tintColor" name="TextDarkBlue"/>
<inset key="imageEdgeInsets" minX="0.0" minY="0.0" maxX="2.2250738585072014e-308" maxY="0.0"/>
<state key="normal" image="heart.fill" catalog="system"/>
</button>
</subviews>
</stackView>
</subviews>
<constraints>
<constraint firstAttribute="height" constant="35" id="UXx-fJ-viE"/>
<constraint firstAttribute="height" constant="40" id="UXx-fJ-viE"/>
</constraints>
</stackView>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<edgeInsets key="layoutMargins" top="10" left="10" bottom="10" right="10"/>
<edgeInsets key="layoutMargins" top="10" left="10" bottom="5" right="10"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="number" keyPath="cornerRadius">
<integer key="value" value="5"/>
@@ -130,5 +144,8 @@
<namedColor name="TextDarkBlue">
<color red="0.10599999874830246" green="0.050999999046325684" blue="0.60399997234344482" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</namedColor>
<systemColor name="systemBackgroundColor">
<color white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</systemColor>
</resources>
</document>

View File

@@ -14,9 +14,18 @@ class MyListVM{
var webSeriesHindi = [FavouriteListingDM.ResultData.ShowDatum]()
let refreshControl = UIRefreshControl()
let feedbackGenerator = UIImpactFeedbackGenerator(style: .light)
func initView(){
setupCell()
Utilities.startProgressHUD()
getFavouriteListing()
NotificationCenter.default.addObserver(self, selector: #selector(languageChanged), name: .languageDidChange, object: nil)
}
@objc func languageChanged(){
self.reloadCollections()
}
func setupCell(){
@@ -44,7 +53,7 @@ class MyListVM{
// MARK: - Get Favourite Listing
func getFavouriteListing(){
Utilities.startProgressHUD()
let headers : HTTPHeaders = ["Accept-Language" : AuthFunc.shareInstance.languageSelected == .english ? "English" : "Hindi",
"access-token": AuthFunc.shareInstance.getAccessToken()]
NetworkManager.shareInstance.apiRequest(url: APIEndPoints.Home.favourite_listing, method: .post, headers: headers) { [weak self](result : Result<BaseResponseModel<FavouriteListingDM>, NetworkManager.APIError>) in
@@ -53,11 +62,18 @@ class MyListVM{
guard let self else{return}
switch data.success{
case 0:
self.refreshControl.endRefreshing()
Utilities.dismissProgressHUD()
self.vc.toast(msg: data.message ?? "Unrecognised error" , time: 2)
reloadCollections()
checkNil()
case 1:
self.refreshControl.endRefreshing()
Utilities.dismissProgressHUD()
guard let data = data.data?.result else{return}
favListingData = nil
webSeriesHindi.removeAll()
favListingData = data
if var hindiData = favListingData?.showData{
@@ -73,20 +89,142 @@ class MyListVM{
// Updating the showData with the filtered list
favListingData?.showData = hindiData
}
vc.webSeriesCV.reloadData()
vc.webSeriesHindiCV.reloadData()
vc.audioBooksCV.reloadData()
vc.karaokeCV.reloadData()
vc.gamesCV.reloadData()
reloadCollections()
feedbackGenerator.impactOccurred()
checkNil()
default:
break
}
case .failure(let error):
guard let self else{return}
self.refreshControl.endRefreshing()
Utilities.dismissProgressHUD()
checkNil()
self.vc.toast(msg: error.localizedDescription , time: 2)
}
}
}
// MARK: - Like , unlike
func likePost(postID : Int, postType : Int, index : Int , onCompletion : @escaping (Bool) -> Void){
Utilities.startProgressHUD()
let headers : HTTPHeaders = ["Accept-Language" : AuthFunc.shareInstance.languageSelected == .english ? "English" : "Hindi",
"access-token": AuthFunc.shareInstance.getAccessToken()]
let params : Parameters = ["post_id" : postID,
"post_type" : postType]
NetworkManager.shareInstance.apiRequest(url: APIEndPoints.Home.post_like, method: .post, parameters: params, headers: headers) { [weak self](result : Result<CommonResponseModel, NetworkManager.APIError>) in
switch result{
case .success(let data):
guard let self else{return}
switch data.success{
case 0:
Utilities.dismissProgressHUD()
self.vc.toast(msg: data.message ?? "Unrecognised error" , time: 2)
onCompletion(false)
case 1:
Utilities.dismissProgressHUD()
onCompletion(true)
default:
Utilities.dismissProgressHUD()
onCompletion(false)
}
case .failure(let error):
guard let self else{return}
Utilities.dismissProgressHUD()
self.vc.toast(msg: error.localizedDescription , time: 2)
onCompletion(false)
}
}
}
func unlikePost(postID : Int, postType : Int , index : Int, onCompletion : @escaping (Bool) -> Void){
Utilities.startProgressHUD()
let headers : HTTPHeaders = ["Accept-Language" : AuthFunc.shareInstance.languageSelected == .english ? "English" : "Hindi",
"access-token": AuthFunc.shareInstance.getAccessToken()]
let params : Parameters = ["post_id" : postID,
"post_type" : postType]
NetworkManager.shareInstance.apiRequest(url: APIEndPoints.Home.post_unlike, method: .post, parameters: params, headers: headers) { [weak self](result : Result<BaseResponseModel<CommonResponseModel>, NetworkManager.APIError>) in
switch result{
case .success(let data):
guard let self else{return}
switch data.success{
case 0:
Utilities.dismissProgressHUD()
self.vc.toast(msg: data.message ?? "Unrecognised error" , time: 2)
onCompletion(false)
case 1:
Utilities.dismissProgressHUD()
onCompletion(true)
default:
Utilities.dismissProgressHUD()
onCompletion(false)
}
case .failure(let error):
guard let self else{return}
Utilities.dismissProgressHUD()
self.vc.toast(msg: error.localizedDescription , time: 2)
onCompletion(false)
}
}
}
// MARK: - Remove Favourite
func removeFavourite(postID : Int, postType : Int, categoryID : String, index : Int , onCompletion : @escaping (Bool) -> Void){
Utilities.startProgressHUD()
let headers : HTTPHeaders = ["Accept-Language" : AuthFunc.shareInstance.languageSelected == .english ? "English" : "Hindi",
"access-token": AuthFunc.shareInstance.getAccessToken()]
let params : Parameters = ["id" : postID,
"post_type" : postType,
"category_id" : categoryID]
NetworkManager.shareInstance.apiRequest(url: APIEndPoints.Home.favourite_remove, method: .post, parameters: params, headers: headers) { [weak self](result : Result<CommonResponseModel, NetworkManager.APIError>) in
switch result{
case .success(let data):
guard let self else{return}
switch data.success{
case 0:
Utilities.dismissProgressHUD()
self.vc.toast(msg: data.message ?? "Unrecognised error" , time: 2)
onCompletion(false)
case 1:
Utilities.dismissProgressHUD()
onCompletion(true)
default:
Utilities.dismissProgressHUD()
onCompletion(false)
}
case .failure(let error):
guard let self else{return}
Utilities.dismissProgressHUD()
self.vc.toast(msg: error.localizedDescription , time: 2)
onCompletion(false)
}
}
}
func checkNil(){
guard let data = favListingData else{
self.vc.noDataStack.isHidden = false
return
}
if data.showData?.count == 0 && data.singKaraokeData?.count == 0 && data.gameData?.count == 0 && data.audioData?.count == 0 && webSeriesHindi.count == 0{
self.vc.noDataStack.isHidden = false
}else{
self.vc.noDataStack.isHidden = true
}
}
func reloadCollections(){
vc.webSeriesCV.reloadData()
vc.webSeriesHindiCV.reloadData()
vc.audioBooksCV.reloadData()
vc.karaokeCV.reloadData()
vc.gamesCV.reloadData()
}
}

View File

@@ -41,3 +41,14 @@
"कराओके" = "KARAOKE";
"दुकान" = "SHOP";
"वोका का अन्वेषण करें" = "Explore WOKA";
/*
My List
*/
"वेबसीरीज (अंग्रेजी)" = "WebSeries (English)";
"वेबसीरीज (हिंदी)" = "WebSeries (Hindi)";
"ऑडियो पुस्तकें" = "Audio Books";
"कराओके" = "Karaoke";
"खेल" = "Games";

View File

@@ -204,3 +204,14 @@
"KARAOKE" = "कराओके";
"SHOP" = "दुकान";
"Explore WOKA" = "वोका का अन्वेषण करें";
/*
My List
*/
"WebSeries (English)" = "वेबसीरीज (अंग्रेजी)";
"WebSeries (Hindi)" = "वेबसीरीज (हिंदी)";
"Audio Books" = "ऑडियो पुस्तकें";
"Karaoke" = "कराओके";
"Games" = "खेल";

View File

@@ -69,6 +69,14 @@ struct APIEndPoints {
static let song_listing = makeURL(path: "song_listing")
static let get_user_notifications = makeURL(path: "get_user_notifications")
static let favourite_listing = makeURL(path: "favourite_listing")
//Post Like Unlike
static let post_like = makeURL(path: "post_like")
static let post_unlike = makeURL(path: "post_unlike")
// Favourite
static let favourite_remove = makeURL(path: "favourite_remove")
static let favourite_add = makeURL(path: "favourite_add")
}
// Other endpoint categories...

View File

@@ -25,7 +25,7 @@ class BaseResponseModel<T: Codable> : Codable, ResponseProtocol{
}
struct CommonResponseModel : Codable {
struct CommonResponseModel : Codable ,ResponseProtocol{
let success: Int?
let message: String?

View File

@@ -202,7 +202,17 @@ open class SideMenuController: UIViewController {
setUpNotifications()
let generator = UINotificationFeedbackGenerator()
generator.notificationOccurred(.error)
NotificationCenter.default.addObserver(self, selector: #selector(enableDisableSideBar), name: .enableDisableSideBar, object: nil)
}
@objc func enableDisableSideBar(_ notification: NSNotification){
if let isEnabled = notification.userInfo?["type"] as? Bool {
panGestureRecognizer?.isEnabled = isEnabled
}
}
private func resolveDirection(with view: UIView) {
if shouldReverseDirection {
@@ -343,6 +353,7 @@ open class SideMenuController: UIViewController {
// MARK: Gesture Recognizer
private func configureGesturesRecognizer() {
// The gesture will be added anyway, its delegate will tell whether it should be recognized
let panGesture = UIPanGestureRecognizer(target: self, action: #selector(SideMenuController.handlePanGesture(_:)))
panGesture.delegate = self

View File

@@ -5,6 +5,7 @@
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="22685"/>
<capability name="Image references" minToolsVersion="12.0"/>
<capability name="Named colors" minToolsVersion="9.0"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="System colors in document resources" minToolsVersion="11.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
@@ -830,12 +831,138 @@
</objects>
<point key="canvasLocation" x="3598" y="-873"/>
</scene>
<!--Blog DetailsVC-->
<scene sceneID="lKv-gz-78f">
<objects>
<viewController storyboardIdentifier="BlogDetailsVC" id="m3z-AW-Y67" customClass="BlogDetailsVC" customModule="WOKA" customModuleProvider="target" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="2ie-fT-lBU">
<rect key="frame" x="0.0" y="0.0" width="393" height="852"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<view alpha="0.60000002384185791" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="bQW-EN-5cE">
<rect key="frame" x="0.0" y="0.0" width="393" height="852"/>
<color key="backgroundColor" white="0.0" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</view>
<stackView opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" axis="vertical" spacing="10" translatesAutoresizingMaskIntoConstraints="NO" id="Piw-bm-f3k">
<rect key="frame" x="20" y="99" width="353" height="679"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="d1Y-Ir-lq2">
<rect key="frame" x="0.0" y="8" width="353" height="35"/>
<subviews>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="5mY-JI-eL1">
<rect key="frame" x="313" y="0.0" width="35" height="35"/>
<constraints>
<constraint firstAttribute="width" secondItem="5mY-JI-eL1" secondAttribute="height" multiplier="1:1" id="Rcf-Zx-41P"/>
</constraints>
<color key="tintColor" name="TextDarkBlue"/>
<inset key="imageEdgeInsets" minX="5" minY="5" maxX="5" maxY="5"/>
<state key="normal" image="CloseIconEmpty"/>
<connections>
<action selector="clostBtnTapped:" destination="m3z-AW-Y67" eventType="touchUpInside" id="TG0-OD-YBa"/>
</connections>
</button>
</subviews>
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
<constraints>
<constraint firstAttribute="height" constant="35" id="7oA-aN-JgC"/>
<constraint firstAttribute="bottom" secondItem="5mY-JI-eL1" secondAttribute="bottom" id="WNx-ag-Xmu"/>
<constraint firstItem="5mY-JI-eL1" firstAttribute="top" secondItem="d1Y-Ir-lq2" secondAttribute="top" id="ZdQ-kc-JgC"/>
<constraint firstAttribute="trailing" secondItem="5mY-JI-eL1" secondAttribute="trailing" constant="5" id="yUn-TX-BAu"/>
</constraints>
</view>
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" translatesAutoresizingMaskIntoConstraints="NO" id="0zg-E5-h57">
<rect key="frame" x="0.0" y="53" width="353" height="180"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="7PR-nA-m6o" customClass="ShadowView" customModule="WOKA" customModuleProvider="target">
<rect key="frame" x="15" y="0.0" width="323" height="180"/>
<subviews>
<imageView opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="2FK-rk-obG">
<rect key="frame" x="0.0" y="0.0" width="323" height="180"/>
<color key="backgroundColor" systemColor="systemBrownColor"/>
</imageView>
</subviews>
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
<constraints>
<constraint firstItem="2FK-rk-obG" firstAttribute="top" secondItem="7PR-nA-m6o" secondAttribute="top" id="0ba-Z3-kLy"/>
<constraint firstAttribute="bottom" secondItem="2FK-rk-obG" secondAttribute="bottom" id="8iD-WR-hN6"/>
<constraint firstAttribute="trailing" secondItem="2FK-rk-obG" secondAttribute="trailing" id="KI1-qy-hb8"/>
<constraint firstItem="2FK-rk-obG" firstAttribute="leading" secondItem="7PR-nA-m6o" secondAttribute="leading" id="WaM-gh-bmf"/>
</constraints>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="number" keyPath="cornerRadius">
<real key="value" value="10"/>
</userDefinedRuntimeAttribute>
<userDefinedRuntimeAttribute type="color" keyPath="shadowColor">
<color key="value" white="0.0" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</userDefinedRuntimeAttribute>
</userDefinedRuntimeAttributes>
</view>
</subviews>
<edgeInsets key="layoutMargins" top="0.0" left="15" bottom="0.0" right="15"/>
</stackView>
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" spacing="10" translatesAutoresizingMaskIntoConstraints="NO" id="dPM-yr-RKo">
<rect key="frame" x="0.0" y="243" width="353" height="436"/>
<subviews>
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" translatesAutoresizingMaskIntoConstraints="NO" id="LyT-t9-LuK">
<rect key="frame" x="15" y="5" width="323" height="174.33333333333334"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" text="" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="r5a-5v-xNf">
<rect key="frame" x="0.0" y="0.0" width="323" height="174.33333333333334"/>
<fontDescription key="fontDescription" name="Exo2-Bold" family="Exo 2" pointSize="18"/>
<color key="textColor" name="TextDarkBlue"/>
<nil key="highlightedColor"/>
</label>
</subviews>
</stackView>
<textView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" showsHorizontalScrollIndicator="NO" showsVerticalScrollIndicator="NO" usesAttributedText="YES" translatesAutoresizingMaskIntoConstraints="NO" id="2tU-Z6-Wgy">
<rect key="frame" x="15" y="189.33333333333337" width="323" height="236.66666666666663"/>
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
<attributedString key="attributedText"/>
<textInputTraits key="textInputTraits" autocapitalizationType="sentences"/>
</textView>
</subviews>
<edgeInsets key="layoutMargins" top="5" left="15" bottom="10" right="15"/>
</stackView>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<edgeInsets key="layoutMargins" top="8" left="0.0" bottom="0.0" right="0.0"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="number" keyPath="cornerRadius">
<integer key="value" value="10"/>
</userDefinedRuntimeAttribute>
</userDefinedRuntimeAttributes>
</stackView>
</subviews>
<viewLayoutGuide key="safeArea" id="Ax4-X5-F7T"/>
<constraints>
<constraint firstItem="Piw-bm-f3k" firstAttribute="leading" secondItem="Ax4-X5-F7T" secondAttribute="leading" constant="20" id="BfI-fB-1Om"/>
<constraint firstAttribute="bottom" secondItem="bQW-EN-5cE" secondAttribute="bottom" id="GLj-g5-5tc"/>
<constraint firstItem="0zg-E5-h57" firstAttribute="height" secondItem="2ie-fT-lBU" secondAttribute="height" multiplier="0.211268" id="IDf-Ic-4sV"/>
<constraint firstItem="Ax4-X5-F7T" firstAttribute="trailing" secondItem="Piw-bm-f3k" secondAttribute="trailing" constant="20" id="RQY-KO-Li0"/>
<constraint firstItem="Ax4-X5-F7T" firstAttribute="trailing" secondItem="bQW-EN-5cE" secondAttribute="trailing" id="RoO-Yi-wP3"/>
<constraint firstItem="Ax4-X5-F7T" firstAttribute="bottom" secondItem="Piw-bm-f3k" secondAttribute="bottom" constant="40" id="nkQ-iC-Mo9"/>
<constraint firstItem="bQW-EN-5cE" firstAttribute="top" secondItem="2ie-fT-lBU" secondAttribute="top" id="pFH-7A-LAb"/>
<constraint firstItem="bQW-EN-5cE" firstAttribute="leading" secondItem="2ie-fT-lBU" secondAttribute="leading" id="vSV-dh-Ba2"/>
<constraint firstItem="Piw-bm-f3k" firstAttribute="top" secondItem="Ax4-X5-F7T" secondAttribute="top" constant="40" id="viN-Vf-tCG"/>
</constraints>
</view>
<connections>
<outlet property="blogDescription" destination="2tU-Z6-Wgy" id="9GC-0m-UrI"/>
<outlet property="blogImage" destination="2FK-rk-obG" id="xsI-NI-Tzk"/>
<outlet property="blogTitle" destination="r5a-5v-xNf" id="i1Z-tU-G4k"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="dyo-bM-Qn7" userLabel="First Responder" customClass="UIResponder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="4353" y="-873"/>
</scene>
</scenes>
<resources>
<image name="AudioBooks" width="172" height="120"/>
<image name="BottomArrow" width="33" height="33"/>
<image name="BottomFrame" width="570.66668701171875" height="729.33331298828125"/>
<image name="Boy" width="49.666667938232422" height="50"/>
<image name="CloseIconEmpty" width="30" height="30"/>
<image name="Cloud1" width="2469.666748046875" height="734.66668701171875"/>
<image name="Cloud2" width="2469.333251953125" height="354.66665649414062"/>
<image name="FM" width="76" height="76"/>
@@ -855,9 +982,15 @@
<image name="UpArrowMore" width="25" height="25"/>
<image name="WebSeries" width="164" height="118.66666412353516"/>
<image name="xmark.circle" catalog="system" width="128" height="123"/>
<namedColor name="TextDarkBlue">
<color red="0.10599999874830246" green="0.050999999046325684" blue="0.60399997234344482" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</namedColor>
<systemColor name="systemBackgroundColor">
<color white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</systemColor>
<systemColor name="systemBrownColor">
<color red="0.63529411764705879" green="0.51764705882352946" blue="0.36862745098039218" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</systemColor>
<systemColor name="systemGreenColor">
<color red="0.20392156862745098" green="0.7803921568627451" blue="0.34901960784313724" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</systemColor>

View File

@@ -17,7 +17,7 @@ class CommonNwCall{
if isRefreshing == false || isRefreshing == nil{
Utilities.startProgressHUD()
}
let headers : HTTPHeaders = ["access-token" : "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwczovL3dva2FsYW5kLmNvbS9hZG1pbi9hcGkvbG9naW4iLCJpYXQiOjE3MTgxODgwNTMsImV4cCI6MTc0OTcyNDA1MywibmJmIjoxNzE4MTg4MDUzLCJqdGkiOiJaNHIyVTlPYUxZanlDZm1TIiwic3ViIjoiMjE2IiwicHJ2IjoiMjNiZDVjODk0OWY2MDBhZGIzOWU3MDFjNDAwODcyZGI3YTU5NzZmNyJ9.09oMvLmPaSzSqI7tQTs0VblGeRxDYYdh4Bt-2z1RTKg"]
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):

View File

@@ -0,0 +1,55 @@
//
// BlogDetailsVC.swift
// WOKA
//
// Created by Bilal on 14/06/2024.
//
import UIKit
class BlogDetailsVC: UIViewController {
@IBOutlet weak var blogImage: UIImageView!
@IBOutlet weak var blogTitle: UILabel!
@IBOutlet weak var blogDescription: UITextView!
var blogData : BlogDM.Blog?
override func viewDidLoad() {
super.viewDidLoad()
updateUI()
}
@IBAction func clostBtnTapped(_ sender: UIButton) {
self.dismiss(animated: true)
}
func updateUI(){
blogImage.roundCorner(radius: 10)
guard let data = blogData else{return}
if let url = data.thumbnailPath{
self.blogImage.imageURL(url)
}
if AuthFunc.shareInstance.getDefaultLanguage() == .english{ // 1 enlgish , 2 hindi
guard let languageData = data.contentMoreDetails?.filter({$0.languageMasterID == 1}).first else{return}
self.blogTitle.text = languageData.title
if let desc = languageData.article?.htmlToAttributedString{
let sizeText = NSMutableAttributedString(attributedString: desc)
sizeText.setFontFace(font: FontCustom.shareInstance.customFont(fontName: .Exo2_Medium, size: 16))
self.blogDescription.attributedText = sizeText
}
}else{
guard let languageData = data.contentMoreDetails?.filter({$0.languageMasterID == 2}).first else{return}
self.blogTitle.text = languageData.title
if let desc = languageData.article?.htmlToAttributedString{
let sizeText = NSMutableAttributedString(attributedString: desc)
sizeText.setFontFace(font: FontCustom.shareInstance.customFont(fontName: .Exo2_Medium, size: 16))
self.blogDescription.attributedText = sizeText
}
}
}
}

View File

@@ -24,7 +24,13 @@ class MoreVC: UIViewController {
vm.initView()
}
override func viewWillAppear(_ animated: Bool) {
NotificationCenter.default.post(name: .enableDisableSideBar, object: nil, userInfo: ["type": false])
}
override func viewWillDisappear(_ animated: Bool) {
NotificationCenter.default.post(name: .enableDisableSideBar, object: nil, userInfo: ["type": true])
vm.player?.pause()
}
}
@@ -203,7 +209,13 @@ extension MoreVC : CollectionViewSRC{
}
func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
print(indexPath.row)
let data = vm.blogData[indexPath.row]
let sb = UIStoryboard(name: K.StoryBoard.theme, bundle: nil)
let vcPush = sb.instantiateViewController(withIdentifier: K.StoryBoardID.Theme.blogDetailsVC) as! BlogDetailsVC
vcPush.blogData = data
vcPush.modalPresentationStyle = .overCurrentContext
vcPush.modalTransitionStyle = .crossDissolve
self.present(vcPush, animated: true)
}
}

View File

@@ -99,3 +99,19 @@ class NavigationController: UINavigationController {
return self.topViewController
}
}
extension UINavigationController {
func pushWithPopInAnimation(_ viewController: UIViewController, duration: CFTimeInterval = 0.3) {
let transition = CATransition()
transition.duration = duration
transition.type = CATransitionType.push
transition.subtype = CATransitionSubtype.fromRight
// Customize the animation to look like a "pop-in"
transition.timingFunction = CAMediaTimingFunction(name: CAMediaTimingFunctionName.easeInEaseOut)
self.view.layer.add(transition, forKey: kCATransition)
self.pushViewController(viewController, animated: false)
}
}

11
WOKA/WOKA.entitlements Normal file
View File

@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.developer.user-fonts</key>
<array>
<string>app-usage</string>
<string>system-installation</string>
</array>
</dict>
</plist>