推送功能开发,UI排查,bug修复
This commit is contained in:
parent
78f810498d
commit
8759b6f80c
@ -154,6 +154,10 @@
|
||||
BFCCE11A2DFAB7CA00EDE165 /* VPLanguageModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = BFCCE1192DFAB7CA00EDE165 /* VPLanguageModel.swift */; };
|
||||
BFCCE11C2DFAB83900EDE165 /* VPLocalizedModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = BFCCE11B2DFAB83900EDE165 /* VPLocalizedModel.swift */; };
|
||||
BFCCE11F2DFAD18000EDE165 /* VPGuideViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = BFCCE11E2DFAD18000EDE165 /* VPGuideViewController.swift */; };
|
||||
BFCCE1212DFBF33500EDE165 /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = BFCCE1202DFBF33500EDE165 /* GoogleService-Info.plist */; };
|
||||
BFCCE1242DFBF57B00EDE165 /* FirebaseCore in Frameworks */ = {isa = PBXBuildFile; productRef = BFCCE1232DFBF57B00EDE165 /* FirebaseCore */; };
|
||||
BFCCE1262DFBF57B00EDE165 /* FirebaseMessaging in Frameworks */ = {isa = PBXBuildFile; productRef = BFCCE1252DFBF57B00EDE165 /* FirebaseMessaging */; };
|
||||
BFCCE1282DFC080200EDE165 /* HWPanModalContentView+VPAdd.swift in Sources */ = {isa = PBXBuildFile; fileRef = BFCCE1272DFC07FB00EDE165 /* HWPanModalContentView+VPAdd.swift */; };
|
||||
BFF5AFA42DE6F15E0044227A /* VPMeVipCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = BFF5AFA32DE6F15E0044227A /* VPMeVipCell.swift */; };
|
||||
BFF5AFA62DE700420044227A /* VPMeVipPrivilegeItemView.swift in Sources */ = {isa = PBXBuildFile; fileRef = BFF5AFA52DE700420044227A /* VPMeVipPrivilegeItemView.swift */; };
|
||||
BFF5AFA82DE704DC0044227A /* VPMeCoinCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = BFF5AFA72DE704DC0044227A /* VPMeCoinCell.swift */; };
|
||||
@ -388,6 +392,8 @@
|
||||
BFCCE1192DFAB7CA00EDE165 /* VPLanguageModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = VPLanguageModel.swift; sourceTree = "<group>"; };
|
||||
BFCCE11B2DFAB83900EDE165 /* VPLocalizedModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = VPLocalizedModel.swift; sourceTree = "<group>"; };
|
||||
BFCCE11E2DFAD18000EDE165 /* VPGuideViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = VPGuideViewController.swift; sourceTree = "<group>"; };
|
||||
BFCCE1202DFBF33500EDE165 /* GoogleService-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "GoogleService-Info.plist"; sourceTree = "<group>"; };
|
||||
BFCCE1272DFC07FB00EDE165 /* HWPanModalContentView+VPAdd.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "HWPanModalContentView+VPAdd.swift"; sourceTree = "<group>"; };
|
||||
BFF5AFA32DE6F15E0044227A /* VPMeVipCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = VPMeVipCell.swift; sourceTree = "<group>"; };
|
||||
BFF5AFA52DE700420044227A /* VPMeVipPrivilegeItemView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = VPMeVipPrivilegeItemView.swift; sourceTree = "<group>"; };
|
||||
BFF5AFA72DE704DC0044227A /* VPMeCoinCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = VPMeCoinCell.swift; sourceTree = "<group>"; };
|
||||
@ -471,6 +477,8 @@
|
||||
files = (
|
||||
F939C04AD4003BA127F15C28 /* Pods_Veloria.framework in Frameworks */,
|
||||
BFF5B2442DF050260044227A /* FacebookCore in Frameworks */,
|
||||
BFCCE1262DFBF57B00EDE165 /* FirebaseMessaging in Frameworks */,
|
||||
BFCCE1242DFBF57B00EDE165 /* FirebaseCore in Frameworks */,
|
||||
BFF5B2462DF050260044227A /* FacebookLogin in Frameworks */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
@ -529,6 +537,7 @@
|
||||
BF0FA7352DDECC4600C9E5F2 /* Font */,
|
||||
1B056E222DDAC0FD007EE38D /* Assets.xcassets */,
|
||||
1B056E232DDAC0FD007EE38D /* Info.plist */,
|
||||
BFCCE1202DFBF33500EDE165 /* GoogleService-Info.plist */,
|
||||
1B056E252DDAC0FD007EE38D /* LaunchScreen.storyboard */,
|
||||
1B056E5E2DDACE12007EE38D /* Veloria-Bridging-Header.h */,
|
||||
1B056E622DDAD035007EE38D /* Localizable.strings */,
|
||||
@ -671,6 +680,7 @@
|
||||
BF0FA77A2DE0788A00C9E5F2 /* UIStackView+VPAdd.swift */,
|
||||
BF0FA7A42DE4384100C9E5F2 /* AttributedString+VPAdd.swift */,
|
||||
BFF5B25B2DF13F850044227A /* Date+VPAdd.swift */,
|
||||
BFCCE1272DFC07FB00EDE165 /* HWPanModalContentView+VPAdd.swift */,
|
||||
);
|
||||
path = Extension;
|
||||
sourceTree = "<group>";
|
||||
@ -1308,6 +1318,7 @@
|
||||
minimizedProjectReferenceProxies = 1;
|
||||
packageReferences = (
|
||||
BFF5B2422DF050260044227A /* XCRemoteSwiftPackageReference "facebook-ios-sdk" */,
|
||||
BFCCE1222DFBF57B00EDE165 /* XCRemoteSwiftPackageReference "firebase-ios-sdk" */,
|
||||
);
|
||||
preferredProjectObjectVersion = 77;
|
||||
productRefGroup = 1B056DF52DDABE2B007EE38D /* Products */;
|
||||
@ -1329,6 +1340,7 @@
|
||||
BF0FA7372DDECC5400C9E5F2 /* PlayfairDisplay-VariableFont_wght.ttf in Resources */,
|
||||
BFF5AFC42DE84F9C0044227A /* Aa厚底黑.ttf in Resources */,
|
||||
1B056E302DDAC0FD007EE38D /* LaunchScreen.storyboard in Resources */,
|
||||
BFCCE1212DFBF33500EDE165 /* GoogleService-Info.plist in Resources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
@ -1433,6 +1445,7 @@
|
||||
BF0FA7672DE0469300C9E5F2 /* VPEpisodeView.swift in Sources */,
|
||||
BF0FA6F92DDC64E700C9E5F2 /* VPHomeAPI.swift in Sources */,
|
||||
BF0FA6F42DDC604500C9E5F2 /* VPHUD.swift in Sources */,
|
||||
BFCCE1282DFC080200EDE165 /* HWPanModalContentView+VPAdd.swift in Sources */,
|
||||
BF0FA7222DDC859D00C9E5F2 /* NSNumber+VPAdd.swift in Sources */,
|
||||
BF0FA73B2DDED1C700C9E5F2 /* VPHomeListCell.swift in Sources */,
|
||||
BF0FA79F2DE1A29A00C9E5F2 /* VPCollectListCell.swift in Sources */,
|
||||
@ -1844,6 +1857,14 @@
|
||||
/* End XCConfigurationList section */
|
||||
|
||||
/* Begin XCRemoteSwiftPackageReference section */
|
||||
BFCCE1222DFBF57B00EDE165 /* XCRemoteSwiftPackageReference "firebase-ios-sdk" */ = {
|
||||
isa = XCRemoteSwiftPackageReference;
|
||||
repositoryURL = "https://github.com/firebase/firebase-ios-sdk";
|
||||
requirement = {
|
||||
kind = upToNextMajorVersion;
|
||||
minimumVersion = 11.14.0;
|
||||
};
|
||||
};
|
||||
BFF5B2422DF050260044227A /* XCRemoteSwiftPackageReference "facebook-ios-sdk" */ = {
|
||||
isa = XCRemoteSwiftPackageReference;
|
||||
repositoryURL = "https://github.com/facebook/facebook-ios-sdk";
|
||||
@ -1855,6 +1876,16 @@
|
||||
/* End XCRemoteSwiftPackageReference section */
|
||||
|
||||
/* Begin XCSwiftPackageProductDependency section */
|
||||
BFCCE1232DFBF57B00EDE165 /* FirebaseCore */ = {
|
||||
isa = XCSwiftPackageProductDependency;
|
||||
package = BFCCE1222DFBF57B00EDE165 /* XCRemoteSwiftPackageReference "firebase-ios-sdk" */;
|
||||
productName = FirebaseCore;
|
||||
};
|
||||
BFCCE1252DFBF57B00EDE165 /* FirebaseMessaging */ = {
|
||||
isa = XCSwiftPackageProductDependency;
|
||||
package = BFCCE1222DFBF57B00EDE165 /* XCRemoteSwiftPackageReference "firebase-ios-sdk" */;
|
||||
productName = FirebaseMessaging;
|
||||
};
|
||||
BFF5B2432DF050260044227A /* FacebookCore */ = {
|
||||
isa = XCSwiftPackageProductDependency;
|
||||
package = BFF5B2422DF050260044227A /* XCRemoteSwiftPackageReference "facebook-ios-sdk" */;
|
||||
|
@ -1,6 +1,24 @@
|
||||
{
|
||||
"originHash" : "ca3cf5f8f83d297b47d2cb0edff3e06f294951e2e06fa55cfc82831103499b2a",
|
||||
"originHash" : "356668427da72005d8cb60963e877385296f1863605fc5a20d1f75f2cec3b22c",
|
||||
"pins" : [
|
||||
{
|
||||
"identity" : "abseil-cpp-binary",
|
||||
"kind" : "remoteSourceControl",
|
||||
"location" : "https://github.com/google/abseil-cpp-binary.git",
|
||||
"state" : {
|
||||
"revision" : "bbe8b69694d7873315fd3a4ad41efe043e1c07c5",
|
||||
"version" : "1.2024072200.0"
|
||||
}
|
||||
},
|
||||
{
|
||||
"identity" : "app-check",
|
||||
"kind" : "remoteSourceControl",
|
||||
"location" : "https://github.com/google/app-check.git",
|
||||
"state" : {
|
||||
"revision" : "61b85103a1aeed8218f17c794687781505fbbef5",
|
||||
"version" : "11.2.0"
|
||||
}
|
||||
},
|
||||
{
|
||||
"identity" : "facebook-ios-sdk",
|
||||
"kind" : "remoteSourceControl",
|
||||
@ -9,6 +27,114 @@
|
||||
"revision" : "c19607d535864533523d1f437c84035e5fb101cf",
|
||||
"version" : "14.1.0"
|
||||
}
|
||||
},
|
||||
{
|
||||
"identity" : "firebase-ios-sdk",
|
||||
"kind" : "remoteSourceControl",
|
||||
"location" : "https://github.com/firebase/firebase-ios-sdk",
|
||||
"state" : {
|
||||
"revision" : "45d327fcbe7793747295346c2209ad419bdead74",
|
||||
"version" : "11.14.0"
|
||||
}
|
||||
},
|
||||
{
|
||||
"identity" : "google-ads-on-device-conversion-ios-sdk",
|
||||
"kind" : "remoteSourceControl",
|
||||
"location" : "https://github.com/googleads/google-ads-on-device-conversion-ios-sdk",
|
||||
"state" : {
|
||||
"revision" : "70a7857886f065a40486a7607268781c49db04ae",
|
||||
"version" : "2.0.0"
|
||||
}
|
||||
},
|
||||
{
|
||||
"identity" : "googleappmeasurement",
|
||||
"kind" : "remoteSourceControl",
|
||||
"location" : "https://github.com/google/GoogleAppMeasurement.git",
|
||||
"state" : {
|
||||
"revision" : "406f72d0d5e9445fd1cf782db3e9e338cee2bed4",
|
||||
"version" : "11.14.0"
|
||||
}
|
||||
},
|
||||
{
|
||||
"identity" : "googledatatransport",
|
||||
"kind" : "remoteSourceControl",
|
||||
"location" : "https://github.com/google/GoogleDataTransport.git",
|
||||
"state" : {
|
||||
"revision" : "617af071af9aa1d6a091d59a202910ac482128f9",
|
||||
"version" : "10.1.0"
|
||||
}
|
||||
},
|
||||
{
|
||||
"identity" : "googleutilities",
|
||||
"kind" : "remoteSourceControl",
|
||||
"location" : "https://github.com/google/GoogleUtilities.git",
|
||||
"state" : {
|
||||
"revision" : "60da361632d0de02786f709bdc0c4df340f7613e",
|
||||
"version" : "8.1.0"
|
||||
}
|
||||
},
|
||||
{
|
||||
"identity" : "grpc-binary",
|
||||
"kind" : "remoteSourceControl",
|
||||
"location" : "https://github.com/google/grpc-binary.git",
|
||||
"state" : {
|
||||
"revision" : "cc0001a0cf963aa40501d9c2b181e7fc9fd8ec71",
|
||||
"version" : "1.69.0"
|
||||
}
|
||||
},
|
||||
{
|
||||
"identity" : "gtm-session-fetcher",
|
||||
"kind" : "remoteSourceControl",
|
||||
"location" : "https://github.com/google/gtm-session-fetcher.git",
|
||||
"state" : {
|
||||
"revision" : "c756a29784521063b6a1202907e2cc47f41b667c",
|
||||
"version" : "4.5.0"
|
||||
}
|
||||
},
|
||||
{
|
||||
"identity" : "interop-ios-for-google-sdks",
|
||||
"kind" : "remoteSourceControl",
|
||||
"location" : "https://github.com/google/interop-ios-for-google-sdks.git",
|
||||
"state" : {
|
||||
"revision" : "040d087ac2267d2ddd4cca36c757d1c6a05fdbfe",
|
||||
"version" : "101.0.0"
|
||||
}
|
||||
},
|
||||
{
|
||||
"identity" : "leveldb",
|
||||
"kind" : "remoteSourceControl",
|
||||
"location" : "https://github.com/firebase/leveldb.git",
|
||||
"state" : {
|
||||
"revision" : "a0bc79961d7be727d258d33d5a6b2f1023270ba1",
|
||||
"version" : "1.22.5"
|
||||
}
|
||||
},
|
||||
{
|
||||
"identity" : "nanopb",
|
||||
"kind" : "remoteSourceControl",
|
||||
"location" : "https://github.com/firebase/nanopb.git",
|
||||
"state" : {
|
||||
"revision" : "b7e1104502eca3a213b46303391ca4d3bc8ddec1",
|
||||
"version" : "2.30910.0"
|
||||
}
|
||||
},
|
||||
{
|
||||
"identity" : "promises",
|
||||
"kind" : "remoteSourceControl",
|
||||
"location" : "https://github.com/google/promises.git",
|
||||
"state" : {
|
||||
"revision" : "540318ecedd63d883069ae7f1ed811a2df00b6ac",
|
||||
"version" : "2.4.0"
|
||||
}
|
||||
},
|
||||
{
|
||||
"identity" : "swift-protobuf",
|
||||
"kind" : "remoteSourceControl",
|
||||
"location" : "https://github.com/apple/swift-protobuf.git",
|
||||
"state" : {
|
||||
"revision" : "102a647b573f60f73afdce5613a51d71349fe507",
|
||||
"version" : "1.30.0"
|
||||
}
|
||||
}
|
||||
],
|
||||
"version" : 3
|
||||
|
@ -10,12 +10,16 @@ import UIKit
|
||||
extension AppDelegate {
|
||||
|
||||
func appConfig() {
|
||||
VPAppTool.appDelegate = self
|
||||
|
||||
UIButton.vp_bt_Awake()
|
||||
UIView.vp_Awake()
|
||||
|
||||
VPToast.config()
|
||||
|
||||
congifNavigation()
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -39,7 +39,7 @@ extension SceneDelegate {
|
||||
private static var webpageURL: URL?
|
||||
|
||||
func vp_handleOpenAppMessage(webpageURL: URL?) {
|
||||
guard VPNetworkReachabilityManager.manager.isReachable == true, SceneDelegate.haveBeenShownAPNS, self.isOpenApp else {
|
||||
guard VPNetworkReachabilityManager.manager.isReachable == true, AppDelegate.haveBeenShownAPNS, self.isOpenApp else {
|
||||
if let webpageURL = webpageURL {
|
||||
SceneDelegate.webpageURL = webpageURL
|
||||
}
|
||||
|
@ -6,12 +6,11 @@
|
||||
//
|
||||
|
||||
import UIKit
|
||||
import FirebaseMessaging
|
||||
|
||||
@main
|
||||
class AppDelegate: UIResponder, UIApplicationDelegate {
|
||||
|
||||
|
||||
|
||||
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
|
||||
|
||||
appConfig()
|
||||
@ -25,6 +24,9 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
|
||||
|
||||
self.registThirdparty(application, didFinishLaunchingWithOptions: launchOptions)
|
||||
|
||||
self.requestAPNS()
|
||||
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
|
@ -5,12 +5,17 @@
|
||||
// Created by 湖南秦九 on 2025/6/11.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
import FirebaseMessaging
|
||||
import FirebaseCore
|
||||
|
||||
extension SceneDelegate {
|
||||
extension AppDelegate {
|
||||
///是否展示过通知提示
|
||||
static var haveBeenShownAPNS = false
|
||||
|
||||
func requestAPNS() {
|
||||
FirebaseApp.configure()
|
||||
Messaging.messaging().delegate = self
|
||||
|
||||
|
||||
let center = UNUserNotificationCenter.current()
|
||||
@ -28,12 +33,15 @@ extension SceneDelegate {
|
||||
}
|
||||
#endif
|
||||
}
|
||||
} else {
|
||||
Self.haveBeenShownAPNS = true
|
||||
VPAppTool.sceneDelegate?.vp_retryHandleOpenAppMessage()
|
||||
}
|
||||
UserDefaults.standard.set(Date(), forKey: kVPApnsAlertDefaultsKey)
|
||||
} else {
|
||||
|
||||
SceneDelegate.haveBeenShownAPNS = true
|
||||
self.vp_retryHandleOpenAppMessage()
|
||||
Self.haveBeenShownAPNS = true
|
||||
VPAppTool.sceneDelegate?.vp_retryHandleOpenAppMessage()
|
||||
}
|
||||
|
||||
|
||||
@ -49,19 +57,89 @@ extension SceneDelegate {
|
||||
alert.clickHighlightButton = { [weak self] in
|
||||
guard let _ = self else { return }
|
||||
VPAppTool.openApnsSetting()
|
||||
SceneDelegate.haveBeenShownAPNS = true
|
||||
Self.haveBeenShownAPNS = true
|
||||
}
|
||||
|
||||
alert.clickCloseButton = { [weak self] in
|
||||
guard let self = self else { return }
|
||||
SceneDelegate.haveBeenShownAPNS = true
|
||||
self.vp_retryHandleOpenAppMessage()
|
||||
guard let _ = self else { return }
|
||||
Self.haveBeenShownAPNS = true
|
||||
VPAppTool.sceneDelegate?.vp_retryHandleOpenAppMessage()
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//MARK: -------------- UNUserNotificationCenterDelegate --------------
|
||||
extension SceneDelegate: UNUserNotificationCenterDelegate {
|
||||
extension AppDelegate: UNUserNotificationCenterDelegate {
|
||||
func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {
|
||||
Messaging.messaging().apnsToken = deviceToken
|
||||
}
|
||||
|
||||
func application(_ application: UIApplication, didFailToRegisterForRemoteNotificationsWithError error: any Error) {
|
||||
vpLog(message: error)
|
||||
}
|
||||
|
||||
///APP处于前台是接收通知消息
|
||||
func userNotificationCenter(_ center: UNUserNotificationCenter, willPresent notification: UNNotification, withCompletionHandler completionHandler: @escaping (UNNotificationPresentationOptions) -> Void) {
|
||||
completionHandler([.badge, .banner])
|
||||
}
|
||||
|
||||
///点击通知消息进入app
|
||||
func userNotificationCenter(_ center: UNUserNotificationCenter, didReceive response: UNNotificationResponse, withCompletionHandler completionHandler: @escaping () -> Void) {
|
||||
if #available(iOS 16.0, *) {
|
||||
UNUserNotificationCenter.current().setBadgeCount(0)
|
||||
} else {
|
||||
UIApplication.shared.applicationIconBadgeNumber = 0
|
||||
}
|
||||
|
||||
guard let userInfo: [String : Any] = response.notification.request.content.userInfo as? [String : Any] else {
|
||||
completionHandler()
|
||||
return
|
||||
}
|
||||
|
||||
guard let model = VPOpenAppModel.deserialize(from: userInfo) else {
|
||||
completionHandler()
|
||||
return
|
||||
}
|
||||
VPStatAPI.requestStatApns(messageId: model.message_id ?? "", title: response.notification.request.content.title)
|
||||
|
||||
|
||||
if model.path == .videoDetail, let shortPlayId = model.short_play_id {
|
||||
let vc = VPDetailPlayerViewController()
|
||||
vc.shortPlayId = shortPlayId
|
||||
VPAppTool.topViewController?.navigationController?.pushViewController(vc, animated: true)
|
||||
|
||||
} else if model.path == .promotion {
|
||||
let vc = VPRewardsViewController()
|
||||
VPAppTool.topViewController?.navigationController?.pushViewController(vc, animated: true)
|
||||
|
||||
} else if model.path == .feedback {
|
||||
let vc = VPCampaignWebViewController()
|
||||
vc.urlStr = kVPFeedBackListWebUrl
|
||||
VPAppTool.topViewController?.navigationController?.pushViewController(vc, animated: true)
|
||||
}
|
||||
|
||||
completionHandler()
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
extension AppDelegate: MessagingDelegate {
|
||||
func messaging(_ messaging: Messaging, didReceiveRegistrationToken fcmToken: String?) {
|
||||
if let token = fcmToken {
|
||||
VPSettingAPI.requestUploadApnsDeviceToken(token: token)
|
||||
}
|
||||
|
||||
// let dataDict: [String: String] = ["token": fcmToken ?? ""]
|
||||
// NotificationCenter.default.post(
|
||||
// name: Notification.Name("FCMToken"),
|
||||
// object: nil,
|
||||
// userInfo: dataDict
|
||||
// )
|
||||
}
|
||||
}
|
||||
|
@ -18,6 +18,7 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate {
|
||||
|
||||
func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
|
||||
guard let windowScene = (scene as? UIWindowScene) else { return }
|
||||
VPAppTool.sceneDelegate = self
|
||||
VPAppTool.windowScene = windowScene
|
||||
|
||||
onLineTimer = Timer.scheduledTimer(timeInterval: 60 * 10, target: YYWeakProxy(target: self), selector: #selector(handleOnLine), userInfo: nil, repeats: true)
|
||||
@ -25,7 +26,7 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate {
|
||||
NotificationCenter.default.addObserver(self, selector: #selector(reachabilityDidChangeNotification), name: VPNetworkReachabilityManager.reachabilityDidChangeNotification, object: nil)
|
||||
NotificationCenter.default.addObserver(self, selector: #selector(localizedDidChangeNotification), name: VPLocalizedManager.localizedDidChangeNotification, object: nil)
|
||||
|
||||
self.requestAPNS()
|
||||
|
||||
|
||||
|
||||
if let webpageURL = connectionOptions.userActivities.first?.webpageURL {
|
||||
@ -70,6 +71,8 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate {
|
||||
vpLog(message: "++++++++++++++sceneDidEnterBackground")
|
||||
}
|
||||
|
||||
|
||||
|
||||
private func enterForeground() {
|
||||
|
||||
handleOnLine()
|
||||
|
25
Veloria/Base/Extension/HWPanModalContentView+VPAdd.swift
Normal file
25
Veloria/Base/Extension/HWPanModalContentView+VPAdd.swift
Normal file
@ -0,0 +1,25 @@
|
||||
//
|
||||
// HWPanModalContentView+VPAdd.swift
|
||||
// Veloria
|
||||
//
|
||||
// Created by 湖南秦九 on 2025/6/13.
|
||||
//
|
||||
|
||||
//HWPanModalContainerView
|
||||
|
||||
extension HWPanModalContentView {
|
||||
|
||||
///是否存在
|
||||
static func doesExis() -> Bool {
|
||||
var result = false
|
||||
|
||||
VPAppTool.keyWindow?.subviews.forEach({
|
||||
if $0.isKind(of: HWPanModalContainerView.self) {
|
||||
result = true
|
||||
}
|
||||
})
|
||||
return result
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -246,4 +246,8 @@ extension UIColor {
|
||||
return UIColor(rgb: 0xDAFDFF, alpha: alpha)
|
||||
}
|
||||
|
||||
static func colorE0E0E0(alpha: CGFloat = 1) -> UIColor {
|
||||
return UIColor(rgb: 0xE0E0E0, alpha: alpha)
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -31,4 +31,15 @@ class VPSettingAPI {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
static func requestUploadApnsDeviceToken(token: String) {
|
||||
var param = VPNetworkParameters(path: "/customer/firebaseToken")
|
||||
param.parameters = ["fcm_token": token]
|
||||
param.isToast = false
|
||||
|
||||
VPNetwork.request(parameters: param) { (response: VPNetworkResponse<String>) in
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -49,4 +49,19 @@ class VPStatAPI: NSObject {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
///统计点击推送消息
|
||||
static func requestStatApns(messageId: String, title: String) {
|
||||
var param = VPNetworkParameters(path: "/message/sendReport")
|
||||
param.isToast = false
|
||||
param.isLoding = false
|
||||
param.parameters = [
|
||||
"message_id" : messageId,
|
||||
"title" : title
|
||||
]
|
||||
|
||||
VPNetwork.request(parameters: param) { (response: VPNetworkResponse<String>) in
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -59,7 +59,9 @@ class VPHomePageViewController: VPViewController {
|
||||
}()
|
||||
|
||||
private lazy var pageView: WMZPageView = {
|
||||
let y = UIScreen.statusBarHeight + 115
|
||||
let titleHeight = self.titleLabel.sizeThatFits(.init(width: UIScreen.width - 30, height: 1000)).height
|
||||
|
||||
let y = UIScreen.statusBarHeight + 28 + titleHeight + 14 + 40 + 10
|
||||
let width = UIScreen.width
|
||||
let height = UIScreen.height - y
|
||||
let pageView = WMZPageView(frame: CGRect(x: 0, y: y, width: width, height: height), param: pageParam, parentReponder: self)
|
||||
@ -105,6 +107,8 @@ class VPHomePageViewController: VPViewController {
|
||||
let label = UILabel()
|
||||
label.font = .fontMedium(ofSize: 16)
|
||||
label.textColor = .colorFFFFFF()
|
||||
label.numberOfLines = 0
|
||||
label.textAlignment = .center
|
||||
label.text = "veloria_addictive_short_await".localized
|
||||
return label
|
||||
}()
|
||||
@ -122,15 +126,24 @@ class VPHomePageViewController: VPViewController {
|
||||
return button
|
||||
}()
|
||||
|
||||
private lazy var emptyView: VPEmptyView = {
|
||||
let view = VPEmptyView()
|
||||
view.image = UIImage(named: "empty_image_03")
|
||||
view.title = "veloria_no_network".localized
|
||||
view.des = "veloria_no_network_string".localized
|
||||
view.clickButtonBlock = { [weak self] in
|
||||
guard let self = self else { return }
|
||||
self.vp_setup()
|
||||
}
|
||||
return view
|
||||
}()
|
||||
|
||||
|
||||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
NotificationCenter.default.addObserver(self, selector: #selector(reachabilityDidChangeNotification), name: VPNetworkReachabilityManager.reachabilityDidChangeNotification, object: nil)
|
||||
|
||||
requestHomeData()
|
||||
requestCategories()
|
||||
setupPageView()
|
||||
vp_setupUI()
|
||||
vp_setup()
|
||||
|
||||
}
|
||||
|
||||
@ -190,14 +203,36 @@ extension VPHomePageViewController {
|
||||
requestHomeData()
|
||||
}
|
||||
requestCategories()
|
||||
|
||||
vp_setupUI()
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
extension VPHomePageViewController {
|
||||
private func vp_setup() {
|
||||
requestHomeData()
|
||||
requestCategories()
|
||||
setupPageView()
|
||||
vp_setupUI()
|
||||
}
|
||||
|
||||
private func vp_setupUI() {
|
||||
guard VPNetworkReachabilityManager.manager.isReachable == true, pageView.superview == nil else {
|
||||
if emptyView.superview == nil {
|
||||
view.addSubview(emptyView)
|
||||
emptyView.snp.makeConstraints { make in
|
||||
make.left.equalToSuperview()
|
||||
make.centerX.equalToSuperview()
|
||||
make.centerY.equalToSuperview().offset(-100)
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
emptyView.removeFromSuperview()
|
||||
|
||||
view.addSubview(titleLabel)
|
||||
view.addSubview(searchButton)
|
||||
view.addSubview(historyButton)
|
||||
@ -206,12 +241,14 @@ extension VPHomePageViewController {
|
||||
titleLabel.snp.makeConstraints { make in
|
||||
make.centerX.equalToSuperview()
|
||||
make.top.equalToSuperview().offset(UIScreen.statusBarHeight + 28)
|
||||
make.right.lessThanOrEqualToSuperview().offset(-15)
|
||||
}
|
||||
|
||||
searchButton.snp.makeConstraints { make in
|
||||
make.left.equalToSuperview().offset(15)
|
||||
make.right.equalTo(historyButton.snp.left).offset(-10)
|
||||
make.top.equalToSuperview().offset(UIScreen.statusBarHeight + 65)
|
||||
// make.top.equalToSuperview().offset(UIScreen.statusBarHeight + 65)
|
||||
make.top.equalTo(titleLabel.snp.bottom).offset(14)
|
||||
make.height.equalTo(40)
|
||||
}
|
||||
|
||||
|
@ -34,6 +34,11 @@ class VPHomeRankingCell: VPCollectionViewCell {
|
||||
var row: Int = 0 {
|
||||
didSet {
|
||||
numLabel.text = "\(row + 1)"
|
||||
if row < 3 {
|
||||
numView.image = UIImage(named: "num_icon_01")
|
||||
} else {
|
||||
numView.image = UIImage(named: "num_icon_02")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -74,7 +79,7 @@ class VPHomeRankingCell: VPCollectionViewCell {
|
||||
return button
|
||||
}()
|
||||
|
||||
private lazy var numView: UIView = {
|
||||
private lazy var numView: UIImageView = {
|
||||
let view = UIImageView(image: UIImage(named: "num_icon_01"))
|
||||
return view
|
||||
}()
|
||||
|
@ -37,7 +37,7 @@ class VPSearchHistoryView: UIView {
|
||||
let tagView = JXTagView(frame: .init(x: 0, y: 0, width: UIScreen.width, height: 10))
|
||||
tagView.tagBackgroundColor = .colorFFFFFF(alpha: 0.1)
|
||||
tagView.tagHeight = 24
|
||||
tagView.textMargin = 5
|
||||
tagView.textMargin = 10
|
||||
tagView.tagCornerRadius = 12
|
||||
tagView.tagHorizontalGap = 8
|
||||
tagView.tagVerticalGap = 8
|
||||
|
@ -107,7 +107,8 @@ class VPLoginContentView: HWPanModalContentView {
|
||||
}
|
||||
|
||||
override func longFormHeight() -> PanModalHeight {
|
||||
return PanModalHeightMake(.content, UIScreen.height * (2 / 3))
|
||||
// return PanModalHeightMake(.content, UIScreen.height * (2 / 3))
|
||||
return PanModalHeightMake(.content, UIScreen.tabbarSafeBottomMargin + 300)
|
||||
}
|
||||
|
||||
override func showDragIndicator() -> Bool {
|
||||
@ -201,7 +202,7 @@ extension VPLoginContentView {
|
||||
|
||||
agreementLabel.snp.makeConstraints { make in
|
||||
make.centerX.equalToSuperview()
|
||||
make.bottom.equalToSuperview().offset(-(UIScreen.tabbarSafeBottomMargin + 10))
|
||||
make.bottom.equalToSuperview().offset(-(UIScreen.tabbarSafeBottomMargin + 20))
|
||||
make.width.equalTo(agreementLabel.textLayout?.textBoundingSize.width ?? 0)
|
||||
make.height.equalTo(agreementLabel.textLayout?.textBoundingSize.height ?? 0)
|
||||
}
|
||||
|
@ -93,11 +93,13 @@ extension VPMeViewController {
|
||||
private func showVipAlert() {
|
||||
guard VPLoginManager.manager.userInfo?.is_vip != true else { return }
|
||||
guard VPVipAlertView.isAllowShowAlert else { return }
|
||||
guard !HWPanModalContentView.doesExis() else { return }
|
||||
|
||||
VPWalletAPI.requestPayTemplate { [weak self] model in
|
||||
guard let self = self else { return }
|
||||
guard self.isDidAppear else { return }
|
||||
guard self.vipAlertView == nil else { return }
|
||||
guard !HWPanModalContentView.doesExis() else { return }
|
||||
guard let item = model?.list_sub_vip?.first else { return }
|
||||
|
||||
let alert = VPVipAlertView().show()
|
||||
|
@ -11,7 +11,7 @@ class VPMeToolCell: VPTableViewCell {
|
||||
|
||||
|
||||
private lazy var stackView: UIStackView = {
|
||||
let view = UIStackView(arrangedSubviews: [walletButton, storeButton, /*rewardsButton,*/ favoritesButton])
|
||||
let view = UIStackView(arrangedSubviews: [walletButton, storeButton, rewardsButton, favoritesButton])
|
||||
view.axis = .horizontal
|
||||
view.distribution = .fillEqually
|
||||
view.alignment = .center
|
||||
|
@ -11,7 +11,8 @@ class VPPlayerVipBuyView: UIView {
|
||||
|
||||
var dataArr: [VPPayTemplateItem] = [] {
|
||||
didSet {
|
||||
self.collectionView.reloadData()
|
||||
self.pageScrollView.reloadData()
|
||||
updatePrivilegeData()
|
||||
}
|
||||
}
|
||||
|
||||
@ -22,23 +23,36 @@ class VPPlayerVipBuyView: UIView {
|
||||
|
||||
private var currentIndex: Int?
|
||||
|
||||
private lazy var collectionViewLayout: UICollectionViewFlowLayout = {
|
||||
let layout = UICollectionViewFlowLayout()
|
||||
layout.scrollDirection = .horizontal
|
||||
layout.minimumLineSpacing = 10
|
||||
layout.sectionInset = .init(top: 0, left: 15, bottom: 0, right: 15)
|
||||
layout.itemSize = .init(width: 332, height: 138)
|
||||
return layout
|
||||
// private lazy var collectionViewLayout: UICollectionViewFlowLayout = {
|
||||
// let layout = UICollectionViewFlowLayout()
|
||||
// layout.scrollDirection = .horizontal
|
||||
// layout.minimumLineSpacing = 10
|
||||
// layout.sectionInset = .init(top: 0, left: 15, bottom: 0, right: 15)
|
||||
// layout.itemSize = .init(width: 332, height: 138)
|
||||
// return layout
|
||||
// }()
|
||||
//
|
||||
// private lazy var collectionView: VPCollectionView = {
|
||||
// let collectionView = VPCollectionView(frame: .zero, collectionViewLayout: collectionViewLayout)
|
||||
// collectionView.delegate = self
|
||||
// collectionView.dataSource = self
|
||||
// collectionView.showsHorizontalScrollIndicator = false
|
||||
// collectionView.register(VPVipBuyCell.self, forCellWithReuseIdentifier: "cell")
|
||||
// return collectionView
|
||||
// }()
|
||||
|
||||
private lazy var pageScrollView: ZKCycleScrollView = {
|
||||
let view = ZKCycleScrollView(frame: .zero, shouldInfiniteLoop: false)
|
||||
view.itemSize = .init(width: 332, height: 138)
|
||||
view.itemSpacing = 10
|
||||
view.delegate = self
|
||||
view.dataSource = self
|
||||
view.hidesPageControl = true
|
||||
view.isAutoScroll = false
|
||||
view.register(VPVipBuyCell.self, forCellWithReuseIdentifier: "cell")
|
||||
return view
|
||||
}()
|
||||
|
||||
private lazy var collectionView: VPCollectionView = {
|
||||
let collectionView = VPCollectionView(frame: .zero, collectionViewLayout: collectionViewLayout)
|
||||
collectionView.delegate = self
|
||||
collectionView.dataSource = self
|
||||
collectionView.showsHorizontalScrollIndicator = false
|
||||
collectionView.register(VPVipBuyCell.self, forCellWithReuseIdentifier: "cell")
|
||||
return collectionView
|
||||
}()
|
||||
|
||||
private lazy var tipBgView: UIView = {
|
||||
let view = VPGradientView()
|
||||
@ -52,33 +66,8 @@ class VPPlayerVipBuyView: UIView {
|
||||
}()
|
||||
|
||||
private lazy var tipLabel: UILabel = {
|
||||
|
||||
|
||||
// let hText1 = "1 week".localized
|
||||
let text1 = "· " + "veloria_store_no_ads".localized
|
||||
|
||||
// let hText2 = "8 days".localized
|
||||
let text2 = "· " + "veloria_store_donate_coins".localized
|
||||
|
||||
let text3 = "· " + "veloria_store_auto_renew".localized
|
||||
|
||||
let text = text1 + "\n" + text2 + "\n" + text3
|
||||
|
||||
// let hRange1 = text.ocString().range(of: hText1)
|
||||
// let hRange2 = text.ocString().range(of: hText2)
|
||||
|
||||
let string = NSMutableAttributedString(string: text)
|
||||
string.lineSpacing = 5
|
||||
string.color = .colorFFFFFF(alpha: 0.8)
|
||||
// string.setColor(.color05CEA0(), range: hRange1)
|
||||
// string.setColor(.color05CEA0(), range: hRange2)
|
||||
|
||||
|
||||
|
||||
|
||||
let label = UILabel()
|
||||
label.font = .fontRegular(ofSize: 12)
|
||||
label.attributedText = string
|
||||
label.numberOfLines = 0
|
||||
return label
|
||||
}()
|
||||
@ -87,31 +76,71 @@ class VPPlayerVipBuyView: UIView {
|
||||
super.init(frame: frame)
|
||||
|
||||
vp_setupUI()
|
||||
updatePrivilegeData()
|
||||
}
|
||||
|
||||
required init?(coder: NSCoder) {
|
||||
fatalError("init(coder:) has not been implemented")
|
||||
}
|
||||
|
||||
private func updatePrivilegeData() {
|
||||
var hText1: String = "veloria_week".localized
|
||||
var hText2: String = "veloria_days_count_text".localizedReplace(text: "8")
|
||||
|
||||
if dataArr.count > 0 {
|
||||
let index = self.pageScrollView.pageIndex
|
||||
let model = dataArr[index]
|
||||
if model.vip_type_key == .month {
|
||||
hText1 = "veloria_month".localized
|
||||
} else if model.vip_type_key == .quarter {
|
||||
hText1 = "veloria_quarter".localized
|
||||
} else if model.vip_type_key == .year {
|
||||
hText1 = "veloria_year".localized
|
||||
}
|
||||
hText2 = "veloria_days_count_text".localizedReplace(text: "\(model.send_coin_ttl ?? 0)")
|
||||
}
|
||||
|
||||
|
||||
let text1 = "· " + "veloria_store_no_ads".localizedReplace(text: hText1)
|
||||
|
||||
let text2 = "· " + "veloria_store_donate_coins_ios".localizedReplace(text: hText2)
|
||||
|
||||
let text3 = "· " + "veloria_store_auto_renew".localized
|
||||
|
||||
let text = text1 + "\n" + text2 + "\n" + text3
|
||||
|
||||
let hRange1 = text.ocString().range(of: hText1)
|
||||
let hRange2 = text.ocString().range(of: hText2)
|
||||
|
||||
let string = NSMutableAttributedString(string: text)
|
||||
string.lineSpacing = 5
|
||||
string.color = .colorFFFFFF(alpha: 0.8)
|
||||
|
||||
string.setColor(.color05CEA0(), range: hRange1)
|
||||
string.setColor(.color05CEA0(), range: hRange2)
|
||||
|
||||
tipLabel.attributedText = string
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
extension VPPlayerVipBuyView {
|
||||
|
||||
private func vp_setupUI() {
|
||||
addSubview(collectionView)
|
||||
addSubview(pageScrollView)
|
||||
addSubview(tipBgView)
|
||||
tipBgView.addSubview(tipLabel)
|
||||
|
||||
collectionView.snp.makeConstraints { make in
|
||||
pageScrollView.snp.makeConstraints { make in
|
||||
make.left.right.equalToSuperview()
|
||||
make.top.equalToSuperview()
|
||||
make.height.equalTo(collectionViewLayout.itemSize.height)
|
||||
make.height.equalTo(pageScrollView.itemSize.height)
|
||||
}
|
||||
|
||||
tipBgView.snp.makeConstraints { make in
|
||||
make.left.equalToSuperview().offset(15)
|
||||
make.right.equalToSuperview().offset(-15)
|
||||
make.top.equalTo(collectionView.snp.bottom).offset(10)
|
||||
make.top.equalTo(pageScrollView.snp.bottom).offset(10)
|
||||
make.bottom.equalToSuperview()
|
||||
}
|
||||
|
||||
@ -124,7 +153,7 @@ extension VPPlayerVipBuyView {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
//MARK: -------------- UICollectionViewDelegate UICollectionViewDataSource --------------
|
||||
extension VPPlayerVipBuyView: UICollectionViewDelegate, UICollectionViewDataSource {
|
||||
|
||||
@ -153,4 +182,41 @@ extension VPPlayerVipBuyView: UICollectionViewDelegate, UICollectionViewDataSour
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
//MARK: -------------- ZKCycleScrollViewDelegate ZKCycleScrollViewDataSource --------------
|
||||
extension VPPlayerVipBuyView: ZKCycleScrollViewDelegate, ZKCycleScrollViewDataSource {
|
||||
func numberOfItems(in cycleScrollView: ZKCycleScrollView) -> Int {
|
||||
return dataArr.count
|
||||
}
|
||||
|
||||
func cycleScrollView(_ cycleScrollView: ZKCycleScrollView, cellForItemAt index: Int) -> ZKCycleScrollViewCell {
|
||||
let cell = cycleScrollView.dequeueReusableCell(withReuseIdentifier: "cell", for: index) as! VPVipBuyCell
|
||||
cell.item = dataArr[index]
|
||||
cell.vp_isSelected = index == currentIndex
|
||||
return cell
|
||||
}
|
||||
|
||||
func cycleScrollView(_ cycleScrollView: ZKCycleScrollView, didSelectItemAt index: Int) {
|
||||
if currentIndex != index {
|
||||
currentIndex = index
|
||||
cycleScrollView.reloadData()
|
||||
}
|
||||
|
||||
VPIAPManager.manager.start(model: dataArr[index]) { finish in
|
||||
if finish {
|
||||
VPLoginManager.manager.updateUserInfo(completer: nil)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func cycleScrollView(_ cycleScrollView: ZKCycleScrollView, didScrollFromIndex fromIndex: Int, toIndex: Int) {
|
||||
if fromIndex != toIndex {
|
||||
updatePrivilegeData()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -17,4 +17,9 @@ class VPRewardsViewController: VPCampaignWebViewController {
|
||||
|
||||
}
|
||||
|
||||
override func viewDidAppear(_ animated: Bool) {
|
||||
super.viewDidAppear(animated)
|
||||
self.webView.reload()
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -12,7 +12,10 @@ class VPVipViewController: VPViewController {
|
||||
|
||||
var dataArr: [VPPayTemplateItem] = [] {
|
||||
didSet {
|
||||
self.collectionView.reloadData()
|
||||
// self.collectionView.reloadData()
|
||||
self.pageScrollView.reloadData()
|
||||
|
||||
updatePrivilegeData()
|
||||
}
|
||||
}
|
||||
|
||||
@ -48,31 +51,12 @@ class VPVipViewController: VPViewController {
|
||||
private lazy var privilegeView1: VPVipPrivilegeItemView = {
|
||||
let view = VPVipPrivilegeItemView()
|
||||
view.icon = UIImage(named: "privilege_icon_04")
|
||||
|
||||
// let hText = "1 week".localized
|
||||
let string = NSMutableAttributedString(string: "veloria_store_no_ads".localized)
|
||||
// let hRange = string.string.ocString().range(of: hText)
|
||||
|
||||
string.color = .colorFFFFFF()
|
||||
// string.setColor(.color05CEA0(), range: hRange)
|
||||
|
||||
view.string = string
|
||||
|
||||
return view
|
||||
}()
|
||||
|
||||
private lazy var privilegeView2: VPVipPrivilegeItemView = {
|
||||
let view = VPVipPrivilegeItemView()
|
||||
view.icon = UIImage(named: "privilege_icon_05")
|
||||
|
||||
// let hText = "8 days".localized
|
||||
let string = NSMutableAttributedString(string: "veloria_store_donate_coins".localized)
|
||||
// let hRange = string.string.ocString().range(of: hText)
|
||||
|
||||
string.color = .colorFFFFFF()
|
||||
// string.setColor(.color05CEA0(), range: hRange)
|
||||
|
||||
view.string = string
|
||||
return view
|
||||
}()
|
||||
|
||||
@ -81,13 +65,11 @@ class VPVipViewController: VPViewController {
|
||||
view.icon = UIImage(named: "privilege_icon_06")
|
||||
|
||||
let string = NSMutableAttributedString(string: "veloria_store_auto_renew".localized)
|
||||
|
||||
string.color = .colorFFFFFF()
|
||||
|
||||
view.string = string
|
||||
return view
|
||||
}()
|
||||
|
||||
/*
|
||||
private lazy var collectionViewLayout: UICollectionViewFlowLayout = {
|
||||
let layout = UICollectionViewFlowLayout()
|
||||
layout.scrollDirection = .horizontal
|
||||
@ -105,6 +87,19 @@ class VPVipViewController: VPViewController {
|
||||
collectionView.register(VPVipBuyCell.self, forCellWithReuseIdentifier: "cell")
|
||||
return collectionView
|
||||
}()
|
||||
*/
|
||||
|
||||
private lazy var pageScrollView: ZKCycleScrollView = {
|
||||
let view = ZKCycleScrollView(frame: .zero, shouldInfiniteLoop: false)
|
||||
view.itemSize = .init(width: 332, height: 138)
|
||||
view.itemSpacing = 10
|
||||
view.delegate = self
|
||||
view.dataSource = self
|
||||
view.hidesPageControl = true
|
||||
view.isAutoScroll = false
|
||||
view.register(VPVipBuyCell.self, forCellWithReuseIdentifier: "cell")
|
||||
return view
|
||||
}()
|
||||
|
||||
private lazy var tipLabel: UILabel = {
|
||||
let label = UILabel()
|
||||
@ -115,21 +110,6 @@ class VPVipViewController: VPViewController {
|
||||
return label
|
||||
}()
|
||||
|
||||
// private lazy var buyButton: UIButton = {
|
||||
// let button = VPGradientButton(type: .custom)
|
||||
// button.layer.cornerRadius = 24
|
||||
// button.layer.masksToBounds = true
|
||||
// button.bt_setGradientBorder()
|
||||
// button.colors = [UIColor.color05CEA0(alpha: 0.3).cgColor, UIColor.color7C174F(alpha: 0.3).cgColor]
|
||||
// button.locations = [0, 1]
|
||||
// button.startPoint = .init(x: 0, y: 0.3)
|
||||
// button.endPoint = .init(x: 1, y: 0.8)
|
||||
// button.setTitle("Buy Now".localized, for: .normal)
|
||||
// button.setTitleColor(.colorFFFFFF(), for: .normal)
|
||||
// button.titleLabel?.font = .fontMedium(ofSize: 14)
|
||||
// return button
|
||||
// }()
|
||||
|
||||
|
||||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
@ -137,9 +117,48 @@ class VPVipViewController: VPViewController {
|
||||
self.view.backgroundColor = .clear
|
||||
|
||||
vp_setupUI()
|
||||
|
||||
updatePrivilegeData()
|
||||
}
|
||||
|
||||
|
||||
private func updatePrivilegeData() {
|
||||
let textColor = UIColor.colorFFFFFF()
|
||||
let hColor = UIColor.color05CEA0()
|
||||
|
||||
var hText1: String = "veloria_week".localized
|
||||
var hText2: String = "veloria_days_count_text".localizedReplace(text: "8")
|
||||
|
||||
if dataArr.count > 0 {
|
||||
let index = self.pageScrollView.pageIndex
|
||||
let model = dataArr[index]
|
||||
if model.vip_type_key == .month {
|
||||
hText1 = "veloria_month".localized
|
||||
} else if model.vip_type_key == .quarter {
|
||||
hText1 = "veloria_quarter".localized
|
||||
} else if model.vip_type_key == .year {
|
||||
hText1 = "veloria_year".localized
|
||||
}
|
||||
hText2 = "veloria_days_count_text".localizedReplace(text: "\(model.send_coin_ttl ?? 0)")
|
||||
}
|
||||
|
||||
|
||||
|
||||
let string1 = NSMutableAttributedString(string: "veloria_store_no_ads".localizedReplace(text: hText1))
|
||||
let hRange1 = string1.string.ocString().range(of: hText1)
|
||||
string1.color = textColor
|
||||
string1.setColor(hColor, range: hRange1)
|
||||
privilegeView1.string = string1
|
||||
|
||||
|
||||
let string2 = NSMutableAttributedString(string: "veloria_store_donate_coins_ios".localizedReplace(text: hText2))
|
||||
let hRange2 = string2.string.ocString().range(of: hText2)
|
||||
string2.color = textColor
|
||||
string2.setColor(hColor, range: hRange2)
|
||||
privilegeView2.string = string2
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
extension VPVipViewController {
|
||||
@ -149,9 +168,8 @@ extension VPVipViewController {
|
||||
scrollView.addSubview(iconImageView)
|
||||
scrollView.addSubview(iconTextLabel)
|
||||
scrollView.addSubview(stackView)
|
||||
scrollView.addSubview(collectionView)
|
||||
scrollView.addSubview(pageScrollView)
|
||||
scrollView.addSubview(tipLabel)
|
||||
// view.addSubview(buyButton)
|
||||
|
||||
scrollView.snp.makeConstraints { make in
|
||||
make.left.right.top.equalToSuperview()
|
||||
@ -175,31 +193,26 @@ extension VPVipViewController {
|
||||
make.top.equalTo(iconImageView.snp.bottom).offset(18)
|
||||
}
|
||||
|
||||
collectionView.snp.makeConstraints { make in
|
||||
pageScrollView.snp.makeConstraints { make in
|
||||
make.left.equalToSuperview()
|
||||
make.centerX.equalToSuperview()
|
||||
make.top.equalTo(stackView.snp.bottom).offset(7)
|
||||
make.height.equalTo(collectionViewLayout.itemSize.height)
|
||||
make.height.equalTo(pageScrollView.itemSize.height)
|
||||
}
|
||||
|
||||
tipLabel.snp.makeConstraints { make in
|
||||
make.top.equalTo(collectionView.snp.bottom).offset(14)
|
||||
make.top.equalTo(pageScrollView.snp.bottom).offset(14)
|
||||
make.left.equalToSuperview().offset(15)
|
||||
make.width.lessThanOrEqualTo(UIScreen.width - 30)
|
||||
// make.bottom.equalToSuperview().offset(-10)
|
||||
make.bottom.equalToSuperview().offset(-(UIScreen.tabbarSafeBottomMargin + 10))
|
||||
}
|
||||
|
||||
// buyButton.snp.makeConstraints { make in
|
||||
// make.left.equalToSuperview().offset(15)
|
||||
// make.centerX.equalToSuperview()
|
||||
// make.bottom.equalToSuperview().offset(-(UIScreen.tabbarSafeBottomMargin + 10))
|
||||
// make.height.equalTo(48)
|
||||
// }
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
//MARK: -------------- UICollectionViewDelegate UICollectionViewDataSource --------------
|
||||
extension VPVipViewController: UICollectionViewDelegate, UICollectionViewDataSource {
|
||||
func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
|
||||
@ -226,4 +239,40 @@ extension VPVipViewController: UICollectionViewDelegate, UICollectionViewDataSou
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
//MARK: -------------- ZKCycleScrollViewDelegate ZKCycleScrollViewDataSource --------------
|
||||
extension VPVipViewController: ZKCycleScrollViewDelegate, ZKCycleScrollViewDataSource {
|
||||
func numberOfItems(in cycleScrollView: ZKCycleScrollView) -> Int {
|
||||
return dataArr.count
|
||||
}
|
||||
|
||||
func cycleScrollView(_ cycleScrollView: ZKCycleScrollView, cellForItemAt index: Int) -> ZKCycleScrollViewCell {
|
||||
let cell = cycleScrollView.dequeueReusableCell(withReuseIdentifier: "cell", for: index) as! VPVipBuyCell
|
||||
cell.item = dataArr[index]
|
||||
cell.vp_isSelected = index == currentIndex
|
||||
return cell
|
||||
}
|
||||
|
||||
func cycleScrollView(_ cycleScrollView: ZKCycleScrollView, didSelectItemAt index: Int) {
|
||||
if currentIndex != index {
|
||||
currentIndex = index
|
||||
cycleScrollView.reloadData()
|
||||
}
|
||||
|
||||
VPIAPManager.manager.start(model: dataArr[index]) { finish in
|
||||
if finish {
|
||||
VPLoginManager.manager.updateUserInfo(completer: nil)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func cycleScrollView(_ cycleScrollView: ZKCycleScrollView, didScrollFromIndex fromIndex: Int, toIndex: Int) {
|
||||
if fromIndex != toIndex {
|
||||
updatePrivilegeData()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -52,6 +52,7 @@ class VPPayTemplateItem: VPModel, SmartCodable {
|
||||
var brief: String?
|
||||
var title: String?
|
||||
|
||||
var send_coin_ttl: Int?
|
||||
|
||||
|
||||
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
import UIKit
|
||||
|
||||
class VPVipBuyCell: VPCollectionViewCell {
|
||||
class VPVipBuyCell: ZKCycleScrollViewCell {
|
||||
|
||||
|
||||
var item: VPPayTemplateItem? {
|
||||
|
@ -9,8 +9,12 @@ import UIKit
|
||||
|
||||
class VPAppTool: NSObject {
|
||||
|
||||
static var appDelegate: AppDelegate?
|
||||
static var sceneDelegate: SceneDelegate?
|
||||
|
||||
static var windowScene: UIWindowScene?
|
||||
|
||||
|
||||
static var keyWindow: UIWindow? {
|
||||
return windowScene?.keyWindow
|
||||
}
|
||||
|
@ -6,6 +6,7 @@
|
||||
//
|
||||
|
||||
import UIKit
|
||||
import SnapKit
|
||||
|
||||
class VPEmptyView: UIView {
|
||||
|
||||
@ -27,6 +28,15 @@ class VPEmptyView: UIView {
|
||||
}
|
||||
}
|
||||
|
||||
var clickButtonBlock: (() -> Void)? {
|
||||
didSet {
|
||||
updateLayout()
|
||||
}
|
||||
}
|
||||
|
||||
var desBottomConstraint: Constraint?
|
||||
var buttonBottomConstraint: Constraint?
|
||||
|
||||
private lazy var imageView: UIImageView = {
|
||||
let imageView = UIImageView()
|
||||
return imageView
|
||||
@ -46,16 +56,50 @@ class VPEmptyView: UIView {
|
||||
return label
|
||||
}()
|
||||
|
||||
private lazy var button: UIButton = {
|
||||
let button = UIButton(type: .custom)
|
||||
button.layer.cornerRadius = 24
|
||||
button.layer.masksToBounds = true
|
||||
button.layer.borderWidth = 1
|
||||
button.layer.borderColor = UIColor.colorE0E0E0().cgColor
|
||||
button.setTitle("veloria_try_again".localized, for: .normal)
|
||||
button.setTitleColor(.colorE0E0E0(), for: .normal)
|
||||
button.titleLabel?.font = .fontRegular(ofSize: 14)
|
||||
button.addTarget(self, action: #selector(hadnleButton), for: .touchUpInside)
|
||||
return button
|
||||
}()
|
||||
|
||||
override init(frame: CGRect) {
|
||||
super.init(frame: frame)
|
||||
|
||||
vp_setupUI()
|
||||
|
||||
updateLayout()
|
||||
}
|
||||
|
||||
required init?(coder: NSCoder) {
|
||||
fatalError("init(coder:) has not been implemented")
|
||||
}
|
||||
|
||||
|
||||
private func updateLayout() {
|
||||
|
||||
if clickButtonBlock == nil {
|
||||
self.button.isHidden = true
|
||||
self.buttonBottomConstraint?.isActive = false
|
||||
self.desBottomConstraint?.isActive = true
|
||||
} else {
|
||||
self.button.isHidden = false
|
||||
self.buttonBottomConstraint?.isActive = true
|
||||
self.desBottomConstraint?.isActive = false
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@objc private func hadnleButton() {
|
||||
self.clickButtonBlock?()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
extension VPEmptyView {
|
||||
@ -64,6 +108,7 @@ extension VPEmptyView {
|
||||
addSubview(imageView)
|
||||
addSubview(titleLabel)
|
||||
addSubview(desLabel)
|
||||
addSubview(button)
|
||||
|
||||
imageView.snp.makeConstraints { make in
|
||||
make.centerX.equalToSuperview()
|
||||
@ -78,9 +123,18 @@ extension VPEmptyView {
|
||||
desLabel.snp.makeConstraints { make in
|
||||
make.centerX.equalToSuperview()
|
||||
make.top.equalTo(titleLabel.snp.bottom).offset(15)
|
||||
make.bottom.equalToSuperview()
|
||||
self.desBottomConstraint = make.bottom.equalToSuperview().constraint
|
||||
}
|
||||
|
||||
button.snp.makeConstraints { make in
|
||||
make.centerX.equalToSuperview()
|
||||
make.width.equalTo(200)
|
||||
make.height.equalTo(48)
|
||||
make.top.equalTo(desLabel.snp.bottom).offset(30)
|
||||
self.buttonBottomConstraint = make.bottom.equalToSuperview().constraint
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
22
Veloria/Source/Assets.xcassets/image/empty_image_03.imageset/Contents.json
vendored
Normal file
22
Veloria/Source/Assets.xcassets/image/empty_image_03.imageset/Contents.json
vendored
Normal file
@ -0,0 +1,22 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"filename" : "缺省页-无网络-切图图层@2x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"filename" : "缺省页-无网络-切图图层@3x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
BIN
Veloria/Source/Assets.xcassets/image/empty_image_03.imageset/缺省页-无网络-切图图层@2x.png
vendored
Normal file
BIN
Veloria/Source/Assets.xcassets/image/empty_image_03.imageset/缺省页-无网络-切图图层@2x.png
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 39 KiB |
BIN
Veloria/Source/Assets.xcassets/image/empty_image_03.imageset/缺省页-无网络-切图图层@3x.png
vendored
Normal file
BIN
Veloria/Source/Assets.xcassets/image/empty_image_03.imageset/缺省页-无网络-切图图层@3x.png
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 72 KiB |
30
Veloria/Source/GoogleService-Info.plist
Normal file
30
Veloria/Source/GoogleService-Info.plist
Normal file
@ -0,0 +1,30 @@
|
||||
<?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>API_KEY</key>
|
||||
<string>AIzaSyBy9LyOWrl2LZxpT1YGg0czY6v8RY6T_Gg</string>
|
||||
<key>GCM_SENDER_ID</key>
|
||||
<string>697499054017</string>
|
||||
<key>PLIST_VERSION</key>
|
||||
<string>1</string>
|
||||
<key>BUNDLE_ID</key>
|
||||
<string>com.qjwl168.veloria.ios</string>
|
||||
<key>PROJECT_ID</key>
|
||||
<string>veloria-4c04f</string>
|
||||
<key>STORAGE_BUCKET</key>
|
||||
<string>veloria-4c04f.firebasestorage.app</string>
|
||||
<key>IS_ADS_ENABLED</key>
|
||||
<false></false>
|
||||
<key>IS_ANALYTICS_ENABLED</key>
|
||||
<false></false>
|
||||
<key>IS_APPINVITE_ENABLED</key>
|
||||
<true></true>
|
||||
<key>IS_GCM_ENABLED</key>
|
||||
<true></true>
|
||||
<key>IS_SIGNIN_ENABLED</key>
|
||||
<true></true>
|
||||
<key>GOOGLE_APP_ID</key>
|
||||
<string>1:697499054017:ios:dd288439560da53f598940</string>
|
||||
</dict>
|
||||
</plist>
|
@ -29,6 +29,8 @@
|
||||
<string>b65496dbe4e9f22569d4438f693ae5a2</string>
|
||||
<key>FacebookDisplayName</key>
|
||||
<string>$(PRODUCT_NAME)</string>
|
||||
<key>FirebaseAppDelegateProxyEnabled</key>
|
||||
<false/>
|
||||
<key>ITSAppUsesNonExemptEncryption</key>
|
||||
<false/>
|
||||
<key>LSApplicationQueriesSchemes</key>
|
||||
|
@ -85,6 +85,15 @@
|
||||
"veloria_order_record" = "Order Record";
|
||||
"veloria_allow" = "Allow";
|
||||
"veloria_get_started" = "Get Started";
|
||||
"veloria_no_network" = "No Network";
|
||||
"veloria_no_network_string" = "Unable to connect. Try again later.";
|
||||
"veloria_try_again" = "Try again";
|
||||
"veloria_week" = "1 week";
|
||||
"veloria_month" = "1 month";
|
||||
"veloria_quarter" = "1 quarter";
|
||||
"veloria_year" = "1 year";
|
||||
"veloria_days_count_text" = "## days";
|
||||
|
||||
|
||||
"veloria_bonus_count_text" = "+## Bonus";
|
||||
"veloria_no_data" = "Nothing Here Yet";
|
||||
@ -101,8 +110,8 @@
|
||||
"veloria_ad_free_streaming_ios" = "Ad-Free<br>Streaming";
|
||||
"veloria_exclusive_episodes_ios" = "Exclusive<br>Episodes";
|
||||
"veloria_daily_free_coins_ios" = "Daily free<br>coins";
|
||||
"veloria_store_no_ads" = "Unlimited access to all series for 1 week (No Ads)";
|
||||
"veloria_store_donate_coins" = "The donate coins will expire in 8 days";
|
||||
"veloria_store_no_ads" = "Unlimited access to all series for ## (No Ads)";
|
||||
"veloria_store_donate_coins_ios" = "The donate coins will expire in ##";
|
||||
"veloria_store_auto_renew" = "Auto renew, cancel anytime";
|
||||
"veloria_login_hint_ios" = "By logging in you agree to: #1# & #2#";
|
||||
"veloria_video_lock_tip_text" = "Please unlock the previous episode";
|
||||
|
@ -2,6 +2,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>aps-environment</key>
|
||||
<string>development</string>
|
||||
<key>com.apple.developer.applesignin</key>
|
||||
<array>
|
||||
<string>Default</string>
|
||||
|
6
资料/推送证书/AuthKey_Y6U23RSYN7.p8
Normal file
6
资料/推送证书/AuthKey_Y6U23RSYN7.p8
Normal file
@ -0,0 +1,6 @@
|
||||
-----BEGIN PRIVATE KEY-----
|
||||
MIGTAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBHkwdwIBAQQgVb82lHXUZ6pgLQA2
|
||||
wFBm1oRVv5P/4UJJsywjMWH1qGygCgYIKoZIzj0DAQehRANCAAThnox8pNNZSVh3
|
||||
vvlz2kyub1gUGhwImyM/ZaG3SV5399x6fVrQ0zxzi7gD9/a6BqBIKQ1/dRS/wGm7
|
||||
Jqrdp1Xg
|
||||
-----END PRIVATE KEY-----
|
Loading…
x
Reference in New Issue
Block a user