Ifd_Mobile 1.1.0 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/Ifd_Mobile/methods/core.rb +10 -2
- data/lib/Ifd_Mobile/version.rb +1 -1
- data/project/features/TestData/globalData.yml +2 -0
- data/project/features/TestSuite/login.feature +1 -0
- data/project/features/support/env.rb +3 -0
- metadata +2 -33
- data/project/apps/TestApp/Default-568h@2x.png +0 -0
- data/project/apps/TestApp/Test App 2/GestureTestViewController.h +0 -18
- data/project/apps/TestApp/Test App 2/GestureTestViewController.m +0 -48
- data/project/apps/TestApp/Test App 2/GestureTestViewController.xib +0 -47
- data/project/apps/TestApp/Test App 2/MyViewControllerViewController.h +0 -42
- data/project/apps/TestApp/Test App 2/MyViewControllerViewController.m +0 -193
- data/project/apps/TestApp/Test App 2/TA2AppDelegate.h +0 -28
- data/project/apps/TestApp/Test App 2/TA2AppDelegate.m +0 -85
- data/project/apps/TestApp/Test App 2/TestApp-Info.plist +0 -40
- data/project/apps/TestApp/Test App 2/TestApp-Prefix.pch +0 -29
- data/project/apps/TestApp/Test App 2/en.lproj/InfoPlist.strings +0 -21
- data/project/apps/TestApp/Test App 2/en.lproj/Localizable.strings +0 -0
- data/project/apps/TestApp/Test App 2/en.lproj/MyViewControllerViewController.xib +0 -175
- data/project/apps/TestApp/Test App 2/main.m +0 -31
- data/project/apps/TestApp/TestApp.xcodeproj/project.pbxproj +0 -336
- data/project/apps/TestApp/TestApp.xcodeproj/project.xcworkspace/contents.xcworkspacedata +0 -7
- data/project/apps/TestApp/TestApp.xcodeproj/project.xcworkspace/xcuserdata/anhpham.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
- data/project/apps/TestApp/TestApp.xcodeproj/xcuserdata/anhpham.xcuserdatad/xcschemes/TestApp.xcscheme +0 -88
- data/project/apps/TestApp/TestApp.xcodeproj/xcuserdata/anhpham.xcuserdatad/xcschemes/xcschememanagement.plist +0 -22
- data/project/apps/TestApp/build/release-iphonesimulator/TestApp.app/Default-568h@2x.png +0 -0
- data/project/apps/TestApp/build/release-iphonesimulator/TestApp.app/GestureTestViewController.nib/objects-8.0+.nib +0 -0
- data/project/apps/TestApp/build/release-iphonesimulator/TestApp.app/GestureTestViewController.nib/objects.nib +0 -0
- data/project/apps/TestApp/build/release-iphonesimulator/TestApp.app/GestureTestViewController.nib/runtime.nib +0 -0
- data/project/apps/TestApp/build/release-iphonesimulator/TestApp.app/Info.plist +0 -0
- data/project/apps/TestApp/build/release-iphonesimulator/TestApp.app/PkgInfo +0 -1
- data/project/apps/TestApp/build/release-iphonesimulator/TestApp.app/TestApp +0 -0
- data/project/apps/TestApp/build/release-iphonesimulator/TestApp.app/en.lproj/InfoPlist.strings +0 -0
- data/project/apps/TestApp/build/release-iphonesimulator/TestApp.app/en.lproj/Localizable.strings +0 -0
- data/project/apps/TestApp/build/release-iphonesimulator/TestApp.app/en.lproj/MyViewControllerViewController.nib/objects-8.0+.nib +0 -0
- data/project/apps/TestApp/build/release-iphonesimulator/TestApp.app/en.lproj/MyViewControllerViewController.nib/objects.nib +0 -0
- data/project/apps/TestApp/build/release-iphonesimulator/TestApp.app/en.lproj/MyViewControllerViewController.nib/runtime.nib +0 -0
- data/project/apps/selendroid-test-app.apk +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f9c76418d2937cd4dc2d5f11b2ffa6f13eeaae50
|
4
|
+
data.tar.gz: c2ed895927e0e2352fac430d43899773ed3e8950
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b035e739edf3b320481c33eb08a5b3feba98633cf463fb0e4626608fabaeabc72458c0c18f63740b1e2d5413421f982766bb965bfccf417cbe271bbeb10a8e4d
|
7
|
+
data.tar.gz: fa1beff164dc4da971fc4f0945ed6751b238e7aaa4aa8ca2d820150477f8869b77fc6d1758c906ee45ac90ce92d87daacc2904f33c01a7902ff9edfcefc7d260
|
@@ -8,7 +8,6 @@ def put_log str
|
|
8
8
|
end
|
9
9
|
|
10
10
|
def find_object string_object
|
11
|
-
object = YAML.load_file("#{File.expand_path(File.dirname(__FILE__) + '/..')}/step_definitions/repositories/project_object.yml")
|
12
11
|
string_object = string_object.gsub(/"/, "'")
|
13
12
|
# puts string_object
|
14
13
|
locator_matching = /(.*?)(\{.*?\})/.match(string_object)
|
@@ -20,7 +19,7 @@ def find_object string_object
|
|
20
19
|
dyn_pros[k.to_s.upcase] = v
|
21
20
|
}
|
22
21
|
end
|
23
|
-
hash_object =
|
22
|
+
hash_object = $OBJECT[string_object]
|
24
23
|
puts hash_object
|
25
24
|
if hash_object == nil
|
26
25
|
put_log ">>> OBJECT NAME MAYBE NOT FOUND!!!"
|
@@ -231,3 +230,12 @@ end
|
|
231
230
|
def move_home
|
232
231
|
selenium.key_event 3
|
233
232
|
end
|
233
|
+
|
234
|
+
def data(name)
|
235
|
+
require 'yaml'
|
236
|
+
begin
|
237
|
+
return $globalData["#{name}"]
|
238
|
+
rescue Exception
|
239
|
+
return name
|
240
|
+
end
|
241
|
+
end
|
data/lib/Ifd_Mobile/version.rb
CHANGED
@@ -17,6 +17,9 @@ $_CONFIG = Hash.new
|
|
17
17
|
PROJECT_CONFIG = YAML.load_file("#{$current_dir}/project_config.yml")
|
18
18
|
$_CONFIG['Print Log'] = true
|
19
19
|
$_CONFIG['Wait Time'] = PROJECT_CONFIG["wait_time"]
|
20
|
+
$OBJECT = YAML.load_file("#{$base_dir}/features/step_definitions/repositories/project_object.yml")
|
21
|
+
$test_data_dir = $base_dir + '/features/TestData/'
|
22
|
+
$globalData = YAML.load_file("#{$test_data_dir}/globalData.yml")
|
20
23
|
|
21
24
|
|
22
25
|
class AppiumWorld
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: Ifd_Mobile
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Anh Pham
|
@@ -84,43 +84,12 @@ files:
|
|
84
84
|
- bin/generate.rb
|
85
85
|
- bin/helper.rb
|
86
86
|
- bin/Ifd_Mobile
|
87
|
-
- project/apps/selendroid-test-app.apk
|
88
|
-
- project/apps/TestApp/build/release-iphonesimulator/TestApp.app/Default-568h@2x.png
|
89
|
-
- project/apps/TestApp/build/release-iphonesimulator/TestApp.app/en.lproj/InfoPlist.strings
|
90
|
-
- project/apps/TestApp/build/release-iphonesimulator/TestApp.app/en.lproj/Localizable.strings
|
91
|
-
- project/apps/TestApp/build/release-iphonesimulator/TestApp.app/en.lproj/MyViewControllerViewController.nib/objects-8.0+.nib
|
92
|
-
- project/apps/TestApp/build/release-iphonesimulator/TestApp.app/en.lproj/MyViewControllerViewController.nib/objects.nib
|
93
|
-
- project/apps/TestApp/build/release-iphonesimulator/TestApp.app/en.lproj/MyViewControllerViewController.nib/runtime.nib
|
94
|
-
- project/apps/TestApp/build/release-iphonesimulator/TestApp.app/GestureTestViewController.nib/objects-8.0+.nib
|
95
|
-
- project/apps/TestApp/build/release-iphonesimulator/TestApp.app/GestureTestViewController.nib/objects.nib
|
96
|
-
- project/apps/TestApp/build/release-iphonesimulator/TestApp.app/GestureTestViewController.nib/runtime.nib
|
97
|
-
- project/apps/TestApp/build/release-iphonesimulator/TestApp.app/Info.plist
|
98
|
-
- project/apps/TestApp/build/release-iphonesimulator/TestApp.app/PkgInfo
|
99
|
-
- project/apps/TestApp/build/release-iphonesimulator/TestApp.app/TestApp
|
100
|
-
- project/apps/TestApp/Default-568h@2x.png
|
101
|
-
- project/apps/TestApp/Test App 2/en.lproj/InfoPlist.strings
|
102
|
-
- project/apps/TestApp/Test App 2/en.lproj/Localizable.strings
|
103
|
-
- project/apps/TestApp/Test App 2/en.lproj/MyViewControllerViewController.xib
|
104
|
-
- project/apps/TestApp/Test App 2/GestureTestViewController.h
|
105
|
-
- project/apps/TestApp/Test App 2/GestureTestViewController.m
|
106
|
-
- project/apps/TestApp/Test App 2/GestureTestViewController.xib
|
107
|
-
- project/apps/TestApp/Test App 2/main.m
|
108
|
-
- project/apps/TestApp/Test App 2/MyViewControllerViewController.h
|
109
|
-
- project/apps/TestApp/Test App 2/MyViewControllerViewController.m
|
110
|
-
- project/apps/TestApp/Test App 2/TA2AppDelegate.h
|
111
|
-
- project/apps/TestApp/Test App 2/TA2AppDelegate.m
|
112
|
-
- project/apps/TestApp/Test App 2/TestApp-Info.plist
|
113
|
-
- project/apps/TestApp/Test App 2/TestApp-Prefix.pch
|
114
|
-
- project/apps/TestApp/TestApp.xcodeproj/project.pbxproj
|
115
|
-
- project/apps/TestApp/TestApp.xcodeproj/project.xcworkspace/contents.xcworkspacedata
|
116
|
-
- project/apps/TestApp/TestApp.xcodeproj/project.xcworkspace/xcuserdata/anhpham.xcuserdatad/UserInterfaceState.xcuserstate
|
117
|
-
- project/apps/TestApp/TestApp.xcodeproj/xcuserdata/anhpham.xcuserdatad/xcschemes/TestApp.xcscheme
|
118
|
-
- project/apps/TestApp/TestApp.xcodeproj/xcuserdata/anhpham.xcuserdatad/xcschemes/xcschememanagement.plist
|
119
87
|
- project/features/step_definitions/lib_steps/step_demo.rb
|
120
88
|
- project/features/step_definitions/repositories/project_object.yml
|
121
89
|
- project/features/support/env.rb
|
122
90
|
- project/features/support/hooks.rb
|
123
91
|
- project/features/support/project_config.yml
|
92
|
+
- project/features/TestData/globalData.yml
|
124
93
|
- project/features/TestSuite/login.feature
|
125
94
|
- project/Gemfile
|
126
95
|
- project/Gemfile.lock
|
Binary file
|
@@ -1,18 +0,0 @@
|
|
1
|
-
//
|
2
|
-
// GestureTestViewController.h
|
3
|
-
// TestApp
|
4
|
-
//
|
5
|
-
// Created by ThinkSys- Amit on 12/07/13.
|
6
|
-
//
|
7
|
-
//
|
8
|
-
|
9
|
-
#import <UIKit/UIKit.h>
|
10
|
-
#import <MapKit/MapKit.h>
|
11
|
-
|
12
|
-
@interface GestureTestViewController : UIViewController<UIGestureRecognizerDelegate>
|
13
|
-
@property (retain, nonatomic) IBOutlet MKMapView *mapView;
|
14
|
-
|
15
|
-
|
16
|
-
- (IBAction)handleRotation:(UIRotationGestureRecognizer*)sender;
|
17
|
-
|
18
|
-
@end
|
@@ -1,48 +0,0 @@
|
|
1
|
-
//
|
2
|
-
// GestureTestViewController.m
|
3
|
-
// TestApp
|
4
|
-
//
|
5
|
-
// Created by ThinkSys- Amit on 12/07/13.
|
6
|
-
//
|
7
|
-
//
|
8
|
-
|
9
|
-
#import "GestureTestViewController.h"
|
10
|
-
|
11
|
-
@interface GestureTestViewController ()
|
12
|
-
|
13
|
-
@end
|
14
|
-
|
15
|
-
@implementation GestureTestViewController
|
16
|
-
|
17
|
-
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
|
18
|
-
{
|
19
|
-
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
|
20
|
-
if (self) {
|
21
|
-
// Custom initialization
|
22
|
-
}
|
23
|
-
return self;
|
24
|
-
}
|
25
|
-
|
26
|
-
- (void)viewDidLoad
|
27
|
-
{
|
28
|
-
[super viewDidLoad];
|
29
|
-
// Do any additional setup after loading the view from its nib.
|
30
|
-
}
|
31
|
-
|
32
|
-
- (void)didReceiveMemoryWarning
|
33
|
-
{
|
34
|
-
[super didReceiveMemoryWarning];
|
35
|
-
// Dispose of any resources that can be recreated.
|
36
|
-
}
|
37
|
-
|
38
|
-
- (IBAction)handleRotation:(UIRotationGestureRecognizer*)sender
|
39
|
-
{
|
40
|
-
NSLog(@"Rotation Starts");
|
41
|
-
sender.view.transform = CGAffineTransformRotate(sender.view.transform, sender.rotation);
|
42
|
-
sender.rotation = 0;
|
43
|
-
}
|
44
|
-
- (void)dealloc {
|
45
|
-
[_mapView release];
|
46
|
-
[super dealloc];
|
47
|
-
}
|
48
|
-
@end
|
@@ -1,47 +0,0 @@
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
2
|
-
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="4514" systemVersion="12F45" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES">
|
3
|
-
<dependencies>
|
4
|
-
<deployment defaultVersion="1552" identifier="iOS"/>
|
5
|
-
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="3747"/>
|
6
|
-
</dependencies>
|
7
|
-
<objects>
|
8
|
-
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="GestureTestViewController">
|
9
|
-
<connections>
|
10
|
-
<outlet property="mapView" destination="4" id="24"/>
|
11
|
-
<outlet property="view" destination="1" id="3"/>
|
12
|
-
</connections>
|
13
|
-
</placeholder>
|
14
|
-
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
|
15
|
-
<view contentMode="scaleToFill" id="1">
|
16
|
-
<rect key="frame" x="0.0" y="0.0" width="320" height="568"/>
|
17
|
-
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
18
|
-
<subviews>
|
19
|
-
<mapView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" mapType="standard" showsUserLocation="YES" translatesAutoresizingMaskIntoConstraints="NO" id="4">
|
20
|
-
<rect key="frame" x="35" y="83" width="250" height="250"/>
|
21
|
-
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
22
|
-
<gestureRecognizers/>
|
23
|
-
<constraints>
|
24
|
-
<constraint firstAttribute="width" constant="250" id="18"/>
|
25
|
-
<constraint firstAttribute="height" constant="250" id="20"/>
|
26
|
-
</constraints>
|
27
|
-
<connections>
|
28
|
-
<outletCollection property="gestureRecognizers" destination="14" appends="YES" id="15"/>
|
29
|
-
</connections>
|
30
|
-
</mapView>
|
31
|
-
</subviews>
|
32
|
-
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
|
33
|
-
<constraints>
|
34
|
-
<constraint firstItem="4" firstAttribute="top" secondItem="1" secondAttribute="top" constant="83" id="22"/>
|
35
|
-
<constraint firstItem="4" firstAttribute="centerX" secondItem="1" secondAttribute="centerX" id="23"/>
|
36
|
-
</constraints>
|
37
|
-
<simulatedStatusBarMetrics key="simulatedStatusBarMetrics"/>
|
38
|
-
<simulatedScreenMetrics key="simulatedDestinationMetrics" type="retina4"/>
|
39
|
-
</view>
|
40
|
-
<rotationGestureRecognizer id="14">
|
41
|
-
<connections>
|
42
|
-
<action selector="handleRotation:" destination="-1" id="16"/>
|
43
|
-
<outlet property="delegate" destination="-1" id="25"/>
|
44
|
-
</connections>
|
45
|
-
</rotationGestureRecognizer>
|
46
|
-
</objects>
|
47
|
-
</document>
|
@@ -1,42 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* Copyright 2012 Appium Committers
|
3
|
-
*
|
4
|
-
* Licensed to the Apache Software Foundation (ASF) under one
|
5
|
-
* or more contributor license agreements. See the NOTICE file
|
6
|
-
* distributed with this work for additional information
|
7
|
-
* regarding copyright ownership. The ASF licenses this file
|
8
|
-
* to you under the Apache License, Version 2.0 (the
|
9
|
-
* "License"); you may not use this file except in compliance
|
10
|
-
* with the License. You may obtain a copy of the License at
|
11
|
-
*
|
12
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
13
|
-
*
|
14
|
-
* Unless required by applicable law or agreed to in writing,
|
15
|
-
* software distributed under the License is distributed on an
|
16
|
-
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
17
|
-
* KIND, either express or implied. See the License for the
|
18
|
-
* specific language governing permissions and limitations
|
19
|
-
* under the License.
|
20
|
-
*/
|
21
|
-
|
22
|
-
#import <UIKit/UIKit.h>
|
23
|
-
#import <CoreLocation/CoreLocation.h>
|
24
|
-
#import "GestureTestViewController.h"
|
25
|
-
|
26
|
-
@interface MyViewControllerViewController : UIViewController <UITextFieldDelegate,CLLocationManagerDelegate>
|
27
|
-
@property (retain, nonatomic) IBOutlet UITextField *firstArg;
|
28
|
-
@property (retain, nonatomic) IBOutlet UITextField *secondArg;
|
29
|
-
@property (retain, nonatomic) IBOutlet UILabel *answerLabel;
|
30
|
-
@property (retain, nonatomic) IBOutlet UISwitch *locationStatus;
|
31
|
-
@property (retain, nonatomic) IBOutlet UIButton *computeSumButton;
|
32
|
-
@property (nonatomic, retain) CLLocationManager *locationMgr;
|
33
|
-
|
34
|
-
- (IBAction)testGesture:(id)sender;
|
35
|
-
- (IBAction)computeAction:(id)sender;
|
36
|
-
- (IBAction)showAlert:(id)sender;
|
37
|
-
- (IBAction)crashApp:(id)sender;
|
38
|
-
- (BOOL)textFieldShouldReturn:(UITextField *)textField;
|
39
|
-
- (void)logLocationAuthFromTimer:(NSTimer *)timer;
|
40
|
-
- (void)logLocationAuth;
|
41
|
-
|
42
|
-
@end
|
@@ -1,193 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* Copyright 2012 Appium Committers
|
3
|
-
*
|
4
|
-
* Licensed to the Apache Software Foundation (ASF) under one
|
5
|
-
* or more contributor license agreements. See the NOTICE file
|
6
|
-
* distributed with this work for additional information
|
7
|
-
* regarding copyright ownership. The ASF licenses this file
|
8
|
-
* to you under the Apache License, Version 2.0 (the
|
9
|
-
* "License"); you may not use this file except in compliance
|
10
|
-
* with the License. You may obtain a copy of the License at
|
11
|
-
*
|
12
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
13
|
-
*
|
14
|
-
* Unless required by applicable law or agreed to in writing,
|
15
|
-
* software distributed under the License is distributed on an
|
16
|
-
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
17
|
-
* KIND, either express or implied. See the License for the
|
18
|
-
* specific language governing permissions and limitations
|
19
|
-
* under the License.
|
20
|
-
*/
|
21
|
-
|
22
|
-
#import "MyViewControllerViewController.h"
|
23
|
-
#import <AddressBook/AddressBook.h>
|
24
|
-
#import <CoreLocation/CoreLocation.h>
|
25
|
-
|
26
|
-
@interface MyViewControllerViewController ()
|
27
|
-
|
28
|
-
@end
|
29
|
-
|
30
|
-
@implementation MyViewControllerViewController
|
31
|
-
@synthesize computeSumButton;
|
32
|
-
@synthesize answerLabel;
|
33
|
-
@synthesize firstArg;
|
34
|
-
@synthesize secondArg;
|
35
|
-
@synthesize locationMgr;
|
36
|
-
@synthesize locationStatus;
|
37
|
-
|
38
|
-
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
|
39
|
-
{
|
40
|
-
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
|
41
|
-
if (self) {
|
42
|
-
// Custom initialization
|
43
|
-
self.locationMgr = [[CLLocationManager alloc] init];
|
44
|
-
self.locationMgr.desiredAccuracy = kCLLocationAccuracyBest;
|
45
|
-
self.locationMgr.delegate = self;
|
46
|
-
[self logLocationAuth];
|
47
|
-
}
|
48
|
-
|
49
|
-
return self;
|
50
|
-
}
|
51
|
-
|
52
|
-
- (void)viewDidLoad
|
53
|
-
{
|
54
|
-
[super viewDidLoad];
|
55
|
-
// Do any additional setup after loading the view from its nib.
|
56
|
-
firstArg.returnKeyType = UIReturnKeyDone;
|
57
|
-
secondArg.returnKeyType = UIReturnKeyDone;
|
58
|
-
firstArg.delegate = self;
|
59
|
-
secondArg.delegate = self;
|
60
|
-
[NSTimer scheduledTimerWithTimeInterval:0.2
|
61
|
-
target:self
|
62
|
-
selector:@selector(logLocationAuthFromTimer:)
|
63
|
-
userInfo:nil
|
64
|
-
repeats:NO];
|
65
|
-
|
66
|
-
[firstArg setAccessibilityIdentifier:@"IntegerA"];
|
67
|
-
[secondArg setAccessibilityIdentifier:@"IntegerB"];
|
68
|
-
[computeSumButton setAccessibilityIdentifier:@"ComputeSumButton"];
|
69
|
-
[answerLabel setAccessibilityIdentifier:@"Answer"];
|
70
|
-
[locationStatus setAccessibilityIdentifier:@"locationStatus"];
|
71
|
-
|
72
|
-
UISwipeGestureRecognizer * swipe =[[UISwipeGestureRecognizer alloc]initWithTarget:self action:@selector(swipeUp:)];
|
73
|
-
swipe.direction = UISwipeGestureRecognizerDirectionUp;
|
74
|
-
[self.view addGestureRecognizer:swipe];
|
75
|
-
[swipe release];
|
76
|
-
|
77
|
-
computeSumButton.titleLabel.text = NSLocalizedString(@"main.button.computeSum", @"Compute Sum button");
|
78
|
-
}
|
79
|
-
|
80
|
-
-(void)swipeUp:(UISwipeGestureRecognizer*)gestureRecognizer
|
81
|
-
{
|
82
|
-
[secondArg resignFirstResponder];
|
83
|
-
}
|
84
|
-
|
85
|
-
|
86
|
-
- (void)logLocationAuthFromTimer:(NSTimer *)timer
|
87
|
-
{
|
88
|
-
[self logLocationAuth];
|
89
|
-
}
|
90
|
-
|
91
|
-
- (void)logLocationAuth
|
92
|
-
{
|
93
|
-
CLAuthorizationStatus status = [CLLocationManager authorizationStatus];
|
94
|
-
if (status != kCLAuthorizationStatusRestricted && status != kCLAuthorizationStatusDenied) {
|
95
|
-
locationStatus.on = YES;
|
96
|
-
} else {
|
97
|
-
locationStatus.on = NO;
|
98
|
-
}
|
99
|
-
}
|
100
|
-
|
101
|
-
- (void)viewDidUnload
|
102
|
-
{
|
103
|
-
[self setFirstArg:nil];
|
104
|
-
[self setSecondArg:nil];
|
105
|
-
[self setAnswerLabel:nil];
|
106
|
-
[self setLocationStatus:nil];
|
107
|
-
[super viewDidUnload];
|
108
|
-
// Release any retained subviews of the main view.
|
109
|
-
// e.g. self.myOutlet = nil;
|
110
|
-
}
|
111
|
-
|
112
|
-
- (BOOL)textFieldShouldReturn:(UITextField *)textField {
|
113
|
-
[textField resignFirstResponder];
|
114
|
-
return YES;
|
115
|
-
}
|
116
|
-
|
117
|
-
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
|
118
|
-
{
|
119
|
-
return (interfaceOrientation == UIInterfaceOrientationPortrait);
|
120
|
-
}
|
121
|
-
|
122
|
-
- (void)dealloc {
|
123
|
-
[self.locationMgr release];
|
124
|
-
self.locationMgr = nil;
|
125
|
-
[firstArg release];
|
126
|
-
[secondArg release];
|
127
|
-
[answerLabel release];
|
128
|
-
[computeSumButton release];
|
129
|
-
[super dealloc];
|
130
|
-
}
|
131
|
-
- (IBAction)testGesture:(id)sender
|
132
|
-
{
|
133
|
-
GestureTestViewController *test = [[GestureTestViewController alloc] initWithNibName:@"GestureTestViewController" bundle:nil];
|
134
|
-
[self presentViewController:test animated:YES completion:NULL];
|
135
|
-
}
|
136
|
-
|
137
|
-
- (IBAction)computeAction:(id)sender {
|
138
|
-
int a = [[firstArg text] intValue];
|
139
|
-
int b = [[secondArg text] intValue];
|
140
|
-
int sum = a + b;
|
141
|
-
NSString *newLabelValue = [NSString stringWithFormat:@"%d",sum];
|
142
|
-
[answerLabel setText:newLabelValue];
|
143
|
-
[answerLabel setAccessibilityLabel:newLabelValue];
|
144
|
-
}
|
145
|
-
|
146
|
-
- (IBAction)showAlert:(id)sender {
|
147
|
-
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Cool title"
|
148
|
-
message:@"this alert is so cool."
|
149
|
-
delegate:nil
|
150
|
-
cancelButtonTitle:@"Cancel"
|
151
|
-
otherButtonTitles:@"OK", nil];
|
152
|
-
[alert show];
|
153
|
-
[alert release];
|
154
|
-
}
|
155
|
-
|
156
|
-
- (IBAction)crashApp:(id)sender {
|
157
|
-
abort();
|
158
|
-
}
|
159
|
-
|
160
|
-
- (void)requestContactsPermission {
|
161
|
-
ABAddressBookRef book = [MyViewControllerViewController addressBookForPermissionRequest];
|
162
|
-
[self popContactsPermissionDialogWithAddressBook:book];
|
163
|
-
}
|
164
|
-
|
165
|
-
- (void)popContactsPermissionDialogWithAddressBook:(ABAddressBookRef)book {
|
166
|
-
ABAddressBookRequestAccessWithCompletion(book, ^(bool granted, CFErrorRef error) {
|
167
|
-
});
|
168
|
-
CFRelease (book);
|
169
|
-
}
|
170
|
-
|
171
|
-
+ (ABAddressBookRef)addressBookForPermissionRequest {
|
172
|
-
CFErrorRef error = NULL;
|
173
|
-
return ABAddressBookCreateWithOptions(NULL, &error);
|
174
|
-
}
|
175
|
-
|
176
|
-
- (IBAction)accessContactsAlert:(id)sender {
|
177
|
-
if ([MyViewControllerViewController addressBookAuthorizationStatus] == kABAuthorizationStatusNotDetermined) {
|
178
|
-
[self requestContactsPermission];
|
179
|
-
}
|
180
|
-
}
|
181
|
-
|
182
|
-
- (IBAction)accessLocationAlert:(id)sender {
|
183
|
-
CLLocationManager *locationManager = [[CLLocationManager alloc] init];
|
184
|
-
|
185
|
-
[locationManager startUpdatingLocation];
|
186
|
-
[locationManager stopUpdatingLocation];
|
187
|
-
}
|
188
|
-
|
189
|
-
+ (ABAuthorizationStatus)addressBookAuthorizationStatus {
|
190
|
-
return ABAddressBookGetAuthorizationStatus();
|
191
|
-
}
|
192
|
-
|
193
|
-
@end
|