Skip to content

Commit

Permalink
描述文件URL匹配从网络中获取;其他细节优化
Browse files Browse the repository at this point in the history
  • Loading branch information
SmileZXLee committed Apr 8, 2023
1 parent bfcf931 commit 7d21cf7
Show file tree
Hide file tree
Showing 10 changed files with 625 additions and 37 deletions.
20 changes: 20 additions & 0 deletions IpaDownloadTool/IpaDownloadTool.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
041C40B729E053A600B611EE /* ZXMPRegularVC.m in Sources */ = {isa = PBXBuildFile; fileRef = 041C40B529E053A600B611EE /* ZXMPRegularVC.m */; };
041C40B829E053A600B611EE /* ZXMPRegularVC.xib in Resources */ = {isa = PBXBuildFile; fileRef = 041C40B629E053A600B611EE /* ZXMPRegularVC.xib */; };
047CDB9929E079BC0013AEAE /* ZXIpaAboutSpaceView.m in Sources */ = {isa = PBXBuildFile; fileRef = 047CDB9829E079BC0013AEAE /* ZXIpaAboutSpaceView.m */; };
047CDBA129E119B30013AEAE /* AFNetworkReachabilityManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 047CDBA029E119B30013AEAE /* AFNetworkReachabilityManager.m */; };
047CDBA629E11E840013AEAE /* UIViewController+ZXAlert.m in Sources */ = {isa = PBXBuildFile; fileRef = 047CDBA429E11E840013AEAE /* UIViewController+ZXAlert.m */; };
04C9937925B2A0910041B15E /* ZXIpaUrlHisVC.m in Sources */ = {isa = PBXBuildFile; fileRef = 04C9937725B2A0910041B15E /* ZXIpaUrlHisVC.m */; };
04C9937A25B2A0910041B15E /* ZXIpaUrlHisVC.xib in Resources */ = {isa = PBXBuildFile; fileRef = 04C9937825B2A0910041B15E /* ZXIpaUrlHisVC.xib */; };
04C9938425B2A0D80041B15E /* ZXIpaUrlHisCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 04C9938225B2A0D80041B15E /* ZXIpaUrlHisCell.m */; };
Expand Down Expand Up @@ -121,6 +123,10 @@
041C40B629E053A600B611EE /* ZXMPRegularVC.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = ZXMPRegularVC.xib; sourceTree = "<group>"; };
047CDB9729E079BC0013AEAE /* ZXIpaAboutSpaceView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ZXIpaAboutSpaceView.h; sourceTree = "<group>"; };
047CDB9829E079BC0013AEAE /* ZXIpaAboutSpaceView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ZXIpaAboutSpaceView.m; sourceTree = "<group>"; };
047CDB9F29E119B30013AEAE /* AFNetworkReachabilityManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AFNetworkReachabilityManager.h; sourceTree = "<group>"; };
047CDBA029E119B30013AEAE /* AFNetworkReachabilityManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AFNetworkReachabilityManager.m; sourceTree = "<group>"; };
047CDBA429E11E840013AEAE /* UIViewController+ZXAlert.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIViewController+ZXAlert.m"; sourceTree = "<group>"; };
047CDBA529E11E840013AEAE /* UIViewController+ZXAlert.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIViewController+ZXAlert.h"; sourceTree = "<group>"; };
04C9937625B2A0910041B15E /* ZXIpaUrlHisVC.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ZXIpaUrlHisVC.h; sourceTree = "<group>"; };
04C9937725B2A0910041B15E /* ZXIpaUrlHisVC.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ZXIpaUrlHisVC.m; sourceTree = "<group>"; };
04C9937825B2A0910041B15E /* ZXIpaUrlHisVC.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = ZXIpaUrlHisVC.xib; sourceTree = "<group>"; };
Expand Down Expand Up @@ -302,6 +308,15 @@
path = ZXMPRegular;
sourceTree = "<group>";
};
047CDB9E29E119B30013AEAE /* Reachability */ = {
isa = PBXGroup;
children = (
047CDB9F29E119B30013AEAE /* AFNetworkReachabilityManager.h */,
047CDBA029E119B30013AEAE /* AFNetworkReachabilityManager.m */,
);
path = Reachability;
sourceTree = "<group>";
};
04C9937325B2A06B0041B15E /* ZXIpaUrlHis(网页加载历史) */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -452,6 +467,7 @@
741B92DF2275D33D00F24EED /* Tools */ = {
isa = PBXGroup;
children = (
047CDB9E29E119B30013AEAE /* Reachability */,
041C409A29DFD3B100B611EE /* DeviceInfo */,
7436DAE1227757A6007AA858 /* BackButtonHandler */,
7436DADA22771E0E007AA858 /* FileManage */,
Expand Down Expand Up @@ -645,6 +661,8 @@
7436DAB422769A65007AA858 /* UIImage+ZXTheme.m */,
7436DABD2276CAE4007AA858 /* NSString+ZXMD5.h */,
7436DABE2276CAE4007AA858 /* NSString+ZXMD5.m */,
047CDBA529E11E840013AEAE /* UIViewController+ZXAlert.h */,
047CDBA429E11E840013AEAE /* UIViewController+ZXAlert.m */,
);
path = Category;
sourceTree = "<group>";
Expand Down Expand Up @@ -897,6 +915,7 @@
04C9938425B2A0D80041B15E /* ZXIpaUrlHisCell.m in Sources */,
741B930C22760BC800F24EED /* ZXIpaDetailModel.m in Sources */,
741B92A82275943700F24EED /* main.m in Sources */,
047CDBA129E119B30013AEAE /* AFNetworkReachabilityManager.m in Sources */,
7436DAA622768B15007AA858 /* SGQRCodeGenerateManager.m in Sources */,
7436DADD22771E20007AA858 /* ZXFileManage.m in Sources */,
7436DAB922769D81007AA858 /* ZXPlaceView.m in Sources */,
Expand Down Expand Up @@ -927,6 +946,7 @@
7436DAB522769A65007AA858 /* UIImage+ZXTheme.m in Sources */,
041C40A129DFD5C300B611EE /* ZXDeviceInfoModel.m in Sources */,
04C9937925B2A0910041B15E /* ZXIpaUrlHisVC.m in Sources */,
047CDBA629E11E840013AEAE /* UIViewController+ZXAlert.m in Sources */,
7436DAD92276D19E007AA858 /* ZXLocalIpaDownloadModel.m in Sources */,
7436DAB2227699E7007AA858 /* UIImage+Rendering.m in Sources */,
7436DABF2276CAE4007AA858 /* NSString+ZXMD5.m in Sources */,
Expand Down
Binary file not shown.
3 changes: 3 additions & 0 deletions IpaDownloadTool/IpaDownloadTool/PrefixHeader.pch
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,14 @@
#import "ZXFileDownload.h"
#import "ZXFileManage.h"

#import "MBProgressHUD.h"
#import "NSString+ZXIpaRegular.h"
#import "UIImage+Rendering.h"
#import "UIAlertController+ZXTheme.h"
#import "UIImage+ZXTheme.h"
#import "NSObject+ZXKVO.h"
#import "UIViewController+ZXPlaceView.h"
#import "UIViewController+ZXAlert.h"

#import "ALToastView.h"

Expand All @@ -35,6 +37,7 @@
#define ZXMobileprovisionRegularDefault @[@"*.mobileconfig", @"*.mobileprovision", @"*/tools/udid/get/"]
#define ZXPasteboardStrLoadUrlNotification @"ZXPasteboardStrLoadUrlNotification"
#define ZXMobileprovisionRegularUpdateNotification @"ZXMobileprovisionRegularUpdateNotification"
#define ZXMobileprovisionUrlRegularGetPath @"http://www.zxlee.cn/ipaDownloadTool/mobileprovisionUrlRegular.json"
#define ZXISiPad (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
#define ZXUA @"com.apple.appstored/1.0 iOS/14.3 model/iPhone10,2 hwp/t8015 build/18C66 (6; dt:158) AMS/1"
#define ZXWebUA @"Mozilla/5.0 (iPhone; CPU iPhone OS 14_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0.2 Mobile/15E148 Safari/604.1"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
//
// UIViewController+ZXAlert.h
// IpaDownloadTool
//
// Created by 李兆祥 on 2023/4/8.
// Copyright © 2023 李兆祥. All rights reserved.
//

#import <UIKit/UIKit.h>

NS_ASSUME_NONNULL_BEGIN

@interface UIViewController (ZXAlert)
- (void)showAlertWithTitle:(NSString *)title message:(NSString *)message;
@end

NS_ASSUME_NONNULL_END
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
//
// UIViewController+ZXAlert.m
// IpaDownloadTool
//
// Created by 李兆祥 on 2023/4/8.
// Copyright © 2023 李兆祥. All rights reserved.
//

#import "UIViewController+ZXAlert.h"

@implementation UIViewController (ZXAlert)
- (void)showAlertWithTitle:(NSString *)title message:(NSString *)message {
UIAlertController *alertController = [UIAlertController alertControllerWithTitle:title message:message preferredStyle:UIAlertControllerStyleAlert];
UIAlertAction *okAction = [UIAlertAction actionWithTitle:@"我知道了" style:UIAlertActionStyleCancel handler:nil];

[alertController addThemeAction:okAction];
[self presentViewController:alertController animated:YES completion:nil];
}
@end

Original file line number Diff line number Diff line change
@@ -0,0 +1,216 @@
// AFNetworkReachabilityManager.h
// Copyright (c) 2011–2016 Alamofire Software Foundation ( http://alamofire.org/ )
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.

#import <Foundation/Foundation.h>

#if !TARGET_OS_WATCH
#import <SystemConfiguration/SystemConfiguration.h>

typedef NS_ENUM(NSInteger, AFNetworkReachabilityStatus) {
AFNetworkReachabilityStatusUnknown = -1,
AFNetworkReachabilityStatusNotReachable = 0,
AFNetworkReachabilityStatusReachableViaWWAN = 1,
AFNetworkReachabilityStatusReachableViaWiFi = 2,
};

NS_ASSUME_NONNULL_BEGIN

/**
`AFNetworkReachabilityManager` monitors the reachability of domains, and addresses for both WWAN and WiFi network interfaces.
Reachability can be used to determine background information about why a network operation failed, or to trigger a network operation retrying when a connection is established. It should not be used to prevent a user from initiating a network request, as it's possible that an initial request may be required to establish reachability.
See Apple's Reachability Sample Code ( https://developer.apple.com/library/ios/samplecode/reachability/ )
@warning Instances of `AFNetworkReachabilityManager` must be started with `-startMonitoring` before reachability status can be determined.
*/
@interface AFNetworkReachabilityManager : NSObject

/**
The current network reachability status.
*/
@property (readonly, nonatomic, assign) AFNetworkReachabilityStatus networkReachabilityStatus;

/**
Whether or not the network is currently reachable.
*/
@property (readonly, nonatomic, assign, getter = isReachable) BOOL reachable;

/**
Whether or not the network is currently reachable via WWAN.
*/
@property (readonly, nonatomic, assign, getter = isReachableViaWWAN) BOOL reachableViaWWAN;

/**
Whether or not the network is currently reachable via WiFi.
*/
@property (readonly, nonatomic, assign, getter = isReachableViaWiFi) BOOL reachableViaWiFi;

///---------------------
/// @name Initialization
///---------------------

/**
Returns the shared network reachability manager.
*/
+ (instancetype)sharedManager;

/**
Creates and returns a network reachability manager with the default socket address.
@return An initialized network reachability manager, actively monitoring the default socket address.
*/
+ (instancetype)manager;

/**
Creates and returns a network reachability manager for the specified domain.
@param domain The domain used to evaluate network reachability.
@return An initialized network reachability manager, actively monitoring the specified domain.
*/
+ (instancetype)managerForDomain:(NSString *)domain;

/**
Creates and returns a network reachability manager for the socket address.
@param address The socket address (`sockaddr_in6`) used to evaluate network reachability.
@return An initialized network reachability manager, actively monitoring the specified socket address.
*/
+ (instancetype)managerForAddress:(const void *)address;

/**
Initializes an instance of a network reachability manager from the specified reachability object.
@param reachability The reachability object to monitor.
@return An initialized network reachability manager, actively monitoring the specified reachability.
*/
- (instancetype)initWithReachability:(SCNetworkReachabilityRef)reachability NS_DESIGNATED_INITIALIZER;

/**
* Unavailable initializer
*/
+ (instancetype)new NS_UNAVAILABLE;

/**
* Unavailable initializer
*/
- (instancetype)init NS_UNAVAILABLE;

///--------------------------------------------------
/// @name Starting & Stopping Reachability Monitoring
///--------------------------------------------------

/**
Starts monitoring for changes in network reachability status.
*/
- (void)startMonitoring;

/**
Stops monitoring for changes in network reachability status.
*/
- (void)stopMonitoring;

///-------------------------------------------------
/// @name Getting Localized Reachability Description
///-------------------------------------------------

/**
Returns a localized string representation of the current network reachability status.
*/
- (NSString *)localizedNetworkReachabilityStatusString;

///---------------------------------------------------
/// @name Setting Network Reachability Change Callback
///---------------------------------------------------

/**
Sets a callback to be executed when the network availability of the `baseURL` host changes.
@param block A block object to be executed when the network availability of the `baseURL` host changes.. This block has no return value and takes a single argument which represents the various reachability states from the device to the `baseURL`.
*/
- (void)setReachabilityStatusChangeBlock:(nullable void (^)(AFNetworkReachabilityStatus status))block;

@end

///----------------
/// @name Constants
///----------------

/**
## Network Reachability
The following constants are provided by `AFNetworkReachabilityManager` as possible network reachability statuses.
enum {
AFNetworkReachabilityStatusUnknown,
AFNetworkReachabilityStatusNotReachable,
AFNetworkReachabilityStatusReachableViaWWAN,
AFNetworkReachabilityStatusReachableViaWiFi,
}
`AFNetworkReachabilityStatusUnknown`
The `baseURL` host reachability is not known.
`AFNetworkReachabilityStatusNotReachable`
The `baseURL` host cannot be reached.
`AFNetworkReachabilityStatusReachableViaWWAN`
The `baseURL` host can be reached via a cellular connection, such as EDGE or GPRS.
`AFNetworkReachabilityStatusReachableViaWiFi`
The `baseURL` host can be reached via a Wi-Fi connection.
### Keys for Notification UserInfo Dictionary
Strings that are used as keys in a `userInfo` dictionary in a network reachability status change notification.
`AFNetworkingReachabilityNotificationStatusItem`
A key in the userInfo dictionary in a `AFNetworkingReachabilityDidChangeNotification` notification.
The corresponding value is an `NSNumber` object representing the `AFNetworkReachabilityStatus` value for the current reachability status.
*/

///--------------------
/// @name Notifications
///--------------------

/**
Posted when network reachability changes.
This notification assigns no notification object. The `userInfo` dictionary contains an `NSNumber` object under the `AFNetworkingReachabilityNotificationStatusItem` key, representing the `AFNetworkReachabilityStatus` value for the current network reachability.
@warning In order for network reachability to be monitored, include the `SystemConfiguration` framework in the active target's "Link Binary With Library" build phase, and add `#import <SystemConfiguration/SystemConfiguration.h>` to the header prefix of the project (`Prefix.pch`).
*/
FOUNDATION_EXPORT NSString * const AFNetworkingReachabilityDidChangeNotification;
FOUNDATION_EXPORT NSString * const AFNetworkingReachabilityNotificationStatusItem;

///--------------------
/// @name Functions
///--------------------

/**
Returns a localized string representation of an `AFNetworkReachabilityStatus` value.
*/
FOUNDATION_EXPORT NSString * AFStringFromNetworkReachabilityStatus(AFNetworkReachabilityStatus status);

NS_ASSUME_NONNULL_END
#endif
Loading

0 comments on commit 7d21cf7

Please sign in to comment.