- Completed click count in sidebar

- Handled optional gender type
- Handled optional gender in profile
- Remaining MyListVC changes
This commit is contained in:
2024-08-13 20:02:41 +05:30
parent d17fe416ae
commit 5cf02c5aae
47 changed files with 1142 additions and 636 deletions

View File

@@ -45,9 +45,7 @@ class GamesListVC: UIViewController {
if self.isMovingFromParent {
// Back button was pressed
if let postID = vm.gameData[vm.indexToLoad].id{
PersistentStorage.shared.addGamesCount(postID: postID)
}
PersistentStorage.shared.addOthersCount()
}
}

View File

@@ -8,15 +8,23 @@
import UIKit
import WebKit
class GamesWebViewVC: UIViewController {
class GamesWebViewVC: UIViewController, WKNavigationDelegate,UIGestureRecognizerDelegate {
var url : String?
var orientation : ScreenOrientation?
var count = 0
var postID : Int?
@IBOutlet weak var clickView: UIView!
@IBOutlet weak var webView: WKWebView!
deinit{
// print("Deinit Game")
if let postID = self.postID{
PersistentStorage.shared.addGamesCount(postID: postID,count: count)
}
}
override func viewDidLoad() {
super.viewDidLoad()
@@ -35,15 +43,26 @@ class GamesWebViewVC: UIViewController {
let request = URLRequest(url: link)
webView.load(request)
webView.addTapGesture { [weak self] in
guard let self else{return}
count += 1
}
let tap = UITapGestureRecognizer(target: self, action: #selector(didTapMethod))
tap.numberOfTapsRequired = 1
tap.delegate = self
// Add the gesture recognizer to the web view
clickView.addGestureRecognizer(tap)
}
func gestureRecognizer(_ gestureRecognizer: UIGestureRecognizer, shouldRecognizeSimultaneouslyWith otherGestureRecognizer: UIGestureRecognizer) -> Bool {
return true
}
@objc func didTapMethod(){
count += 1
print(count)
}
@IBAction func backBtnTapped(_ sender: UIButton) {
if let postID = self.postID{
PersistentStorage.shared.addGamesCount(postID: postID)
PersistentStorage.shared.addOthersCount()
}
let sb = UIStoryboard(name: K.StoryBoard.customAlerts, bundle: nil)
@@ -56,9 +75,7 @@ class GamesWebViewVC: UIViewController {
guard let self else{return}
switch mode{
case .yes:
if let postID = self.postID{
PersistentStorage.shared.addGamesCount(postID: postID)
}
if orientation == .landscape{
appDelegate.deviceOrientation = .portrait
let value = UIInterfaceOrientation.portrait.rawValue

View File

@@ -534,15 +534,27 @@
<rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<wkWebView contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="k9t-dv-nhb">
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="UBq-Ug-nVj">
<rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
<color key="backgroundColor" white="0.0" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<wkWebViewConfiguration key="configuration" allowsAirPlayForMediaPlayback="NO" allowsPictureInPictureMediaPlayback="NO">
<dataDetectorTypes key="dataDetectorTypes"/>
<audiovisualMediaTypes key="mediaTypesRequiringUserActionForPlayback" none="YES"/>
<wkPreferences key="preferences"/>
</wkWebViewConfiguration>
</wkWebView>
<subviews>
<wkWebView contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="k9t-dv-nhb">
<rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
<color key="backgroundColor" white="0.0" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<wkWebViewConfiguration key="configuration" allowsAirPlayForMediaPlayback="NO" allowsPictureInPictureMediaPlayback="NO">
<dataDetectorTypes key="dataDetectorTypes" none="YES"/>
<audiovisualMediaTypes key="mediaTypesRequiringUserActionForPlayback" none="YES"/>
<wkPreferences key="preferences"/>
</wkWebViewConfiguration>
</wkWebView>
</subviews>
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
<constraints>
<constraint firstAttribute="trailing" secondItem="k9t-dv-nhb" secondAttribute="trailing" id="280-OD-igM"/>
<constraint firstAttribute="bottom" secondItem="k9t-dv-nhb" secondAttribute="bottom" id="LwL-cf-cGz"/>
<constraint firstItem="k9t-dv-nhb" firstAttribute="top" secondItem="UBq-Ug-nVj" secondAttribute="top" id="OLz-JE-Ule"/>
<constraint firstItem="k9t-dv-nhb" firstAttribute="leading" secondItem="UBq-Ug-nVj" secondAttribute="leading" id="XhR-Si-hmd"/>
</constraints>
</view>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="7Qp-yb-i2l">
<rect key="frame" x="7" y="58" width="35" height="35"/>
<color key="backgroundColor" name="ImageDarkBlue"/>
@@ -564,23 +576,24 @@
</button>
</subviews>
<viewLayoutGuide key="safeArea" id="UAe-my-8xP"/>
<color key="backgroundColor" white="0.0" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints>
<constraint firstItem="UBq-Ug-nVj" firstAttribute="top" secondItem="8Dy-BS-4tC" secondAttribute="top" id="9CL-yd-6Hq"/>
<constraint firstItem="UBq-Ug-nVj" firstAttribute="leading" secondItem="UAe-my-8xP" secondAttribute="leading" id="9hb-Yg-ACx"/>
<constraint firstItem="7Qp-yb-i2l" firstAttribute="top" secondItem="UAe-my-8xP" secondAttribute="top" constant="10" id="Oxh-34-kbI"/>
<constraint firstItem="k9t-dv-nhb" firstAttribute="top" secondItem="8Dy-BS-4tC" secondAttribute="top" id="Tj3-by-0aA"/>
<constraint firstItem="k9t-dv-nhb" firstAttribute="leading" secondItem="UAe-my-8xP" secondAttribute="leading" id="dmX-Nj-8mc"/>
<constraint firstAttribute="bottom" secondItem="k9t-dv-nhb" secondAttribute="bottom" id="nbu-MB-upl"/>
<constraint firstAttribute="bottom" secondItem="UBq-Ug-nVj" secondAttribute="bottom" id="lOx-rP-1sz"/>
<constraint firstItem="7Qp-yb-i2l" firstAttribute="leading" secondItem="UAe-my-8xP" secondAttribute="leading" constant="7" id="otO-uz-8gX"/>
<constraint firstItem="UAe-my-8xP" firstAttribute="trailing" secondItem="k9t-dv-nhb" secondAttribute="trailing" id="zmC-r9-WYr"/>
<constraint firstItem="UBq-Ug-nVj" firstAttribute="trailing" secondItem="UAe-my-8xP" secondAttribute="trailing" id="xcS-Cj-AOE"/>
</constraints>
</view>
<connections>
<outlet property="clickView" destination="UBq-Ug-nVj" id="AR4-7x-xFq"/>
<outlet property="webView" destination="k9t-dv-nhb" id="3fK-U0-3Dd"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="hXA-NY-nAf" userLabel="First Responder" customClass="UIResponder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="1580" y="-1"/>
<point key="canvasLocation" x="1579.7101449275362" y="-1.3392857142857142"/>
</scene>
</scenes>
<resources>