11
@@ -15,6 +15,7 @@
|
||||
#import <AdSupport/AdSupport.h>
|
||||
#import <AppTrackingTransparency/AppTrackingTransparency.h>
|
||||
#import <SVProgressHUD.h>
|
||||
#import <SDWebImage.h>
|
||||
|
||||
#import "MacroDefine.h"
|
||||
#import "MainOldViewController.h"
|
||||
@@ -61,7 +62,7 @@
|
||||
request.HTTPMethod = @"PUT";
|
||||
[request setValue:@"application/json" forHTTPHeaderField:@"Content-Type"];
|
||||
|
||||
NSDictionary *parmas = @{@"userId":[NSNumber numberWithInteger:[Tinju55UserID integerValue]]};
|
||||
NSDictionary *parmas = @{@"userId":[NSNumber numberWithInteger:[TESTUserID integerValue]]};
|
||||
NSData *jsonData = [NSJSONSerialization dataWithJSONObject:parmas options:NSJSONWritingPrettyPrinted error:nil];
|
||||
request.HTTPBody = jsonData;
|
||||
|
||||
@@ -240,26 +241,27 @@
|
||||
if (type == 2 && !ISNULLSTR(image)) {
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
NSURL *url = [NSURL URLWithString:image];
|
||||
NSData *data = [NSData dataWithContentsOfURL:url];
|
||||
|
||||
UIView *bgView = [[UIView alloc] initWithFrame:self.window.bounds];
|
||||
bgView.backgroundColor = [UIColor colorWithWhite:0 alpha:0.5];
|
||||
|
||||
UIImageView *imageview = [[UIImageView alloc] initWithFrame:CGRectMake(20, 80, bgView.frame.size.width-40, bgView.frame.size.height-160)];
|
||||
imageview.image = [UIImage imageWithData:data];
|
||||
imageview.contentMode = UIViewContentModeScaleAspectFill;
|
||||
[imageview sd_setImageWithURL:url];
|
||||
imageview.userInteractionEnabled = NO;
|
||||
imageview.contentMode = UIViewContentModeScaleAspectFit;
|
||||
|
||||
UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapImageView:)];
|
||||
[imageview addGestureRecognizer:tap];
|
||||
[bgView addGestureRecognizer:tap];
|
||||
|
||||
[self.window addSubview:bgView];
|
||||
[bgView addSubview:imageview];
|
||||
});
|
||||
}else if (type == 3 && !ISNULLSTR(jumpUrl)) {
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
MainOldViewController *view = [[MainOldViewController alloc] init];
|
||||
view.gameURLString = jumpUrl;
|
||||
UIStoryboard *sb = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
|
||||
MainOldViewController *view = [sb instantiateViewControllerWithIdentifier:@"MainOldViewController"];
|
||||
view.isPresent = YES;
|
||||
view.gameURLString = jumpUrl;
|
||||
view.modalPresentationStyle = UIModalPresentationFullScreen;
|
||||
[self.window.rootViewController presentViewController:view animated:YES completion:^{}];
|
||||
});
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"filename" : "Tinju55.png",
|
||||
"idiom" : "universal",
|
||||
"platform" : "ios",
|
||||
"size" : "1024x1024"
|
||||
|
||||
|
Before Width: | Height: | Size: 264 KiB |
21
ShenQi/Assets.xcassets/fanhui.imageset/Contents.json
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"filename" : "fanhui.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
||||
BIN
ShenQi/Assets.xcassets/fanhui.imageset/fanhui.png
vendored
Normal file
|
After Width: | Height: | Size: 1.6 KiB |
21
ShenQi/Assets.xcassets/noti.imageset/Contents.json
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"filename" : "noti.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
||||
BIN
ShenQi/Assets.xcassets/noti.imageset/noti.png
vendored
Normal file
|
After Width: | Height: | Size: 6.8 KiB |
21
ShenQi/Assets.xcassets/s.imageset/Contents.json
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"filename" : "s.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
||||
BIN
ShenQi/Assets.xcassets/s.imageset/s.png
vendored
Normal file
|
After Width: | Height: | Size: 1.5 KiB |
21
ShenQi/Assets.xcassets/xaingxia.imageset/Contents.json
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"filename" : "xaingxia.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
||||
BIN
ShenQi/Assets.xcassets/xaingxia.imageset/xaingxia.png
vendored
Normal file
|
After Width: | Height: | Size: 1.5 KiB |
21
ShenQi/Assets.xcassets/youxiang.imageset/Contents.json
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"filename" : "youxiang.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
||||
BIN
ShenQi/Assets.xcassets/youxiang.imageset/youxiang.png
vendored
Normal file
|
After Width: | Height: | Size: 2.9 KiB |
21
ShenQi/Assets.xcassets/zhanwei.imageset/Contents.json
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"filename" : "zhanwei.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
||||
BIN
ShenQi/Assets.xcassets/zhanwei.imageset/zhanwei.png
vendored
Normal file
|
After Width: | Height: | Size: 3.7 KiB |
@@ -16,7 +16,7 @@
|
||||
<rect key="frame" x="0.0" y="0.0" width="393" height="852"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<subviews>
|
||||
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="Tinju55" translatesAutoresizingMaskIntoConstraints="NO" id="wWz-RR-gyr">
|
||||
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="weibiaoti" translatesAutoresizingMaskIntoConstraints="NO" id="wWz-RR-gyr">
|
||||
<rect key="frame" x="96.666666666666686" y="298.66666666666669" width="200" height="200"/>
|
||||
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<constraints>
|
||||
@@ -39,6 +39,6 @@
|
||||
</scene>
|
||||
</scenes>
|
||||
<resources>
|
||||
<image name="Tinju55" width="1024" height="1024"/>
|
||||
<image name="weibiaoti" width="200" height="200"/>
|
||||
</resources>
|
||||
</document>
|
||||
|
||||
@@ -104,7 +104,7 @@
|
||||
<rect key="frame" x="0.0" y="0.0" width="393" height="852"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<subviews>
|
||||
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="Tinju55" translatesAutoresizingMaskIntoConstraints="NO" id="keb-Jy-qyA">
|
||||
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="weibiaoti" translatesAutoresizingMaskIntoConstraints="NO" id="keb-Jy-qyA">
|
||||
<rect key="frame" x="96.666666666666686" y="298.66666666666669" width="200" height="200"/>
|
||||
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<constraints>
|
||||
@@ -127,8 +127,8 @@
|
||||
</scene>
|
||||
</scenes>
|
||||
<resources>
|
||||
<image name="Tinju55" width="1024" height="1024"/>
|
||||
<image name="shuaxin" width="20" height="20"/>
|
||||
<image name="weibiaoti" width="200" height="200"/>
|
||||
<systemColor name="systemBackgroundColor">
|
||||
<color white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
</systemColor>
|
||||
|
||||
8
ShenQi/DataModels.h
Normal file
@@ -0,0 +1,8 @@
|
||||
//
|
||||
// DataModels.h
|
||||
//
|
||||
// Created by on 2025/1/11
|
||||
// Copyright (c) 2025 zL. All rights reserved.
|
||||
//
|
||||
|
||||
#import "PushRecordDataModel.h"
|
||||
@@ -3,17 +3,17 @@
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>API_KEY</key>
|
||||
<string>AIzaSyC2cWVgJynDraJoUjaFKeOgYjo8NHy4KD8</string>
|
||||
<string>AIzaSyAWtv-R4wb8abP5aurHx6PtuzQYIlcAaY8</string>
|
||||
<key>GCM_SENDER_ID</key>
|
||||
<string>764655735875</string>
|
||||
<string>514702139781</string>
|
||||
<key>PLIST_VERSION</key>
|
||||
<string>1</string>
|
||||
<key>BUNDLE_ID</key>
|
||||
<string>noti.tinju55</string>
|
||||
<string>noti.testAPP</string>
|
||||
<key>PROJECT_ID</key>
|
||||
<string>tinju55</string>
|
||||
<string>testapp-c6578</string>
|
||||
<key>STORAGE_BUCKET</key>
|
||||
<string>tinju55.firebasestorage.app</string>
|
||||
<string>testapp-c6578.firebasestorage.app</string>
|
||||
<key>IS_ADS_ENABLED</key>
|
||||
<false></false>
|
||||
<key>IS_ANALYTICS_ENABLED</key>
|
||||
@@ -25,6 +25,6 @@
|
||||
<key>IS_SIGNIN_ENABLED</key>
|
||||
<true></true>
|
||||
<key>GOOGLE_APP_ID</key>
|
||||
<string>1:764655735875:ios:3ab676387399bad656b0f6</string>
|
||||
<string>1:514702139781:ios:572b9bb9211a9edac864ec</string>
|
||||
</dict>
|
||||
</plist>
|
||||
@@ -29,7 +29,7 @@
|
||||
- (void)viewDidLoad {
|
||||
[super viewDidLoad];
|
||||
|
||||
self.mainUserId = Tinju55UserID;
|
||||
self.mainUserId = TESTUserID;
|
||||
|
||||
[self setupGameURLData];
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
<rect key="frame" x="0.0" y="0.0" width="393" height="852"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<subviews>
|
||||
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="Tinju55" translatesAutoresizingMaskIntoConstraints="NO" id="QOC-Bf-3uG">
|
||||
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="weibiaoti" translatesAutoresizingMaskIntoConstraints="NO" id="QOC-Bf-3uG">
|
||||
<rect key="frame" x="96.666666666666686" y="298.66666666666669" width="200" height="200"/>
|
||||
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<constraints>
|
||||
@@ -39,6 +39,6 @@
|
||||
</viewController>
|
||||
</objects>
|
||||
<resources>
|
||||
<image name="Tinju55" width="1024" height="1024"/>
|
||||
<image name="weibiaoti" width="200" height="200"/>
|
||||
</resources>
|
||||
</document>
|
||||
|
||||
@@ -27,6 +27,9 @@
|
||||
#define WithdrawBanksURL [NSString stringWithFormat:@"%@/api/withdraw/banks",BASEURL] // 获取银行列表接口
|
||||
#define WithdrawApplyURL [NSString stringWithFormat:@"%@/api/withdraw/apply",BASEURL] // 提现申请接口
|
||||
|
||||
#define PushRecordsURL [NSString stringWithFormat:@"%@/api/push/pushRecords",BASEURL] // 推送中心
|
||||
|
||||
|
||||
#define TESTUserID @"2"
|
||||
|
||||
// 新
|
||||
|
||||
@@ -21,6 +21,8 @@
|
||||
#import "ConfigDataModel.h"
|
||||
#import "LinkConfig.h"
|
||||
|
||||
#import "NotiCenterViewController.h"
|
||||
|
||||
@interface MainOldViewController () <WKUIDelegate,WKNavigationDelegate,DSWebMenuDelegate>
|
||||
|
||||
@property (strong, nonatomic) WKWebView *webView;
|
||||
@@ -45,7 +47,7 @@
|
||||
- (void)viewDidLoad {
|
||||
[super viewDidLoad];
|
||||
|
||||
self.mainUserId = Tinju55UserID;
|
||||
self.mainUserId = TESTUserID;
|
||||
|
||||
WKWebViewConfiguration *wkWebConfig = [[WKWebViewConfiguration alloc] init];
|
||||
wkWebConfig.preferences.javaScriptCanOpenWindowsAutomatically = YES;
|
||||
@@ -62,92 +64,73 @@
|
||||
|
||||
NSMutableArray *menuArray = @[].mutableCopy;
|
||||
AppDelegate *appDelegate = (AppDelegate *)[UIApplication sharedApplication].delegate;
|
||||
// 回到菜单按钮
|
||||
NSInteger height = 60;
|
||||
[menuArray addObject:[NSNumber numberWithInteger:DSWebMenuHomeType]];
|
||||
// 回到主页
|
||||
height = height + 60;
|
||||
LinkConfig *config = [[LinkConfig alloc] init];
|
||||
config.isGoBack = YES;
|
||||
config.icon = @"";
|
||||
config.name = @"HOME";
|
||||
config.linkUrl = appDelegate.mainURLString;
|
||||
[menuArray addObject:config];
|
||||
// 菜单
|
||||
if (!ISNULLSTR(appDelegate.data.linkConfig)) {
|
||||
NSError *jsonError;
|
||||
id linkConfigResponse = [NSJSONSerialization JSONObjectWithData:[appDelegate.data.linkConfig dataUsingEncoding:NSUTF8StringEncoding] options:NSJSONReadingMutableContainers error:&jsonError];
|
||||
if (jsonError==nil && [linkConfigResponse isKindOfClass:[NSArray class]]) {
|
||||
NSArray *linkConfigArray = linkConfigResponse;
|
||||
height = height + linkConfigArray.count*60;
|
||||
for (NSDictionary *dic in linkConfigArray) {
|
||||
LinkConfig *linkModel = [LinkConfig modelWithDictionary:dic];
|
||||
[menuArray addObject:linkModel];
|
||||
NSInteger height = 0 ;
|
||||
if (self.isPresent != YES) {
|
||||
// 回到菜单按钮
|
||||
height = 60;
|
||||
[menuArray addObject:[NSNumber numberWithInteger:DSWebMenuHomeType]];
|
||||
// 回到主页
|
||||
height = height + 60;
|
||||
LinkConfig *config = [[LinkConfig alloc] init];
|
||||
config.isGoBack = YES;
|
||||
config.icon = @"";
|
||||
config.name = @"HOME";
|
||||
config.linkUrl = appDelegate.mainURLString;
|
||||
[menuArray addObject:config];
|
||||
// 菜单
|
||||
if (!ISNULLSTR(appDelegate.data.linkConfig)) {
|
||||
NSError *jsonError;
|
||||
id linkConfigResponse = [NSJSONSerialization JSONObjectWithData:[appDelegate.data.linkConfig dataUsingEncoding:NSUTF8StringEncoding] options:NSJSONReadingMutableContainers error:&jsonError];
|
||||
if (jsonError==nil && [linkConfigResponse isKindOfClass:[NSArray class]]) {
|
||||
NSArray *linkConfigArray = linkConfigResponse;
|
||||
height = height + linkConfigArray.count*70;
|
||||
for (NSDictionary *dic in linkConfigArray) {
|
||||
LinkConfig *linkModel = [LinkConfig modelWithDictionary:dic];
|
||||
[menuArray addObject:linkModel];
|
||||
}
|
||||
}
|
||||
}
|
||||
// 客服平台
|
||||
if (!ISNULLSTR(appDelegate.data.fbUrl)) {
|
||||
height = height + 70;
|
||||
[menuArray addObject:[NSNumber numberWithInteger:DSWebMenuFacebookType]];
|
||||
}
|
||||
if (!ISNULLSTR(appDelegate.data.tgUrl)) {
|
||||
height = height + 70;
|
||||
[menuArray addObject:[NSNumber numberWithInteger:DSWebMenuTelegramType]];
|
||||
}
|
||||
if (!ISNULLSTR(appDelegate.data.wsUrl)) {
|
||||
height = height + 70;
|
||||
[menuArray addObject:[NSNumber numberWithInteger:DSWebMenuWhatsAppType]];
|
||||
}
|
||||
// 刷新按钮
|
||||
height = height + 70;
|
||||
[menuArray addObject:[NSNumber numberWithInteger:DSWebMenuRefreshType]];
|
||||
// 推送中心按钮
|
||||
height = height + 70;
|
||||
[menuArray addObject:[NSNumber numberWithInteger:DSWebMenuNotiType]];
|
||||
}
|
||||
// 客服平台
|
||||
if (!ISNULLSTR(appDelegate.data.fbUrl)) {
|
||||
height = height + 60;
|
||||
[menuArray addObject:[NSNumber numberWithInteger:DSWebMenuFacebookType]];
|
||||
}
|
||||
if (!ISNULLSTR(appDelegate.data.tgUrl)) {
|
||||
height = height + 60;
|
||||
[menuArray addObject:[NSNumber numberWithInteger:DSWebMenuTelegramType]];
|
||||
}
|
||||
if (!ISNULLSTR(appDelegate.data.wsUrl)) {
|
||||
height = height + 60;
|
||||
[menuArray addObject:[NSNumber numberWithInteger:DSWebMenuWhatsAppType]];
|
||||
}
|
||||
// 刷新按钮
|
||||
height = height + 60;
|
||||
[menuArray addObject:[NSNumber numberWithInteger:DSWebMenuRefreshType]];
|
||||
|
||||
self.webMenuCollectionView.shareArray = menuArray;
|
||||
self.webMenuCollectionView.webMenuDelegate = self;
|
||||
|
||||
height = height + 10;
|
||||
if (height > self.view.frame.size.height) {
|
||||
height = self.view.frame.size.height;
|
||||
self.webMenuCollectionView.scrollEnabled = YES;
|
||||
}else{
|
||||
self.webMenuCollectionView.scrollEnabled = NO;
|
||||
}
|
||||
self.dragHeightConstarint.constant = height;
|
||||
self.webDragView.freeRect = CGRectMake(0, 128, self.view.frame.size.width, self.view.frame.size.height-128);
|
||||
self.webDragView.isKeepBounds = YES;
|
||||
self.webDragView.clickDragViewBlock = ^(WMDragView *dragView) {
|
||||
self.webDragView.hidden = YES;
|
||||
self.webMenuCollectionView.hidden = NO;
|
||||
/*
|
||||
AppDelegate *appDelegate = (AppDelegate *)[UIApplication sharedApplication].delegate;
|
||||
UIAlertController *alertview = [UIAlertController alertControllerWithTitle:nil message:nil preferredStyle:(UIAlertControllerStyleActionSheet)];
|
||||
UIAlertAction *homepageAction = [UIAlertAction actionWithTitle:NSLocalizedString(@"HOMEPAGE", nil) style:(UIAlertActionStyleDefault) handler:^(UIAlertAction * _Nonnull action) {
|
||||
if (weakSelf.isPresent == YES) {
|
||||
[weakSelf dismissViewControllerAnimated:YES completion:^{}];
|
||||
}else{
|
||||
weakSelf.isPresent = NO;
|
||||
[weakSelf intoMainWebView];
|
||||
}
|
||||
}];
|
||||
[alertview addAction:homepageAction];
|
||||
if (!ISNULLSTR(appDelegate.data.wsUrl)) {
|
||||
UIAlertAction *whatsAppAction = [UIAlertAction actionWithTitle:NSLocalizedString(@"Share With WhatsApp", nil) style:(UIAlertActionStyleDefault) handler:^(UIAlertAction * _Nonnull action) {
|
||||
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:[NSString stringWithFormat:@"https://wa.me/message/%@",appDelegate.data.wsUrl]] options:@{UIApplicationOpenURLOptionUniversalLinksOnly:@NO} completionHandler:^(BOOL success) {}];
|
||||
}];
|
||||
[alertview addAction:whatsAppAction];
|
||||
if (self.isPresent == YES) {
|
||||
[self dismissViewControllerAnimated:YES completion:^{}];
|
||||
}else{
|
||||
self.webDragView.hidden = YES;
|
||||
self.webMenuCollectionView.hidden = NO;
|
||||
}
|
||||
if (!ISNULLSTR(appDelegate.data.tgUrl)) {
|
||||
UIAlertAction *telegramAppAction = [UIAlertAction actionWithTitle:NSLocalizedString(@"Share With Telegram", nil) style:(UIAlertActionStyleDefault) handler:^(UIAlertAction * _Nonnull action) {
|
||||
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:[NSString stringWithFormat:@"https://t.me/%@",appDelegate.data.tgUrl]] options:@{UIApplicationOpenURLOptionUniversalLinksOnly:@NO} completionHandler:^(BOOL success) {}];
|
||||
}];
|
||||
[alertview addAction:telegramAppAction];
|
||||
}
|
||||
if (!ISNULLSTR(appDelegate.data.fbUrl)) {
|
||||
UIAlertAction *fbAppAction = [UIAlertAction actionWithTitle:NSLocalizedString(@"Share With Facebook", nil) style:(UIAlertActionStyleDefault) handler:^(UIAlertAction * _Nonnull action) {
|
||||
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:[NSString stringWithFormat:@"fb://profile/%@",appDelegate.data.fbUrl]] options:@{UIApplicationOpenURLOptionUniversalLinksOnly:@NO} completionHandler:^(BOOL success) {}];
|
||||
}];
|
||||
[alertview addAction:fbAppAction];
|
||||
}
|
||||
UIAlertAction *cancel = [UIAlertAction actionWithTitle:NSLocalizedString(@"CANCEL", nil) style:(UIAlertActionStyleCancel) handler:^(UIAlertAction * _Nonnull action) {}];
|
||||
[alertview addAction:cancel];
|
||||
[weakSelf presentViewController:alertview animated:YES completion:^{}];
|
||||
*/
|
||||
};
|
||||
|
||||
if (self.isPresent == YES) {
|
||||
@@ -207,6 +190,10 @@
|
||||
if (!ISNULLSTR(appDelegate.data.fbUrl)) {
|
||||
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@",appDelegate.data.fbUrl]] options:@{UIApplicationOpenURLOptionUniversalLinksOnly:@NO} completionHandler:^(BOOL success) {}];
|
||||
}
|
||||
}else if (menuType == DSWebMenuNotiType) {
|
||||
NotiCenterViewController *notiCenterViewController = [[NotiCenterViewController alloc] initWithNibName:@"NotiCenterViewController" bundle:nil];
|
||||
notiCenterViewController.modalPresentationStyle = UIModalPresentationFullScreen;
|
||||
[self presentViewController:notiCenterViewController animated:NO completion:nil];
|
||||
}
|
||||
}
|
||||
self.webDragView.hidden = NO;
|
||||
|
||||
22
ShenQi/NotiCenterContentTableViewCell.h
Normal file
@@ -0,0 +1,22 @@
|
||||
//
|
||||
// NotiCenterContentTableViewCell.h
|
||||
// ShenQi
|
||||
//
|
||||
// Created by twotutoo on 2025/1/11.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
#import "PushRecordList.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface NotiCenterContentTableViewCell : UITableViewCell
|
||||
|
||||
@property (weak, nonatomic) IBOutlet UILabel *contentLabel;
|
||||
|
||||
@property (nonatomic, strong) PushRecordList *list;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
34
ShenQi/NotiCenterContentTableViewCell.m
Normal file
@@ -0,0 +1,34 @@
|
||||
//
|
||||
// NotiCenterContentTableViewCell.m
|
||||
// ShenQi
|
||||
//
|
||||
// Created by twotutoo on 2025/1/11.
|
||||
//
|
||||
|
||||
#import "NotiCenterContentTableViewCell.h"
|
||||
|
||||
#import "MacroDefine.h"
|
||||
|
||||
@implementation NotiCenterContentTableViewCell
|
||||
|
||||
- (void)awakeFromNib {
|
||||
[super awakeFromNib];
|
||||
|
||||
[self setSelectionStyle:(UITableViewCellSelectionStyleNone)];
|
||||
self.contentView.backgroundColor = UIColorFromRGB(0xFAFAFA);
|
||||
}
|
||||
|
||||
-(void)setList:(PushRecordList *)list
|
||||
{
|
||||
_list = list;
|
||||
|
||||
self.contentLabel.text = self.list.content;
|
||||
}
|
||||
|
||||
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
|
||||
[super setSelected:selected animated:animated];
|
||||
|
||||
// Configure the view for the selected state
|
||||
}
|
||||
|
||||
@end
|
||||
52
ShenQi/NotiCenterContentTableViewCell.xib
Normal file
@@ -0,0 +1,52 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="32700.99.1234" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
|
||||
<device id="retina6_12" orientation="portrait" appearance="light"/>
|
||||
<dependencies>
|
||||
<deployment identifier="iOS"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="22685"/>
|
||||
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
|
||||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||
</dependencies>
|
||||
<objects>
|
||||
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
|
||||
<tableViewCell contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" id="KGk-i7-Jjw" customClass="NotiCenterContentTableViewCell">
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="48"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
||||
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="KGk-i7-Jjw" id="H2p-sc-9uM">
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="48"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="APJ-0z-014">
|
||||
<rect key="frame" x="15" y="0.0" width="290" height="48"/>
|
||||
<subviews>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="dJI-wp-REe">
|
||||
<rect key="frame" x="15.000000000000004" y="15" width="37.333333333333343" height="18"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="15"/>
|
||||
<color key="textColor" white="0.0" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
</subviews>
|
||||
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="bottom" secondItem="dJI-wp-REe" secondAttribute="bottom" constant="15" id="56o-wF-6WX"/>
|
||||
<constraint firstItem="dJI-wp-REe" firstAttribute="leading" secondItem="APJ-0z-014" secondAttribute="leading" constant="15" id="K7d-Zk-3Xm"/>
|
||||
<constraint firstItem="dJI-wp-REe" firstAttribute="top" secondItem="APJ-0z-014" secondAttribute="top" constant="15" id="rcr-4D-gn9"/>
|
||||
</constraints>
|
||||
</view>
|
||||
</subviews>
|
||||
<constraints>
|
||||
<constraint firstItem="APJ-0z-014" firstAttribute="leading" secondItem="H2p-sc-9uM" secondAttribute="leading" constant="15" id="HVu-2q-jpz"/>
|
||||
<constraint firstItem="APJ-0z-014" firstAttribute="centerY" secondItem="H2p-sc-9uM" secondAttribute="centerY" id="adY-D8-NRG"/>
|
||||
<constraint firstItem="APJ-0z-014" firstAttribute="centerX" secondItem="H2p-sc-9uM" secondAttribute="centerX" id="anY-jh-NQd"/>
|
||||
<constraint firstItem="APJ-0z-014" firstAttribute="height" secondItem="H2p-sc-9uM" secondAttribute="height" id="i0w-WQ-wOO"/>
|
||||
</constraints>
|
||||
</tableViewCellContentView>
|
||||
<viewLayoutGuide key="safeArea" id="aW0-zy-SZf"/>
|
||||
<connections>
|
||||
<outlet property="contentLabel" destination="dJI-wp-REe" id="tWk-qj-wNB"/>
|
||||
</connections>
|
||||
<point key="canvasLocation" x="8" y="20"/>
|
||||
</tableViewCell>
|
||||
</objects>
|
||||
</document>
|
||||
24
ShenQi/NotiCenterImageTableViewCell.h
Normal file
@@ -0,0 +1,24 @@
|
||||
//
|
||||
// NotiCenterImageTableViewCell.h
|
||||
// ShenQi
|
||||
//
|
||||
// Created by twotutoo on 2025/1/11.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
#import "PushRecordList.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface NotiCenterImageTableViewCell : UITableViewCell
|
||||
|
||||
@property (weak, nonatomic) IBOutlet UIImageView *contentImageView;
|
||||
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *imageHeightConstraint;
|
||||
@property (weak, nonatomic) IBOutlet UILabel *contentLabel;
|
||||
|
||||
@property (nonatomic, strong) PushRecordList *list;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
38
ShenQi/NotiCenterImageTableViewCell.m
Normal file
@@ -0,0 +1,38 @@
|
||||
//
|
||||
// NotiCenterImageTableViewCell.m
|
||||
// ShenQi
|
||||
//
|
||||
// Created by twotutoo on 2025/1/11.
|
||||
//
|
||||
|
||||
#import "NotiCenterImageTableViewCell.h"
|
||||
|
||||
#import "MacroDefine.h"
|
||||
#import <SDWebImage.h>
|
||||
|
||||
@implementation NotiCenterImageTableViewCell
|
||||
|
||||
- (void)awakeFromNib {
|
||||
[super awakeFromNib];
|
||||
|
||||
[self setSelectionStyle:(UITableViewCellSelectionStyleNone)];
|
||||
self.contentView.backgroundColor = UIColorFromRGB(0xFAFAFA);
|
||||
}
|
||||
|
||||
-(void)setList:(PushRecordList *)list
|
||||
{
|
||||
_list = list;
|
||||
|
||||
NSURL *url = [NSURL URLWithString:self.list.image];
|
||||
self.contentLabel.text = self.list.content;
|
||||
self.imageHeightConstraint.constant = self.list.imageHeight;
|
||||
[self.contentImageView sd_setImageWithURL:url];
|
||||
}
|
||||
|
||||
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
|
||||
[super setSelected:selected animated:animated];
|
||||
|
||||
// Configure the view for the selected state
|
||||
}
|
||||
|
||||
@end
|
||||
67
ShenQi/NotiCenterImageTableViewCell.xib
Normal file
@@ -0,0 +1,67 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="32700.99.1234" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
|
||||
<device id="retina6_12" orientation="portrait" appearance="light"/>
|
||||
<dependencies>
|
||||
<deployment identifier="iOS"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="22685"/>
|
||||
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
|
||||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||
</dependencies>
|
||||
<objects>
|
||||
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
|
||||
<tableViewCell contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" id="KGk-i7-Jjw" customClass="NotiCenterImageTableViewCell">
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="244"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
||||
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="KGk-i7-Jjw" id="H2p-sc-9uM">
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="244"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="1rb-eT-Nio">
|
||||
<rect key="frame" x="15" y="0.0" width="290" height="244"/>
|
||||
<subviews>
|
||||
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="zhanwei" translatesAutoresizingMaskIntoConstraints="NO" id="zKK-V0-BdP">
|
||||
<rect key="frame" x="0.0" y="0.0" width="290" height="200"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="200" id="7xZ-86-lYP"/>
|
||||
</constraints>
|
||||
</imageView>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="iR3-wu-qoW">
|
||||
<rect key="frame" x="15" y="215" width="260" height="19"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="15"/>
|
||||
<color key="textColor" white="0.0" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
</subviews>
|
||||
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<constraints>
|
||||
<constraint firstItem="iR3-wu-qoW" firstAttribute="centerX" secondItem="1rb-eT-Nio" secondAttribute="centerX" id="RQZ-fQ-m5a"/>
|
||||
<constraint firstItem="iR3-wu-qoW" firstAttribute="leading" secondItem="1rb-eT-Nio" secondAttribute="leading" constant="15" id="cJC-Hg-OGF"/>
|
||||
<constraint firstItem="zKK-V0-BdP" firstAttribute="centerX" secondItem="1rb-eT-Nio" secondAttribute="centerX" id="hhT-Cc-pPI"/>
|
||||
<constraint firstItem="zKK-V0-BdP" firstAttribute="width" secondItem="1rb-eT-Nio" secondAttribute="width" id="k8Y-OO-Lni"/>
|
||||
<constraint firstItem="iR3-wu-qoW" firstAttribute="top" secondItem="zKK-V0-BdP" secondAttribute="bottom" constant="15" id="mTp-7p-nmt"/>
|
||||
<constraint firstAttribute="bottom" secondItem="iR3-wu-qoW" secondAttribute="bottom" constant="10" id="ns6-Lc-NNT"/>
|
||||
<constraint firstItem="zKK-V0-BdP" firstAttribute="top" secondItem="1rb-eT-Nio" secondAttribute="top" id="rWX-n2-AC3"/>
|
||||
</constraints>
|
||||
</view>
|
||||
</subviews>
|
||||
<constraints>
|
||||
<constraint firstItem="1rb-eT-Nio" firstAttribute="centerY" secondItem="H2p-sc-9uM" secondAttribute="centerY" id="D01-aE-Kde"/>
|
||||
<constraint firstItem="1rb-eT-Nio" firstAttribute="height" secondItem="H2p-sc-9uM" secondAttribute="height" id="D6l-H4-QW0"/>
|
||||
<constraint firstItem="1rb-eT-Nio" firstAttribute="leading" secondItem="H2p-sc-9uM" secondAttribute="leading" constant="15" id="iy3-HL-mKr"/>
|
||||
<constraint firstItem="1rb-eT-Nio" firstAttribute="centerX" secondItem="H2p-sc-9uM" secondAttribute="centerX" id="yYR-Mx-oq9"/>
|
||||
</constraints>
|
||||
</tableViewCellContentView>
|
||||
<viewLayoutGuide key="safeArea" id="aW0-zy-SZf"/>
|
||||
<connections>
|
||||
<outlet property="contentImageView" destination="zKK-V0-BdP" id="KVo-ME-9Cl"/>
|
||||
<outlet property="contentLabel" destination="iR3-wu-qoW" id="F7s-d7-QPS"/>
|
||||
<outlet property="imageHeightConstraint" destination="7xZ-86-lYP" id="xCQ-wP-UFe"/>
|
||||
</connections>
|
||||
<point key="canvasLocation" x="113" y="20"/>
|
||||
</tableViewCell>
|
||||
</objects>
|
||||
<resources>
|
||||
<image name="zhanwei" width="200" height="200"/>
|
||||
</resources>
|
||||
</document>
|
||||
23
ShenQi/NotiCenterJumpLinkTableViewCell.h
Normal file
@@ -0,0 +1,23 @@
|
||||
//
|
||||
// NotiCenterJumpLinkTableViewCell.h
|
||||
// ShenQi
|
||||
//
|
||||
// Created by twotutoo on 2025/1/11.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
#import "PushRecordList.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface NotiCenterJumpLinkTableViewCell : UITableViewCell
|
||||
|
||||
@property (weak, nonatomic) IBOutlet UILabel *contentLabel;
|
||||
@property (weak, nonatomic) IBOutlet UIButton *linkBtn;
|
||||
|
||||
@property (nonatomic, strong) PushRecordList *list;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
34
ShenQi/NotiCenterJumpLinkTableViewCell.m
Normal file
@@ -0,0 +1,34 @@
|
||||
//
|
||||
// NotiCenterJumpLinkTableViewCell.m
|
||||
// ShenQi
|
||||
//
|
||||
// Created by twotutoo on 2025/1/11.
|
||||
//
|
||||
|
||||
#import "NotiCenterJumpLinkTableViewCell.h"
|
||||
#import "MacroDefine.h"
|
||||
|
||||
@implementation NotiCenterJumpLinkTableViewCell
|
||||
|
||||
- (void)awakeFromNib {
|
||||
[super awakeFromNib];
|
||||
|
||||
[self setSelectionStyle:(UITableViewCellSelectionStyleNone)];
|
||||
self.contentView.backgroundColor = UIColorFromRGB(0xFAFAFA);
|
||||
}
|
||||
|
||||
-(void)setList:(PushRecordList *)list
|
||||
{
|
||||
_list = list;
|
||||
|
||||
self.contentLabel.text = self.list.content;
|
||||
[self.linkBtn setTitle:self.list.jumpUrl forState:(UIControlStateNormal)];
|
||||
}
|
||||
|
||||
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
|
||||
[super setSelected:selected animated:animated];
|
||||
|
||||
// Configure the view for the selected state
|
||||
}
|
||||
|
||||
@end
|
||||
70
ShenQi/NotiCenterJumpLinkTableViewCell.xib
Normal file
@@ -0,0 +1,70 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="32700.99.1234" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
|
||||
<device id="retina6_12" orientation="portrait" appearance="light"/>
|
||||
<dependencies>
|
||||
<deployment identifier="iOS"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="22685"/>
|
||||
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
|
||||
<capability name="System colors in document resources" minToolsVersion="11.0"/>
|
||||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||
</dependencies>
|
||||
<objects>
|
||||
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
|
||||
<tableViewCell contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" id="KGk-i7-Jjw" customClass="NotiCenterJumpLinkTableViewCell">
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="84"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
||||
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="KGk-i7-Jjw" id="H2p-sc-9uM">
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="84"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="jXW-hO-rus">
|
||||
<rect key="frame" x="15" y="0.0" width="290" height="84"/>
|
||||
<subviews>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="x4W-IN-GCA">
|
||||
<rect key="frame" x="15" y="15" width="260" height="18"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="15"/>
|
||||
<color key="textColor" white="0.0" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="y8C-he-Bhk">
|
||||
<rect key="frame" x="15" y="43" width="41" height="31"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="15"/>
|
||||
<inset key="imageEdgeInsets" minX="0.0" minY="0.0" maxX="2.2250738585072014e-308" maxY="0.0"/>
|
||||
<state key="normal" title="http://">
|
||||
<color key="titleColor" systemColor="linkColor"/>
|
||||
</state>
|
||||
</button>
|
||||
</subviews>
|
||||
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="bottom" secondItem="y8C-he-Bhk" secondAttribute="bottom" constant="10" id="1hf-HA-tKi"/>
|
||||
<constraint firstItem="x4W-IN-GCA" firstAttribute="top" secondItem="jXW-hO-rus" secondAttribute="top" constant="15" id="58F-mK-KCo"/>
|
||||
<constraint firstItem="y8C-he-Bhk" firstAttribute="leading" secondItem="x4W-IN-GCA" secondAttribute="leading" id="5gE-8Z-avW"/>
|
||||
<constraint firstItem="x4W-IN-GCA" firstAttribute="leading" secondItem="jXW-hO-rus" secondAttribute="leading" constant="15" id="6Fa-1H-ib8"/>
|
||||
<constraint firstItem="x4W-IN-GCA" firstAttribute="centerX" secondItem="jXW-hO-rus" secondAttribute="centerX" id="Nba-FX-aT4"/>
|
||||
<constraint firstItem="y8C-he-Bhk" firstAttribute="top" secondItem="x4W-IN-GCA" secondAttribute="bottom" constant="10" id="ipO-cU-B4V"/>
|
||||
</constraints>
|
||||
</view>
|
||||
</subviews>
|
||||
<constraints>
|
||||
<constraint firstItem="jXW-hO-rus" firstAttribute="centerX" secondItem="H2p-sc-9uM" secondAttribute="centerX" id="1qM-IQ-i90"/>
|
||||
<constraint firstItem="jXW-hO-rus" firstAttribute="leading" secondItem="H2p-sc-9uM" secondAttribute="leading" constant="15" id="8Vo-R2-8ml"/>
|
||||
<constraint firstItem="jXW-hO-rus" firstAttribute="height" secondItem="H2p-sc-9uM" secondAttribute="height" id="JOP-hB-N0M"/>
|
||||
<constraint firstItem="jXW-hO-rus" firstAttribute="centerY" secondItem="H2p-sc-9uM" secondAttribute="centerY" id="ZmE-PA-CJA"/>
|
||||
</constraints>
|
||||
</tableViewCellContentView>
|
||||
<viewLayoutGuide key="safeArea" id="aW0-zy-SZf"/>
|
||||
<connections>
|
||||
<outlet property="contentLabel" destination="x4W-IN-GCA" id="ciA-xu-jMT"/>
|
||||
<outlet property="linkBtn" destination="y8C-he-Bhk" id="Qc0-rL-seX"/>
|
||||
</connections>
|
||||
<point key="canvasLocation" x="136" y="20"/>
|
||||
</tableViewCell>
|
||||
</objects>
|
||||
<resources>
|
||||
<systemColor name="linkColor">
|
||||
<color red="0.0" green="0.47843137254901963" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
</systemColor>
|
||||
</resources>
|
||||
</document>
|
||||
27
ShenQi/NotiCenterTableViewCell.h
Normal file
@@ -0,0 +1,27 @@
|
||||
//
|
||||
// NotiCenterTableViewCell.h
|
||||
// ShenQi
|
||||
//
|
||||
// Created by twotutoo on 2025/1/11.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
#import "PushRecordList.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface NotiCenterTableViewCell : UITableViewCell
|
||||
|
||||
@property (weak, nonatomic) IBOutlet UIView *mainView;
|
||||
@property (weak, nonatomic) IBOutlet UILabel *typeLabel;
|
||||
@property (weak, nonatomic) IBOutlet UILabel *dateLabel;
|
||||
@property (weak, nonatomic) IBOutlet UILabel *titleLabel;
|
||||
@property (weak, nonatomic) IBOutlet UIButton *arrowBtn;
|
||||
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *widthConstraint;
|
||||
|
||||
@property (nonatomic, strong) PushRecordList *list;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
50
ShenQi/NotiCenterTableViewCell.m
Normal file
@@ -0,0 +1,50 @@
|
||||
//
|
||||
// NotiCenterTableViewCell.m
|
||||
// ShenQi
|
||||
//
|
||||
// Created by twotutoo on 2025/1/11.
|
||||
//
|
||||
|
||||
#import "NotiCenterTableViewCell.h"
|
||||
|
||||
#import "MacroDefine.h"
|
||||
|
||||
@implementation NotiCenterTableViewCell
|
||||
|
||||
- (void)awakeFromNib {
|
||||
[super awakeFromNib];
|
||||
|
||||
[self setSelectionStyle:(UITableViewCellSelectionStyleNone)];
|
||||
self.contentView.backgroundColor = UIColorFromRGB(0xFAFAFA);
|
||||
self.typeLabel.layer.cornerRadius = 4.f;
|
||||
self.typeLabel.layer.masksToBounds = YES;
|
||||
}
|
||||
|
||||
-(void)setList:(PushRecordList *)list
|
||||
{
|
||||
_list = list;
|
||||
|
||||
if (self.list.type == 1) {
|
||||
self.typeLabel.text = @"Text";
|
||||
self.mainView.backgroundColor = UIColorFromRGB(0xACDFEE);
|
||||
}else if (self.list.type == 2) {
|
||||
self.typeLabel.text = @"Image";
|
||||
self.mainView.backgroundColor = UIColorFromRGB(0xBDDDB7);
|
||||
}else if (self.list.type == 3) {
|
||||
self.typeLabel.text = @"Jump link";
|
||||
self.mainView.backgroundColor = UIColorFromRGB(0xC3B5D0);
|
||||
}
|
||||
UIFont *textFont = [UIFont boldSystemFontOfSize:15];
|
||||
CGFloat width = [self.typeLabel.text boundingRectWithSize:CGSizeMake(MAXFLOAT, 30) options:NSStringDrawingTruncatesLastVisibleLine | NSStringDrawingUsesLineFragmentOrigin | NSStringDrawingUsesFontLeading attributes:@{NSFontAttributeName: textFont} context:nil].size.width;
|
||||
self.widthConstraint.constant = width+20;
|
||||
self.dateLabel.text = self.list.createTime;
|
||||
self.titleLabel.text = self.list.title;
|
||||
}
|
||||
|
||||
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
|
||||
[super setSelected:selected animated:animated];
|
||||
|
||||
// Configure the view for the selected state
|
||||
}
|
||||
|
||||
@end
|
||||
102
ShenQi/NotiCenterTableViewCell.xib
Normal file
@@ -0,0 +1,102 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="32700.99.1234" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
|
||||
<device id="retina6_12" orientation="portrait" appearance="light"/>
|
||||
<dependencies>
|
||||
<deployment identifier="iOS"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="22685"/>
|
||||
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
|
||||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||
</dependencies>
|
||||
<objects>
|
||||
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
|
||||
<tableViewCell contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" id="KGk-i7-Jjw" customClass="NotiCenterTableViewCell">
|
||||
<rect key="frame" x="0.0" y="0.0" width="375" height="123"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
||||
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="KGk-i7-Jjw" id="H2p-sc-9uM">
|
||||
<rect key="frame" x="0.0" y="0.0" width="375" height="123"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="3e5-oX-6YU">
|
||||
<rect key="frame" x="15" y="0.0" width="345" height="123"/>
|
||||
<subviews>
|
||||
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="youxiang" translatesAutoresizingMaskIntoConstraints="NO" id="TgL-RB-BCA">
|
||||
<rect key="frame" x="15" y="15" width="30" height="30"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" constant="30" id="Ux7-Y9-MiA"/>
|
||||
<constraint firstAttribute="width" secondItem="TgL-RB-BCA" secondAttribute="height" multiplier="1:1" id="uwq-Lf-wyd"/>
|
||||
</constraints>
|
||||
</imageView>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="center" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="5ek-Yw-lmE">
|
||||
<rect key="frame" x="55" y="15" width="40" height="30"/>
|
||||
<color key="backgroundColor" white="0.0" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" constant="40" id="Vlv-qN-mDw"/>
|
||||
<constraint firstAttribute="height" constant="30" id="mx6-1a-ByH"/>
|
||||
</constraints>
|
||||
<fontDescription key="fontDescription" type="system" weight="medium" pointSize="15"/>
|
||||
<color key="textColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="" textAlignment="right" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="dKE-oh-YgT">
|
||||
<rect key="frame" x="335" y="30" width="0.0" height="0.0"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="15"/>
|
||||
<color key="textColor" white="0.0" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text=" " lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="IqX-dC-Y6b">
|
||||
<rect key="frame" x="15" y="55" width="315" height="18"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="15"/>
|
||||
<color key="textColor" white="0.0" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="fYB-eL-33B">
|
||||
<rect key="frame" x="310" y="83" width="30" height="30"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="30" id="MNt-Af-lN6"/>
|
||||
<constraint firstAttribute="width" secondItem="fYB-eL-33B" secondAttribute="height" multiplier="1:1" id="ixD-J5-b0D"/>
|
||||
</constraints>
|
||||
<inset key="imageEdgeInsets" minX="0.0" minY="0.0" maxX="2.2250738585072014e-308" maxY="0.0"/>
|
||||
<state key="normal" image="xaingxia"/>
|
||||
</button>
|
||||
</subviews>
|
||||
<constraints>
|
||||
<constraint firstItem="fYB-eL-33B" firstAttribute="top" secondItem="IqX-dC-Y6b" secondAttribute="bottom" constant="10" id="3dB-7m-zch"/>
|
||||
<constraint firstItem="5ek-Yw-lmE" firstAttribute="centerY" secondItem="TgL-RB-BCA" secondAttribute="centerY" id="82x-Bc-67k"/>
|
||||
<constraint firstAttribute="trailing" secondItem="fYB-eL-33B" secondAttribute="trailing" constant="5" id="8KX-ki-Wuk"/>
|
||||
<constraint firstAttribute="bottom" secondItem="fYB-eL-33B" secondAttribute="bottom" constant="10" id="8o6-GL-OR3"/>
|
||||
<constraint firstAttribute="trailing" secondItem="dKE-oh-YgT" secondAttribute="trailing" constant="10" id="E9d-F5-psU"/>
|
||||
<constraint firstItem="IqX-dC-Y6b" firstAttribute="top" secondItem="TgL-RB-BCA" secondAttribute="bottom" constant="10" id="Ppz-5Y-HyX"/>
|
||||
<constraint firstItem="dKE-oh-YgT" firstAttribute="centerY" secondItem="TgL-RB-BCA" secondAttribute="centerY" id="RsE-7q-n2f"/>
|
||||
<constraint firstItem="IqX-dC-Y6b" firstAttribute="centerX" secondItem="3e5-oX-6YU" secondAttribute="centerX" id="Z3K-n4-Izn"/>
|
||||
<constraint firstItem="IqX-dC-Y6b" firstAttribute="leading" secondItem="TgL-RB-BCA" secondAttribute="leading" id="ape-2Z-rlR"/>
|
||||
<constraint firstItem="TgL-RB-BCA" firstAttribute="leading" secondItem="3e5-oX-6YU" secondAttribute="leading" constant="15" id="dyL-Yq-flf"/>
|
||||
<constraint firstItem="TgL-RB-BCA" firstAttribute="top" secondItem="3e5-oX-6YU" secondAttribute="top" constant="15" id="jgl-CI-mBv"/>
|
||||
<constraint firstItem="5ek-Yw-lmE" firstAttribute="leading" secondItem="TgL-RB-BCA" secondAttribute="trailing" constant="10" id="we3-20-2Rk"/>
|
||||
</constraints>
|
||||
</view>
|
||||
</subviews>
|
||||
<constraints>
|
||||
<constraint firstItem="3e5-oX-6YU" firstAttribute="height" secondItem="H2p-sc-9uM" secondAttribute="height" id="KYe-Xi-eFK"/>
|
||||
<constraint firstItem="3e5-oX-6YU" firstAttribute="centerY" secondItem="H2p-sc-9uM" secondAttribute="centerY" id="bW1-Sg-stI"/>
|
||||
<constraint firstItem="3e5-oX-6YU" firstAttribute="leading" secondItem="H2p-sc-9uM" secondAttribute="leading" constant="15" id="ojC-ik-oKP"/>
|
||||
<constraint firstItem="3e5-oX-6YU" firstAttribute="centerX" secondItem="H2p-sc-9uM" secondAttribute="centerX" id="uHx-2L-hLL"/>
|
||||
</constraints>
|
||||
</tableViewCellContentView>
|
||||
<viewLayoutGuide key="safeArea" id="aW0-zy-SZf"/>
|
||||
<connections>
|
||||
<outlet property="arrowBtn" destination="fYB-eL-33B" id="StK-YE-jDf"/>
|
||||
<outlet property="dateLabel" destination="dKE-oh-YgT" id="orO-sH-Vsm"/>
|
||||
<outlet property="mainView" destination="3e5-oX-6YU" id="R7H-UI-cTv"/>
|
||||
<outlet property="titleLabel" destination="IqX-dC-Y6b" id="pIO-2i-W4Z"/>
|
||||
<outlet property="typeLabel" destination="5ek-Yw-lmE" id="OG2-fm-DiE"/>
|
||||
<outlet property="widthConstraint" destination="Vlv-qN-mDw" id="bs6-KS-C1v"/>
|
||||
</connections>
|
||||
<point key="canvasLocation" x="31" y="20"/>
|
||||
</tableViewCell>
|
||||
</objects>
|
||||
<resources>
|
||||
<image name="xaingxia" width="200" height="200"/>
|
||||
<image name="youxiang" width="200" height="200"/>
|
||||
</resources>
|
||||
</document>
|
||||
16
ShenQi/NotiCenterViewController.h
Normal file
@@ -0,0 +1,16 @@
|
||||
//
|
||||
// NotiCenterViewController.h
|
||||
// ShenQi
|
||||
//
|
||||
// Created by twotutoo on 2025/1/11.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface NotiCenterViewController : UIViewController
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
211
ShenQi/NotiCenterViewController.m
Normal file
@@ -0,0 +1,211 @@
|
||||
//
|
||||
// NotiCenterViewController.m
|
||||
// ShenQi
|
||||
//
|
||||
// Created by twotutoo on 2025/1/11.
|
||||
//
|
||||
|
||||
#import "NotiCenterViewController.h"
|
||||
|
||||
#import "NotiCenterTableViewCell.h"
|
||||
#import "NotiCenterContentTableViewCell.h"
|
||||
#import "NotiCenterImageTableViewCell.h"
|
||||
#import "NotiCenterJumpLinkTableViewCell.h"
|
||||
|
||||
#import "MacroDefine.h"
|
||||
#import <SVProgressHUD.h>
|
||||
#import <SDWebImage.h>
|
||||
#import "DataModels.h"
|
||||
#import "UIButton+DSButtonBlock.h"
|
||||
|
||||
#import "MainOldViewController.h"
|
||||
|
||||
static NSString *identifier = @"NotiCenterTableViewCell";
|
||||
static NSString *contentidentifier = @"NotiCenterContentTableViewCell";
|
||||
static NSString *imageidentifier = @"NotiCenterImageTableViewCell";
|
||||
static NSString *linkidentifier = @"NotiCenterJumpLinkTableViewCell";
|
||||
|
||||
@interface NotiCenterViewController () <UITableViewDelegate,UITableViewDataSource>
|
||||
|
||||
@property (weak, nonatomic) IBOutlet UITableView *tableView;
|
||||
|
||||
@property (nonatomic, strong) NSString *mainUserId;
|
||||
@property (nonatomic, strong) NSMutableArray *notiArray;
|
||||
|
||||
@end
|
||||
|
||||
@implementation NotiCenterViewController
|
||||
|
||||
- (IBAction)gobackAction:(id)sender
|
||||
{
|
||||
[self dismissViewControllerAnimated:NO completion:nil];
|
||||
}
|
||||
|
||||
- (void)viewDidLoad {
|
||||
[super viewDidLoad];
|
||||
|
||||
self.mainUserId = TESTUserID;
|
||||
|
||||
self.tableView.delegate = self;
|
||||
self.tableView.dataSource = self;
|
||||
self.tableView.rowHeight = UITableViewAutomaticDimension;
|
||||
self.tableView.sectionHeaderHeight = 10;
|
||||
self.tableView.sectionFooterHeight = 0;
|
||||
self.tableView.backgroundColor = UIColorFromRGB(0xFAFAFA);
|
||||
[self.tableView registerNib:[UINib nibWithNibName:@"NotiCenterTableViewCell" bundle:nil] forCellReuseIdentifier:identifier];
|
||||
[self.tableView registerNib:[UINib nibWithNibName:@"NotiCenterContentTableViewCell" bundle:nil] forCellReuseIdentifier:contentidentifier];
|
||||
[self.tableView registerNib:[UINib nibWithNibName:@"NotiCenterImageTableViewCell" bundle:nil] forCellReuseIdentifier:imageidentifier];
|
||||
[self.tableView registerNib:[UINib nibWithNibName:@"NotiCenterJumpLinkTableViewCell" bundle:nil] forCellReuseIdentifier:linkidentifier];
|
||||
self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
|
||||
self.tableView.tableFooterView = [UIView new];
|
||||
|
||||
self.notiArray = @[].mutableCopy;
|
||||
[self setupDatasource];
|
||||
}
|
||||
|
||||
-(void)setupDatasource
|
||||
{
|
||||
NSString *urlstring = [NSString stringWithFormat:@"%@?userId=%@&page=1&size=100",PushRecordsURL,self.mainUserId];
|
||||
NSURL *url = [NSURL URLWithString:urlstring];
|
||||
|
||||
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url];
|
||||
request.HTTPMethod = @"GET";
|
||||
[request setValue:@"application/json" forHTTPHeaderField:@"Content-Type"];
|
||||
|
||||
NSURLSession *session = [NSURLSession sharedSession];
|
||||
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request completionHandler:^(NSData * _Nullable data, NSURLResponse * _Nullable response, NSError * _Nullable error) {
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
if (error) {
|
||||
[SVProgressHUD showInfoWithStatus:error.localizedDescription];
|
||||
}else{
|
||||
NSError *error;
|
||||
NSMutableDictionary *responseObject = [NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingMutableContainers error:&error];
|
||||
if (error) {
|
||||
[SVProgressHUD showInfoWithStatus:error.localizedDescription];
|
||||
}else{
|
||||
if (ISNULL(error) && !ISNULL(responseObject) && [[responseObject objectForKey:@"code"] integerValue] == 1) {
|
||||
PushRecordDataModel *model = [[PushRecordDataModel alloc] initWithDictionary:responseObject];
|
||||
for (PushRecordList *list in self.notiArray) {
|
||||
if (list.type == 2) {
|
||||
list.imageHeight = SCREEN_WIDTH-30;
|
||||
}
|
||||
}
|
||||
[self.notiArray addObjectsFromArray:model.data.list];
|
||||
[self.tableView reloadData];
|
||||
[self refreshImageDatasource];
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}];
|
||||
[dataTask resume];
|
||||
}
|
||||
|
||||
-(void)refreshImageDatasource
|
||||
{
|
||||
for (PushRecordList *list in self.notiArray) {
|
||||
NSURL *url = [NSURL URLWithString:list.image];
|
||||
[[SDWebImageDownloader sharedDownloader] downloadImageWithURL:url completed:^(UIImage * _Nullable image, NSData * _Nullable data, NSError * _Nullable error, BOOL finished) {
|
||||
if (image && error == nil) {
|
||||
list.imageHeight = (SCREEN_WIDTH-30)*image.size.height/image.size.width;
|
||||
}
|
||||
}];
|
||||
}
|
||||
}
|
||||
|
||||
-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
|
||||
{
|
||||
return self.notiArray.count;
|
||||
}
|
||||
|
||||
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
|
||||
{
|
||||
PushRecordList *list = self.notiArray[section];
|
||||
if (list.isOpen == YES) {
|
||||
return 2;
|
||||
}else{
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
|
||||
{
|
||||
// PushRecordList *list = self.notiArray[indexPath.section];
|
||||
// if (list.isOpen == YES) {
|
||||
// if (indexPath.row == 0) {
|
||||
// return UITableViewAutomaticDimension;
|
||||
// }else{
|
||||
// if (list.type == 2) {
|
||||
// return list.imageHeight;
|
||||
// }else{
|
||||
// return UITableViewAutomaticDimension;
|
||||
// }
|
||||
// }
|
||||
// }else{
|
||||
// return UITableViewAutomaticDimension;
|
||||
// }
|
||||
return UITableViewAutomaticDimension;
|
||||
}
|
||||
|
||||
-(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
|
||||
{
|
||||
return 10;
|
||||
}
|
||||
|
||||
-(CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section
|
||||
{
|
||||
return CGFLOAT_MIN;
|
||||
}
|
||||
|
||||
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
|
||||
{
|
||||
PushRecordList *list = self.notiArray[indexPath.section];
|
||||
if (indexPath.row == 0) {
|
||||
NotiCenterTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:identifier];
|
||||
cell.list = list;
|
||||
if (list.isOpen == YES) {
|
||||
[cell.arrowBtn setImage:[UIImage imageNamed:@"s"] forState:(UIControlStateNormal)];
|
||||
}else{
|
||||
[cell.arrowBtn setImage:[UIImage imageNamed:@"xaingxia"] forState:(UIControlStateNormal)];
|
||||
}
|
||||
[cell.arrowBtn addAction:^(UIButton * _Nullable btn) {
|
||||
list.isOpen = !list.isOpen;
|
||||
[self.tableView reloadData];
|
||||
}];
|
||||
return cell;
|
||||
}else if (indexPath.row == 1) {
|
||||
if (list.type == 1) {
|
||||
NotiCenterContentTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:contentidentifier];
|
||||
cell.list = list;
|
||||
return cell;
|
||||
}else if (list.type == 2) {
|
||||
NotiCenterImageTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:imageidentifier];
|
||||
cell.list = list;
|
||||
return cell;
|
||||
}else if (list.type == 3) {
|
||||
NotiCenterJumpLinkTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:linkidentifier];
|
||||
cell.list = list;
|
||||
[cell.linkBtn addAction:^(UIButton * _Nullable btn) {
|
||||
UIStoryboard *sb = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
|
||||
MainOldViewController *view = [sb instantiateViewControllerWithIdentifier:@"MainOldViewController"];
|
||||
view.isPresent = YES;
|
||||
view.gameURLString = list.jumpUrl;
|
||||
view.modalPresentationStyle = UIModalPresentationFullScreen;
|
||||
[self presentViewController:view animated:YES completion:^{}];
|
||||
}];
|
||||
return cell;
|
||||
}
|
||||
}
|
||||
return nil;
|
||||
}
|
||||
|
||||
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
|
||||
{
|
||||
PushRecordList *list = self.notiArray[indexPath.section];
|
||||
if (indexPath.row == 0) {
|
||||
list.isOpen = !list.isOpen;
|
||||
[self.tableView reloadData];
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
||||
78
ShenQi/NotiCenterViewController.xib
Normal file
@@ -0,0 +1,78 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="32700.99.1234" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
|
||||
<device id="retina6_12" orientation="portrait" appearance="light"/>
|
||||
<dependencies>
|
||||
<deployment identifier="iOS"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="22685"/>
|
||||
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
|
||||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||
</dependencies>
|
||||
<objects>
|
||||
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="NotiCenterViewController">
|
||||
<connections>
|
||||
<outlet property="tableView" destination="led-oX-0RS" id="7cj-Ih-kwz"/>
|
||||
<outlet property="view" destination="i5M-Pr-FkT" id="sfx-zR-JGt"/>
|
||||
</connections>
|
||||
</placeholder>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
|
||||
<view clearsContextBeforeDrawing="NO" contentMode="scaleToFill" id="i5M-Pr-FkT">
|
||||
<rect key="frame" x="0.0" y="0.0" width="393" height="852"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<subviews>
|
||||
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="2mx-7I-LLS">
|
||||
<rect key="frame" x="0.0" y="59" width="393" height="44"/>
|
||||
<subviews>
|
||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Vch-gT-LYq">
|
||||
<rect key="frame" x="15" y="10" width="24" height="24"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" secondItem="Vch-gT-LYq" secondAttribute="height" multiplier="1:1" id="5jl-Y9-YBz"/>
|
||||
<constraint firstAttribute="height" constant="24" id="8bE-BS-OfA"/>
|
||||
</constraints>
|
||||
<inset key="imageEdgeInsets" minX="0.0" minY="0.0" maxX="2.2250738585072014e-308" maxY="0.0"/>
|
||||
<state key="normal" image="fanhui"/>
|
||||
<connections>
|
||||
<action selector="gobackAction:" destination="-1" eventType="touchUpInside" id="GtT-rN-5E8"/>
|
||||
</connections>
|
||||
</button>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="通知" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="lwx-be-vjd">
|
||||
<rect key="frame" x="179.33333333333334" y="11.666666666666671" width="34.666666666666657" height="21"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
||||
<color key="textColor" white="0.0" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
</subviews>
|
||||
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<constraints>
|
||||
<constraint firstItem="lwx-be-vjd" firstAttribute="centerX" secondItem="2mx-7I-LLS" secondAttribute="centerX" id="DCe-Kb-Ha6"/>
|
||||
<constraint firstItem="lwx-be-vjd" firstAttribute="centerY" secondItem="Vch-gT-LYq" secondAttribute="centerY" id="IyH-2s-Qor"/>
|
||||
<constraint firstItem="Vch-gT-LYq" firstAttribute="leading" secondItem="2mx-7I-LLS" secondAttribute="leading" constant="15" id="NGA-75-Rbm"/>
|
||||
<constraint firstAttribute="height" constant="44" id="a6t-Gn-0Vd"/>
|
||||
<constraint firstAttribute="bottom" secondItem="Vch-gT-LYq" secondAttribute="bottom" constant="10" id="hv6-Ha-lkj"/>
|
||||
</constraints>
|
||||
</view>
|
||||
<tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" style="grouped" separatorStyle="default" rowHeight="-1" estimatedRowHeight="-1" sectionHeaderHeight="18" estimatedSectionHeaderHeight="-1" sectionFooterHeight="18" estimatedSectionFooterHeight="-1" translatesAutoresizingMaskIntoConstraints="NO" id="led-oX-0RS">
|
||||
<rect key="frame" x="0.0" y="103" width="393" height="715"/>
|
||||
<color key="backgroundColor" systemColor="groupTableViewBackgroundColor"/>
|
||||
</tableView>
|
||||
</subviews>
|
||||
<viewLayoutGuide key="safeArea" id="Q5M-cg-NOt"/>
|
||||
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<constraints>
|
||||
<constraint firstItem="led-oX-0RS" firstAttribute="centerX" secondItem="Q5M-cg-NOt" secondAttribute="centerX" id="2l1-cL-rQl"/>
|
||||
<constraint firstItem="2mx-7I-LLS" firstAttribute="width" secondItem="i5M-Pr-FkT" secondAttribute="width" id="ESz-0V-t0T"/>
|
||||
<constraint firstItem="led-oX-0RS" firstAttribute="width" secondItem="i5M-Pr-FkT" secondAttribute="width" id="Fws-0a-UOd"/>
|
||||
<constraint firstItem="led-oX-0RS" firstAttribute="top" secondItem="2mx-7I-LLS" secondAttribute="bottom" id="T01-El-6eL"/>
|
||||
<constraint firstItem="2mx-7I-LLS" firstAttribute="top" secondItem="Q5M-cg-NOt" secondAttribute="top" id="cSF-Es-GO6"/>
|
||||
<constraint firstItem="2mx-7I-LLS" firstAttribute="centerX" secondItem="Q5M-cg-NOt" secondAttribute="centerX" id="pI6-je-3yA"/>
|
||||
<constraint firstItem="Q5M-cg-NOt" firstAttribute="bottom" secondItem="led-oX-0RS" secondAttribute="bottom" id="qlr-QU-gnW"/>
|
||||
</constraints>
|
||||
<point key="canvasLocation" x="69" y="20"/>
|
||||
</view>
|
||||
</objects>
|
||||
<resources>
|
||||
<image name="fanhui" width="200" height="200"/>
|
||||
<systemColor name="groupTableViewBackgroundColor">
|
||||
<color red="0.94901960784313721" green="0.94901960784313721" blue="0.96862745098039216" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
</systemColor>
|
||||
</resources>
|
||||
</document>
|
||||
24
ShenQi/PushRecordData.h
Normal file
@@ -0,0 +1,24 @@
|
||||
//
|
||||
// PushRecordData.h
|
||||
//
|
||||
// Created by on 2025/1/11
|
||||
// Copyright (c) 2025 zL. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
@interface PushRecordData : NSObject <NSCoding, NSCopying>
|
||||
|
||||
@property (nonatomic, assign) NSInteger pages;
|
||||
@property (nonatomic, assign) BOOL hasNextPage;
|
||||
@property (nonatomic, assign) NSInteger nextPage;
|
||||
@property (nonatomic, assign) NSInteger total;
|
||||
@property (nonatomic, strong) NSArray *list;
|
||||
@property (nonatomic, assign) BOOL hasPreviousPage;
|
||||
@property (nonatomic, assign) NSInteger prePage;
|
||||
|
||||
+ (instancetype)modelObjectWithDictionary:(NSDictionary *)dict;
|
||||
- (instancetype)initWithDictionary:(NSDictionary *)dict;
|
||||
- (NSDictionary *)dictionaryRepresentation;
|
||||
|
||||
@end
|
||||
140
ShenQi/PushRecordData.m
Normal file
@@ -0,0 +1,140 @@
|
||||
//
|
||||
// PushRecordData.m
|
||||
//
|
||||
// Created by on 2025/1/11
|
||||
// Copyright (c) 2025 zL. All rights reserved.
|
||||
//
|
||||
|
||||
#import "PushRecordData.h"
|
||||
#import "PushRecordList.h"
|
||||
|
||||
NSString *const kPushRecordDataPages = @"pages";
|
||||
NSString *const kPushRecordDataHasNextPage = @"hasNextPage";
|
||||
NSString *const kPushRecordDataNextPage = @"nextPage";
|
||||
NSString *const kPushRecordDataTotal = @"total";
|
||||
NSString *const kPushRecordDataList = @"list";
|
||||
NSString *const kPushRecordDataHasPreviousPage = @"hasPreviousPage";
|
||||
NSString *const kPushRecordDataPrePage = @"prePage";
|
||||
|
||||
@interface PushRecordData ()
|
||||
|
||||
- (id)objectOrNilForKey:(id)aKey fromDictionary:(NSDictionary *)dict;
|
||||
|
||||
@end
|
||||
|
||||
@implementation PushRecordData
|
||||
|
||||
@synthesize pages = _pages;
|
||||
@synthesize hasNextPage = _hasNextPage;
|
||||
@synthesize nextPage = _nextPage;
|
||||
@synthesize total = _total;
|
||||
@synthesize list = _list;
|
||||
@synthesize hasPreviousPage = _hasPreviousPage;
|
||||
@synthesize prePage = _prePage;
|
||||
|
||||
+ (instancetype)modelObjectWithDictionary:(NSDictionary *)dict {
|
||||
return [[self alloc] initWithDictionary:dict];
|
||||
}
|
||||
|
||||
- (instancetype)initWithDictionary:(NSDictionary *)dict {
|
||||
self = [super init];
|
||||
// This check serves to make sure that a non-NSDictionary object
|
||||
// passed into the model class doesn't break the parsing.
|
||||
if (self && [dict isKindOfClass:[NSDictionary class]]) {
|
||||
self.pages = [[self objectOrNilForKey:kPushRecordDataPages fromDictionary:dict] intValue];
|
||||
self.hasNextPage = [[self objectOrNilForKey:kPushRecordDataHasNextPage fromDictionary:dict] boolValue];
|
||||
self.nextPage = [[self objectOrNilForKey:kPushRecordDataNextPage fromDictionary:dict] intValue];
|
||||
self.total = [[self objectOrNilForKey:kPushRecordDataTotal fromDictionary:dict] intValue];
|
||||
NSObject *receivedPushRecordList = [dict objectForKey:kPushRecordDataList];
|
||||
NSMutableArray *parsedPushRecordList = [NSMutableArray array];
|
||||
|
||||
if ([receivedPushRecordList isKindOfClass:[NSArray class]]) {
|
||||
for (NSDictionary *item in (NSArray *)receivedPushRecordList) {
|
||||
if ([item isKindOfClass:[NSDictionary class]]) {
|
||||
[parsedPushRecordList addObject:[PushRecordList modelObjectWithDictionary:item]];
|
||||
}
|
||||
}
|
||||
} else if ([receivedPushRecordList isKindOfClass:[NSDictionary class]]) {
|
||||
[parsedPushRecordList addObject:[PushRecordList modelObjectWithDictionary:(NSDictionary *)receivedPushRecordList]];
|
||||
}
|
||||
|
||||
self.list = [NSArray arrayWithArray:parsedPushRecordList];
|
||||
self.hasPreviousPage = [[self objectOrNilForKey:kPushRecordDataHasPreviousPage fromDictionary:dict] boolValue];
|
||||
self.prePage = [[self objectOrNilForKey:kPushRecordDataPrePage fromDictionary:dict] intValue];
|
||||
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (NSDictionary *)dictionaryRepresentation {
|
||||
NSMutableDictionary *mutableDict = [NSMutableDictionary dictionary];
|
||||
[mutableDict setValue:[NSNumber numberWithInteger:self.pages] forKey:kPushRecordDataPages];
|
||||
[mutableDict setValue:[NSNumber numberWithBool:self.hasNextPage] forKey:kPushRecordDataHasNextPage];
|
||||
[mutableDict setValue:[NSNumber numberWithInteger:self.nextPage] forKey:kPushRecordDataNextPage];
|
||||
[mutableDict setValue:[NSNumber numberWithInteger:self.total] forKey:kPushRecordDataTotal];
|
||||
NSMutableArray *tempArrayForList = [NSMutableArray array];
|
||||
|
||||
for (NSObject *subArrayObject in self.list) {
|
||||
if ([subArrayObject respondsToSelector:@selector(dictionaryRepresentation)]) {
|
||||
// This class is a model object
|
||||
[tempArrayForList addObject:[subArrayObject performSelector:@selector(dictionaryRepresentation)]];
|
||||
} else {
|
||||
// Generic object
|
||||
[tempArrayForList addObject:subArrayObject];
|
||||
}
|
||||
}
|
||||
[mutableDict setValue:[NSArray arrayWithArray:tempArrayForList] forKey:kPushRecordDataList];
|
||||
[mutableDict setValue:[NSNumber numberWithBool:self.hasPreviousPage] forKey:kPushRecordDataHasPreviousPage];
|
||||
[mutableDict setValue:[NSNumber numberWithInteger:self.prePage] forKey:kPushRecordDataPrePage];
|
||||
return [NSDictionary dictionaryWithDictionary:mutableDict];
|
||||
}
|
||||
|
||||
- (NSString *)description {
|
||||
return [NSString stringWithFormat:@"%@", [self dictionaryRepresentation]];
|
||||
}
|
||||
|
||||
#pragma mark - Helper Method
|
||||
- (id)objectOrNilForKey:(id)aKey fromDictionary:(NSDictionary *)dict {
|
||||
id object = [dict objectForKey:aKey];
|
||||
return [object isEqual:[NSNull null]] ? nil : object;
|
||||
}
|
||||
|
||||
#pragma mark - NSCoding Methods
|
||||
|
||||
- (id)initWithCoder:(NSCoder *)aDecoder {
|
||||
self = [super init];
|
||||
self.pages = [aDecoder decodeIntegerForKey:kPushRecordDataPages];
|
||||
self.hasNextPage = [aDecoder decodeBoolForKey:kPushRecordDataHasNextPage];
|
||||
self.nextPage = [aDecoder decodeIntegerForKey:kPushRecordDataNextPage];
|
||||
self.total = [aDecoder decodeIntegerForKey:kPushRecordDataTotal];
|
||||
self.list = [aDecoder decodeObjectForKey:kPushRecordDataList];
|
||||
self.hasPreviousPage = [aDecoder decodeBoolForKey:kPushRecordDataHasPreviousPage];
|
||||
self.prePage = [aDecoder decodeIntegerForKey:kPushRecordDataPrePage];
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)encodeWithCoder:(NSCoder *)aCoder {
|
||||
[aCoder encodeInteger:_pages forKey:kPushRecordDataPages];
|
||||
[aCoder encodeBool:_hasNextPage forKey:kPushRecordDataHasNextPage];
|
||||
[aCoder encodeInteger:_nextPage forKey:kPushRecordDataNextPage];
|
||||
[aCoder encodeInteger:_total forKey:kPushRecordDataTotal];
|
||||
[aCoder encodeObject:_list forKey:kPushRecordDataList];
|
||||
[aCoder encodeBool:_hasPreviousPage forKey:kPushRecordDataHasPreviousPage];
|
||||
[aCoder encodeInteger:_prePage forKey:kPushRecordDataPrePage];
|
||||
}
|
||||
|
||||
- (id)copyWithZone:(NSZone *)zone {
|
||||
PushRecordData *copy = [[PushRecordData alloc] init];
|
||||
if (copy) {
|
||||
copy.pages = self.pages;
|
||||
copy.hasNextPage = self.hasNextPage;
|
||||
copy.nextPage = self.nextPage;
|
||||
copy.total = self.total;
|
||||
copy.list = [self.list copyWithZone:zone];
|
||||
copy.hasPreviousPage = self.hasPreviousPage;
|
||||
copy.prePage = self.prePage;
|
||||
}
|
||||
return copy;
|
||||
}
|
||||
|
||||
@end
|
||||
19
ShenQi/PushRecordDataModel.h
Normal file
@@ -0,0 +1,19 @@
|
||||
//
|
||||
// PushRecordDataModel.h
|
||||
//
|
||||
// Created by on 2025/1/11
|
||||
// Copyright (c) 2025 zL. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
@class PushRecordData;
|
||||
@interface PushRecordDataModel : NSObject <NSCoding, NSCopying>
|
||||
|
||||
@property (nonatomic, strong) PushRecordData *data;
|
||||
@property (nonatomic, assign) NSInteger code;
|
||||
|
||||
+ (instancetype)modelObjectWithDictionary:(NSDictionary *)dict;
|
||||
- (instancetype)initWithDictionary:(NSDictionary *)dict;
|
||||
- (NSDictionary *)dictionaryRepresentation;
|
||||
|
||||
@end
|
||||
81
ShenQi/PushRecordDataModel.m
Normal file
@@ -0,0 +1,81 @@
|
||||
//
|
||||
// PushRecordDataModel.m
|
||||
//
|
||||
// Created by on 2025/1/11
|
||||
// Copyright (c) 2025 zL. All rights reserved.
|
||||
//
|
||||
|
||||
#import "PushRecordDataModel.h"
|
||||
#import "PushRecordData.h"
|
||||
|
||||
NSString *const kPushRecordDataModelData = @"data";
|
||||
NSString *const kPushRecordDataModelCode = @"code";
|
||||
|
||||
@interface PushRecordDataModel ()
|
||||
|
||||
- (id)objectOrNilForKey:(id)aKey fromDictionary:(NSDictionary *)dict;
|
||||
|
||||
@end
|
||||
|
||||
@implementation PushRecordDataModel
|
||||
|
||||
@synthesize data = _data;
|
||||
@synthesize code = _code;
|
||||
|
||||
+ (instancetype)modelObjectWithDictionary:(NSDictionary *)dict {
|
||||
return [[self alloc] initWithDictionary:dict];
|
||||
}
|
||||
|
||||
- (instancetype)initWithDictionary:(NSDictionary *)dict {
|
||||
self = [super init];
|
||||
// This check serves to make sure that a non-NSDictionary object
|
||||
// passed into the model class doesn't break the parsing.
|
||||
if (self && [dict isKindOfClass:[NSDictionary class]]) {
|
||||
self.data = [PushRecordData modelObjectWithDictionary:[dict objectForKey:kPushRecordDataModelData]];
|
||||
self.code = [[self objectOrNilForKey:kPushRecordDataModelCode fromDictionary:dict] intValue];
|
||||
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (NSDictionary *)dictionaryRepresentation {
|
||||
NSMutableDictionary *mutableDict = [NSMutableDictionary dictionary];
|
||||
[mutableDict setValue:[self.data dictionaryRepresentation] forKey:kPushRecordDataModelData];
|
||||
[mutableDict setValue:[NSNumber numberWithInteger:self.code] forKey:kPushRecordDataModelCode];
|
||||
return [NSDictionary dictionaryWithDictionary:mutableDict];
|
||||
}
|
||||
|
||||
- (NSString *)description {
|
||||
return [NSString stringWithFormat:@"%@", [self dictionaryRepresentation]];
|
||||
}
|
||||
|
||||
#pragma mark - Helper Method
|
||||
- (id)objectOrNilForKey:(id)aKey fromDictionary:(NSDictionary *)dict {
|
||||
id object = [dict objectForKey:aKey];
|
||||
return [object isEqual:[NSNull null]] ? nil : object;
|
||||
}
|
||||
|
||||
#pragma mark - NSCoding Methods
|
||||
|
||||
- (id)initWithCoder:(NSCoder *)aDecoder {
|
||||
self = [super init];
|
||||
self.data = [aDecoder decodeObjectForKey:kPushRecordDataModelData];
|
||||
self.code = [aDecoder decodeIntegerForKey:kPushRecordDataModelCode];
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)encodeWithCoder:(NSCoder *)aCoder {
|
||||
[aCoder encodeObject:_data forKey:kPushRecordDataModelData];
|
||||
[aCoder encodeInteger:_code forKey:kPushRecordDataModelCode];
|
||||
}
|
||||
|
||||
- (id)copyWithZone:(NSZone *)zone {
|
||||
PushRecordDataModel *copy = [[PushRecordDataModel alloc] init];
|
||||
if (copy) {
|
||||
copy.data = [self.data copyWithZone:zone];
|
||||
copy.code = self.code;
|
||||
}
|
||||
return copy;
|
||||
}
|
||||
|
||||
@end
|
||||
30
ShenQi/PushRecordList.h
Normal file
@@ -0,0 +1,30 @@
|
||||
//
|
||||
// PushRecordList.h
|
||||
//
|
||||
// Created by on 2025/1/11
|
||||
// Copyright (c) 2025 zL. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
@interface PushRecordList : NSObject <NSCoding, NSCopying>
|
||||
|
||||
@property (nonatomic, assign) NSInteger status;
|
||||
@property (nonatomic, strong) NSString *content;
|
||||
@property (nonatomic, assign) NSInteger userId;
|
||||
@property (nonatomic, strong) NSString *jumpUrl;
|
||||
@property (nonatomic, assign) NSInteger receiveTimes;
|
||||
@property (nonatomic, assign) NSInteger recordId;
|
||||
@property (nonatomic, strong) NSString *image;
|
||||
@property (nonatomic, strong) NSString *title;
|
||||
@property (nonatomic, assign) NSInteger type; // 1:文字 2:图片 3:链接跳转
|
||||
@property (nonatomic, strong) NSString *createTime;
|
||||
|
||||
@property (nonatomic, assign) BOOL isOpen;
|
||||
@property (nonatomic, assign) CGFloat imageHeight;
|
||||
|
||||
+ (instancetype)modelObjectWithDictionary:(NSDictionary *)dict;
|
||||
- (instancetype)initWithDictionary:(NSDictionary *)dict;
|
||||
- (NSDictionary *)dictionaryRepresentation;
|
||||
|
||||
@end
|
||||
136
ShenQi/PushRecordList.m
Normal file
@@ -0,0 +1,136 @@
|
||||
//
|
||||
// PushRecordList.m
|
||||
//
|
||||
// Created by on 2025/1/11
|
||||
// Copyright (c) 2025 zL. All rights reserved.
|
||||
//
|
||||
|
||||
#import "PushRecordList.h"
|
||||
|
||||
NSString *const kPushRecordListStatus = @"status";
|
||||
NSString *const kPushRecordListContent = @"content";
|
||||
NSString *const kPushRecordListUserId = @"userId";
|
||||
NSString *const kPushRecordListJumpUrl = @"jumpUrl";
|
||||
NSString *const kPushRecordListReceiveTimes = @"receiveTimes";
|
||||
NSString *const kPushRecordListRecordId = @"recordId";
|
||||
NSString *const kPushRecordListImage = @"image";
|
||||
NSString *const kPushRecordListTitle = @"title";
|
||||
NSString *const kPushRecordListType = @"type";
|
||||
NSString *const kPushRecordListCreateTime = @"createTime";
|
||||
|
||||
@interface PushRecordList ()
|
||||
|
||||
- (id)objectOrNilForKey:(id)aKey fromDictionary:(NSDictionary *)dict;
|
||||
|
||||
@end
|
||||
|
||||
@implementation PushRecordList
|
||||
|
||||
@synthesize status = _status;
|
||||
@synthesize content = _content;
|
||||
@synthesize userId = _userId;
|
||||
@synthesize jumpUrl = _jumpUrl;
|
||||
@synthesize receiveTimes = _receiveTimes;
|
||||
@synthesize recordId = _recordId;
|
||||
@synthesize image = _image;
|
||||
@synthesize title = _title;
|
||||
@synthesize type = _type;
|
||||
@synthesize createTime = _createTime;
|
||||
|
||||
+ (instancetype)modelObjectWithDictionary:(NSDictionary *)dict {
|
||||
return [[self alloc] initWithDictionary:dict];
|
||||
}
|
||||
|
||||
- (instancetype)initWithDictionary:(NSDictionary *)dict {
|
||||
self = [super init];
|
||||
// This check serves to make sure that a non-NSDictionary object
|
||||
// passed into the model class doesn't break the parsing.
|
||||
if (self && [dict isKindOfClass:[NSDictionary class]]) {
|
||||
self.status = [[self objectOrNilForKey:kPushRecordListStatus fromDictionary:dict] intValue];
|
||||
self.content = [self objectOrNilForKey:kPushRecordListContent fromDictionary:dict];
|
||||
self.userId = [[self objectOrNilForKey:kPushRecordListUserId fromDictionary:dict] intValue];
|
||||
self.jumpUrl = [self objectOrNilForKey:kPushRecordListJumpUrl fromDictionary:dict];
|
||||
self.receiveTimes = [[self objectOrNilForKey:kPushRecordListReceiveTimes fromDictionary:dict] intValue];
|
||||
self.recordId = [[self objectOrNilForKey:kPushRecordListRecordId fromDictionary:dict] intValue];
|
||||
self.image = [self objectOrNilForKey:kPushRecordListImage fromDictionary:dict];
|
||||
self.title = [self objectOrNilForKey:kPushRecordListTitle fromDictionary:dict];
|
||||
self.type = [[self objectOrNilForKey:kPushRecordListType fromDictionary:dict] intValue];
|
||||
self.createTime = [self objectOrNilForKey:kPushRecordListCreateTime fromDictionary:dict];
|
||||
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (NSDictionary *)dictionaryRepresentation {
|
||||
NSMutableDictionary *mutableDict = [NSMutableDictionary dictionary];
|
||||
[mutableDict setValue:[NSNumber numberWithInteger:self.status] forKey:kPushRecordListStatus];
|
||||
[mutableDict setValue:self.content forKey:kPushRecordListContent];
|
||||
[mutableDict setValue:[NSNumber numberWithInteger:self.userId] forKey:kPushRecordListUserId];
|
||||
[mutableDict setValue:self.jumpUrl forKey:kPushRecordListJumpUrl];
|
||||
[mutableDict setValue:[NSNumber numberWithInteger:self.receiveTimes] forKey:kPushRecordListReceiveTimes];
|
||||
[mutableDict setValue:[NSNumber numberWithInteger:self.recordId] forKey:kPushRecordListRecordId];
|
||||
[mutableDict setValue:self.image forKey:kPushRecordListImage];
|
||||
[mutableDict setValue:self.title forKey:kPushRecordListTitle];
|
||||
[mutableDict setValue:[NSNumber numberWithInteger:self.type] forKey:kPushRecordListType];
|
||||
[mutableDict setValue:self.createTime forKey:kPushRecordListCreateTime];
|
||||
return [NSDictionary dictionaryWithDictionary:mutableDict];
|
||||
}
|
||||
|
||||
- (NSString *)description {
|
||||
return [NSString stringWithFormat:@"%@", [self dictionaryRepresentation]];
|
||||
}
|
||||
|
||||
#pragma mark - Helper Method
|
||||
- (id)objectOrNilForKey:(id)aKey fromDictionary:(NSDictionary *)dict {
|
||||
id object = [dict objectForKey:aKey];
|
||||
return [object isEqual:[NSNull null]] ? nil : object;
|
||||
}
|
||||
|
||||
#pragma mark - NSCoding Methods
|
||||
|
||||
- (id)initWithCoder:(NSCoder *)aDecoder {
|
||||
self = [super init];
|
||||
self.status = [aDecoder decodeIntegerForKey:kPushRecordListStatus];
|
||||
self.content = [aDecoder decodeObjectForKey:kPushRecordListContent];
|
||||
self.userId = [aDecoder decodeIntegerForKey:kPushRecordListUserId];
|
||||
self.jumpUrl = [aDecoder decodeObjectForKey:kPushRecordListJumpUrl];
|
||||
self.receiveTimes = [aDecoder decodeIntegerForKey:kPushRecordListReceiveTimes];
|
||||
self.recordId = [aDecoder decodeIntegerForKey:kPushRecordListRecordId];
|
||||
self.image = [aDecoder decodeObjectForKey:kPushRecordListImage];
|
||||
self.title = [aDecoder decodeObjectForKey:kPushRecordListTitle];
|
||||
self.type = [aDecoder decodeIntegerForKey:kPushRecordListType];
|
||||
self.createTime = [aDecoder decodeObjectForKey:kPushRecordListCreateTime];
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)encodeWithCoder:(NSCoder *)aCoder {
|
||||
[aCoder encodeInteger:_status forKey:kPushRecordListStatus];
|
||||
[aCoder encodeObject:_content forKey:kPushRecordListContent];
|
||||
[aCoder encodeInteger:_userId forKey:kPushRecordListUserId];
|
||||
[aCoder encodeObject:_jumpUrl forKey:kPushRecordListJumpUrl];
|
||||
[aCoder encodeInteger:_receiveTimes forKey:kPushRecordListReceiveTimes];
|
||||
[aCoder encodeInteger:_recordId forKey:kPushRecordListRecordId];
|
||||
[aCoder encodeObject:_image forKey:kPushRecordListImage];
|
||||
[aCoder encodeObject:_title forKey:kPushRecordListTitle];
|
||||
[aCoder encodeInteger:_type forKey:kPushRecordListType];
|
||||
[aCoder encodeObject:_createTime forKey:kPushRecordListCreateTime];
|
||||
}
|
||||
|
||||
- (id)copyWithZone:(NSZone *)zone {
|
||||
PushRecordList *copy = [[PushRecordList alloc] init];
|
||||
if (copy) {
|
||||
copy.status = self.status;
|
||||
copy.content = [self.content copyWithZone:zone];
|
||||
copy.userId = self.userId;
|
||||
copy.jumpUrl = [self.jumpUrl copyWithZone:zone];
|
||||
copy.receiveTimes = self.receiveTimes;
|
||||
copy.recordId = self.recordId;
|
||||
copy.image = [self.image copyWithZone:zone];
|
||||
copy.title = [self.title copyWithZone:zone];
|
||||
copy.type = self.type;
|
||||
copy.createTime = [self.createTime copyWithZone:zone];
|
||||
}
|
||||
return copy;
|
||||
}
|
||||
|
||||
@end
|
||||
29
ShenQi/UIButton+DSButtonBlock/UIButton+DSButtonBlock.h
Normal file
@@ -0,0 +1,29 @@
|
||||
//
|
||||
// UIButton+DSButtonBlock.h
|
||||
// DSChat
|
||||
//
|
||||
// Created by Mac on 2022/6/14.
|
||||
// Copyright © 2022 DS. All rights reserved.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
typedef void(^ButtonBlock)(UIButton * _Nullable btn);
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface UIButton (DSButtonBlock)
|
||||
|
||||
/**
|
||||
* button 添加点击事件
|
||||
*/
|
||||
- (void)addAction:(ButtonBlock)block;
|
||||
|
||||
/**
|
||||
* button 添加事件
|
||||
*/
|
||||
- (void)addAction:(ButtonBlock)block forControlEvents:(UIControlEvents)controlEvents;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
42
ShenQi/UIButton+DSButtonBlock/UIButton+DSButtonBlock.m
Normal file
@@ -0,0 +1,42 @@
|
||||
//
|
||||
// UIButton+DSButtonBlock.m
|
||||
// DSChat
|
||||
//
|
||||
// Created by Mac on 2022/6/14.
|
||||
// Copyright © 2022 DS. All rights reserved.
|
||||
//
|
||||
|
||||
#import "UIButton+DSButtonBlock.h"
|
||||
|
||||
#import <objc/runtime.h>
|
||||
|
||||
@implementation UIButton (DSButtonBlock)
|
||||
|
||||
static char ActionTag;
|
||||
/**
|
||||
* button 添加点击事件
|
||||
*/
|
||||
- (void)addAction:(ButtonBlock)block
|
||||
{
|
||||
objc_setAssociatedObject(self, &ActionTag, block, OBJC_ASSOCIATION_COPY_NONATOMIC);
|
||||
[self addTarget:self action:@selector(action:) forControlEvents:UIControlEventTouchUpInside];
|
||||
}
|
||||
|
||||
/**
|
||||
* button 添加事件
|
||||
*/
|
||||
- (void)addAction:(ButtonBlock)block forControlEvents:(UIControlEvents)controlEvents
|
||||
{
|
||||
objc_setAssociatedObject(self, &ActionTag, block, OBJC_ASSOCIATION_COPY_NONATOMIC);
|
||||
[self addTarget:self action:@selector(action:) forControlEvents:controlEvents];
|
||||
}
|
||||
|
||||
- (void)action:(id)sender
|
||||
{
|
||||
ButtonBlock blockAction = (ButtonBlock)objc_getAssociatedObject(self, &ActionTag);
|
||||
if (blockAction) {
|
||||
blockAction(self);
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -11,8 +11,8 @@
|
||||
- (void)awakeFromNib {
|
||||
[super awakeFromNib];
|
||||
|
||||
// self.avatarImageView.layer.cornerRadius = 25.f;
|
||||
// self.avatarImageView.layer.masksToBounds = YES;
|
||||
self.avatarImageView.layer.cornerRadius = 30.f;
|
||||
self.avatarImageView.layer.masksToBounds = YES;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@@ -17,6 +17,7 @@ typedef NS_ENUM(NSInteger, DSWebMenuType) {
|
||||
DSWebMenuTelegramType, // Telegram
|
||||
DSWebMenuWhatsAppType, // WhatsApp
|
||||
DSWebMenuFacebookType, // Facebook
|
||||
DSWebMenuNotiType, // 推送中心
|
||||
};
|
||||
|
||||
@protocol DSWebMenuDelegate <NSObject>
|
||||
|
||||
@@ -48,17 +48,17 @@ static NSString *identifier = @"AvatarCollectionViewCell";
|
||||
|
||||
- (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath
|
||||
{
|
||||
return CGSizeMake(collectionView.frame.size.width, ((collectionView.frame.size.height-(self.shareArray.count-1)*10))/self.shareArray.count);
|
||||
return CGSizeMake(60, 60);
|
||||
}
|
||||
|
||||
-(UIEdgeInsets)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout insetForSectionAtIndex:(NSInteger)section
|
||||
{
|
||||
return UIEdgeInsetsMake(0, 0, 0, 0);
|
||||
return UIEdgeInsetsMake(0, 0, 10, 0);
|
||||
}
|
||||
|
||||
- (CGFloat)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout minimumInteritemSpacingForSectionAtIndex:(NSInteger)section
|
||||
{
|
||||
return 10;
|
||||
return 0;
|
||||
}
|
||||
|
||||
- (CGFloat)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout minimumLineSpacingForSectionAtIndex:(NSInteger)section
|
||||
@@ -106,6 +106,8 @@ static NSString *identifier = @"AvatarCollectionViewCell";
|
||||
cell.avatarImageView.image = [UIImage imageNamed:@"whatsapp"];
|
||||
}else if (type == DSWebMenuFacebookType) {
|
||||
cell.avatarImageView.image = [UIImage imageNamed:@"facebook"];
|
||||
}else if (type == DSWebMenuNotiType) {
|
||||
cell.avatarImageView.image = [UIImage imageNamed:@"noti"];
|
||||
}
|
||||
}
|
||||
cell.avatarImageView.contentMode = UIViewContentModeScaleAspectFit;
|
||||
|
||||