Skip to content

Commit 6826486

Browse files
committed
适配RN V0.29之后的url方式
1 parent 5ffe323 commit 6826486

25 files changed

+75
-1803
lines changed

.DS_Store

-2 KB
Binary file not shown.

DebugServerHost.podspec

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
#
2+
# Be sure to run `pod lib lint DebugServerHost.podspec' to ensure this is a
3+
# valid spec before submitting.
4+
#
5+
# Any lines starting with a # are optional, but their use is encouraged
6+
# To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html
7+
#
8+
9+
Pod::Spec.new do |s|
10+
s.name = 'DebugServerHost'
11+
s.version = '0.1.0'
12+
s.summary = 'React Native Debug server host for iOS'
13+
14+
# This description is used to generate tags and improve search results.
15+
# * Think: What does it do? Why did you write it? What is the focus?
16+
# * Try to keep it short, snappy and to the point.
17+
# * Write the description between the DESC delimiters below.
18+
# * Finally, don't worry about the indent, CocoaPods strips it!
19+
20+
s.description = <<-DESC
21+
React Native Debug server host for iOS
22+
DESC
23+
24+
s.homepage = 'https://github.com/xuwening/react-native-debug-server-host'
25+
# s.screenshots = 'www.example.com/screenshots_1', 'www.example.com/screenshots_2'
26+
s.license = { :type => 'MIT', :file => 'LICENSE' }
27+
s.author = { 'xuwening' => 'xuwening@126.com' }
28+
s.source = { :git => 'git@github.com:xuwening/react-native-debug-server-host.git', :tag => s.version.to_s }
29+
# s.social_media_url = 'https://twitter.com/<TWITTER_USERNAME>'
30+
31+
s.ios.deployment_target = '8.0'
32+
33+
s.source_files = 'DebugServerHost/Classes/**/*'
34+
35+
# s.resource_bundles = {
36+
# 'DebugServerHost' => ['DebugServerHost/Assets/*.png']
37+
# }
38+
39+
# s.public_header_files = 'Pod/Classes/**/*.h'
40+
# s.frameworks = 'UIKit', 'MapKit'
41+
s.dependency 'QRCodeReaderViewController'
42+
end

DebugServerHost/.DS_Store

6 KB
Binary file not shown.

DebugServerHost/Assets/.gitkeep

Whitespace-only changes.

DebugServerHost/Classes/.DS_Store

6 KB
Binary file not shown.

DebugServerHost/Classes/.gitkeep

Whitespace-only changes.

DebugServerHost/DevServerAddrViewController.m renamed to DebugServerHost/Classes/DevServerAddrViewController.m

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,22 @@ @implementation DevServerAddrViewController
2121
-(void)viewDidLoad {
2222

2323
[self.view addSubview: self.urlTextField];
24-
[self.view addSubview: self.qrScanButton];
24+
// [self.view addSubview: self.qrScanButton];
2525
[self.view addSubview: self.cancelButton];
2626
[self.view addSubview: self.okButton];
2727

2828
self.view.backgroundColor = [UIColor whiteColor];
2929

30-
self.urlTextField.text = [[NSUserDefaults standardUserDefaults] objectForKey:@"RCT_SERVER_ADDR_URL"] ? : @"";
30+
// self.urlTextField.text = [[NSUserDefaults standardUserDefaults] objectForKey:@"RCT_SERVER_ADDR_URL"] ? : @"";
31+
32+
UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapAction:)];
33+
[self.view addGestureRecognizer: tap];
3134
}
3235

36+
-(IBAction)tapAction:(id)sender {
37+
38+
[self.urlTextField resignFirstResponder];
39+
}
3340

3441
-(UITextField *)urlTextField {
3542
if (_urlTextField == nil) {
@@ -39,6 +46,7 @@ -(UITextField *)urlTextField {
3946
_urlTextField = [[UITextField alloc] initWithFrame: rect];
4047
_urlTextField.borderStyle = UITextBorderStyleRoundedRect;
4148
_urlTextField.placeholder = @"Input URL manual";
49+
_urlTextField.text = [[NSUserDefaults standardUserDefaults] stringForKey:@"RCT_jsLocation"];
4250
// _urlTextField.backgroundColor = [UIColor redColor];
4351
}
4452

@@ -95,7 +103,7 @@ -(IBAction)okAction:(id)sender {
95103

96104
NSString *url = [_urlTextField.text stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]];
97105

98-
[[NSUserDefaults standardUserDefaults] setObject:url forKey:@"RCT_SERVER_ADDR_URL"];
106+
[[NSUserDefaults standardUserDefaults] setObject:url forKey:@"RCT_jsLocation"];
99107
[[NSUserDefaults standardUserDefaults] synchronize];
100108

101109
[self dismissViewControllerAnimated:YES completion:^{

DebugServerHost/DevServerAddr.h

Lines changed: 0 additions & 13 deletions
This file was deleted.

DebugServerHost/DevServerAddr.m

Lines changed: 0 additions & 89 deletions
This file was deleted.

DebugServerHost/DevServerAddrManager.h

Lines changed: 0 additions & 19 deletions
This file was deleted.

DebugServerHost/DevServerAddrManager.m

Lines changed: 0 additions & 65 deletions
This file was deleted.

DebugServerHost/QRCodeReaderViewController/QRCameraSwitchButton.h

Lines changed: 0 additions & 66 deletions
This file was deleted.

0 commit comments

Comments
 (0)