反馈,活动,H5交互

This commit is contained in:
zjx 2025-06-04 17:20:33 +08:00
parent 27b4f23d7f
commit 8d13a9373f
15 changed files with 234 additions and 8 deletions

View File

@ -29,6 +29,7 @@ target 'Veloria' do
pod 'WMZPageController' #分页控制器
pod 'ZFPlayer/AVPlayer' #播放器
pod 'EmptyDataSet-Swift' #空数据页面
pod 'ZLPhotoBrowser' #相册
end

View File

@ -26,6 +26,9 @@ PODS:
- ZFPlayer/AVPlayer (4.1.4):
- ZFPlayer/Core
- ZFPlayer/Core (4.1.4)
- ZLPhotoBrowser (4.6.0.1):
- ZLPhotoBrowser/Core (= 4.6.0.1)
- ZLPhotoBrowser/Core (4.6.0.1)
DEPENDENCIES:
- EmptyDataSet-Swift
@ -41,6 +44,7 @@ DEPENDENCIES:
- WMZPageController
- YYKit
- ZFPlayer/AVPlayer
- ZLPhotoBrowser
SPEC REPOS:
trunk:
@ -59,6 +63,7 @@ SPEC REPOS:
- WMZPageController
- YYKit
- ZFPlayer
- ZLPhotoBrowser
SPEC CHECKSUMS:
Alamofire: 7193b3b92c74a07f85569e1a6c4f4237291e7496
@ -76,7 +81,8 @@ SPEC CHECKSUMS:
WMZPageController: 87dd82d1e3528cd362de19b9a74fd6890d6e1906
YYKit: 7cda43304a8dc3696c449041e2cb3107b4e236e7
ZFPlayer: 5cf39e8d9f0c2394a014b0db4767b5b5a6bffe13
ZLPhotoBrowser: 20f32e6429448cc1c008795a1b55472d5772939c
PODFILE CHECKSUM: e2712ae0c35ebb37af30822c851f06195b8f41d7
PODFILE CHECKSUM: 4ec05325e0f82746c022a9c8ea6b1af5d1e5092f
COCOAPODS: 1.16.2

View File

@ -191,6 +191,9 @@
BFF5B2372DF013410044227A /* VPAlertWindowManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = BFF5B2362DF013410044227A /* VPAlertWindowManager.swift */; };
BFF5B2392DF014520044227A /* VPBaseAlertView.swift in Sources */ = {isa = PBXBuildFile; fileRef = BFF5B2382DF014520044227A /* VPBaseAlertView.swift */; };
BFF5B23B2DF018900044227A /* VPAlertView.swift in Sources */ = {isa = PBXBuildFile; fileRef = BFF5B23A2DF018900044227A /* VPAlertView.swift */; };
BFF5B23D2DF034420044227A /* VPFeedbackViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = BFF5B23C2DF034420044227A /* VPFeedbackViewController.swift */; };
BFF5B23F2DF0443B0044227A /* VPWebScriptModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = BFF5B23E2DF0443B0044227A /* VPWebScriptModel.swift */; };
BFF5B2412DF045BF0044227A /* VPRewardsAPI.swift in Sources */ = {isa = PBXBuildFile; fileRef = BFF5B2402DF045BF0044227A /* VPRewardsAPI.swift */; };
F939C04AD4003BA127F15C28 /* Pods_Veloria.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 34F57E87E765BF8D72A43DCA /* Pods_Veloria.framework */; };
/* End PBXBuildFile section */
@ -389,6 +392,9 @@
BFF5B2362DF013410044227A /* VPAlertWindowManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = VPAlertWindowManager.swift; sourceTree = "<group>"; };
BFF5B2382DF014520044227A /* VPBaseAlertView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = VPBaseAlertView.swift; sourceTree = "<group>"; };
BFF5B23A2DF018900044227A /* VPAlertView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = VPAlertView.swift; sourceTree = "<group>"; };
BFF5B23C2DF034420044227A /* VPFeedbackViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = VPFeedbackViewController.swift; sourceTree = "<group>"; };
BFF5B23E2DF0443B0044227A /* VPWebScriptModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = VPWebScriptModel.swift; sourceTree = "<group>"; };
BFF5B2402DF045BF0044227A /* VPRewardsAPI.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = VPRewardsAPI.swift; sourceTree = "<group>"; };
E0BDA3570E00C90877E45AA0 /* Pods-VideoPlayer.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-VideoPlayer.debug.xcconfig"; path = "Target Support Files/Pods-VideoPlayer/Pods-VideoPlayer.debug.xcconfig"; sourceTree = "<group>"; };
/* End PBXFileReference section */
@ -713,6 +719,7 @@
BF0FA6F82DDC64E700C9E5F2 /* VPHomeAPI.swift */,
BF0FA73C2DDED2D000C9E5F2 /* VPVideoAPI.swift */,
BF0FA7C22DE45DE300C9E5F2 /* VPUserAPI.swift */,
BFF5B2402DF045BF0044227A /* VPRewardsAPI.swift */,
);
path = API;
sourceTree = "<group>";
@ -943,6 +950,7 @@
BF0FA7AE2DE443E000C9E5F2 /* VPMeViewController.swift */,
BF5E75AE2DE4632200DE9DFE /* VPAboutUsViewController.swift */,
BFF5B22B2DEFE8A80044227A /* VPDeleteAccountViewController.swift */,
BFF5B23C2DF034420044227A /* VPFeedbackViewController.swift */,
);
path = Controller;
sourceTree = "<group>";
@ -983,6 +991,7 @@
BF0FA7B72DE44FCC00C9E5F2 /* VPWebViewController.swift */,
BF5E75B02DE4656600DE9DFE /* VPCampaignWebViewController.swift */,
BFF5B21B2DEEDE130044227A /* VPWebViewController+Script.swift */,
BFF5B23E2DF0443B0044227A /* VPWebScriptModel.swift */,
);
path = WebView;
sourceTree = "<group>";
@ -1310,6 +1319,7 @@
BF5E75CD2DE5692D00DE9DFE /* JXTransitionDelegateBridge.swift in Sources */,
BF5E75CE2DE5692D00DE9DFE /* JXPushAnimatedTransition.swift in Sources */,
BF5E75CF2DE5692D00DE9DFE /* UIViewController+JXTransition.swift in Sources */,
BFF5B23F2DF0443B0044227A /* VPWebScriptModel.swift in Sources */,
BFF5B23B2DF018900044227A /* VPAlertView.swift in Sources */,
BF5E75D02DE5692D00DE9DFE /* UIGestureRecognizer+JXTransition.swift in Sources */,
BFF5AFA62DE700420044227A /* VPMeVipPrivilegeItemView.swift in Sources */,
@ -1392,6 +1402,7 @@
BF0FA7892DE161F200C9E5F2 /* VPSearchResultView.swift in Sources */,
1B056E792DDB365A007EE38D /* VPTabBarItemSelectedView.swift in Sources */,
1B056E722DDB022F007EE38D /* VPTabBarItem.swift in Sources */,
BFF5B23D2DF034420044227A /* VPFeedbackViewController.swift in Sources */,
BFF5B2392DF014520044227A /* VPBaseAlertView.swift in Sources */,
BFF5AFCC2DE98C7F0044227A /* VPOrderRecordsViewController.swift in Sources */,
1B056E412DDAC30A007EE38D /* VPModel.swift in Sources */,
@ -1420,6 +1431,7 @@
1B056E492DDAC3DF007EE38D /* VPAppTool.swift in Sources */,
BFF5AFE62DEEDB7F0044227A /* VPRewardsViewController.swift in Sources */,
BF0FA74E2DDF067E00C9E5F2 /* VPVideoPlayViewModel.swift in Sources */,
BFF5B2412DF045BF0044227A /* VPRewardsAPI.swift in Sources */,
BF0FA75B2DDF206000C9E5F2 /* VPExplorePlayerCell.swift in Sources */,
BF0FA7412DDEFBC700C9E5F2 /* UIScrollView+VPRefresh.swift in Sources */,
BF0FA70C2DDC6A3800C9E5F2 /* VPHomeBannerContentCell.swift in Sources */,
@ -1463,6 +1475,9 @@
DEVELOPMENT_TEAM = 394VH538M8;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_FILE = Veloria/Source/Info.plist;
INFOPLIST_KEY_NSCameraUsageDescription = "The APP needs to access your album to provide screenshots for feedback.";
INFOPLIST_KEY_NSLocationWhenInUseUsageDescription = "The APP needs to access your location to recommend better short dramas for you";
INFOPLIST_KEY_NSPhotoLibraryUsageDescription = "The APP needs to access your album to provide screenshots for feedback.";
INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES;
INFOPLIST_KEY_UILaunchStoryboardName = LaunchScreen;
INFOPLIST_KEY_UIMainStoryboardFile = "";
@ -1501,6 +1516,9 @@
DEVELOPMENT_TEAM = 394VH538M8;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_FILE = Veloria/Source/Info.plist;
INFOPLIST_KEY_NSCameraUsageDescription = "The APP needs to access your album to provide screenshots for feedback.";
INFOPLIST_KEY_NSLocationWhenInUseUsageDescription = "The APP needs to access your location to recommend better short dramas for you";
INFOPLIST_KEY_NSPhotoLibraryUsageDescription = "The APP needs to access your album to provide screenshots for feedback.";
INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES;
INFOPLIST_KEY_UILaunchStoryboardName = LaunchScreen;
INFOPLIST_KEY_UIMainStoryboardFile = "";

View File

@ -9,7 +9,7 @@ import UIKit
extension UIColor {
static func backgroundColor() -> UIColor {
return color000000()
return color080B16()
}
static func placeholderColor() -> UIColor {

View File

@ -0,0 +1,25 @@
//
// VPRewardsAPI.swift
// Veloria
//
// Created by on 2025/6/4.
//
import UIKit
class VPRewardsAPI: NSObject {
///
static func requestUploadOpenNotify(completer: ((_ finish: Bool) -> Void)?) {
let param = VPNetworkParameters(path: "/openNotify")
VPNetwork.request(parameters: param) { (response: VPNetworkResponse<String>) in
if response.code == VPNetworkCodeSucceed {
completer?(true)
} else {
completer?(false)
}
}
}
}

View File

@ -0,0 +1,25 @@
//
// VPWebScriptModel.swift
// Veloria
//
// Created by on 2025/6/4.
//
import UIKit
import SmartCodable
class VPWebScriptModel: VPModel, SmartCodable {
var type: String?
var data: VPWebScriptData?
}
struct VPWebScriptData: SmartCodable {
var activity_id: String?
var short_play_id: String?
var link: String?
}

View File

@ -7,6 +7,7 @@
import UIKit
import WebKit
import ZLPhotoBrowser
typealias VPWebViewMessageName = String
@ -25,8 +26,98 @@ extension VPWebViewController {
let name = message.name
let body = message.body
switch name {
case VPWebMessageOpenFeedbackList:
let vc = VPCampaignWebViewController()
vc.bgImageView.isHidden = true
vc.urlStr = kVPFeedBackListWebUrl
self.navigationController?.pushViewController(vc, animated: true)
case VPWebMessageOpenFeedbackDetail:
let vc = VPCampaignWebViewController()
vc.bgImageView.isHidden = true
vc.urlStr = kVPFeedBackDetailWebUrl
self.navigationController?.pushViewController(vc, animated: true)
case VPWebMessageOpenPhotoPicker:
openPhotoPicker()
case VPWebMessageAPP:
guard let body = message.body as? [String : Any] else { return }
guard let model = VPWebScriptModel.deserialize(from: body) else { return }
let type = model.type
let data = model.data
if type == "login" {
VPLoginManager.manager.openLogin()
} else if type == "open_notify" {
openNotify()
} else if type == "watch_video" {
let vc = VPDetailPlayerViewController()
vc.shortPlayId = data?.short_play_id
vc.activityId = data?.activity_id
self.navigationController?.pushViewController(vc, animated: true)
} else {
guard let urlStr = data?.link else { return }
guard let url = URL(string: urlStr) else { return }
if UIApplication.shared.canOpenURL(url) {
UIApplication.shared.open(url)
}
}
default:
break
}
}
}
extension VPWebViewController {
///
private func openPhotoPicker() {
ZLPhotoConfiguration.default().allowSelectOriginal = false
ZLPhotoConfiguration.default().maxSelectCount = 1
ZLPhotoConfiguration.default().allowEditImage = false
ZLPhotoConfiguration.default().allowSelectVideo = false
ZLPhotoConfiguration.default().allowSelectGif = false
ZLPhotoConfiguration.default().allowTakePhotoInLibrary = false
let picker = ZLPhotoPicker()
picker.selectImageBlock = { [weak self] (results, _) in
guard let self = self else { return }
guard let image = results.first?.image else { return }
guard let imageData = image.jpegData(compressionQuality: 0.8) else { return }
let imageDataStr = imageData.base64EncodedString(options: .endLineWithCarriageReturn)
let js = "uploadConvertImage('\(imageDataStr)')"
self.webView.evaluateJavaScript(js)
}
picker.showPhotoLibrary(sender: self)
}
///
private func openNotify() {
UNUserNotificationCenter.current().getNotificationSettings { settings in
DispatchQueue.main.async { [weak self] in
guard let self = self else { return }
if settings.authorizationStatus != .authorized {
VPAppTool.openApnsSetting()
} else {
VPRewardsAPI.requestUploadOpenNotify { [weak self] finish in
if finish {
self?.reload()
}
}
}
}
}
}
}

View File

@ -0,0 +1,28 @@
//
// VPFeedbackViewController.swift
// Veloria
//
// Created by on 2025/6/4.
//
import UIKit
class VPFeedbackViewController: VPCampaignWebViewController {
override func viewDidLoad() {
self.urlStr = kVPFeedBackHomeWebUrl
super.viewDidLoad()
self.bgImageView.isHidden = true
self.navigationItem.rightBarButtonItem = UIBarButtonItem(image: UIImage(named: "feed_back_icon_01"), style: .plain, target: self, action: #selector(handleRightButton))
}
@objc private func handleRightButton() {
let vc = VPCampaignWebViewController()
vc.urlStr = kVPFeedBackListWebUrl
vc.bgImageView.isHidden = true
self.navigationController?.pushViewController(vc, animated: true)
}
}

View File

@ -162,6 +162,10 @@ extension VPMeViewController: UITableViewDelegate, UITableViewDataSource {
let vc = VPDeleteAccountViewController()
self.navigationController?.pushViewController(vc, animated: true)
case .feedback:
let vc = VPFeedbackViewController()
self.navigationController?.pushViewController(vc, animated: true)
default:
break
}
@ -201,7 +205,7 @@ extension VPMeViewController {
cellArr.append(VPMeItem(icon: UIImage(named: "me_item_icon_05"), title: "Language".localized, type: .language, cellKey: .normal))
cellArr.append(VPMeItem(icon: UIImage(named: "me_item_icon_01"), title: "Privacy Policy".localized, type: .privacyPolicy, cellKey: .normal))
cellArr.append(VPMeItem(icon: UIImage(named: "me_item_icon_02"), title: "User Agreement".localized, type: .userAgreement, cellKey: .normal))
// cellArr.append(VPMeItem(icon: UIImage(named: "me_item_icon_04"), title: "Help Center".localized, type: .feedback, cellKey: .normal))
cellArr.append(VPMeItem(icon: UIImage(named: "me_item_icon_04"), title: "Help Center".localized, type: .feedback, cellKey: .normal))
cellArr.append(VPMeItem(icon: UIImage(named: "me_item_icon_03"), title: "About Us".localized, type: .aboutUs, cellKey: .normal))
if VPLoginManager.manager.userInfo?.is_tourist == false {

View File

@ -51,8 +51,7 @@ class VPMeFooterView: UIView {
@objc private func handleButton() {
if userInfo?.is_tourist == true {
let view = VPLoginContentView()
view.present(in: nil)
VPLoginManager.manager.openLogin()
} else {
let alert = VPAlertView(title: "kLogoutAlertTitle".localized, subtitle: "kLogoutAlertText".localized, icon: UIImage(named: "alert_icon_02"), normalButtonText: "Log Out".localized, highlightButtonText: "Cancel".localized).show()
alert.clickNormalButton = {

View File

@ -83,8 +83,7 @@ class VPMeUserInfoCell: VPTableViewCell {
}
@objc private func handleLoginButton() {
let view = VPLoginContentView()
view.present(in: nil)
VPLoginManager.manager.openLogin()
}
}

View File

@ -38,6 +38,11 @@ class VPLoginManager: NSObject {
UserDefaults.vp_setObject(token, forKey: kVPLoginTokenDefaultsKey)
}
func openLogin() {
let view = VPLoginContentView()
view.present(in: nil)
}
func login(type: LoginType, presentingViewController: UIViewController?, completer: ((_ isFinish: Bool) -> Void)?) {
switch type {

View File

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 479 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 617 B