浏览代码

[WIP] Download zipped game resource file: iOS

Pal Lockheart 7 年之前
父节点
当前提交
63f20a7aa1

+ 3 - 0
ios/SDLPal/Podfile

@@ -1,2 +1,5 @@
 target 'SDLPal'
+use_frameworks!
 pod 'ActionSheetPicker-3.0', '~> 2.2.0'
+pod 'AFNetworking', '~> 3.0'
+pod 'SSZipArchive'

+ 21 - 1
ios/SDLPal/Podfile.lock

@@ -1,12 +1,32 @@
 PODS:
   - ActionSheetPicker-3.0 (2.2.0)
+  - AFNetworking (3.1.0):
+    - AFNetworking/NSURLSession (= 3.1.0)
+    - AFNetworking/Reachability (= 3.1.0)
+    - AFNetworking/Security (= 3.1.0)
+    - AFNetworking/Serialization (= 3.1.0)
+    - AFNetworking/UIKit (= 3.1.0)
+  - AFNetworking/NSURLSession (3.1.0):
+    - AFNetworking/Reachability
+    - AFNetworking/Security
+    - AFNetworking/Serialization
+  - AFNetworking/Reachability (3.1.0)
+  - AFNetworking/Security (3.1.0)
+  - AFNetworking/Serialization (3.1.0)
+  - AFNetworking/UIKit (3.1.0):
+    - AFNetworking/NSURLSession
+  - SSZipArchive (1.6.2)
 
 DEPENDENCIES:
   - ActionSheetPicker-3.0 (~> 2.2.0)
+  - AFNetworking (~> 3.0)
+  - SSZipArchive
 
 SPEC CHECKSUMS:
   ActionSheetPicker-3.0: d11a4c12c6aaf704b8a3f56d179198c99f3e41e6
+  AFNetworking: 5e0e199f73d8626b11e79750991f5d173d1f8b67
+  SSZipArchive: 428eb1ac8d37dd133404d30f422b23958c1f9acc
 
-PODFILE CHECKSUM: cb0e67e3620d915f68ac1b0695b9a096f64afba1
+PODFILE CHECKSUM: 9b14772d94af9cfd9292cff7075737b77a8823aa
 
 COCOAPODS: 1.2.0

+ 12 - 6
ios/SDLPal/SDLPal.xcodeproj/project.pbxproj

@@ -97,8 +97,10 @@
 		71AA35801A0BCA4E00793FFF /* util.mm in Sources */ = {isa = PBXBuildFile; fileRef = 71AA357F1A0BCA4E00793FFF /* util.mm */; };
 		71DCB6961ED9CBB000F120DB /* aviplay.c in Sources */ = {isa = PBXBuildFile; fileRef = 71DCB6941ED9CBB000F120DB /* aviplay.c */; };
 		71DCB6991ED9CCFE00F120DB /* GameController.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C622BE731E474CE2000C8970 /* GameController.framework */; };
+		AF3C0D1876FE5963AEC8C171 /* Pods_SDLPal.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2CE88E13A6D270C55171A0A6 /* Pods_SDLPal.framework */; };
 		C60441781ED9AF3C006C7A7C /* Settings.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = C604417A1ED9AF3C006C7A7C /* Settings.storyboard */; };
 		C6153B9D1EEE2ECD00DFFCAA /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = C6153B9F1EEE2ECD00DFFCAA /* Localizable.strings */; };
+		C6153BAA1EEFB98500DFFCAA /* SPWebViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = C6153BA91EEFB98500DFFCAA /* SPWebViewController.m */; };
 		C622BE661E474B5E000C8970 /* audio.c in Sources */ = {isa = PBXBuildFile; fileRef = C622BE641E474B5E000C8970 /* audio.c */; };
 		C622BE6C1E474C01000C8970 /* palcfg.c in Sources */ = {isa = PBXBuildFile; fileRef = C622BE6A1E474C01000C8970 /* palcfg.c */; };
 		C622BE701E474CA9000C8970 /* overlay.c in Sources */ = {isa = PBXBuildFile; fileRef = C622BE6F1E474CA9000C8970 /* overlay.c */; };
@@ -113,7 +115,6 @@
 		C6743A841ECCAFA700AEF782 /* SettingsTableViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = C6743A831ECCAFA700AEF782 /* SettingsTableViewController.m */; };
 		C694CF871EB6197C0006F937 /* gs_instruments.dls in Resources */ = {isa = PBXBuildFile; fileRef = C694CF861EB619660006F937 /* gs_instruments.dls */; };
 		C6E974A21E49C24500F76B17 /* libSDL2.a in Frameworks */ = {isa = PBXBuildFile; fileRef = C6E9749D1E49C22D00F76B17 /* libSDL2.a */; };
-		F9BC4A0C6F1B983EB45414F3 /* libPods-SDLPal.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 2765B76B4AC93B4F654F1289 /* libPods-SDLPal.a */; };
 /* End PBXBuildFile section */
 
 /* Begin PBXContainerItemProxy section */
@@ -141,7 +142,7 @@
 /* End PBXContainerItemProxy section */
 
 /* Begin PBXFileReference section */
-		2765B76B4AC93B4F654F1289 /* libPods-SDLPal.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-SDLPal.a"; sourceTree = BUILT_PRODUCTS_DIR; };
+		2CE88E13A6D270C55171A0A6 /* Pods_SDLPal.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_SDLPal.framework; sourceTree = BUILT_PRODUCTS_DIR; };
 		57FB00E81B7A4FEA005FCF4C /* dbemuopl.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = dbemuopl.cpp; sourceTree = "<group>"; };
 		57FB00E91B7A4FEA005FCF4C /* dbemuopl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = dbemuopl.h; sourceTree = "<group>"; };
 		57FB00EA1B7A4FEA005FCF4C /* dbopl.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = dbopl.cpp; sourceTree = "<group>"; };
@@ -352,6 +353,8 @@
 		C6153B9E1EEE2ECD00DFFCAA /* Base */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = Base; path = Base.lproj/Localizable.strings; sourceTree = "<group>"; };
 		C6153BA01EEE2ED300DFFCAA /* zh-Hant */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hant"; path = "zh-Hant.lproj/Localizable.strings"; sourceTree = "<group>"; };
 		C6153BA11EEE2ED600DFFCAA /* zh-Hans */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hans"; path = "zh-Hans.lproj/Localizable.strings"; sourceTree = "<group>"; };
+		C6153BA81EEFB98500DFFCAA /* SPWebViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SPWebViewController.h; sourceTree = "<group>"; };
+		C6153BA91EEFB98500DFFCAA /* SPWebViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SPWebViewController.m; sourceTree = "<group>"; };
 		C622BE4E1E474AAF000C8970 /* SDL.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = SDL.xcodeproj; path = "../../3rd/SDL/Xcode-iOS/SDL/SDL.xcodeproj"; sourceTree = "<group>"; };
 		C622BE641E474B5E000C8970 /* audio.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = audio.c; path = ../../../audio.c; sourceTree = "<group>"; };
 		C622BE651E474B5E000C8970 /* audio.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = audio.h; path = ../../../audio.h; sourceTree = "<group>"; };
@@ -394,7 +397,7 @@
 				71655061195BB372006E1227 /* UIKit.framework in Frameworks */,
 				71655063195BB372006E1227 /* Foundation.framework in Frameworks */,
 				71655065195BB372006E1227 /* CoreGraphics.framework in Frameworks */,
-				F9BC4A0C6F1B983EB45414F3 /* libPods-SDLPal.a in Frameworks */,
+				AF3C0D1876FE5963AEC8C171 /* Pods_SDLPal.framework in Frameworks */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
@@ -600,7 +603,7 @@
 				71655060195BB372006E1227 /* UIKit.framework */,
 				71655062195BB372006E1227 /* Foundation.framework */,
 				71655064195BB372006E1227 /* CoreGraphics.framework */,
-				2765B76B4AC93B4F654F1289 /* libPods-SDLPal.a */,
+				2CE88E13A6D270C55171A0A6 /* Pods_SDLPal.framework */,
 			);
 			name = Frameworks;
 			sourceTree = "<group>";
@@ -665,6 +668,8 @@
 				C6743A851ECCAFC600AEF782 /* SettingsTableViewController.h */,
 				C6743A831ECCAFA700AEF782 /* SettingsTableViewController.m */,
 				C6153B9F1EEE2ECD00DFFCAA /* Localizable.strings */,
+				C6153BA81EEFB98500DFFCAA /* SPWebViewController.h */,
+				C6153BA91EEFB98500DFFCAA /* SPWebViewController.m */,
 			);
 			name = "Supporting Files";
 			path = SDLPal;
@@ -1043,6 +1048,7 @@
 				57FB01491B7A50B0005FCF4C /* floor1.c in Sources */,
 				71655281195BB6DB006E1227 /* play.c in Sources */,
 				71655282195BB6DB006E1227 /* res.c in Sources */,
+				C6153BAA1EEFB98500DFFCAA /* SPWebViewController.m in Sources */,
 				71655283195BB6DB006E1227 /* rixplay.cpp in Sources */,
 				71655284195BB6DB006E1227 /* rngplay.c in Sources */,
 				71655285195BB6DB006E1227 /* scene.c in Sources */,
@@ -1177,6 +1183,7 @@
 					../../,
 					../../liboggvorbis/include,
 					../../liboggvorbis/src,
+					"\"${PODS_ROOT}\"/**",
 				);
 				INFOPLIST_FILE = "SDLPal/SDLPal-Info.plist";
 				INIT_ROUTINE = "";
@@ -1184,7 +1191,6 @@
 				OTHER_LDFLAGS = (
 					"$(inherited)",
 					"-ObjC",
-					"-l\"ActionSheetPicker-3.0\"",
 					"-framework",
 					"\"UIKit\"",
 					"-Wl,-e,_sdlpal_main",
@@ -1219,6 +1225,7 @@
 					../../,
 					../../liboggvorbis/include,
 					../../liboggvorbis/src,
+					"\"${PODS_ROOT}\"/**",
 				);
 				INFOPLIST_FILE = "SDLPal/SDLPal-Info.plist";
 				INIT_ROUTINE = "";
@@ -1226,7 +1233,6 @@
 				OTHER_LDFLAGS = (
 					"$(inherited)",
 					"-ObjC",
-					"-l\"ActionSheetPicker-3.0\"",
 					"-framework",
 					"\"UIKit\"",
 					"-Wl,-e,_sdlpal_main",

+ 22 - 1
ios/SDLPal/SDLPal/Base.lproj/Settings.storyboard

@@ -616,6 +616,7 @@
                         <outlet property="toggleSurroundOPL" destination="YBD-8I-fzH" id="fbs-J6-e6Z"/>
                         <outlet property="toggleTouchScreenOverlay" destination="ko1-dc-Oae" id="Z2D-hm-7Ax"/>
                         <outlet property="transitionView" destination="Pwb-Li-avz" id="ZFM-WI-3U5"/>
+                        <segue destination="tAk-RF-FG0" kind="show" identifier="showWebView" id="qS3-4k-aBG"/>
                     </connections>
                 </tableViewController>
                 <placeholder placeholderIdentifier="IBFirstResponder" id="hs4-N9-FQA" userLabel="First Responder" sceneMemberID="firstResponder"/>
@@ -625,7 +626,27 @@
                     <color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
                 </view>
             </objects>
-            <point key="canvasLocation" x="-160.1449275362319" y="17.52717391304348"/>
+            <point key="canvasLocation" x="-94" y="18"/>
+        </scene>
+        <!--Web View Controller-->
+        <scene sceneID="glU-yY-Ydv">
+            <objects>
+                <viewController id="tAk-RF-FG0" customClass="SPWebViewController" sceneMemberID="viewController">
+                    <webView key="view" contentMode="scaleToFill" id="ocs-cb-56O">
+                        <rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
+                        <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
+                        <color key="backgroundColor" red="0.36078431370000003" green="0.38823529410000002" blue="0.4039215686" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
+                        <connections>
+                            <outlet property="delegate" destination="tAk-RF-FG0" id="BnT-Jw-nOU"/>
+                        </connections>
+                    </webView>
+                    <connections>
+                        <outlet property="webView" destination="ocs-cb-56O" id="8w7-UK-yG2"/>
+                    </connections>
+                </viewController>
+                <placeholder placeholderIdentifier="IBFirstResponder" id="f0c-K7-tMQ" userLabel="First Responder" sceneMemberID="firstResponder"/>
+            </objects>
+            <point key="canvasLocation" x="698" y="18"/>
         </scene>
     </scenes>
 </document>

+ 5 - 0
ios/SDLPal/SDLPal/SDLPal-Info.plist

@@ -24,6 +24,11 @@
 	<string>1.0</string>
 	<key>LSRequiresIPhoneOS</key>
 	<false/>
+	<key>NSAppTransportSecurity</key>
+	<dict>
+		<key>NSAllowsArbitraryLoads</key>
+		<true/>
+	</dict>
 	<key>UIFileSharingEnabled</key>
 	<true/>
 	<key>UIRequiresFullScreen</key>

+ 19 - 0
ios/SDLPal/SDLPal/SPWebViewController.h

@@ -0,0 +1,19 @@
+//
+//  SPWebViewController.h
+//  SDLPal
+//
+//  Created by palxex on 2017/6/13.
+//  Copyright © 2017年 SDLPAL team. All rights reserved.
+//
+
+#import <UIKit/UIKit.h>
+#import "SettingsTableViewController.h"
+
+@interface SPWebViewController : UIViewController
+
+@property (weak, nonatomic) id<WebCaptureProtocol> delegate;
+
+@property (assign, nonatomic) NSString *url;
+@property (assign, nonatomic) NSString *signature;
+
+@end

+ 56 - 0
ios/SDLPal/SDLPal/SPWebViewController.m

@@ -0,0 +1,56 @@
+//
+//  SPWebViewController.m
+//  SDLPal
+//
+//  Created by palxex on 2017/6/13.
+//  Copyright © 2017年 SDLPAL team. All rights reserved.
+//
+
+#import "SPWebViewController.h"
+#define UIKitLocalizedString(key) [[NSBundle bundleWithIdentifier:@"com.apple.UIKit"] localizedStringForKey:key value:@"" table:nil]
+
+@interface SPWebViewController ()<UIWebViewDelegate>
+
+@property (strong, nonatomic) IBOutlet UIWebView *webView;
+
+@end
+
+@implementation SPWebViewController
+
+- (void)viewDidLoad {
+    [super viewDidLoad];
+    // Do any additional setup after loading the view.
+    [self.webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:self.url]]];
+    [[UIApplication sharedApplication] setNetworkActivityIndicatorVisible:YES];
+}
+
+- (void)didReceiveMemoryWarning {
+    [super didReceiveMemoryWarning];
+    // Dispose of any resources that can be recreated.
+}
+
+- (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType{
+    if( [request.URL.path containsString:self.signature] ) {
+        [self.navigationController popViewControllerAnimated:YES];
+        [self.delegate capturedURL:request.URL];
+        return NO;
+    }
+    return YES;
+}
+
+- (void)webViewDidFinishLoad:(UIWebView *)webView {
+    [[UIApplication sharedApplication] setNetworkActivityIndicatorVisible:NO];
+    [self setTitle:[self.webView stringByEvaluatingJavaScriptFromString:@"document.title"]];
+}
+
+/*
+#pragma mark - Navigation
+
+// In a storyboard-based application, you will often want to do a little preparation before navigation
+- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
+    // Get the new view controller using [segue destinationViewController].
+    // Pass the selected object to the new view controller.
+}
+*/
+
+@end

+ 7 - 1
ios/SDLPal/SDLPal/SettingsTableViewController.h

@@ -11,7 +11,13 @@
 
 #import <UIKit/UIKit.h>
 
-@interface SettingsTableViewController : UITableViewController {
+@protocol WebCaptureProtocol
+
+- (void)capturedURL:(NSURL *)url;
+
+@end
+
+@interface SettingsTableViewController : UITableViewController<WebCaptureProtocol> {
     
 }
 @end

文件差异内容过多而无法显示
+ 149 - 15
ios/SDLPal/SDLPal/SettingsTableViewController.m


文件差异内容过多而无法显示
+ 12 - 1
ios/SDLPal/SDLPal/zh-Hans.lproj/Localizable.strings


文件差异内容过多而无法显示
+ 12 - 1
ios/SDLPal/SDLPal/zh-Hant.lproj/Localizable.strings