消息通知开发
This commit is contained in:
parent
690f961812
commit
cd6b6f7dcf
18
NotificationService/Info.plist
Normal file
18
NotificationService/Info.plist
Normal file
@ -0,0 +1,18 @@
|
||||
<?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>NSAppTransportSecurity</key>
|
||||
<dict>
|
||||
<key>NSAllowsArbitraryLoads</key>
|
||||
<true/>
|
||||
</dict>
|
||||
<key>NSExtension</key>
|
||||
<dict>
|
||||
<key>NSExtensionPointIdentifier</key>
|
||||
<string>com.apple.usernotifications.service</string>
|
||||
<key>NSExtensionPrincipalClass</key>
|
||||
<string>$(PRODUCT_MODULE_NAME).NotificationService</string>
|
||||
</dict>
|
||||
</dict>
|
||||
</plist>
|
67
NotificationService/NotificationService.swift
Normal file
67
NotificationService/NotificationService.swift
Normal file
@ -0,0 +1,67 @@
|
||||
//
|
||||
// NotificationService.swift
|
||||
// NotificationService
|
||||
//
|
||||
// Created by 湖南秦九 on 2025/6/16.
|
||||
//
|
||||
|
||||
import UserNotifications
|
||||
|
||||
class NotificationService: UNNotificationServiceExtension {
|
||||
var contentHandler: ((UNNotificationContent) -> Void)?
|
||||
var bestAttemptContent: UNMutableNotificationContent?
|
||||
|
||||
override func didReceive(_ request: UNNotificationRequest, withContentHandler contentHandler: @escaping (UNNotificationContent) -> Void) {
|
||||
|
||||
self.contentHandler = contentHandler
|
||||
bestAttemptContent = (request.content.mutableCopy() as? UNMutableNotificationContent)
|
||||
|
||||
guard let bestAttemptContent = bestAttemptContent else {
|
||||
contentHandler(request.content)
|
||||
return
|
||||
}
|
||||
|
||||
if let options = request.content.userInfo["fcm_options"] as? [String : Any],
|
||||
let imageURLString = options["image"] as? String,
|
||||
let imageURL = URL(string: imageURLString) {
|
||||
|
||||
downloadImage(from: imageURL) { attachment in
|
||||
if let attachment = attachment {
|
||||
bestAttemptContent.attachments = [attachment]
|
||||
}
|
||||
contentHandler(bestAttemptContent)
|
||||
}
|
||||
} else {
|
||||
contentHandler(bestAttemptContent)
|
||||
}
|
||||
}
|
||||
|
||||
override func serviceExtensionTimeWillExpire() {
|
||||
if let contentHandler = contentHandler, let bestAttemptContent = bestAttemptContent {
|
||||
contentHandler(bestAttemptContent)
|
||||
}
|
||||
}
|
||||
|
||||
// 下载图片
|
||||
private func downloadImage(from url: URL, completion: @escaping (UNNotificationAttachment?) -> Void) {
|
||||
let task = URLSession.shared.downloadTask(with: url) { (downloadedUrl, _, error) in
|
||||
guard let downloadedUrl = downloadedUrl else {
|
||||
completion(nil)
|
||||
return
|
||||
}
|
||||
|
||||
let tmpDir = FileManager.default.temporaryDirectory
|
||||
let tmpFile = tmpDir.appendingPathComponent(url.lastPathComponent)
|
||||
|
||||
do {
|
||||
try FileManager.default.moveItem(at: downloadedUrl, to: tmpFile)
|
||||
let attachment = try UNNotificationAttachment(identifier: UUID().uuidString, url: tmpFile, options: nil)
|
||||
completion(attachment)
|
||||
} catch {
|
||||
completion(nil)
|
||||
}
|
||||
}
|
||||
task.resume()
|
||||
}
|
||||
}
|
||||
|
@ -158,6 +158,10 @@
|
||||
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 */; };
|
||||
BFCCE1342DFFFAB600EDE165 /* NotificationService.appex in Embed Foundation Extensions */ = {isa = PBXBuildFile; fileRef = BFCCE12D2DFFFAB600EDE165 /* NotificationService.appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; };
|
||||
BFCCE13D2DFFFAC500EDE165 /* NotificationService.swift in Sources */ = {isa = PBXBuildFile; fileRef = BFCCE13B2DFFFAC500EDE165 /* NotificationService.swift */; };
|
||||
BFCCE1402E000ACE00EDE165 /* VPAnpsAlertView.swift in Sources */ = {isa = PBXBuildFile; fileRef = BFCCE13F2E000ACE00EDE165 /* VPAnpsAlertView.swift */; };
|
||||
BFCCE1422E000F4800EDE165 /* VPHomePlayHistoricalView.swift in Sources */ = {isa = PBXBuildFile; fileRef = BFCCE1412E000F4800EDE165 /* VPHomePlayHistoricalView.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 */; };
|
||||
@ -235,6 +239,30 @@
|
||||
F939C04AD4003BA127F15C28 /* Pods_Veloria.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 34F57E87E765BF8D72A43DCA /* Pods_Veloria.framework */; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXContainerItemProxy section */
|
||||
BFCCE1322DFFFAB600EDE165 /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = 1B056DEC2DDABE2B007EE38D /* Project object */;
|
||||
proxyType = 1;
|
||||
remoteGlobalIDString = BFCCE12C2DFFFAB600EDE165;
|
||||
remoteInfo = NotificationService;
|
||||
};
|
||||
/* End PBXContainerItemProxy section */
|
||||
|
||||
/* Begin PBXCopyFilesBuildPhase section */
|
||||
BFCCE1352DFFFAB600EDE165 /* Embed Foundation Extensions */ = {
|
||||
isa = PBXCopyFilesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
dstPath = "";
|
||||
dstSubfolderSpec = 13;
|
||||
files = (
|
||||
BFCCE1342DFFFAB600EDE165 /* NotificationService.appex in Embed Foundation Extensions */,
|
||||
);
|
||||
name = "Embed Foundation Extensions";
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXCopyFilesBuildPhase section */
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
1B056DF42DDABE2B007EE38D /* Veloria.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Veloria.app; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
1B056E212DDAC0FD007EE38D /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
|
||||
@ -394,6 +422,11 @@
|
||||
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>"; };
|
||||
BFCCE12D2DFFFAB600EDE165 /* NotificationService.appex */ = {isa = PBXFileReference; explicitFileType = "wrapper.app-extension"; includeInIndex = 0; path = NotificationService.appex; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
BFCCE13A2DFFFAC500EDE165 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
||||
BFCCE13B2DFFFAC500EDE165 /* NotificationService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NotificationService.swift; sourceTree = "<group>"; };
|
||||
BFCCE13F2E000ACE00EDE165 /* VPAnpsAlertView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = VPAnpsAlertView.swift; sourceTree = "<group>"; };
|
||||
BFCCE1412E000F4800EDE165 /* VPHomePlayHistoricalView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = VPHomePlayHistoricalView.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>"; };
|
||||
@ -483,6 +516,13 @@
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
BFCCE12A2DFFFAB600EDE165 /* Frameworks */ = {
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXFrameworksBuildPhase section */
|
||||
|
||||
/* Begin PBXGroup section */
|
||||
@ -490,6 +530,7 @@
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
1B056E2A2DDAC0FD007EE38D /* Veloria */,
|
||||
BFCCE13C2DFFFAC500EDE165 /* NotificationService */,
|
||||
1B056DF52DDABE2B007EE38D /* Products */,
|
||||
97790501CCBF987017A55C80 /* Pods */,
|
||||
AEE348721F7DD68AB45E7964 /* Frameworks */,
|
||||
@ -500,6 +541,7 @@
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
1B056DF42DDABE2B007EE38D /* Veloria.app */,
|
||||
BFCCE12D2DFFFAB600EDE165 /* NotificationService.appex */,
|
||||
);
|
||||
name = Products;
|
||||
sourceTree = "<group>";
|
||||
@ -879,6 +921,7 @@
|
||||
BF0FA78A2DE164C100C9E5F2 /* VPSearchResultCell.swift */,
|
||||
BF0FA7902DE16CBF00C9E5F2 /* VPSearchHistoryView.swift */,
|
||||
BF5E75BF2DE5566200DE9DFE /* VPHomePageControlView.swift */,
|
||||
BFCCE1412E000F4800EDE165 /* VPHomePlayHistoricalView.swift */,
|
||||
);
|
||||
path = View;
|
||||
sourceTree = "<group>";
|
||||
@ -1143,6 +1186,15 @@
|
||||
path = Guide;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
BFCCE13C2DFFFAC500EDE165 /* NotificationService */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
BFCCE13A2DFFFAC500EDE165 /* Info.plist */,
|
||||
BFCCE13B2DFFFAC500EDE165 /* NotificationService.swift */,
|
||||
);
|
||||
path = NotificationService;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
BFF5AFBB2DE837710044227A /* Wallet */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
@ -1245,6 +1297,7 @@
|
||||
BFF5B23A2DF018900044227A /* VPAlertView.swift */,
|
||||
BFF5B2382DF014520044227A /* VPBaseAlertView.swift */,
|
||||
BFF5B2362DF013410044227A /* VPAlertWindowManager.swift */,
|
||||
BFCCE13F2E000ACE00EDE165 /* VPAnpsAlertView.swift */,
|
||||
);
|
||||
path = Alert;
|
||||
sourceTree = "<group>";
|
||||
@ -1280,16 +1333,37 @@
|
||||
1B056DF12DDABE2B007EE38D /* Frameworks */,
|
||||
1B056DF22DDABE2B007EE38D /* Resources */,
|
||||
D1E2E0FAE9833666668F2F70 /* [CP] Embed Pods Frameworks */,
|
||||
BFCCE1352DFFFAB600EDE165 /* Embed Foundation Extensions */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
BFCCE1332DFFFAB600EDE165 /* PBXTargetDependency */,
|
||||
);
|
||||
name = Veloria;
|
||||
productName = VideoPlayer;
|
||||
productReference = 1B056DF42DDABE2B007EE38D /* Veloria.app */;
|
||||
productType = "com.apple.product-type.application";
|
||||
};
|
||||
BFCCE12C2DFFFAB600EDE165 /* NotificationService */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = BFCCE1392DFFFAB600EDE165 /* Build configuration list for PBXNativeTarget "NotificationService" */;
|
||||
buildPhases = (
|
||||
BFCCE1292DFFFAB600EDE165 /* Sources */,
|
||||
BFCCE12A2DFFFAB600EDE165 /* Frameworks */,
|
||||
BFCCE12B2DFFFAB600EDE165 /* Resources */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
);
|
||||
name = NotificationService;
|
||||
packageProductDependencies = (
|
||||
);
|
||||
productName = NotificationService;
|
||||
productReference = BFCCE12D2DFFFAB600EDE165 /* NotificationService.appex */;
|
||||
productType = "com.apple.product-type.app-extension";
|
||||
};
|
||||
/* End PBXNativeTarget section */
|
||||
|
||||
/* Begin PBXProject section */
|
||||
@ -1305,6 +1379,9 @@
|
||||
CreatedOnToolsVersion = 16.2;
|
||||
LastSwiftMigration = 1620;
|
||||
};
|
||||
BFCCE12C2DFFFAB600EDE165 = {
|
||||
CreatedOnToolsVersion = 16.2;
|
||||
};
|
||||
};
|
||||
};
|
||||
buildConfigurationList = 1B056DEF2DDABE2B007EE38D /* Build configuration list for PBXProject "Veloria" */;
|
||||
@ -1326,6 +1403,7 @@
|
||||
projectRoot = "";
|
||||
targets = (
|
||||
1B056DF32DDABE2B007EE38D /* Veloria */,
|
||||
BFCCE12C2DFFFAB600EDE165 /* NotificationService */,
|
||||
);
|
||||
};
|
||||
/* End PBXProject section */
|
||||
@ -1344,6 +1422,13 @@
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
BFCCE12B2DFFFAB600EDE165 /* Resources */ = {
|
||||
isa = PBXResourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXResourcesBuildPhase section */
|
||||
|
||||
/* Begin PBXShellScriptBuildPhase section */
|
||||
@ -1468,6 +1553,7 @@
|
||||
BF5E75CC2DE5692D00DE9DFE /* JXTransitionDefine.swift in Sources */,
|
||||
BF5E75CD2DE5692D00DE9DFE /* JXTransitionDelegateBridge.swift in Sources */,
|
||||
BF5E75CE2DE5692D00DE9DFE /* JXPushAnimatedTransition.swift in Sources */,
|
||||
BFCCE1402E000ACE00EDE165 /* VPAnpsAlertView.swift in Sources */,
|
||||
BF5E75CF2DE5692D00DE9DFE /* UIViewController+JXTransition.swift in Sources */,
|
||||
BFF5B26E2DF297680044227A /* VPOpenAppModel.swift in Sources */,
|
||||
BFF5B23F2DF0443B0044227A /* VPWebScriptModel.swift in Sources */,
|
||||
@ -1586,6 +1672,7 @@
|
||||
BFCCE1122DF9638B00EDE165 /* VPVipAlertView.swift in Sources */,
|
||||
BF0FA7172DDC78FF00C9E5F2 /* ZKCycleScrollView.swift in Sources */,
|
||||
BFF5B4AF2DF6B6630044227A /* VPMutualCollectionView.swift in Sources */,
|
||||
BFCCE1422E000F4800EDE165 /* VPHomePlayHistoricalView.swift in Sources */,
|
||||
BF0FA7612DDFFE7100C9E5F2 /* VPVideoDetailModel.swift in Sources */,
|
||||
BFF5AFD22DE9A58A0044227A /* VPVIPRecordViewController.swift in Sources */,
|
||||
BFF5AFDA2DEE90350044227A /* VPVideoLockView.swift in Sources */,
|
||||
@ -1611,8 +1698,24 @@
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
BFCCE1292DFFFAB600EDE165 /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
BFCCE13D2DFFFAC500EDE165 /* NotificationService.swift in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXSourcesBuildPhase section */
|
||||
|
||||
/* Begin PBXTargetDependency section */
|
||||
BFCCE1332DFFFAB600EDE165 /* PBXTargetDependency */ = {
|
||||
isa = PBXTargetDependency;
|
||||
target = BFCCE12C2DFFFAB600EDE165 /* NotificationService */;
|
||||
targetProxy = BFCCE1322DFFFAB600EDE165 /* PBXContainerItemProxy */;
|
||||
};
|
||||
/* End PBXTargetDependency section */
|
||||
|
||||
/* Begin PBXVariantGroup section */
|
||||
1B056E252DDAC0FD007EE38D /* LaunchScreen.storyboard */ = {
|
||||
isa = PBXVariantGroup;
|
||||
@ -1833,6 +1936,62 @@
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
BFCCE1362DFFFAB600EDE165 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
CODE_SIGN_IDENTITY = "Apple Development";
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
CURRENT_PROJECT_VERSION = 1;
|
||||
DEVELOPMENT_TEAM = 394VH538M8;
|
||||
ENABLE_USER_SCRIPT_SANDBOXING = YES;
|
||||
GENERATE_INFOPLIST_FILE = YES;
|
||||
INFOPLIST_FILE = NotificationService/Info.plist;
|
||||
INFOPLIST_KEY_CFBundleDisplayName = NotificationService;
|
||||
INFOPLIST_KEY_NSHumanReadableCopyright = "";
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 15.6;
|
||||
LD_RUNPATH_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"@executable_path/Frameworks",
|
||||
"@executable_path/../../Frameworks",
|
||||
);
|
||||
MARKETING_VERSION = 1.0;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.qjwl168.veloria.ios.NotificationService;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SKIP_INSTALL = YES;
|
||||
SWIFT_EMIT_LOC_STRINGS = YES;
|
||||
SWIFT_VERSION = 5.0;
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
BFCCE1372DFFFAB600EDE165 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
CODE_SIGN_IDENTITY = "Apple Development";
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
CURRENT_PROJECT_VERSION = 1;
|
||||
DEVELOPMENT_TEAM = 394VH538M8;
|
||||
ENABLE_USER_SCRIPT_SANDBOXING = YES;
|
||||
GENERATE_INFOPLIST_FILE = YES;
|
||||
INFOPLIST_FILE = NotificationService/Info.plist;
|
||||
INFOPLIST_KEY_CFBundleDisplayName = NotificationService;
|
||||
INFOPLIST_KEY_NSHumanReadableCopyright = "";
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 15.6;
|
||||
LD_RUNPATH_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"@executable_path/Frameworks",
|
||||
"@executable_path/../../Frameworks",
|
||||
);
|
||||
MARKETING_VERSION = 1.0;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.qjwl168.veloria.ios.NotificationService;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SKIP_INSTALL = YES;
|
||||
SWIFT_EMIT_LOC_STRINGS = YES;
|
||||
SWIFT_VERSION = 5.0;
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
/* End XCBuildConfiguration section */
|
||||
|
||||
/* Begin XCConfigurationList section */
|
||||
@ -1854,6 +2013,15 @@
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
BFCCE1392DFFFAB600EDE165 /* Build configuration list for PBXNativeTarget "NotificationService" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
BFCCE1362DFFFAB600EDE165 /* Debug */,
|
||||
BFCCE1372DFFFAB600EDE165 /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
/* End XCConfigurationList section */
|
||||
|
||||
/* Begin XCRemoteSwiftPackageReference section */
|
||||
|
@ -51,7 +51,7 @@ extension AppDelegate {
|
||||
}
|
||||
|
||||
private func showApnsAlert() {
|
||||
let alert = VPAlertView(title: "open_notice_at_watch_video".localized, subtitle: "veloria_open_notice_alert_text".localized, icon: UIImage(named: "alert_icon_03"), normalButtonText: nil, highlightButtonText: "veloria_allow".localized)
|
||||
let alert = VPAnpsAlertView(title: "veloria_open_notice_at_watch_video".localized, subtitle: "veloria_open_notice_alert_text".localized, icon: UIImage(named: "alert_icon_03"), normalButtonText: nil, highlightButtonText: "veloria_allow".localized)
|
||||
alert.show()
|
||||
|
||||
alert.clickHighlightButton = { [weak self] in
|
||||
|
@ -83,14 +83,12 @@ extension VPApi: TargetType {
|
||||
"lang-key" : VPLocalizedManager.shared.currentLocalizedKey,//当前语言
|
||||
"time-zone" : String.timeZone(), //时区
|
||||
"app-version" : kVPAPPVersion,
|
||||
// "device-id" : JXUUID.systemUUID(), //设备id
|
||||
"device-id" : JXUUID.uuid(), //设备id
|
||||
"brand" : "apple", //品牌
|
||||
"app-name" : kVPAPPBundleIdentifier,
|
||||
"system-type" : "ios",
|
||||
"idfa" : JXUUID.idfa(),
|
||||
"model" : UIDevice.vp_machineModelName(),
|
||||
// "security" : "false",
|
||||
]
|
||||
//登录信息
|
||||
dic["authorization"] = userToken
|
||||
|
@ -138,6 +138,11 @@ class VPHomePageViewController: VPViewController {
|
||||
return view
|
||||
}()
|
||||
|
||||
private lazy var playHistoricalView: VPHomePlayHistoricalView = {
|
||||
let view = VPHomePlayHistoricalView()
|
||||
return view
|
||||
}()
|
||||
|
||||
|
||||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
@ -237,6 +242,7 @@ extension VPHomePageViewController {
|
||||
view.addSubview(searchButton)
|
||||
view.addSubview(historyButton)
|
||||
view.addSubview(pageView)
|
||||
view.addSubview(playHistoricalView)
|
||||
|
||||
titleLabel.snp.makeConstraints { make in
|
||||
make.centerX.equalToSuperview()
|
||||
@ -257,6 +263,12 @@ extension VPHomePageViewController {
|
||||
make.width.height.equalTo(40)
|
||||
make.centerY.equalTo(searchButton)
|
||||
}
|
||||
|
||||
playHistoricalView.snp.makeConstraints { make in
|
||||
make.centerX.equalToSuperview()
|
||||
make.right.equalToSuperview().offset(15)
|
||||
make.bottom.equalToSuperview().offset(-(UIScreen.customTabBarHeight + 10))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
46
Veloria/Class/Home/View/VPHomePlayHistoricalView.swift
Normal file
46
Veloria/Class/Home/View/VPHomePlayHistoricalView.swift
Normal file
@ -0,0 +1,46 @@
|
||||
//
|
||||
// VPHomePlayHistoricalView.swift
|
||||
// Veloria
|
||||
//
|
||||
// Created by 湖南秦九 on 2025/6/16.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
|
||||
class VPHomePlayHistoricalView: UIView {
|
||||
|
||||
private lazy var bgView: UIView = {
|
||||
let view = UIView()
|
||||
view.layer.cornerRadius = 10
|
||||
view.layer.masksToBounds = true
|
||||
view.addEffectView(style: .dark)
|
||||
return view
|
||||
}()
|
||||
|
||||
override init(frame: CGRect) {
|
||||
super.init(frame: frame)
|
||||
|
||||
|
||||
vp_setupUI()
|
||||
}
|
||||
|
||||
required init?(coder: NSCoder) {
|
||||
fatalError("init(coder:) has not been implemented")
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
extension VPHomePlayHistoricalView {
|
||||
|
||||
private func vp_setupUI() {
|
||||
addSubview(bgView)
|
||||
|
||||
bgView.snp.makeConstraints { make in
|
||||
make.left.right.bottom.equalToSuperview()
|
||||
make.top.equalToSuperview().offset(12)
|
||||
make.height.equalTo(56)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -14,7 +14,7 @@ class VPAlertView: VPBaseAlertView {
|
||||
var clickCloseButton: (() -> Void)?
|
||||
|
||||
|
||||
private lazy var bgView: UIImageView = {
|
||||
private(set) lazy var bgView: UIImageView = {
|
||||
let imageView = UIImageView(image: UIImage(named: "alert_bg_image_01"))
|
||||
imageView.backgroundColor = .colorFFFFFF()
|
||||
imageView.layer.cornerRadius = 18
|
||||
@ -169,7 +169,7 @@ extension VPAlertView {
|
||||
titleLabel.snp.makeConstraints { make in
|
||||
make.left.equalToSuperview().offset(33)
|
||||
make.top.equalToSuperview().offset(36)
|
||||
make.right.lessThanOrEqualToSuperview().offset(-100)
|
||||
make.right.lessThanOrEqualToSuperview().offset(-130)
|
||||
}
|
||||
|
||||
titleIconImageView.snp.makeConstraints { make in
|
||||
|
35
Veloria/Libs/Alert/VPAnpsAlertView.swift
Normal file
35
Veloria/Libs/Alert/VPAnpsAlertView.swift
Normal file
@ -0,0 +1,35 @@
|
||||
//
|
||||
// VPAnpsAlertView.swift
|
||||
// Veloria
|
||||
//
|
||||
// Created by 湖南秦九 on 2025/6/16.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
|
||||
class VPAnpsAlertView: VPAlertView {
|
||||
|
||||
|
||||
private lazy var switchIconImageView: UIImageView = {
|
||||
let imageView = UIImageView(image: UIImage(named: "switch_icon_01"))
|
||||
return imageView
|
||||
}()
|
||||
|
||||
override init(title: String, subtitle: String, icon: UIImage?, normalButtonText: String?, highlightButtonText: String?) {
|
||||
super.init(title: title, subtitle: subtitle, icon: icon, normalButtonText: normalButtonText, highlightButtonText: highlightButtonText)
|
||||
|
||||
bgView.addSubview(switchIconImageView)
|
||||
|
||||
switchIconImageView.snp.makeConstraints { make in
|
||||
make.right.equalToSuperview().offset(-13)
|
||||
make.top.equalToSuperview().offset(63)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@MainActor required init?(coder: NSCoder) {
|
||||
fatalError("init(coder:) has not been implemented")
|
||||
}
|
||||
|
||||
|
||||
}
|
22
Veloria/Source/Assets.xcassets/icon/switch_icon_01.imageset/Contents.json
vendored
Normal file
22
Veloria/Source/Assets.xcassets/icon/switch_icon_01.imageset/Contents.json
vendored
Normal file
@ -0,0 +1,22 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"filename" : "Frame@2x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"filename" : "Frame@3x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
BIN
Veloria/Source/Assets.xcassets/icon/switch_icon_01.imageset/Frame@2x.png
vendored
Normal file
BIN
Veloria/Source/Assets.xcassets/icon/switch_icon_01.imageset/Frame@2x.png
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.7 KiB |
BIN
Veloria/Source/Assets.xcassets/icon/switch_icon_01.imageset/Frame@3x.png
vendored
Normal file
BIN
Veloria/Source/Assets.xcassets/icon/switch_icon_01.imageset/Frame@3x.png
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.5 KiB |
@ -144,7 +144,7 @@
|
||||
"veloria_action_cannot_undone" = "This action cannot be undone.";
|
||||
"veloria_un_favorites" = "UnFavorites";
|
||||
"veloria_un_favorites_text" = "You may not find this collection after you uncollect it";
|
||||
"open_notice_at_watch_video" = "Turn on Notifications?";
|
||||
"veloria_open_notice_at_watch_video" = "Turn on Notifications?";
|
||||
"veloria_open_notice_alert_text" = "Get alerts for new episodes and exclusive offers.";
|
||||
"veloria_vip_splash_title" = "Unlock VIP Privileges!";
|
||||
"veloria_vip_splash_content" = "Enjoy ad-free streaming, early access, and exclusive content!";
|
||||
|
Loading…
x
Reference in New Issue
Block a user