Browse Source

Published on DaveGit

David Walter 3 years ago
commit
a2b6baa3da
52 changed files with 2586 additions and 0 deletions
  1. 503
    0
      CodeReader.xcodeproj/project.pbxproj
  2. 7
    0
      CodeReader.xcodeproj/project.xcworkspace/contents.xcworkspacedata
  3. BIN
      CodeReader.xcodeproj/project.xcworkspace/xcuserdata/david.xcuserdatad/UserInterfaceState.xcuserstate
  4. 14
    0
      CodeReader.xcodeproj/project.xcworkspace/xcuserdata/david.xcuserdatad/xcdebugger/Expressions.xcexplist
  5. 5
    0
      CodeReader.xcodeproj/xcuserdata/david.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist
  6. 115
    0
      CodeReader.xcodeproj/xcuserdata/david.xcuserdatad/xcschemes/CodeReader.xcscheme
  7. 27
    0
      CodeReader.xcodeproj/xcuserdata/david.xcuserdatad/xcschemes/xcschememanagement.plist
  8. 58
    0
      CodeReader/AppDelegate.swift
  9. 22
    0
      CodeReader/Base.lproj/LaunchScreen.xib
  10. 322
    0
      CodeReader/Base.lproj/Main.storyboard
  11. 48
    0
      CodeReader/CameraFocusSquare.swift
  12. 4
    0
      CodeReader/CodeReader-Bridging-Header.h
  13. 146
    0
      CodeReader/CodeReader.swift
  14. 281
    0
      CodeReader/DetailViewController.swift
  15. 40
    0
      CodeReader/Images.xcassets/AppIcon.appiconset/Contents.json
  16. BIN
      CodeReader/Images.xcassets/AppIcon.appiconset/Icon@2x.png
  17. BIN
      CodeReader/Images.xcassets/AppIcon.appiconset/Icon@3x.png
  18. 6
    0
      CodeReader/Images.xcassets/Contents.json
  19. 22
    0
      CodeReader/Images.xcassets/Flash.imageset/Contents.json
  20. BIN
      CodeReader/Images.xcassets/Flash.imageset/Slice 2@2x.png
  21. BIN
      CodeReader/Images.xcassets/Flash.imageset/Slice 2@3x.png
  22. 22
    0
      CodeReader/Images.xcassets/Gear.imageset/Contents.json
  23. BIN
      CodeReader/Images.xcassets/Gear.imageset/Gear@2x.png
  24. BIN
      CodeReader/Images.xcassets/Gear.imageset/Gear@3x.png
  25. 22
    0
      CodeReader/Images.xcassets/Mail.imageset/Contents.json
  26. BIN
      CodeReader/Images.xcassets/Mail.imageset/Mail-1.png
  27. BIN
      CodeReader/Images.xcassets/Mail.imageset/Mail.png
  28. 22
    0
      CodeReader/Images.xcassets/Maps.imageset/Contents.json
  29. BIN
      CodeReader/Images.xcassets/Maps.imageset/Maps-1.png
  30. BIN
      CodeReader/Images.xcassets/Maps.imageset/Maps.png
  31. 22
    0
      CodeReader/Images.xcassets/Paste.imageset/Contents.json
  32. BIN
      CodeReader/Images.xcassets/Paste.imageset/Paste-1.png
  33. BIN
      CodeReader/Images.xcassets/Paste.imageset/Paste.png
  34. 22
    0
      CodeReader/Images.xcassets/Phone.imageset/Contents.json
  35. BIN
      CodeReader/Images.xcassets/Phone.imageset/Phone-1.png
  36. BIN
      CodeReader/Images.xcassets/Phone.imageset/Phone.png
  37. 22
    0
      CodeReader/Images.xcassets/SMS.imageset/Contents.json
  38. BIN
      CodeReader/Images.xcassets/SMS.imageset/SMS-1.png
  39. BIN
      CodeReader/Images.xcassets/SMS.imageset/SMS.png
  40. 22
    0
      CodeReader/Images.xcassets/Safari.imageset/Contents.json
  41. BIN
      CodeReader/Images.xcassets/Safari.imageset/Safari-1.png
  42. BIN
      CodeReader/Images.xcassets/Safari.imageset/Safari.png
  43. 49
    0
      CodeReader/Info.plist
  44. 55
    0
      CodeReader/Outpan.swift
  45. 34
    0
      CodeReader/Overlay.swift
  46. 80
    0
      CodeReader/RemoveAds.swift
  47. 80
    0
      CodeReader/Settings.swift
  48. 133
    0
      CodeReader/SettingsViewController.swift
  49. 158
    0
      CodeReader/Validation.swift
  50. 163
    0
      CodeReader/ViewController.swift
  51. 36
    0
      CodeReaderTests/CodeReaderTests.swift
  52. 24
    0
      CodeReaderTests/Info.plist

+ 503
- 0
CodeReader.xcodeproj/project.pbxproj View File

@@ -0,0 +1,503 @@
1
+// !$*UTF8*$!
2
+{
3
+	archiveVersion = 1;
4
+	classes = {
5
+	};
6
+	objectVersion = 46;
7
+	objects = {
8
+
9
+/* Begin PBXBuildFile section */
10
+		6307550E1A7BBFA200EA3D60 /* SettingsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6307550D1A7BBFA200EA3D60 /* SettingsViewController.swift */; };
11
+		630755101A7BCBF600EA3D60 /* Outpan.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6307550F1A7BCBF600EA3D60 /* Outpan.swift */; };
12
+		630819B71A83C94000EAD1BC /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 630819B61A83C94000EAD1BC /* QuartzCore.framework */; };
13
+		630819B91A83C95100EAD1BC /* CameraFocusSquare.swift in Sources */ = {isa = PBXBuildFile; fileRef = 630819B81A83C95100EAD1BC /* CameraFocusSquare.swift */; };
14
+		630819D41A7A9CA90077456C /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 630819D31A7A9CA90077456C /* AppDelegate.swift */; };
15
+		630819D61A7A9CA90077456C /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 630819D51A7A9CA90077456C /* ViewController.swift */; };
16
+		630819D91A7A9CA90077456C /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 630819D71A7A9CA90077456C /* Main.storyboard */; };
17
+		630819DB1A7A9CA90077456C /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 630819DA1A7A9CA90077456C /* Images.xcassets */; };
18
+		630819DE1A7A9CA90077456C /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = 630819DC1A7A9CA90077456C /* LaunchScreen.xib */; };
19
+		630819EA1A7A9CAA0077456C /* CodeReaderTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 630819E91A7A9CAA0077456C /* CodeReaderTests.swift */; };
20
+		630819F41A7A9CEA0077456C /* iAd.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 630819F31A7A9CEA0077456C /* iAd.framework */; };
21
+		630819F61A7A9CF00077456C /* AVFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 630819F51A7A9CF00077456C /* AVFoundation.framework */; };
22
+		630819F81A7A9D460077456C /* CodeReader.swift in Sources */ = {isa = PBXBuildFile; fileRef = 630819F71A7A9D460077456C /* CodeReader.swift */; };
23
+		630819FA1A7AA8970077456C /* DetailViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 630819F91A7AA8970077456C /* DetailViewController.swift */; };
24
+		636D4D181A840FB100EC103A /* StoreKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 636D4D171A840FB100EC103A /* StoreKit.framework */; };
25
+		636D4D1C1A84116A00EC103A /* RemoveAds.swift in Sources */ = {isa = PBXBuildFile; fileRef = 636D4D1B1A84116A00EC103A /* RemoveAds.swift */; };
26
+		636D4D1E1A841FDE00EC103A /* Overlay.swift in Sources */ = {isa = PBXBuildFile; fileRef = 636D4D1D1A841FDE00EC103A /* Overlay.swift */; };
27
+		63E272E31A83A1FF00293C83 /* Validation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 63E272E21A83A1FF00293C83 /* Validation.swift */; };
28
+		63E272E51A83AB0D00293C83 /* Settings.swift in Sources */ = {isa = PBXBuildFile; fileRef = 63E272E41A83AB0D00293C83 /* Settings.swift */; };
29
+/* End PBXBuildFile section */
30
+
31
+/* Begin PBXContainerItemProxy section */
32
+		630819E41A7A9CAA0077456C /* PBXContainerItemProxy */ = {
33
+			isa = PBXContainerItemProxy;
34
+			containerPortal = 630819C61A7A9CA90077456C /* Project object */;
35
+			proxyType = 1;
36
+			remoteGlobalIDString = 630819CD1A7A9CA90077456C;
37
+			remoteInfo = CodeReader;
38
+		};
39
+/* End PBXContainerItemProxy section */
40
+
41
+/* Begin PBXFileReference section */
42
+		6307550D1A7BBFA200EA3D60 /* SettingsViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SettingsViewController.swift; sourceTree = "<group>"; };
43
+		6307550F1A7BCBF600EA3D60 /* Outpan.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Outpan.swift; sourceTree = "<group>"; };
44
+		630755111A7EDEDA00EA3D60 /* CodeReader-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "CodeReader-Bridging-Header.h"; sourceTree = "<group>"; };
45
+		630819B61A83C94000EAD1BC /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; };
46
+		630819B81A83C95100EAD1BC /* CameraFocusSquare.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CameraFocusSquare.swift; sourceTree = "<group>"; };
47
+		630819CE1A7A9CA90077456C /* CodeReader.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = CodeReader.app; sourceTree = BUILT_PRODUCTS_DIR; };
48
+		630819D21A7A9CA90077456C /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
49
+		630819D31A7A9CA90077456C /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
50
+		630819D51A7A9CA90077456C /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = "<group>"; };
51
+		630819D81A7A9CA90077456C /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; };
52
+		630819DA1A7A9CA90077456C /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = "<group>"; };
53
+		630819DD1A7A9CA90077456C /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/LaunchScreen.xib; sourceTree = "<group>"; };
54
+		630819E31A7A9CAA0077456C /* CodeReaderTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = CodeReaderTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
55
+		630819E81A7A9CAA0077456C /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
56
+		630819E91A7A9CAA0077456C /* CodeReaderTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CodeReaderTests.swift; sourceTree = "<group>"; };
57
+		630819F31A7A9CEA0077456C /* iAd.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = iAd.framework; path = System/Library/Frameworks/iAd.framework; sourceTree = SDKROOT; };
58
+		630819F51A7A9CF00077456C /* AVFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AVFoundation.framework; path = System/Library/Frameworks/AVFoundation.framework; sourceTree = SDKROOT; };
59
+		630819F71A7A9D460077456C /* CodeReader.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CodeReader.swift; sourceTree = "<group>"; };
60
+		630819F91A7AA8970077456C /* DetailViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DetailViewController.swift; sourceTree = "<group>"; };
61
+		636D4D171A840FB100EC103A /* StoreKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = StoreKit.framework; path = System/Library/Frameworks/StoreKit.framework; sourceTree = SDKROOT; };
62
+		636D4D1B1A84116A00EC103A /* RemoveAds.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RemoveAds.swift; sourceTree = "<group>"; };
63
+		636D4D1D1A841FDE00EC103A /* Overlay.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Overlay.swift; sourceTree = "<group>"; };
64
+		63E272E21A83A1FF00293C83 /* Validation.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Validation.swift; sourceTree = "<group>"; };
65
+		63E272E41A83AB0D00293C83 /* Settings.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Settings.swift; sourceTree = "<group>"; };
66
+/* End PBXFileReference section */
67
+
68
+/* Begin PBXFrameworksBuildPhase section */
69
+		630819CB1A7A9CA90077456C /* Frameworks */ = {
70
+			isa = PBXFrameworksBuildPhase;
71
+			buildActionMask = 2147483647;
72
+			files = (
73
+				636D4D181A840FB100EC103A /* StoreKit.framework in Frameworks */,
74
+				630819B71A83C94000EAD1BC /* QuartzCore.framework in Frameworks */,
75
+				630819F61A7A9CF00077456C /* AVFoundation.framework in Frameworks */,
76
+				630819F41A7A9CEA0077456C /* iAd.framework in Frameworks */,
77
+			);
78
+			runOnlyForDeploymentPostprocessing = 0;
79
+		};
80
+		630819E01A7A9CAA0077456C /* Frameworks */ = {
81
+			isa = PBXFrameworksBuildPhase;
82
+			buildActionMask = 2147483647;
83
+			files = (
84
+			);
85
+			runOnlyForDeploymentPostprocessing = 0;
86
+		};
87
+/* End PBXFrameworksBuildPhase section */
88
+
89
+/* Begin PBXGroup section */
90
+		630819C51A7A9CA90077456C = {
91
+			isa = PBXGroup;
92
+			children = (
93
+				636D4D171A840FB100EC103A /* StoreKit.framework */,
94
+				630819B61A83C94000EAD1BC /* QuartzCore.framework */,
95
+				630819F51A7A9CF00077456C /* AVFoundation.framework */,
96
+				630819F31A7A9CEA0077456C /* iAd.framework */,
97
+				630819D01A7A9CA90077456C /* CodeReader */,
98
+				630819E61A7A9CAA0077456C /* CodeReaderTests */,
99
+				630819CF1A7A9CA90077456C /* Products */,
100
+			);
101
+			sourceTree = "<group>";
102
+		};
103
+		630819CF1A7A9CA90077456C /* Products */ = {
104
+			isa = PBXGroup;
105
+			children = (
106
+				630819CE1A7A9CA90077456C /* CodeReader.app */,
107
+				630819E31A7A9CAA0077456C /* CodeReaderTests.xctest */,
108
+			);
109
+			name = Products;
110
+			sourceTree = "<group>";
111
+		};
112
+		630819D01A7A9CA90077456C /* CodeReader */ = {
113
+			isa = PBXGroup;
114
+			children = (
115
+				630819D31A7A9CA90077456C /* AppDelegate.swift */,
116
+				630819D51A7A9CA90077456C /* ViewController.swift */,
117
+				630819F91A7AA8970077456C /* DetailViewController.swift */,
118
+				6307550D1A7BBFA200EA3D60 /* SettingsViewController.swift */,
119
+				630819F71A7A9D460077456C /* CodeReader.swift */,
120
+				636D4D1B1A84116A00EC103A /* RemoveAds.swift */,
121
+				63E272E21A83A1FF00293C83 /* Validation.swift */,
122
+				6307550F1A7BCBF600EA3D60 /* Outpan.swift */,
123
+				630819D71A7A9CA90077456C /* Main.storyboard */,
124
+				630819DA1A7A9CA90077456C /* Images.xcassets */,
125
+				630819DC1A7A9CA90077456C /* LaunchScreen.xib */,
126
+				630819D11A7A9CA90077456C /* Supporting Files */,
127
+				630755111A7EDEDA00EA3D60 /* CodeReader-Bridging-Header.h */,
128
+				630819B81A83C95100EAD1BC /* CameraFocusSquare.swift */,
129
+				636D4D1D1A841FDE00EC103A /* Overlay.swift */,
130
+				63E272E41A83AB0D00293C83 /* Settings.swift */,
131
+			);
132
+			path = CodeReader;
133
+			sourceTree = "<group>";
134
+		};
135
+		630819D11A7A9CA90077456C /* Supporting Files */ = {
136
+			isa = PBXGroup;
137
+			children = (
138
+				630819D21A7A9CA90077456C /* Info.plist */,
139
+			);
140
+			name = "Supporting Files";
141
+			sourceTree = "<group>";
142
+		};
143
+		630819E61A7A9CAA0077456C /* CodeReaderTests */ = {
144
+			isa = PBXGroup;
145
+			children = (
146
+				630819E91A7A9CAA0077456C /* CodeReaderTests.swift */,
147
+				630819E71A7A9CAA0077456C /* Supporting Files */,
148
+			);
149
+			path = CodeReaderTests;
150
+			sourceTree = "<group>";
151
+		};
152
+		630819E71A7A9CAA0077456C /* Supporting Files */ = {
153
+			isa = PBXGroup;
154
+			children = (
155
+				630819E81A7A9CAA0077456C /* Info.plist */,
156
+			);
157
+			name = "Supporting Files";
158
+			sourceTree = "<group>";
159
+		};
160
+/* End PBXGroup section */
161
+
162
+/* Begin PBXNativeTarget section */
163
+		630819CD1A7A9CA90077456C /* CodeReader */ = {
164
+			isa = PBXNativeTarget;
165
+			buildConfigurationList = 630819ED1A7A9CAA0077456C /* Build configuration list for PBXNativeTarget "CodeReader" */;
166
+			buildPhases = (
167
+				630819CA1A7A9CA90077456C /* Sources */,
168
+				630819CB1A7A9CA90077456C /* Frameworks */,
169
+				630819CC1A7A9CA90077456C /* Resources */,
170
+			);
171
+			buildRules = (
172
+			);
173
+			dependencies = (
174
+			);
175
+			name = CodeReader;
176
+			productName = CodeReader;
177
+			productReference = 630819CE1A7A9CA90077456C /* CodeReader.app */;
178
+			productType = "com.apple.product-type.application";
179
+		};
180
+		630819E21A7A9CAA0077456C /* CodeReaderTests */ = {
181
+			isa = PBXNativeTarget;
182
+			buildConfigurationList = 630819F01A7A9CAA0077456C /* Build configuration list for PBXNativeTarget "CodeReaderTests" */;
183
+			buildPhases = (
184
+				630819DF1A7A9CAA0077456C /* Sources */,
185
+				630819E01A7A9CAA0077456C /* Frameworks */,
186
+				630819E11A7A9CAA0077456C /* Resources */,
187
+			);
188
+			buildRules = (
189
+			);
190
+			dependencies = (
191
+				630819E51A7A9CAA0077456C /* PBXTargetDependency */,
192
+			);
193
+			name = CodeReaderTests;
194
+			productName = CodeReaderTests;
195
+			productReference = 630819E31A7A9CAA0077456C /* CodeReaderTests.xctest */;
196
+			productType = "com.apple.product-type.bundle.unit-test";
197
+		};
198
+/* End PBXNativeTarget section */
199
+
200
+/* Begin PBXProject section */
201
+		630819C61A7A9CA90077456C /* Project object */ = {
202
+			isa = PBXProject;
203
+			attributes = {
204
+				LastSwiftMigration = 0700;
205
+				LastSwiftUpdateCheck = 0700;
206
+				LastUpgradeCheck = 0700;
207
+				ORGANIZATIONNAME = "David Walter";
208
+				TargetAttributes = {
209
+					630819CD1A7A9CA90077456C = {
210
+						CreatedOnToolsVersion = 6.1.1;
211
+						DevelopmentTeam = 7MLF4U25UX;
212
+						LastSwiftMigration = 0820;
213
+					};
214
+					630819E21A7A9CAA0077456C = {
215
+						CreatedOnToolsVersion = 6.1.1;
216
+						LastSwiftMigration = 0820;
217
+						TestTargetID = 630819CD1A7A9CA90077456C;
218
+					};
219
+				};
220
+			};
221
+			buildConfigurationList = 630819C91A7A9CA90077456C /* Build configuration list for PBXProject "CodeReader" */;
222
+			compatibilityVersion = "Xcode 3.2";
223
+			developmentRegion = English;
224
+			hasScannedForEncodings = 0;
225
+			knownRegions = (
226
+				en,
227
+				Base,
228
+			);
229
+			mainGroup = 630819C51A7A9CA90077456C;
230
+			productRefGroup = 630819CF1A7A9CA90077456C /* Products */;
231
+			projectDirPath = "";
232
+			projectRoot = "";
233
+			targets = (
234
+				630819CD1A7A9CA90077456C /* CodeReader */,
235
+				630819E21A7A9CAA0077456C /* CodeReaderTests */,
236
+			);
237
+		};
238
+/* End PBXProject section */
239
+
240
+/* Begin PBXResourcesBuildPhase section */
241
+		630819CC1A7A9CA90077456C /* Resources */ = {
242
+			isa = PBXResourcesBuildPhase;
243
+			buildActionMask = 2147483647;
244
+			files = (
245
+				630819D91A7A9CA90077456C /* Main.storyboard in Resources */,
246
+				630819DE1A7A9CA90077456C /* LaunchScreen.xib in Resources */,
247
+				630819DB1A7A9CA90077456C /* Images.xcassets in Resources */,
248
+			);
249
+			runOnlyForDeploymentPostprocessing = 0;
250
+		};
251
+		630819E11A7A9CAA0077456C /* Resources */ = {
252
+			isa = PBXResourcesBuildPhase;
253
+			buildActionMask = 2147483647;
254
+			files = (
255
+			);
256
+			runOnlyForDeploymentPostprocessing = 0;
257
+		};
258
+/* End PBXResourcesBuildPhase section */
259
+
260
+/* Begin PBXSourcesBuildPhase section */
261
+		630819CA1A7A9CA90077456C /* Sources */ = {
262
+			isa = PBXSourcesBuildPhase;
263
+			buildActionMask = 2147483647;
264
+			files = (
265
+				636D4D1C1A84116A00EC103A /* RemoveAds.swift in Sources */,
266
+				630755101A7BCBF600EA3D60 /* Outpan.swift in Sources */,
267
+				630819D61A7A9CA90077456C /* ViewController.swift in Sources */,
268
+				63E272E51A83AB0D00293C83 /* Settings.swift in Sources */,
269
+				630819D41A7A9CA90077456C /* AppDelegate.swift in Sources */,
270
+				630819B91A83C95100EAD1BC /* CameraFocusSquare.swift in Sources */,
271
+				630819F81A7A9D460077456C /* CodeReader.swift in Sources */,
272
+				636D4D1E1A841FDE00EC103A /* Overlay.swift in Sources */,
273
+				6307550E1A7BBFA200EA3D60 /* SettingsViewController.swift in Sources */,
274
+				63E272E31A83A1FF00293C83 /* Validation.swift in Sources */,
275
+				630819FA1A7AA8970077456C /* DetailViewController.swift in Sources */,
276
+			);
277
+			runOnlyForDeploymentPostprocessing = 0;
278
+		};
279
+		630819DF1A7A9CAA0077456C /* Sources */ = {
280
+			isa = PBXSourcesBuildPhase;
281
+			buildActionMask = 2147483647;
282
+			files = (
283
+				630819EA1A7A9CAA0077456C /* CodeReaderTests.swift in Sources */,
284
+			);
285
+			runOnlyForDeploymentPostprocessing = 0;
286
+		};
287
+/* End PBXSourcesBuildPhase section */
288
+
289
+/* Begin PBXTargetDependency section */
290
+		630819E51A7A9CAA0077456C /* PBXTargetDependency */ = {
291
+			isa = PBXTargetDependency;
292
+			target = 630819CD1A7A9CA90077456C /* CodeReader */;
293
+			targetProxy = 630819E41A7A9CAA0077456C /* PBXContainerItemProxy */;
294
+		};
295
+/* End PBXTargetDependency section */
296
+
297
+/* Begin PBXVariantGroup section */
298
+		630819D71A7A9CA90077456C /* Main.storyboard */ = {
299
+			isa = PBXVariantGroup;
300
+			children = (
301
+				630819D81A7A9CA90077456C /* Base */,
302
+			);
303
+			name = Main.storyboard;
304
+			sourceTree = "<group>";
305
+		};
306
+		630819DC1A7A9CA90077456C /* LaunchScreen.xib */ = {
307
+			isa = PBXVariantGroup;
308
+			children = (
309
+				630819DD1A7A9CA90077456C /* Base */,
310
+			);
311
+			name = LaunchScreen.xib;
312
+			sourceTree = "<group>";
313
+		};
314
+/* End PBXVariantGroup section */
315
+
316
+/* Begin XCBuildConfiguration section */
317
+		630819EB1A7A9CAA0077456C /* Debug */ = {
318
+			isa = XCBuildConfiguration;
319
+			buildSettings = {
320
+				ALWAYS_SEARCH_USER_PATHS = NO;
321
+				CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
322
+				CLANG_CXX_LIBRARY = "libc++";
323
+				CLANG_ENABLE_MODULES = YES;
324
+				CLANG_ENABLE_OBJC_ARC = YES;
325
+				CLANG_WARN_BOOL_CONVERSION = YES;
326
+				CLANG_WARN_CONSTANT_CONVERSION = YES;
327
+				CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
328
+				CLANG_WARN_EMPTY_BODY = YES;
329
+				CLANG_WARN_ENUM_CONVERSION = YES;
330
+				CLANG_WARN_INT_CONVERSION = YES;
331
+				CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
332
+				CLANG_WARN_UNREACHABLE_CODE = YES;
333
+				CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
334
+				"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
335
+				COPY_PHASE_STRIP = NO;
336
+				ENABLE_STRICT_OBJC_MSGSEND = YES;
337
+				ENABLE_TESTABILITY = YES;
338
+				GCC_C_LANGUAGE_STANDARD = gnu99;
339
+				GCC_DYNAMIC_NO_PIC = NO;
340
+				GCC_OPTIMIZATION_LEVEL = 0;
341
+				GCC_PREPROCESSOR_DEFINITIONS = (
342
+					"DEBUG=1",
343
+					"$(inherited)",
344
+				);
345
+				GCC_SYMBOLS_PRIVATE_EXTERN = NO;
346
+				GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
347
+				GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
348
+				GCC_WARN_UNDECLARED_SELECTOR = YES;
349
+				GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
350
+				GCC_WARN_UNUSED_FUNCTION = YES;
351
+				GCC_WARN_UNUSED_VARIABLE = YES;
352
+				IPHONEOS_DEPLOYMENT_TARGET = 8.1;
353
+				MTL_ENABLE_DEBUG_INFO = YES;
354
+				ONLY_ACTIVE_ARCH = YES;
355
+				SDKROOT = iphoneos;
356
+				SWIFT_OPTIMIZATION_LEVEL = "-Onone";
357
+			};
358
+			name = Debug;
359
+		};
360
+		630819EC1A7A9CAA0077456C /* Release */ = {
361
+			isa = XCBuildConfiguration;
362
+			buildSettings = {
363
+				ALWAYS_SEARCH_USER_PATHS = NO;
364
+				CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
365
+				CLANG_CXX_LIBRARY = "libc++";
366
+				CLANG_ENABLE_MODULES = YES;
367
+				CLANG_ENABLE_OBJC_ARC = YES;
368
+				CLANG_WARN_BOOL_CONVERSION = YES;
369
+				CLANG_WARN_CONSTANT_CONVERSION = YES;
370
+				CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
371
+				CLANG_WARN_EMPTY_BODY = YES;
372
+				CLANG_WARN_ENUM_CONVERSION = YES;
373
+				CLANG_WARN_INT_CONVERSION = YES;
374
+				CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
375
+				CLANG_WARN_UNREACHABLE_CODE = YES;
376
+				CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
377
+				"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
378
+				COPY_PHASE_STRIP = YES;
379
+				ENABLE_NS_ASSERTIONS = NO;
380
+				ENABLE_STRICT_OBJC_MSGSEND = YES;
381
+				GCC_C_LANGUAGE_STANDARD = gnu99;
382
+				GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
383
+				GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
384
+				GCC_WARN_UNDECLARED_SELECTOR = YES;
385
+				GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
386
+				GCC_WARN_UNUSED_FUNCTION = YES;
387
+				GCC_WARN_UNUSED_VARIABLE = YES;
388
+				IPHONEOS_DEPLOYMENT_TARGET = 8.1;
389
+				MTL_ENABLE_DEBUG_INFO = NO;
390
+				SDKROOT = iphoneos;
391
+				VALIDATE_PRODUCT = YES;
392
+			};
393
+			name = Release;
394
+		};
395
+		630819EE1A7A9CAA0077456C /* Debug */ = {
396
+			isa = XCBuildConfiguration;
397
+			buildSettings = {
398
+				ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
399
+				CLANG_ENABLE_MODULES = YES;
400
+				CODE_SIGN_IDENTITY = "iPhone Developer";
401
+				"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
402
+				INFOPLIST_FILE = CodeReader/Info.plist;
403
+				IPHONEOS_DEPLOYMENT_TARGET = 8.0;
404
+				LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
405
+				PRODUCT_BUNDLE_IDENTIFIER = "at.davidwalter.$(PRODUCT_NAME:rfc1034identifier)";
406
+				PRODUCT_NAME = "$(TARGET_NAME)";
407
+				PROVISIONING_PROFILE = "";
408
+				SWIFT_OBJC_BRIDGING_HEADER = "CodeReader/CodeReader-Bridging-Header.h";
409
+				SWIFT_OPTIMIZATION_LEVEL = "-Onone";
410
+				SWIFT_VERSION = 3.0;
411
+			};
412
+			name = Debug;
413
+		};
414
+		630819EF1A7A9CAA0077456C /* Release */ = {
415
+			isa = XCBuildConfiguration;
416
+			buildSettings = {
417
+				ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
418
+				CLANG_ENABLE_MODULES = YES;
419
+				CODE_SIGN_IDENTITY = "iPhone Developer";
420
+				"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
421
+				INFOPLIST_FILE = CodeReader/Info.plist;
422
+				IPHONEOS_DEPLOYMENT_TARGET = 8.0;
423
+				LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
424
+				PRODUCT_BUNDLE_IDENTIFIER = "at.davidwalter.$(PRODUCT_NAME:rfc1034identifier)";
425
+				PRODUCT_NAME = "$(TARGET_NAME)";
426
+				PROVISIONING_PROFILE = "";
427
+				SWIFT_OBJC_BRIDGING_HEADER = "CodeReader/CodeReader-Bridging-Header.h";
428
+				SWIFT_VERSION = 3.0;
429
+			};
430
+			name = Release;
431
+		};
432
+		630819F11A7A9CAA0077456C /* Debug */ = {
433
+			isa = XCBuildConfiguration;
434
+			buildSettings = {
435
+				BUNDLE_LOADER = "$(TEST_HOST)";
436
+				FRAMEWORK_SEARCH_PATHS = (
437
+					"$(SDKROOT)/Developer/Library/Frameworks",
438
+					"$(inherited)",
439
+				);
440
+				GCC_PREPROCESSOR_DEFINITIONS = (
441
+					"DEBUG=1",
442
+					"$(inherited)",
443
+				);
444
+				INFOPLIST_FILE = CodeReaderTests/Info.plist;
445
+				LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
446
+				PRODUCT_BUNDLE_IDENTIFIER = "at.davidwalter.$(PRODUCT_NAME:rfc1034identifier)";
447
+				PRODUCT_NAME = "$(TARGET_NAME)";
448
+				SWIFT_VERSION = 3.0;
449
+				TEST_HOST = "$(BUILT_PRODUCTS_DIR)/CodeReader.app/CodeReader";
450
+			};
451
+			name = Debug;
452
+		};
453
+		630819F21A7A9CAA0077456C /* Release */ = {
454
+			isa = XCBuildConfiguration;
455
+			buildSettings = {
456
+				BUNDLE_LOADER = "$(TEST_HOST)";
457
+				FRAMEWORK_SEARCH_PATHS = (
458
+					"$(SDKROOT)/Developer/Library/Frameworks",
459
+					"$(inherited)",
460
+				);
461
+				INFOPLIST_FILE = CodeReaderTests/Info.plist;
462
+				LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
463
+				PRODUCT_BUNDLE_IDENTIFIER = "at.davidwalter.$(PRODUCT_NAME:rfc1034identifier)";
464
+				PRODUCT_NAME = "$(TARGET_NAME)";
465
+				SWIFT_VERSION = 3.0;
466
+				TEST_HOST = "$(BUILT_PRODUCTS_DIR)/CodeReader.app/CodeReader";
467
+			};
468
+			name = Release;
469
+		};
470
+/* End XCBuildConfiguration section */
471
+
472
+/* Begin XCConfigurationList section */
473
+		630819C91A7A9CA90077456C /* Build configuration list for PBXProject "CodeReader" */ = {
474
+			isa = XCConfigurationList;
475
+			buildConfigurations = (
476
+				630819EB1A7A9CAA0077456C /* Debug */,
477
+				630819EC1A7A9CAA0077456C /* Release */,
478
+			);
479
+			defaultConfigurationIsVisible = 0;
480
+			defaultConfigurationName = Release;
481
+		};
482
+		630819ED1A7A9CAA0077456C /* Build configuration list for PBXNativeTarget "CodeReader" */ = {
483
+			isa = XCConfigurationList;
484
+			buildConfigurations = (
485
+				630819EE1A7A9CAA0077456C /* Debug */,
486
+				630819EF1A7A9CAA0077456C /* Release */,
487
+			);
488
+			defaultConfigurationIsVisible = 0;
489
+			defaultConfigurationName = Release;
490
+		};
491
+		630819F01A7A9CAA0077456C /* Build configuration list for PBXNativeTarget "CodeReaderTests" */ = {
492
+			isa = XCConfigurationList;
493
+			buildConfigurations = (
494
+				630819F11A7A9CAA0077456C /* Debug */,
495
+				630819F21A7A9CAA0077456C /* Release */,
496
+			);
497
+			defaultConfigurationIsVisible = 0;
498
+			defaultConfigurationName = Release;
499
+		};
500
+/* End XCConfigurationList section */
501
+	};
502
+	rootObject = 630819C61A7A9CA90077456C /* Project object */;
503
+}

+ 7
- 0
CodeReader.xcodeproj/project.xcworkspace/contents.xcworkspacedata View File

@@ -0,0 +1,7 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<Workspace
3
+   version = "1.0">
4
+   <FileRef
5
+      location = "self:CodeReader.xcodeproj">
6
+   </FileRef>
7
+</Workspace>

BIN
CodeReader.xcodeproj/project.xcworkspace/xcuserdata/david.xcuserdatad/UserInterfaceState.xcuserstate View File


+ 14
- 0
CodeReader.xcodeproj/project.xcworkspace/xcuserdata/david.xcuserdatad/xcdebugger/Expressions.xcexplist View File

@@ -0,0 +1,14 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<VariablesViewState
3
+   version = "1.0">
4
+   <ContextStates>
5
+      <ContextState
6
+         contextName = "CodeReader.DetailViewController.tableView (CodeReader.DetailViewController)(ObjectiveC.UITableView, cellForRowAtIndexPath : ObjectiveC.NSIndexPath) -&gt; ObjectiveC.UITableViewCell:DetailViewController.swift">
7
+         <PersistentStrings>
8
+            <PersistentString
9
+               value = "">
10
+            </PersistentString>
11
+         </PersistentStrings>
12
+      </ContextState>
13
+   </ContextStates>
14
+</VariablesViewState>

+ 5
- 0
CodeReader.xcodeproj/xcuserdata/david.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist View File

@@ -0,0 +1,5 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<Bucket
3
+   type = "1"
4
+   version = "2.0">
5
+</Bucket>

+ 115
- 0
CodeReader.xcodeproj/xcuserdata/david.xcuserdatad/xcschemes/CodeReader.xcscheme View File

@@ -0,0 +1,115 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<Scheme
3
+   LastUpgradeVersion = "0700"
4
+   version = "1.3">
5
+   <BuildAction
6
+      parallelizeBuildables = "YES"
7
+      buildImplicitDependencies = "YES">
8
+      <BuildActionEntries>
9
+         <BuildActionEntry
10
+            buildForTesting = "YES"
11
+            buildForRunning = "YES"
12
+            buildForProfiling = "YES"
13
+            buildForArchiving = "YES"
14
+            buildForAnalyzing = "YES">
15
+            <BuildableReference
16
+               BuildableIdentifier = "primary"
17
+               BlueprintIdentifier = "630819CD1A7A9CA90077456C"
18
+               BuildableName = "CodeReader.app"
19
+               BlueprintName = "CodeReader"
20
+               ReferencedContainer = "container:CodeReader.xcodeproj">
21
+            </BuildableReference>
22
+         </BuildActionEntry>
23
+         <BuildActionEntry
24
+            buildForTesting = "YES"
25
+            buildForRunning = "YES"
26
+            buildForProfiling = "NO"
27
+            buildForArchiving = "NO"
28
+            buildForAnalyzing = "YES">
29
+            <BuildableReference
30
+               BuildableIdentifier = "primary"
31
+               BlueprintIdentifier = "630819E21A7A9CAA0077456C"
32
+               BuildableName = "CodeReaderTests.xctest"
33
+               BlueprintName = "CodeReaderTests"
34
+               ReferencedContainer = "container:CodeReader.xcodeproj">
35
+            </BuildableReference>
36
+         </BuildActionEntry>
37
+      </BuildActionEntries>
38
+   </BuildAction>
39
+   <TestAction
40
+      buildConfiguration = "Debug"
41
+      selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
42
+      selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
43
+      shouldUseLaunchSchemeArgsEnv = "YES">
44
+      <Testables>
45
+         <TestableReference
46
+            skipped = "NO">
47
+            <BuildableReference
48
+               BuildableIdentifier = "primary"
49
+               BlueprintIdentifier = "630819E21A7A9CAA0077456C"
50
+               BuildableName = "CodeReaderTests.xctest"
51
+               BlueprintName = "CodeReaderTests"
52
+               ReferencedContainer = "container:CodeReader.xcodeproj">
53
+            </BuildableReference>
54
+         </TestableReference>
55
+      </Testables>
56
+      <MacroExpansion>
57
+         <BuildableReference
58
+            BuildableIdentifier = "primary"
59
+            BlueprintIdentifier = "630819CD1A7A9CA90077456C"
60
+            BuildableName = "CodeReader.app"
61
+            BlueprintName = "CodeReader"
62
+            ReferencedContainer = "container:CodeReader.xcodeproj">
63
+         </BuildableReference>
64
+      </MacroExpansion>
65
+      <AdditionalOptions>
66
+      </AdditionalOptions>
67
+   </TestAction>
68
+   <LaunchAction
69
+      buildConfiguration = "Debug"
70
+      selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
71
+      selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
72
+      launchStyle = "0"
73
+      useCustomWorkingDirectory = "NO"
74
+      ignoresPersistentStateOnLaunch = "NO"
75
+      debugDocumentVersioning = "YES"
76
+      debugServiceExtension = "internal"
77
+      allowLocationSimulation = "YES">
78
+      <BuildableProductRunnable
79
+         runnableDebuggingMode = "0">
80
+         <BuildableReference
81
+            BuildableIdentifier = "primary"
82
+            BlueprintIdentifier = "630819CD1A7A9CA90077456C"
83
+            BuildableName = "CodeReader.app"
84
+            BlueprintName = "CodeReader"
85
+            ReferencedContainer = "container:CodeReader.xcodeproj">
86
+         </BuildableReference>
87
+      </BuildableProductRunnable>
88
+      <AdditionalOptions>
89
+      </AdditionalOptions>
90
+   </LaunchAction>
91
+   <ProfileAction
92
+      buildConfiguration = "Release"
93
+      shouldUseLaunchSchemeArgsEnv = "YES"
94
+      savedToolIdentifier = ""
95
+      useCustomWorkingDirectory = "NO"
96
+      debugDocumentVersioning = "YES">
97
+      <BuildableProductRunnable
98
+         runnableDebuggingMode = "0">
99
+         <BuildableReference
100
+            BuildableIdentifier = "primary"
101
+            BlueprintIdentifier = "630819CD1A7A9CA90077456C"
102
+            BuildableName = "CodeReader.app"
103
+            BlueprintName = "CodeReader"
104
+            ReferencedContainer = "container:CodeReader.xcodeproj">
105
+         </BuildableReference>
106
+      </BuildableProductRunnable>
107
+   </ProfileAction>
108
+   <AnalyzeAction
109
+      buildConfiguration = "Debug">
110
+   </AnalyzeAction>
111
+   <ArchiveAction
112
+      buildConfiguration = "Release"
113
+      revealArchiveInOrganizer = "YES">
114
+   </ArchiveAction>
115
+</Scheme>

+ 27
- 0
CodeReader.xcodeproj/xcuserdata/david.xcuserdatad/xcschemes/xcschememanagement.plist View File

@@ -0,0 +1,27 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3
+<plist version="1.0">
4
+<dict>
5
+	<key>SchemeUserState</key>
6
+	<dict>
7
+		<key>CodeReader.xcscheme</key>
8
+		<dict>
9
+			<key>orderHint</key>
10
+			<integer>0</integer>
11
+		</dict>
12
+	</dict>
13
+	<key>SuppressBuildableAutocreation</key>
14
+	<dict>
15
+		<key>630819CD1A7A9CA90077456C</key>
16
+		<dict>
17
+			<key>primary</key>
18
+			<true/>
19
+		</dict>
20
+		<key>630819E21A7A9CAA0077456C</key>
21
+		<dict>
22
+			<key>primary</key>
23
+			<true/>
24
+		</dict>
25
+	</dict>
26
+</dict>
27
+</plist>

+ 58
- 0
CodeReader/AppDelegate.swift View File

@@ -0,0 +1,58 @@
1
+//
2
+//  AppDelegate.swift
3
+//  CodeReader
4
+//
5
+//  Created by David Walter on 29.01.15.
6
+//  Copyright (c) 2015 David Walter. All rights reserved.
7
+//
8
+
9
+import UIKit
10
+
11
+@UIApplicationMain
12
+class AppDelegate: UIResponder, UIApplicationDelegate {
13
+
14
+    var window: UIWindow?
15
+
16
+
17
+    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
18
+        // Override point for customization after application launch.
19
+        UIApplication.shared.statusBarStyle = .lightContent
20
+        
21
+        if(!Settings.FirstLaunched()) {
22
+            Settings.setShowAds()
23
+            Settings.setFirstLaunched()
24
+            Settings.setOpenLinksAutomatically(true)
25
+            Settings.setOpenMailAutomatically(true)
26
+            Settings.setOpenPhoneAutomatically(true)
27
+            Settings.setOpenSMSAutomatically(true)
28
+            Settings.setOpenLocationAutomatically(true)
29
+        }
30
+        
31
+        return true
32
+    }
33
+
34
+    func applicationWillResignActive(_ application: UIApplication) {
35
+        // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
36
+        // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
37
+    }
38
+
39
+    func applicationDidEnterBackground(_ application: UIApplication) {
40
+        // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
41
+        // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
42
+    }
43
+
44
+    func applicationWillEnterForeground(_ application: UIApplication) {
45
+        // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
46
+    }
47
+
48
+    func applicationDidBecomeActive(_ application: UIApplication) {
49
+        // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
50
+    }
51
+
52
+    func applicationWillTerminate(_ application: UIApplication) {
53
+        // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
54
+    }
55
+
56
+
57
+}
58
+

+ 22
- 0
CodeReader/Base.lproj/LaunchScreen.xib View File

@@ -0,0 +1,22 @@
1
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2
+<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="8187.4" systemVersion="15A279b" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES">
3
+    <dependencies>
4
+        <deployment identifier="iOS"/>
5
+        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="8151.3"/>
6
+    </dependencies>
7
+    <objects>
8
+        <placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
9
+        <placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
10
+        <view contentMode="scaleToFill" id="iN0-l3-epB">
11
+            <rect key="frame" x="0.0" y="0.0" width="480" height="480"/>
12
+            <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
13
+            <animations/>
14
+            <color key="backgroundColor" white="0.0" alpha="1" colorSpace="calibratedWhite"/>
15
+            <nil key="simulatedStatusBarMetrics"/>
16
+            <simulatedNavigationBarMetrics key="simulatedTopBarMetrics" barStyle="black" prompted="NO"/>
17
+            <nil key="simulatedBottomBarMetrics"/>
18
+            <freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
19
+            <point key="canvasLocation" x="548" y="455"/>
20
+        </view>
21
+    </objects>
22
+</document>

+ 322
- 0
CodeReader/Base.lproj/Main.storyboard View File

@@ -0,0 +1,322 @@
1
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2
+<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="8187.4" systemVersion="15A279b" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="g24-NZ-lCn">
3
+    <dependencies>
4
+        <deployment identifier="iOS"/>
5
+        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="8151.3"/>
6
+        <capability name="Constraints to layout margins" minToolsVersion="6.0"/>
7
+    </dependencies>
8
+    <scenes>
9
+        <!--View Controller-->
10
+        <scene sceneID="ufC-wZ-h7g">
11
+            <objects>
12
+                <viewController id="vXZ-lx-hvc" customClass="ViewController" customModule="CodeReader" customModuleProvider="target" sceneMemberID="viewController">
13
+                    <layoutGuides>
14
+                        <viewControllerLayoutGuide type="top" id="jyV-Pf-zRb"/>
15
+                        <viewControllerLayoutGuide type="bottom" id="2fi-mo-0CV"/>
16
+                    </layoutGuides>
17
+                    <view key="view" contentMode="scaleToFill" id="kh9-bI-dsS">
18
+                        <rect key="frame" x="0.0" y="0.0" width="320" height="600"/>
19
+                        <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
20
+                        <subviews>
21
+                            <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="gv3-eU-Lfi">
22
+                                <rect key="frame" x="0.0" y="0.0" width="320" height="600"/>
23
+                                <animations/>
24
+                                <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
25
+                            </view>
26
+                            <adBannerView hidden="YES" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" misplaced="YES" translatesAutoresizingMaskIntoConstraints="NO" id="EKM-kw-x2m">
27
+                                <rect key="frame" x="0.0" y="550" width="320" height="50"/>
28
+                                <animations/>
29
+                                <constraints>
30
+                                    <constraint firstAttribute="height" constant="50" id="dvy-G3-Zbf"/>
31
+                                </constraints>
32
+                                <connections>
33
+                                    <outlet property="delegate" destination="vXZ-lx-hvc" id="hxs-LW-uwi"/>
34
+                                </connections>
35
+                            </adBannerView>
36
+                        </subviews>
37
+                        <animations/>
38
+                        <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
39
+                        <constraints>
40
+                            <constraint firstItem="gv3-eU-Lfi" firstAttribute="leading" secondItem="kh9-bI-dsS" secondAttribute="leadingMargin" constant="-16" id="0jB-tD-H5R"/>
41
+                            <constraint firstAttribute="trailingMargin" secondItem="gv3-eU-Lfi" secondAttribute="trailing" constant="-16" id="GO1-Xx-qkR"/>
42
+                            <constraint firstItem="2fi-mo-0CV" firstAttribute="top" secondItem="gv3-eU-Lfi" secondAttribute="bottom" id="JGV-vu-4pc"/>
43
+                            <constraint firstItem="EKM-kw-x2m" firstAttribute="leading" secondItem="kh9-bI-dsS" secondAttribute="leadingMargin" constant="-20" id="Oph-Vb-bts"/>
44
+                            <constraint firstAttribute="trailingMargin" secondItem="EKM-kw-x2m" secondAttribute="trailing" constant="-20" id="bTw-ng-msg"/>
45
+                            <constraint firstItem="EKM-kw-x2m" firstAttribute="bottom" secondItem="kh9-bI-dsS" secondAttribute="bottomMargin" id="dGM-TD-4Lz"/>
46
+                            <constraint firstItem="2fi-mo-0CV" firstAttribute="top" secondItem="EKM-kw-x2m" secondAttribute="bottom" id="ebV-7L-SEW"/>
47
+                            <constraint firstItem="gv3-eU-Lfi" firstAttribute="top" secondItem="kh9-bI-dsS" secondAttribute="topMargin" id="nK7-50-dRD"/>
48
+                        </constraints>
49
+                        <variation key="default">
50
+                            <mask key="constraints">
51
+                                <exclude reference="ebV-7L-SEW"/>
52
+                            </mask>
53
+                        </variation>
54
+                    </view>
55
+                    <navigationItem key="navigationItem" id="n1w-Zw-otG">
56
+                        <barButtonItem key="leftBarButtonItem" image="Gear" id="gWI-s8-4wp">
57
+                            <connections>
58
+                                <segue destination="ghB-8c-FC9" kind="show" identifier="SettingsSegue" id="wHf-9P-3aO"/>
59
+                            </connections>
60
+                        </barButtonItem>
61
+                        <barButtonItem key="rightBarButtonItem" image="Flash" id="pcN-Lv-9CO">
62
+                            <color key="tintColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
63
+                            <connections>
64
+                                <action selector="toggleFlash:" destination="vXZ-lx-hvc" id="RvB-Jv-cZl"/>
65
+                            </connections>
66
+                        </barButtonItem>
67
+                    </navigationItem>
68
+                    <freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
69
+                    <size key="freeformSize" width="320" height="600"/>
70
+                    <connections>
71
+                        <outlet property="banner" destination="EKM-kw-x2m" id="4k5-19-3JS"/>
72
+                        <outlet property="cameraView" destination="gv3-eU-Lfi" id="ouX-UK-LCl"/>
73
+                        <outlet property="flashButton" destination="pcN-Lv-9CO" id="NMY-tf-y3N"/>
74
+                        <segue destination="7ns-37-3i1" kind="show" identifier="CodeDetail" id="LcQ-Cf-4fe"/>
75
+                    </connections>
76
+                </viewController>
77
+                <placeholder placeholderIdentifier="IBFirstResponder" id="x5A-6p-PRh" sceneMemberID="firstResponder"/>
78
+            </objects>
79
+            <point key="canvasLocation" x="185" y="336"/>
80
+        </scene>
81
+        <!--Detail View Controller-->
82
+        <scene sceneID="DHb-Rn-Gjk">
83
+            <objects>
84
+                <tableViewController id="7ns-37-3i1" customClass="DetailViewController" customModule="CodeReader" customModuleProvider="target" sceneMemberID="viewController">
85
+                    <tableView key="view" clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="grouped" separatorStyle="default" rowHeight="44" sectionHeaderHeight="10" sectionFooterHeight="10" id="GUN-BG-B7N">
86
+                        <rect key="frame" x="0.0" y="0.0" width="320" height="600"/>
87
+                        <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
88
+                        <animations/>
89
+                        <color key="backgroundColor" red="0.93725490199999995" green="0.93725490199999995" blue="0.95686274510000002" alpha="1" colorSpace="calibratedRGB"/>
90
+                        <adBannerView key="tableHeaderView" hidden="YES" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" id="jej-HZ-rEX">
91
+                            <rect key="frame" x="0.0" y="64" width="320" height="44"/>
92
+                            <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES" flexibleMaxY="YES"/>
93
+                            <animations/>
94
+                            <connections>
95
+                                <outlet property="delegate" destination="7ns-37-3i1" id="QPY-cH-QgL"/>
96
+                            </connections>
97
+                        </adBannerView>
98
+                        <prototypes>
99
+                            <tableViewCell contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" reuseIdentifier="DetailCell" id="ZTO-zO-xx0">
100
+                                <rect key="frame" x="0.0" y="179.5" width="320" height="44"/>
101
+                                <autoresizingMask key="autoresizingMask"/>
102
+                                <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="ZTO-zO-xx0" id="XqK-DN-gmo">
103
+                                    <rect key="frame" x="0.0" y="0.0" width="320" height="43.5"/>
104
+                                    <autoresizingMask key="autoresizingMask"/>
105
+                                    <animations/>
106
+                                </tableViewCellContentView>
107
+                                <animations/>
108
+                            </tableViewCell>
109
+                            <tableViewCell contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" reuseIdentifier="AttributeCell" textLabel="l7i-GU-Rix" detailTextLabel="cPw-2i-8Qf" style="IBUITableViewCellStyleValue1" id="C0S-vN-MeR" customClass="AttributeCell" customModule="CodeReader" customModuleProvider="target">
110
+                                <rect key="frame" x="0.0" y="223.5" width="320" height="44"/>
111
+                                <autoresizingMask key="autoresizingMask"/>
112
+                                <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="C0S-vN-MeR" id="C3d-sx-wLI">
113
+                                    <rect key="frame" x="0.0" y="0.0" width="320" height="43.5"/>
114
+                                    <autoresizingMask key="autoresizingMask"/>
115
+                                    <subviews>
116
+                                        <label opaque="NO" multipleTouchEnabled="YES" contentMode="left" text="Title" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="l7i-GU-Rix">
117
+                                            <rect key="frame" x="15" y="12" width="31.5" height="19.5"/>
118
+                                            <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
119
+                                            <animations/>
120
+                                            <fontDescription key="fontDescription" type="system" pointSize="16"/>
121
+                                            <color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
122
+                                            <nil key="highlightedColor"/>
123
+                                        </label>
124
+                                        <label opaque="NO" multipleTouchEnabled="YES" contentMode="left" text="Detail" textAlignment="right" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="cPw-2i-8Qf">
125
+                                            <rect key="frame" x="263.5" y="12" width="41.5" height="19.5"/>
126
+                                            <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
127
+                                            <animations/>
128
+                                            <fontDescription key="fontDescription" type="system" pointSize="16"/>
129
+                                            <color key="textColor" red="0.55686274509803924" green="0.55686274509803924" blue="0.57647058823529407" alpha="1" colorSpace="calibratedRGB"/>
130
+                                            <nil key="highlightedColor"/>
131
+                                        </label>
132
+                                    </subviews>
133
+                                    <animations/>
134
+                                </tableViewCellContentView>
135
+                                <animations/>
136
+                                <connections>
137
+                                    <outlet property="detail" destination="cPw-2i-8Qf" id="t8w-Bp-3jk"/>
138
+                                    <outlet property="name" destination="l7i-GU-Rix" id="JqH-93-KQD"/>
139
+                                </connections>
140
+                            </tableViewCell>
141
+                            <tableViewCell contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" reuseIdentifier="ImageCell" rowHeight="150" id="Htw-m3-fgz" customClass="ImageCell" customModule="CodeReader" customModuleProvider="target">
142
+                                <rect key="frame" x="0.0" y="267.5" width="320" height="150"/>
143
+                                <autoresizingMask key="autoresizingMask"/>
144
+                                <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="Htw-m3-fgz" id="ixZ-ny-O1I">
145
+                                    <rect key="frame" x="0.0" y="0.0" width="320" height="149.5"/>
146
+                                    <autoresizingMask key="autoresizingMask"/>
147
+                                    <subviews>
148
+                                        <imageView userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="sfB-8a-sKq">
149
+                                            <rect key="frame" x="0.0" y="8" width="320" height="134"/>
150
+                                            <animations/>
151
+                                        </imageView>
152
+                                    </subviews>
153
+                                    <animations/>
154
+                                    <constraints>
155
+                                        <constraint firstItem="sfB-8a-sKq" firstAttribute="top" secondItem="ixZ-ny-O1I" secondAttribute="topMargin" id="DuI-V0-TRB"/>
156
+                                        <constraint firstAttribute="trailingMargin" secondItem="sfB-8a-sKq" secondAttribute="trailing" constant="-8" id="JuO-y1-w2e"/>
157
+                                        <constraint firstAttribute="bottomMargin" secondItem="sfB-8a-sKq" secondAttribute="bottom" id="Kct-CF-Hgi"/>
158
+                                        <constraint firstItem="sfB-8a-sKq" firstAttribute="leading" secondItem="ixZ-ny-O1I" secondAttribute="leadingMargin" constant="-8" id="QoV-Jz-GVg"/>
159
+                                    </constraints>
160
+                                </tableViewCellContentView>
161
+                                <animations/>
162
+                                <connections>
163
+                                    <outlet property="product" destination="sfB-8a-sKq" id="LLF-bG-3F1"/>
164
+                                </connections>
165
+                            </tableViewCell>
166
+                        </prototypes>
167
+                        <connections>
168
+                            <outlet property="dataSource" destination="7ns-37-3i1" id="O1C-kD-vmU"/>
169
+                            <outlet property="delegate" destination="7ns-37-3i1" id="x8s-Oi-Odw"/>
170
+                        </connections>
171
+                    </tableView>
172
+                    <toolbarItems/>
173
+                    <navigationItem key="navigationItem" id="WZR-iU-0dh">
174
+                        <barButtonItem key="backBarButtonItem" title="Back" id="8cS-cW-soE"/>
175
+                        <barButtonItem key="rightBarButtonItem" systemItem="action" id="w7z-OY-st4">
176
+                            <connections>
177
+                                <action selector="share:" destination="7ns-37-3i1" id="NPi-Y6-1ru"/>
178
+                            </connections>
179
+                        </barButtonItem>
180
+                    </navigationItem>
181
+                    <simulatedStatusBarMetrics key="simulatedStatusBarMetrics" statusBarStyle="lightContent"/>
182
+                    <nil key="simulatedBottomBarMetrics"/>
183
+                </tableViewController>
184
+                <placeholder placeholderIdentifier="IBFirstResponder" id="aVO-1W-ahG" userLabel="First Responder" sceneMemberID="firstResponder"/>
185
+            </objects>
186
+            <point key="canvasLocation" x="843" y="-12"/>
187
+        </scene>
188
+        <!--Settings View Controller-->
189
+        <scene sceneID="uOY-T5-lJa">
190
+            <objects>
191
+                <tableViewController id="ghB-8c-FC9" customClass="SettingsViewController" customModule="CodeReader" customModuleProvider="target" sceneMemberID="viewController">
192
+                    <tableView key="view" clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="grouped" separatorStyle="default" rowHeight="44" sectionHeaderHeight="10" sectionFooterHeight="10" id="cTt-Pf-ZR6">
193
+                        <rect key="frame" x="0.0" y="0.0" width="320" height="600"/>
194
+                        <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
195
+                        <animations/>
196
+                        <color key="backgroundColor" red="0.93725490199999995" green="0.93725490199999995" blue="0.95686274510000002" alpha="1" colorSpace="calibratedRGB"/>
197
+                        <prototypes>
198
+                            <tableViewCell contentMode="scaleToFill" selectionStyle="none" indentationWidth="10" reuseIdentifier="SettingsCell" id="tPf-UV-yUd" customClass="SettingsCell" customModule="CodeReader" customModuleProvider="target">
199
+                                <rect key="frame" x="0.0" y="113.5" width="320" height="44"/>
200
+                                <autoresizingMask key="autoresizingMask"/>
201
+                                <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="tPf-UV-yUd" id="8vB-ca-M4q">
202
+                                    <rect key="frame" x="0.0" y="0.0" width="320" height="43.5"/>
203
+                                    <autoresizingMask key="autoresizingMask"/>
204
+                                    <subviews>
205
+                                        <switch opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" contentHorizontalAlignment="center" contentVerticalAlignment="center" translatesAutoresizingMaskIntoConstraints="NO" id="vjk-We-wAJ">
206
+                                            <rect key="frame" x="263" y="6" width="51" height="31"/>
207
+                                            <animations/>
208
+                                            <constraints>
209
+                                                <constraint firstAttribute="width" constant="49" id="Xn2-QG-iLj"/>
210
+                                                <constraint firstAttribute="height" constant="31" id="ytj-O1-lfP"/>
211
+                                            </constraints>
212
+                                            <color key="onTintColor" red="0.99607849120000003" green="0.79607850309999995" blue="0.180392161" alpha="1" colorSpace="deviceRGB"/>
213
+                                        </switch>
214
+                                        <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="0cJ-Fa-X75">
215
+                                            <rect key="frame" x="56" y="0.0" width="199" height="44"/>
216
+                                            <animations/>
217
+                                            <fontDescription key="fontDescription" type="system" pointSize="17"/>
218
+                                            <color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
219
+                                            <nil key="highlightedColor"/>
220
+                                        </label>
221
+                                        <imageView userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="8M5-Hn-mGa">
222
+                                            <rect key="frame" x="8" y="2" width="40" height="40"/>
223
+                                            <animations/>
224
+                                            <constraints>
225
+                                                <constraint firstAttribute="width" constant="40" id="77d-it-dVA"/>
226
+                                            </constraints>
227
+                                        </imageView>
228
+                                    </subviews>
229
+                                    <animations/>
230
+                                    <constraints>
231
+                                        <constraint firstItem="vjk-We-wAJ" firstAttribute="leading" secondItem="0cJ-Fa-X75" secondAttribute="trailing" constant="8" id="Ce7-yl-wN9"/>
232
+                                        <constraint firstItem="vjk-We-wAJ" firstAttribute="trailing" secondItem="8vB-ca-M4q" secondAttribute="trailingMargin" id="FLg-gp-9xQ"/>
233
+                                        <constraint firstItem="0cJ-Fa-X75" firstAttribute="leading" secondItem="8vB-ca-M4q" secondAttribute="leadingMargin" constant="48" id="Ivv-PQ-fUS"/>
234
+                                        <constraint firstItem="8M5-Hn-mGa" firstAttribute="leading" secondItem="8vB-ca-M4q" secondAttribute="leadingMargin" constant="-4" id="JJh-SP-H4i"/>
235
+                                        <constraint firstAttribute="bottomMargin" secondItem="8M5-Hn-mGa" secondAttribute="bottom" constant="-6.5" id="UDY-7W-Dk6"/>
236
+                                        <constraint firstAttribute="bottomMargin" secondItem="8M5-Hn-mGa" secondAttribute="bottom" constant="-8" id="UMS-M5-U4u"/>
237
+                                        <constraint firstAttribute="bottomMargin" secondItem="0cJ-Fa-X75" secondAttribute="bottom" constant="-8" id="WNZ-1D-6pz"/>
238
+                                        <constraint firstItem="0cJ-Fa-X75" firstAttribute="leading" secondItem="8M5-Hn-mGa" secondAttribute="trailing" constant="8" id="YKJ-8J-LPV"/>
239
+                                        <constraint firstItem="8M5-Hn-mGa" firstAttribute="top" secondItem="8vB-ca-M4q" secondAttribute="topMargin" constant="-6" id="by2-nC-7tU"/>
240
+                                        <constraint firstItem="0cJ-Fa-X75" firstAttribute="leading" secondItem="8M5-Hn-mGa" secondAttribute="trailing" constant="8" id="jPc-vB-e2h"/>
241
+                                        <constraint firstItem="vjk-We-wAJ" firstAttribute="top" secondItem="8vB-ca-M4q" secondAttribute="topMargin" constant="-2" id="kRB-ny-dvb"/>
242
+                                        <constraint firstItem="8M5-Hn-mGa" firstAttribute="top" secondItem="8vB-ca-M4q" secondAttribute="topMargin" constant="-8" id="kjT-GT-1L8"/>
243
+                                        <constraint firstAttribute="bottomMargin" secondItem="8M5-Hn-mGa" secondAttribute="bottom" constant="6" id="lGI-7c-MU8"/>
244
+                                        <constraint firstItem="8M5-Hn-mGa" firstAttribute="top" secondItem="8vB-ca-M4q" secondAttribute="topMargin" constant="-6" id="ntu-7T-5Qy"/>
245
+                                        <constraint firstItem="8M5-Hn-mGa" firstAttribute="leading" secondItem="8vB-ca-M4q" secondAttribute="leadingMargin" constant="-8" id="pey-aW-vLE"/>
246
+                                        <constraint firstItem="8M5-Hn-mGa" firstAttribute="leading" secondItem="8vB-ca-M4q" secondAttribute="leadingMargin" id="qdk-br-HfR"/>
247
+                                        <constraint firstItem="0cJ-Fa-X75" firstAttribute="top" secondItem="8vB-ca-M4q" secondAttribute="topMargin" constant="-8" id="tek-eQ-3xc"/>
248
+                                        <constraint firstItem="0cJ-Fa-X75" firstAttribute="leading" secondItem="8M5-Hn-mGa" secondAttribute="trailing" constant="8" id="vM0-To-FQj"/>
249
+                                    </constraints>
250
+                                    <variation key="default">
251
+                                        <mask key="constraints">
252
+                                            <exclude reference="JJh-SP-H4i"/>
253
+                                            <exclude reference="UMS-M5-U4u"/>
254
+                                            <exclude reference="kjT-GT-1L8"/>
255
+                                            <exclude reference="lGI-7c-MU8"/>
256
+                                            <exclude reference="ntu-7T-5Qy"/>
257
+                                            <exclude reference="pey-aW-vLE"/>
258
+                                            <exclude reference="YKJ-8J-LPV"/>
259
+                                            <exclude reference="jPc-vB-e2h"/>
260
+                                            <exclude reference="vM0-To-FQj"/>
261
+                                        </mask>
262
+                                    </variation>
263
+                                </tableViewCellContentView>
264
+                                <animations/>
265
+                                <connections>
266
+                                    <outlet property="label" destination="0cJ-Fa-X75" id="eHJ-QZ-Rbi"/>
267
+                                    <outlet property="logo" destination="8M5-Hn-mGa" id="fVk-XL-l77"/>
268
+                                    <outlet property="onoff" destination="vjk-We-wAJ" id="hpy-ak-3VX"/>
269
+                                </connections>
270
+                            </tableViewCell>
271
+                            <tableViewCell contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" reuseIdentifier="RemoveAdsCell" id="Nxi-Pg-GvM">
272
+                                <rect key="frame" x="0.0" y="157.5" width="320" height="44"/>
273
+                                <autoresizingMask key="autoresizingMask"/>
274
+                                <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="Nxi-Pg-GvM" id="kfj-fx-mzD">
275
+                                    <rect key="frame" x="0.0" y="0.0" width="320" height="43.5"/>
276
+                                    <autoresizingMask key="autoresizingMask"/>
277
+                                    <animations/>
278
+                                </tableViewCellContentView>
279
+                                <animations/>
280
+                            </tableViewCell>
281
+                        </prototypes>
282
+                        <connections>
283
+                            <outlet property="dataSource" destination="ghB-8c-FC9" id="vtz-gZ-cCi"/>
284
+                            <outlet property="delegate" destination="ghB-8c-FC9" id="cJG-eV-8fy"/>
285
+                        </connections>
286
+                    </tableView>
287
+                </tableViewController>
288
+                <placeholder placeholderIdentifier="IBFirstResponder" id="Sx9-Wh-WeU" userLabel="First Responder" sceneMemberID="firstResponder"/>
289
+            </objects>
290
+            <point key="canvasLocation" x="843" y="684"/>
291
+        </scene>
292
+        <!--Navigation Controller-->
293
+        <scene sceneID="uco-aj-gNv">
294
+            <objects>
295
+                <navigationController id="g24-NZ-lCn" sceneMemberID="viewController">
296
+                    <nil key="simulatedBottomBarMetrics"/>
297
+                    <navigationBar key="navigationBar" contentMode="scaleToFill" barStyle="black" id="h5M-U2-u01">
298
+                        <rect key="frame" x="0.0" y="0.0" width="320" height="44"/>
299
+                        <autoresizingMask key="autoresizingMask"/>
300
+                        <animations/>
301
+                        <color key="backgroundColor" white="0.0" alpha="1" colorSpace="calibratedWhite"/>
302
+                        <color key="tintColor" red="0.99607849120000003" green="0.79607850309999995" blue="0.180392161" alpha="1" colorSpace="deviceRGB"/>
303
+                        <color key="barTintColor" white="0.0" alpha="1" colorSpace="calibratedWhite"/>
304
+                        <textAttributes key="titleTextAttributes">
305
+                            <color key="textColor" red="0.99607849120000003" green="0.79607850309999995" blue="0.180392161" alpha="1" colorSpace="deviceRGB"/>
306
+                            <color key="textShadowColor" white="0.0" alpha="1" colorSpace="calibratedWhite"/>
307
+                        </textAttributes>
308
+                    </navigationBar>
309
+                    <connections>
310
+                        <segue destination="vXZ-lx-hvc" kind="relationship" relationship="rootViewController" id="nXI-cC-RAI"/>
311
+                    </connections>
312
+                </navigationController>
313
+                <placeholder placeholderIdentifier="IBFirstResponder" id="5ib-zn-Br3" userLabel="First Responder" sceneMemberID="firstResponder"/>
314
+            </objects>
315
+            <point key="canvasLocation" x="-501" y="336"/>
316
+        </scene>
317
+    </scenes>
318
+    <resources>
319
+        <image name="Flash" width="18" height="30"/>
320
+        <image name="Gear" width="30" height="30"/>
321
+    </resources>
322
+</document>

+ 48
- 0
CodeReader/CameraFocusSquare.swift View File

@@ -0,0 +1,48 @@
1
+//
2
+//  CameraFocusSquare.swift
3
+//  CodeReader
4
+//
5
+//  Created by David Walter on 05.02.15.
6
+//  Copyright (c) 2015 David Walter. All rights reserved.
7
+//
8
+
9
+import UIKit
10
+
11
+class CameraFocusSquare: UIView {
12
+
13
+    required init?(coder aDecoder: NSCoder) {
14
+        super.init(coder: aDecoder)
15
+    }
16
+    
17
+    override init(frame: CGRect) {
18
+        super.init(frame: frame)
19
+       
20
+        self.backgroundColor = UIColor.clear
21
+        self.layer.borderWidth = 1.0
22
+        self.layer.borderColor = UIColor(red: 1, green: 0.8, blue: 0.18, alpha: 1).cgColor
23
+        
24
+        addLine(CGPoint(x: 39.5, y: 0), to: CGPoint(x: 39.5, y: 7))
25
+        addLine(CGPoint(x: 0, y: 39.5), to: CGPoint(x: 7, y: 40))
26
+        addLine(CGPoint(x: 39.5, y: 80), to: CGPoint(x: 39.5, y: 73))
27
+        addLine(CGPoint(x: 80, y: 39.5), to: CGPoint(x: 73, y: 39.5))
28
+        /*
29
+        let selectionAnimation = CABasicAnimation(keyPath: "borderColor")
30
+        selectionAnimation.toValue = UIColor.whiteColor().CGColor
31
+        selectionAnimation.repeatCount = 4
32
+        self.layer.addAnimation(selectionAnimation, forKey: "selectionAnimation")
33
+        */
34
+    }
35
+    
36
+    func addLine(_ from: CGPoint, to: CGPoint) {
37
+        let line = CAShapeLayer()
38
+        let path = UIBezierPath()
39
+        
40
+        path.move(to: from)
41
+        path.addLine(to: to)
42
+        line.path = path.cgPath
43
+        line.fillColor = nil
44
+        line.opacity = 1
45
+        line.strokeColor = UIColor(red: 1, green: 0.8, blue: 0.18, alpha: 1).cgColor
46
+        self.layer.addSublayer(line)
47
+    }
48
+}

+ 4
- 0
CodeReader/CodeReader-Bridging-Header.h View File

@@ -0,0 +1,4 @@
1
+//
2
+//  Use this file to import your target's public headers that you would like to expose to Swift.
3
+//
4
+

+ 146
- 0
CodeReader/CodeReader.swift View File

@@ -0,0 +1,146 @@
1
+//
2
+//  CodeReader.swift
3
+//  CodeReader
4
+//
5
+//  Created by David Walter on 29.01.15.
6
+//  Copyright (c) 2015 David Walter. All rights reserved.
7
+//
8
+
9
+import Foundation
10
+import UIKit
11
+import AVFoundation
12
+
13
+class CodeReader: NSObject, AVCaptureMetadataOutputObjectsDelegate {
14
+    
15
+    var delegate : ViewController?
16
+    
17
+    var isReady = false
18
+    
19
+    var device : AVCaptureDevice?
20
+    var captureSession : AVCaptureSession?
21
+    //var videoPreviewLayer: AVCaptureVideoPreviewLayer?
22
+
23
+    init(delegate: ViewController) {
24
+        super.init()
25
+        self.delegate = delegate
26
+        device = AVCaptureDevice.defaultDevice(withMediaType: AVMediaTypeVideo)
27
+        self.StartReading()
28
+    }
29
+    
30
+    func toggleFlashlight() -> Bool {
31
+        if (device?.torchMode == AVCaptureTorchMode.off) {
32
+            flashLightOn()
33
+            return true
34
+        } else {
35
+            flashLightOff()
36
+            return false
37
+        }
38
+    }
39
+    
40
+    func flashLightOff() {
41
+        let error: NSErrorPointer = nil
42
+        
43
+        do {
44
+            try device?.lockForConfiguration()
45
+        } catch let error1 as NSError {
46
+            error?.pointee = error1
47
+        }
48
+        device?.torchMode = AVCaptureTorchMode.off
49
+        device?.unlockForConfiguration()
50
+    }
51
+    
52
+    func flashLightOn() {
53
+        let error: NSErrorPointer = nil
54
+        
55
+        do {
56
+            try device?.lockForConfiguration()
57
+        } catch let error1 as NSError {
58
+            error?.pointee = error1
59
+        }
60
+        device?.torchMode = AVCaptureTorchMode.on
61
+        device?.unlockForConfiguration()
62
+    }
63
+    
64
+    func Continue() {
65
+        captureSession?.startRunning()
66
+    }
67
+    
68
+    func Pause() {
69
+        captureSession?.stopRunning()
70
+        isReady = false
71
+    }
72
+    
73
+    func focus(_ point: CGPoint) {
74
+        if  let d = device {
75
+            if (d.isFocusPointOfInterestSupported &&
76
+                d.isFocusModeSupported(AVCaptureFocusMode.autoFocus)) {
77
+                    let error: NSErrorPointer = nil
78
+            
79
+                    do {
80
+                        try d.lockForConfiguration()
81
+                    } catch let error1 as NSError {
82
+                        error?.pointee = error1
83
+                    }
84
+            
85
+                    d.focusPointOfInterest = point
86
+                    d.focusMode = AVCaptureFocusMode.continuousAutoFocus //AVCaptureFocusMode.AutoFocus
87
+                    
88
+                    if (d.isExposureModeSupported(AVCaptureExposureMode.continuousAutoExposure)) {
89
+                        d.exposureMode = AVCaptureExposureMode.continuousAutoExposure
90
+                    }
91
+            
92
+                    d.unlockForConfiguration()
93
+            }
94
+        }
95
+    }
96
+    
97
+    func StartReading() {
98
+        if let d = device {
99
+            
100
+            do {
101
+                let input = try AVCaptureDeviceInput(device: d)
102
+                //let input = AVCaptureDeviceInput.deviceInputWithDevice(d, error: error) as AVCaptureDeviceInput
103
+                captureSession = AVCaptureSession()
104
+                captureSession?.addInput(input)
105
+                
106
+                let metadata = AVCaptureMetadataOutput()
107
+                captureSession?.addOutput(metadata)
108
+                
109
+                let queue : DispatchQueue = DispatchQueue(label: "myQueue", attributes: [])
110
+                
111
+                metadata.setMetadataObjectsDelegate(self, queue: queue)
112
+                //metadata.metadataObjectTypes = [AVMetadataObjectTypeQRCode]
113
+                metadata.metadataObjectTypes = [AVMetadataObjectTypeAztecCode, AVMetadataObjectTypeCode128Code, AVMetadataObjectTypeCode39Code, AVMetadataObjectTypeCode39Mod43Code, AVMetadataObjectTypeCode93Code, AVMetadataObjectTypeDataMatrixCode, AVMetadataObjectTypeEAN13Code, AVMetadataObjectTypeEAN8Code, AVMetadataObjectTypeInterleaved2of5Code, AVMetadataObjectTypeITF14Code, AVMetadataObjectTypePDF417Code, AVMetadataObjectTypeQRCode, AVMetadataObjectTypeUPCECode]
114
+                //metadata.metadataObjectTypes = [AVMetadataObjectTypeQRCode, AVMetadataObjectTypeCode128Code, AVMetadataObjectTypeCode39Code, AVMetadataObjectTypeCode39Mod43Code, AVMetadataObjectTypeCode93Code, AVMetadataObjectTypeEAN13Code, AVMetadataObjectTypeEAN8Code, AVMetadataObjectTypeUPCECode]
115
+                
116
+                let videoPreviewLayer = AVCaptureVideoPreviewLayer(session: captureSession)
117
+                videoPreviewLayer?.videoGravity = AVLayerVideoGravityResizeAspectFill
118
+                
119
+                if let frame = delegate {
120
+                    videoPreviewLayer?.frame = frame.view.layer.bounds
121
+                    frame.cameraView?.layer.addSublayer(videoPreviewLayer!)
122
+                }
123
+                
124
+                isReady = true
125
+                
126
+                self.Continue()
127
+            } catch {
128
+                
129
+            }
130
+            
131
+        }
132
+    }
133
+    
134
+    func captureOutput(_ captureOutput: AVCaptureOutput!, didOutputMetadataObjects metadataObjects: [Any]!, from connection: AVCaptureConnection!) {
135
+        
136
+        if (isReady && metadataObjects.count > 0) {
137
+            let object : AVMetadataMachineReadableCodeObject! = metadataObjects[0] as! AVMetadataMachineReadableCodeObject
138
+            
139
+            self.Pause()
140
+            DispatchQueue.main.async(execute: {
141
+                if let d = self.delegate { d.CodeFound(object) }
142
+            })
143
+        }
144
+    }
145
+    
146
+}

+ 281
- 0
CodeReader/DetailViewController.swift View File

@@ -0,0 +1,281 @@
1
+//
2
+//  DetailViewController.swift
3
+//  CodeReader
4
+//
5
+//  Created by David Walter on 29.01.15.
6
+//  Copyright (c) 2015 David Walter. All rights reserved.
7
+//
8
+
9
+import UIKit
10
+import AVFoundation
11
+import iAd
12
+
13
+class AttributeCell: UITableViewCell {
14
+    @IBOutlet var detail : UILabel!
15
+    @IBOutlet var name : UILabel!
16
+}
17
+
18
+class ImageCell: UITableViewCell {
19
+    @IBOutlet var product : UIImageView!
20
+}
21
+
22
+class DetailViewController: UITableViewController, ADBannerViewDelegate {
23
+    
24
+    var overlay : Overlay?
25
+    
26
+    var dict : NSDictionary?
27
+    var productImage : UIImage?
28
+    
29
+    var object : AVMetadataMachineReadableCodeObject?
30
+    var hasValidData = false
31
+    var hasAttributes = false
32
+    var loadingOutpan = false
33
+    
34
+    var option : String!
35
+    var code = Validation.ValidationCode.undefined
36
+    
37
+    override func viewDidLoad() {
38
+        super.viewDidLoad()
39
+        
40
+        if let o = object {
41
+            let info = Validation.validateString(o.stringValue)
42
+            option = info.text
43
+            code = info.code
44
+            
45
+            if (code == .number && o.type != AVMetadataObjectTypeQRCode) {
46
+                self.loadingOutpan = true
47
+                let queue : DispatchQueue = DispatchQueue(label: "outpan", attributes: [])
48
+                queue.async(execute: {
49
+                    let outpan = Outpan()
50
+                    self.dict = outpan.getData(self.option)
51
+                    if (self.dict?.object(forKey: "error") == nil) {
52
+                        self.hasValidData = true
53
+                        
54
+                        if let ia = self.dict?.object(forKey: "images") {
55
+                            let imageArray = ia as! NSArray
56
+                            
57
+                            if (imageArray.count > 0) {
58
+                                var urlString = imageArray.object(at: 0) as! String;
59
+                                urlString = urlString.replacingOccurrences(of: "\\", with: "")
60
+                                if let url = URL(string: urlString) {
61
+                                    if let data = try? Data(contentsOf: url) {
62
+                                        self.productImage = UIImage(data: data)
63
+                                    }
64
+                                }
65
+                            }
66
+                        }
67
+                        
68
+                        DispatchQueue.main.async(execute: {
69
+                            self.tableView.reloadData()
70
+                        })
71
+                    }
72
+                })
73
+            }
74
+        }
75
+    }
76
+    
77
+    func bannerView(_ banner: ADBannerView!, didFailToReceiveAdWithError error: Error!) {
78
+        banner.isHidden = true
79
+    }
80
+    
81
+    func bannerViewDidLoadAd(_ banner: ADBannerView!) {
82
+        banner.isHidden = Settings.HideAds()
83
+    }
84
+    
85
+    @IBAction func share(_ sender: UIBarButtonItem) {
86
+        if let stringValue = object?.stringValue {
87
+            let activity = UIActivityViewController(activityItems: [stringValue], applicationActivities: nil)
88
+            //UIView.setAnimationsEnabled(true)
89
+            self.present(activity, animated: true, completion: nil)
90
+            activity.popoverPresentationController?.sourceView = self.view
91
+        }
92
+    }
93
+    
94
+    override func numberOfSections(in tableView: UITableView) -> Int {
95
+        return loadingOutpan ? 2 : 1
96
+    }
97
+    
98
+    override func tableView(_ tableView: UITableView?, numberOfRowsInSection section: Int) -> Int {
99
+        if (section == 0) {
100
+            if (code == .undefined) {
101
+                return 1
102
+            }
103
+            
104
+            if (code == .number || code ==  .phone || code == .sms) {
105
+                return 3
106
+            }
107
+            
108
+            return 2
109
+        }
110
+        
111
+        if (hasValidData && section == 1) {
112
+            
113
+            let any : AnyObject! = dict?.object(forKey: "attributes") as AnyObject!
114
+            //let value = (dict.objectForKey("images") as NSArray).count + 1
115
+            let value = 1
116
+            
117
+            if (any is NSDictionary) {
118
+                hasAttributes = true
119
+                return value + any.count
120
+            } else {
121
+                hasAttributes = true
122
+                return value
123
+            }
124
+        }
125
+        
126
+        return 1
127
+    }
128
+    
129
+    override func tableView(_ tableView: UITableView, titleForHeaderInSection section: Int) -> String? {
130
+        if (section == 0) {
131
+            return "Data"
132
+        } else if (section == 1) {
133
+            return "Outpan"
134
+        }
135
+        
136
+        return nil
137
+    }
138
+    
139
+    override func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
140
+        if (indexPath.section == 1) {
141
+            if (productImage != nil && indexPath.row == 1) {
142
+                return 150.0
143
+            } else {
144
+                return 44.0
145
+            }
146
+        }
147
+        
148
+        return 44.0
149
+    }
150
+    
151
+    override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
152
+        if (indexPath.section == 1 && hasValidData) {
153
+            
154
+            if (indexPath.row == 0) {
155
+                let cell:UITableViewCell = self.tableView.dequeueReusableCell(withIdentifier: "DetailCell", for: indexPath) as UITableViewCell
156
+                
157
+                let name = dict?.object(forKey: "name")
158
+                
159
+                if let text = name as? String {
160
+                    if (!text.isEmpty) {
161
+                        cell.textLabel?.text = text.cleanString()
162
+                    } else {
163
+                        cell.textLabel?.text = "No information"
164
+                    }
165
+                } else {
166
+                    cell.textLabel?.text = "No information"
167
+                }
168
+                
169
+                cell.selectionStyle = .none
170
+                return cell
171
+            } else if (productImage != nil && indexPath.row == 1) {
172
+                let icell = self.tableView.dequeueReusableCell(withIdentifier: "ImageCell", for: indexPath) as! ImageCell
173
+                
174
+                icell.product?.image = productImage
175
+                
176
+                icell.selectionStyle = .none
177
+                return icell
178
+            } else if (hasAttributes) {
179
+                
180
+                let attributes = dict?.object(forKey: "attributes") as! NSDictionary!
181
+                var keys = attributes?.allKeys
182
+                
183
+                let acell = self.tableView.dequeueReusableCell(withIdentifier: "AttributeCell", for: indexPath) as! AttributeCell
184
+                
185
+                let index = indexPath.row - (productImage != nil ? 2 : 1)
186
+                
187
+                if (index < (keys?.count)!) {
188
+                    let text = keys?[index] as! String
189
+                    let detail = attributes?.object(forKey: text) as! String
190
+                    
191
+                    acell.name?.text = text.cleanString()
192
+                    acell.detail?.text = detail.cleanString()
193
+                }
194
+                
195
+                acell.selectionStyle = .none
196
+                return acell
197
+            }
198
+        } else if (indexPath.section == 1) {
199
+            let cell:UITableViewCell = self.tableView.dequeueReusableCell(withIdentifier: "DetailCell", for: indexPath) as UITableViewCell
200
+            
201
+            cell.textLabel?.text = "Loading..."
202
+            
203
+            cell.selectionStyle = .none
204
+            return cell
205
+        }
206
+        
207
+        let cell:UITableViewCell = self.tableView.dequeueReusableCell(withIdentifier: "DetailCell", for: indexPath) as UITableViewCell
208
+        
209
+        if (indexPath.row == 0) {
210
+            cell.textLabel?.text = object?.stringValue
211
+            cell.imageView?.image = UIImage(named: "Paste")
212
+        } else if (code != .undefined) {
213
+            cell.textLabel?.text = option
214
+            
215
+            switch(code) {
216
+            case .number, .phone, .sms:
217
+                if (indexPath.row == 1) {
218
+                    cell.imageView?.image = UIImage(named: "Phone")
219
+                } else {
220
+                    cell.imageView?.image = UIImage(named: "SMS")
221
+                }
222
+            case .url:
223
+                cell.imageView?.image = UIImage(named: "Safari")
224
+            case .email:
225
+                cell.imageView?.image = UIImage(named: "Mail")
226
+            case .location:
227
+                cell.imageView?.image = UIImage(named: "Maps")
228
+            default:
229
+                cell.imageView?.image = UIImage(named: "Data")
230
+            }
231
+        }
232
+        
233
+        return cell
234
+    }
235
+    
236
+    override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
237
+        self.tableView.deselectRow(at: indexPath, animated: true)
238
+        
239
+        if (indexPath.section == 0) {
240
+            if (indexPath.row == 0) {
241
+                UIPasteboard.general.string = object?.stringValue
242
+                displayOverlay()
243
+            } else if (code == .url) {
244
+                let url = URL(string: option)
245
+                UIApplication.shared.openURL(url!)
246
+            } else if (code == .email) {
247
+                let url = URL(string: "mailto:" + option)
248
+                UIApplication.shared.openURL(url!)
249
+            } else if (code == .number || code ==  .phone || code == .sms) {
250
+                if (indexPath.row == 1) {
251
+                    let url = URL(string: "tel://" + option)
252
+                    UIApplication.shared.openURL(url!)
253
+                } else {
254
+                    let url = URL(string: "sms://" + option)
255
+                    UIApplication.shared.openURL(url!)
256
+                }
257
+            } else  if (code == .location) {
258
+                let url = URL(string: "http://maps.apple.com?q=" + option)
259
+                UIApplication.shared.openURL(url!)
260
+            } else if (code == .contact) {
261
+                
262
+            }
263
+        } else {
264
+            //Outpan
265
+            //TODO
266
+        }
267
+    }
268
+    
269
+    func displayOverlay() {
270
+        overlay?.removeFromSuperview()
271
+        
272
+        overlay = Overlay(message: "Copied to Clipboard")
273
+        self.view.addSubview(overlay!)
274
+        overlay!.setNeedsDisplay()
275
+        
276
+        UIView.beginAnimations(nil, context: nil)
277
+        UIView.setAnimationDuration(1.0)
278
+        overlay!.alpha = 0.0
279
+        UIView.commitAnimations()
280
+    }
281
+}

+ 40
- 0
CodeReader/Images.xcassets/AppIcon.appiconset/Contents.json View File

@@ -0,0 +1,40 @@
1
+{
2
+  "images" : [
3
+    {
4
+      "idiom" : "iphone",
5
+      "size" : "29x29",
6
+      "scale" : "2x"
7
+    },
8
+    {
9
+      "idiom" : "iphone",
10
+      "size" : "29x29",
11
+      "scale" : "3x"
12
+    },
13
+    {
14
+      "idiom" : "iphone",
15
+      "size" : "40x40",
16
+      "scale" : "2x"
17
+    },
18
+    {
19
+      "idiom" : "iphone",
20
+      "size" : "40x40",
21
+      "scale" : "3x"
22
+    },
23
+    {
24
+      "size" : "60x60",
25
+      "idiom" : "iphone",
26
+      "filename" : "Icon@2x.png",
27
+      "scale" : "2x"
28
+    },
29
+    {
30
+      "size" : "60x60",
31
+      "idiom" : "iphone",
32
+      "filename" : "Icon@3x.png",
33
+      "scale" : "3x"
34
+    }
35
+  ],
36
+  "info" : {
37
+    "version" : 1,
38
+    "author" : "xcode"
39
+  }
40
+}

BIN
CodeReader/Images.xcassets/AppIcon.appiconset/Icon@2x.png View File


BIN
CodeReader/Images.xcassets/AppIcon.appiconset/Icon@3x.png View File


+ 6
- 0
CodeReader/Images.xcassets/Contents.json View File

@@ -0,0 +1,6 @@
1
+{
2
+  "info" : {
3
+    "version" : 1,
4
+    "author" : "xcode"
5
+  }
6
+}

+ 22
- 0
CodeReader/Images.xcassets/Flash.imageset/Contents.json View File

@@ -0,0 +1,22 @@
1
+{
2
+  "images" : [
3
+    {
4
+      "idiom" : "universal",
5
+      "scale" : "1x"
6
+    },
7
+    {
8
+      "idiom" : "universal",
9
+      "scale" : "2x",
10
+      "filename" : "Slice 2@2x.png"
11
+    },
12
+    {
13
+      "idiom" : "universal",
14
+      "scale" : "3x",
15
+      "filename" : "Slice 2@3x.png"
16
+    }
17
+  ],
18
+  "info" : {
19
+    "version" : 1,
20
+    "author" : "xcode"
21
+  }
22
+}

BIN
CodeReader/Images.xcassets/Flash.imageset/Slice 2@2x.png View File


BIN
CodeReader/Images.xcassets/Flash.imageset/Slice 2@3x.png View File


+ 22
- 0
CodeReader/Images.xcassets/Gear.imageset/Contents.json View File

@@ -0,0 +1,22 @@
1
+{
2
+  "images" : [
3
+    {
4
+      "idiom" : "universal",
5
+      "scale" : "1x"
6
+    },
7
+    {
8
+      "idiom" : "universal",
9
+      "scale" : "2x",
10
+      "filename" : "Gear@2x.png"
11
+    },
12
+    {
13
+      "idiom" : "universal",
14
+      "scale" : "3x",
15
+      "filename" : "Gear@3x.png"
16
+    }
17
+  ],
18
+  "info" : {
19
+    "version" : 1,
20
+    "author" : "xcode"
21
+  }
22
+}

BIN
CodeReader/Images.xcassets/Gear.imageset/Gear@2x.png View File


BIN
CodeReader/Images.xcassets/Gear.imageset/Gear@3x.png View File


+ 22
- 0
CodeReader/Images.xcassets/Mail.imageset/Contents.json View File

@@ -0,0 +1,22 @@
1
+{
2
+  "images" : [
3
+    {
4
+      "idiom" : "universal",
5
+      "scale" : "1x"
6
+    },
7
+    {
8
+      "idiom" : "universal",
9
+      "scale" : "2x",
10
+      "filename" : "Mail-1.png"
11
+    },
12
+    {
13
+      "idiom" : "universal",
14
+      "scale" : "3x",
15
+      "filename" : "Mail.png"
16
+    }
17
+  ],
18
+  "info" : {
19
+    "version" : 1,
20
+    "author" : "xcode"
21
+  }
22
+}

BIN
CodeReader/Images.xcassets/Mail.imageset/Mail-1.png View File


BIN
CodeReader/Images.xcassets/Mail.imageset/Mail.png View File


+ 22
- 0
CodeReader/Images.xcassets/Maps.imageset/Contents.json View File

@@ -0,0 +1,22 @@
1
+{
2
+  "images" : [
3
+    {
4
+      "idiom" : "universal",
5
+      "scale" : "1x"
6
+    },
7
+    {
8
+      "idiom" : "universal",
9
+      "scale" : "2x",
10
+      "filename" : "Maps-1.png"
11
+    },
12
+    {
13
+      "idiom" : "universal",
14
+      "scale" : "3x",
15
+      "filename" : "Maps.png"
16
+    }
17
+  ],
18
+  "info" : {
19
+    "version" : 1,
20
+    "author" : "xcode"
21
+  }
22
+}

BIN
CodeReader/Images.xcassets/Maps.imageset/Maps-1.png View File


BIN
CodeReader/Images.xcassets/Maps.imageset/Maps.png View File


+ 22
- 0
CodeReader/Images.xcassets/Paste.imageset/Contents.json View File

@@ -0,0 +1,22 @@
1
+{
2
+  "images" : [
3
+    {
4
+      "idiom" : "universal",
5
+      "scale" : "1x"
6
+    },
7
+    {
8
+      "idiom" : "universal",
9
+      "scale" : "2x",
10
+      "filename" : "Paste-1.png"
11
+    },
12
+    {
13
+      "idiom" : "universal",
14
+      "scale" : "3x",
15
+      "filename" : "Paste.png"
16
+    }
17
+  ],
18
+  "info" : {
19
+    "version" : 1,
20
+    "author" : "xcode"
21
+  }
22
+}

BIN
CodeReader/Images.xcassets/Paste.imageset/Paste-1.png View File


BIN
CodeReader/Images.xcassets/Paste.imageset/Paste.png View File


+ 22
- 0
CodeReader/Images.xcassets/Phone.imageset/Contents.json View File

@@ -0,0 +1,22 @@
1
+{
2
+  "images" : [
3
+    {
4
+      "idiom" : "universal",
5
+      "scale" : "1x"
6
+    },
7
+    {
8
+      "idiom" : "universal",
9
+      "scale" : "2x",
10
+      "filename" : "Phone-1.png"
11
+    },
12
+    {
13
+      "idiom" : "universal",
14
+      "scale" : "3x",
15
+      "filename" : "Phone.png"
16
+    }
17
+  ],
18
+  "info" : {
19
+    "version" : 1,
20
+    "author" : "xcode"
21
+  }
22
+}

BIN
CodeReader/Images.xcassets/Phone.imageset/Phone-1.png View File


BIN
CodeReader/Images.xcassets/Phone.imageset/Phone.png View File


+ 22
- 0
CodeReader/Images.xcassets/SMS.imageset/Contents.json View File

@@ -0,0 +1,22 @@
1
+{
2
+  "images" : [
3
+    {
4
+      "idiom" : "universal",
5
+      "scale" : "1x"
6
+    },
7
+    {
8
+      "idiom" : "universal",
9
+      "scale" : "2x",
10
+      "filename" : "SMS-1.png"
11
+    },
12
+    {
13
+      "idiom" : "universal",
14
+      "scale" : "3x",
15
+      "filename" : "SMS.png"
16
+    }
17
+  ],
18
+  "info" : {
19
+    "version" : 1,
20
+    "author" : "xcode"
21
+  }
22
+}

BIN
CodeReader/Images.xcassets/SMS.imageset/SMS-1.png View File


BIN
CodeReader/Images.xcassets/SMS.imageset/SMS.png View File


+ 22
- 0
CodeReader/Images.xcassets/Safari.imageset/Contents.json View File

@@ -0,0 +1,22 @@
1
+{
2
+  "images" : [
3
+    {
4
+      "idiom" : "universal",
5
+      "scale" : "1x"
6
+    },
7
+    {
8
+      "idiom" : "universal",
9
+      "scale" : "2x",
10
+      "filename" : "Safari-1.png"
11
+    },
12
+    {
13
+      "idiom" : "universal",
14
+      "scale" : "3x",
15
+      "filename" : "Safari.png"
16
+    }
17
+  ],
18
+  "info" : {
19
+    "version" : 1,
20
+    "author" : "xcode"
21
+  }
22
+}

BIN
CodeReader/Images.xcassets/Safari.imageset/Safari-1.png View File


BIN
CodeReader/Images.xcassets/Safari.imageset/Safari.png View File


+ 49
- 0
CodeReader/Info.plist View File

@@ -0,0 +1,49 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3
+<plist version="1.0">
4
+<dict>
5
+	<key>CFBundleDevelopmentRegion</key>
6
+	<string>en</string>
7
+	<key>CFBundleExecutable</key>
8
+	<string>$(EXECUTABLE_NAME)</string>
9
+	<key>CFBundleIdentifier</key>
10
+	<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
11
+	<key>CFBundleInfoDictionaryVersion</key>
12
+	<string>6.0</string>
13
+	<key>CFBundleName</key>
14
+	<string>$(PRODUCT_NAME)</string>
15
+	<key>CFBundlePackageType</key>
16
+	<string>APPL</string>
17
+	<key>CFBundleShortVersionString</key>
18
+	<string>1.2</string>
19
+	<key>CFBundleSignature</key>
20
+	<string>????</string>
21
+	<key>CFBundleVersion</key>
22
+	<string>3</string>
23
+	<key>LSRequiresIPhoneOS</key>
24
+	<true/>
25
+	<key>NSAppTransportSecurity</key>
26
+	<dict>
27
+		<key>NSAllowsArbitraryLoads</key>
28
+		<true/>
29
+	</dict>
30
+	<key>UILaunchStoryboardName</key>
31
+	<string>LaunchScreen</string>
32
+	<key>UIMainStoryboardFile</key>
33
+	<string>Main</string>
34
+	<key>UIRequiredDeviceCapabilities</key>
35
+	<array>
36
+		<string>armv7</string>
37
+	</array>
38
+	<key>UIStatusBarHidden</key>
39
+	<true/>
40
+	<key>UIStatusBarStyle</key>
41
+	<string>UIStatusBarStyleLightContent</string>
42
+	<key>UISupportedInterfaceOrientations</key>
43
+	<array>
44
+		<string>UIInterfaceOrientationPortrait</string>
45
+	</array>
46
+	<key>UIViewControllerBasedStatusBarAppearance</key>
47
+	<true/>
48
+</dict>
49
+</plist>

+ 55
- 0
CodeReader/Outpan.swift View File

@@ -0,0 +1,55 @@
1
+//
2
+//  Outpan.swift
3
+//  CodeReader
4
+//
5
+//  Created by David Walter on 30.01.15.
6
+//  Copyright (c) 2015 David Walter. All rights reserved.
7
+//
8
+
9
+import Foundation
10
+
11
+class Outpan : NSObject {
12
+    let apikey = "34fc5d8878c199192649c97785bb2f10:"
13
+    
14
+    func getData(_ barcode: String) -> NSDictionary {
15
+        let request = NSMutableURLRequest(url: URL(string: "https://api.outpan.com/v1/products/" + barcode)!)
16
+        request.httpMethod = "GET"
17
+        
18
+        let auth = apikey.data(using: String.Encoding.ascii)
19
+        if let base64 = auth?.base64EncodedString(options: .lineLength64Characters) {
20
+            request.setValue("Basic " + base64, forHTTPHeaderField: "Authorization")
21
+        }
22
+        
23
+        do {
24
+            let jsonData = try NSURLConnection.sendSynchronousRequest(request as URLRequest, returning: nil)
25
+            return try JSONSerialization.jsonObject(with: jsonData, options: []) as! NSDictionary
26
+        } catch {
27
+            return NSDictionary()
28
+        }
29
+    }
30
+    
31
+    /*func getData(barcode: String) -> NSDictionary {
32
+        
33
+        let fullURL = self.url + "?apikey=" + self.apikey + "&barcode=" + barcode
34
+        print(fullURL)
35
+        let jsonData = NSData(contentsOfURL: NSURL(string: fullURL)!)
36
+        
37
+        return try! NSJSONSerialization.JSONObjectWithData(jsonData!, options: []) as! NSDictionary
38
+    }*/
39
+}
40
+
41
+extension String {
42
+    func cleanString() -> String {
43
+        var value : String = self
44
+        
45
+        value = value.replacingOccurrences(of: "ä", with: "ä")
46
+        value = value.replacingOccurrences(of: "Ä", with: "Ä")
47
+        value = value.replacingOccurrences(of: "ö", with: "ö")
48
+        value = value.replacingOccurrences(of: "Ö", with: "Ö")
49
+        value = value.replacingOccurrences(of: "ü", with: "ü")
50
+        value = value.replacingOccurrences(of: "Ãœ", with: "Ü")
51
+        value = value.replacingOccurrences(of: "ß", with: "ß")
52
+        
53
+        return value
54
+    }
55
+}

+ 34
- 0
CodeReader/Overlay.swift View File

@@ -0,0 +1,34 @@
1
+//
2
+//  Overlay.swift
3
+//  CodeReader
4
+//
5
+//  Created by David Walter on 05.02.15.
6
+//  Copyright (c) 2015 David Walter. All rights reserved.
7
+//
8
+
9
+import UIKit
10
+
11
+class Overlay: UIView {
12
+    
13
+    required init?(coder aDecoder: NSCoder) {
14
+        super.init(coder: aDecoder)
15
+    }
16
+    
17
+    init(message: String) {
18
+        let width = 170.0 as CGFloat
19
+        let height = 60.0 as CGFloat
20
+        
21
+        let label = UILabel(frame: CGRect(x: 0, y: 0, width: width, height: height))
22
+        label.text = message
23
+        label.textAlignment = NSTextAlignment.center
24
+        label.textColor = UIColor.white
25
+        
26
+        let screen = UIScreen.main.bounds
27
+        super.init(frame: CGRect(x: (screen.size.width - width)/2, y: (screen.size.height - height)/2,width: width,height: height))
28
+        
29
+        self.backgroundColor = UIColor(white: 0.2, alpha: 0.7)
30
+        self.layer.cornerRadius = 10.0
31
+        self.addSubview(label)
32
+    }
33
+
34
+}

+ 80
- 0
CodeReader/RemoveAds.swift View File

@@ -0,0 +1,80 @@
1
+//
2
+//  RemoveAds.swift
3
+//  CodeReader
4
+//
5
+//  Created by David Walter on 05.02.15.
6
+//  Copyright (c) 2015 David Walter. All rights reserved.
7
+//
8
+
9
+import Foundation
10
+import StoreKit
11
+
12
+class RemoveAds: NSObject, SKProductsRequestDelegate, SKPaymentTransactionObserver {
13
+
14
+    func RemoveAds() {
15
+        if (SKPaymentQueue.canMakePayments()) {
16
+            let request = SKProductsRequest(productIdentifiers: NSSet(object: "at.davidwalter.CodeReader.RemoveAds") as! Set<String>)
17
+            request.delegate = self
18
+            request.start()
19
+        } else {
20
+            let alert = UIAlertView(title: "Prohibited", message: "Parental Control is enabled, cannot make a purchase!", delegate: nil, cancelButtonTitle: "OK")
21
+            alert.show()
22
+        }
23
+    }
24
+    
25
+    func restoreRemoveAds() {
26
+        SKPaymentQueue.default().restoreCompletedTransactions()
27
+    }
28
+    
29
+    func paymentQueue(_ queue: SKPaymentQueue, updatedTransactions transactions: [SKPaymentTransaction]) {
30
+        for transaction in transactions {
31
+            let trans : SKPaymentTransaction! = transaction as SKPaymentTransaction
32
+            switch(trans.transactionState) {
33
+            case .purchased:
34
+                completeTransaction(trans)
35
+            case .failed:
36
+                failedTransaction(trans)
37
+            case .restored:
38
+                completeTransaction(trans)
39
+            default:
40
+                break
41
+            }
42
+        }
43
+    }
44
+    
45
+    func completeTransaction(_ trans: SKPaymentTransaction) {
46
+        Settings.setHideAds()
47
+        SKPaymentQueue.default().finishTransaction(trans)
48
+    }
49
+    
50
+    func failedTransaction(_ trans: SKPaymentTransaction) {
51
+        let alert = UIAlertView(title: "Failed Transaction", message: trans.error!.localizedDescription, delegate: nil, cancelButtonTitle: "OK")
52
+        alert.show()
53
+        SKPaymentQueue.default().finishTransaction(trans)
54
+    }
55
+    
56
+    func productsRequest(_ request: SKProductsRequest, didReceive response: SKProductsResponse) {
57
+        var validProduct : SKProduct!
58
+        let products = response.products as NSArray
59
+        
60
+        if (products.count > 0) {
61
+            validProduct = products.object(at: 0) as! SKProduct
62
+            
63
+            let payment = SKPayment(product: validProduct)
64
+            
65
+            SKPaymentQueue.default().add(self)
66
+            SKPaymentQueue.default().add(payment)
67
+        } else {
68
+            let alert = UIAlertView(title: "Not available", message: "No products to purchase", delegate: nil, cancelButtonTitle: "OK")
69
+            alert.show()
70
+        }
71
+    }
72
+    
73
+    func requestDidFinish(_ request: SKRequest) {
74
+        
75
+    }
76
+    
77
+    func request(_ request: SKRequest, didFailWithError error: Error) {
78
+        
79
+    }
80
+}

+ 80
- 0
CodeReader/Settings.swift View File

@@ -0,0 +1,80 @@
1
+//
2
+//  Settings.swift
3
+//  CodeReader
4
+//
5
+//  Created by David Walter on 05.02.15.
6
+//  Copyright (c) 2015 David Walter. All rights reserved.
7
+//
8
+
9
+import Foundation
10
+
11
+class Settings: NSObject {
12
+    
13
+    class func FirstLaunched() -> Bool {
14
+        return UserDefaults.standard.bool(forKey: "FirstLaunched")
15
+    }
16
+    
17
+    class func setFirstLaunched() {
18
+        UserDefaults.standard.set(true, forKey: "FirstLaunched")
19
+        UserDefaults.standard.synchronize()
20
+    }
21
+    
22
+    class func OpenLinksAutomatically() -> Bool {
23
+        return UserDefaults.standard.bool(forKey: "OpenLinksAutomatically")
24
+    }
25
+    
26
+    class func setOpenLinksAutomatically(_ value: Bool) {
27
+        UserDefaults.standard.set(value, forKey: "OpenLinksAutomatically")
28
+        UserDefaults.standard.synchronize()
29
+    }
30
+    
31
+    class func OpenMailAutomatically() -> Bool {
32
+        return UserDefaults.standard.bool(forKey: "OpenMailAutomatically")
33
+    }
34
+    
35
+    class func setOpenMailAutomatically(_ value: Bool) {
36
+        UserDefaults.standard.set(value, forKey: "OpenMailAutomatically")
37
+        UserDefaults.standard.synchronize()
38
+    }
39
+    
40
+    class func OpenPhoneAutomatically() -> Bool {
41
+        return UserDefaults.standard.bool(forKey: "OpenPhoneAutomatically")
42
+    }
43
+    
44
+    class func setOpenPhoneAutomatically(_ value: Bool) {
45
+        UserDefaults.standard.set(value, forKey: "OpenPhoneAutomatically")
46
+        UserDefaults.standard.synchronize()
47
+    }
48
+    
49
+    class func OpenSMSAutomatically() -> Bool {
50
+        return UserDefaults.standard.bool(forKey: "OpenSMSAutomatically")
51
+    }
52
+    
53
+    class func setOpenSMSAutomatically(_ value: Bool) {
54
+        UserDefaults.standard.set(value, forKey: "OpenSMSAutomatically")
55
+        UserDefaults.standard.synchronize()
56
+    }
57
+    
58
+    class func OpenLocationAutomatically() -> Bool {
59
+        return UserDefaults.standard.bool(forKey: "OpenLocationAutomatically")
60
+    }
61
+    
62
+    class func setOpenLocationAutomatically(_ value: Bool) {
63
+        UserDefaults.standard.set(value, forKey: "OpenLocationAutomatically")
64
+        UserDefaults.standard.synchronize()
65
+    }
66
+    
67
+    class func HideAds() -> Bool {
68
+        return UserDefaults.standard.bool(forKey: "HideAds")
69
+    }
70
+    
71
+    class func setHideAds() {
72
+        UserDefaults.standard.set(true, forKey: "HideAds")
73
+        UserDefaults.standard.synchronize()
74
+    }
75
+    
76
+    class func setShowAds() {
77
+        UserDefaults.standard.set(false, forKey: "HideAds")
78
+        UserDefaults.standard.synchronize()
79
+    }
80
+}

+ 133
- 0
CodeReader/SettingsViewController.swift View File

@@ -0,0 +1,133 @@
1
+//
2
+//  SettingsViewController.swift
3
+//  CodeReader
4
+//
5
+//  Created by David Walter on 30.01.15.
6
+//  Copyright (c) 2015 David Walter. All rights reserved.
7
+//
8
+
9
+import UIKit
10
+import StoreKit
11
+
12
+class SettingsCell: UITableViewCell {
13
+    @IBOutlet var label : UILabel!
14
+    @IBOutlet var onoff : UISwitch!
15
+    @IBOutlet var logo : UIImageView!
16
+}
17
+
18
+class SettingsViewController: UITableViewController {
19
+    
20
+    let removeAds = RemoveAds()
21
+    
22
+    override func viewDidLoad() {
23
+        super.viewDidLoad()
24
+        self.navigationItem.title = "Settings"
25
+    }
26
+    
27
+    override func numberOfSections(in tableView: UITableView) -> Int {
28
+        return Settings.HideAds() ? 1 : 2
29
+    }
30
+    
31
+    override func tableView(_ tableView: UITableView?, numberOfRowsInSection section: Int) -> Int {
32
+        if (!Settings.HideAds() && section == 1) {  //Remove Ads
33
+            return 2
34
+        }
35
+        
36
+        return 5
37
+    }
38
+    
39
+    override func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
40
+        if (indexPath.section == 1) { //Remove Ads
41
+            if (indexPath.row == 0) {
42
+                return 70.0
43
+            } else {
44
+                return 45.0
45
+            }
46
+        }
47
+        
48
+        return 44.0
49
+    }
50
+    
51
+    override func tableView(_ tableView: UITableView, titleForHeaderInSection section: Int) -> String? {
52
+        if (section == 1) {
53
+            return "Remove Ads"
54
+        }
55
+        
56
+        return "Open automatically"
57
+    }
58
+    
59
+    override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
60
+        
61
+        if indexPath.section == 1 {  //Remove Ads
62
+            let cell = self.tableView.dequeueReusableCell(withIdentifier: "RemoveAdsCell", for: indexPath) 
63
+            
64
+            cell.textLabel?.textAlignment = NSTextAlignment.center
65
+            if (indexPath.row == 0) {
66
+                cell.textLabel?.text = "Remove Ads"
67
+            } else {
68
+                cell.textLabel?.text = "Restore"
69
+            }
70
+            
71
+            return cell
72
+        } else {
73
+            let scell = self.tableView.dequeueReusableCell(withIdentifier: "SettingsCell", for: indexPath) as! SettingsCell
74
+            
75
+            if (indexPath.row == 0) {
76
+                scell.logo?.image = UIImage(named: "Safari")
77
+                scell.label?.text = "Links"
78
+                scell.onoff.setOn(Settings.OpenLinksAutomatically(), animated: false)
79
+            } else if (indexPath.row == 1) {
80
+                scell.logo?.image = UIImage(named: "Mail")
81
+                scell.label?.text = "Mail drafts"
82
+                scell.onoff.setOn(Settings.OpenMailAutomatically(), animated: false)
83
+            } else if (indexPath.row == 2) {
84
+                scell.logo?.image = UIImage(named: "Phone")
85
+                scell.label?.text = "Phone numbers"
86
+                scell.onoff.setOn(Settings.OpenPhoneAutomatically(), animated: false)
87
+            } else if (indexPath.row == 3) {
88
+                scell.logo?.image = UIImage(named: "SMS")
89
+                scell.label?.text = "Text messages"
90
+                scell.onoff.setOn(Settings.OpenSMSAutomatically(), animated: false)
91
+            } else if (indexPath.row == 4) {
92
+                scell.logo?.image = UIImage(named: "Maps")
93
+                scell.label?.text = "Locations"
94
+                scell.onoff.setOn(Settings.OpenLocationAutomatically(), animated: false)
95
+            }
96
+            
97
+            scell.onoff?.tag = indexPath.row
98
+            scell.onoff?.addTarget(self, action: #selector(SettingsViewController.flip(_:)), for: UIControlEvents.valueChanged)
99
+            
100
+            return scell
101
+        }
102
+    }
103
+    
104
+    @IBAction func flip(_ id: UISwitch) {
105
+        switch(id.tag) {
106
+        case 0:
107
+            Settings.setOpenLinksAutomatically(id.isOn)
108
+        case 1:
109
+            Settings.setOpenMailAutomatically(id.isOn)
110
+        case 2:
111
+            Settings.setOpenPhoneAutomatically(id.isOn)
112
+        case 3:
113
+            Settings.setOpenSMSAutomatically(id.isOn)
114
+        case 4:
115
+            Settings.setOpenLocationAutomatically(id.isOn)
116
+        default:
117
+            break
118
+        }
119
+    }
120
+    
121
+    override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
122
+        
123
+        self.tableView.deselectRow(at: indexPath, animated: true)
124
+        
125
+        if (indexPath.section == 1) { //Remove Ads
126
+            if (indexPath.row == 0) {
127
+                removeAds.RemoveAds()
128
+            } else {
129
+                removeAds.restoreRemoveAds()
130
+            }
131
+        }
132
+    }
133
+}

+ 158
- 0
CodeReader/Validation.swift View File

@@ -0,0 +1,158 @@
1
+//
2
+//  Validation.swift
3
+//  CodeReader
4
+//
5
+//  Created by David Walter on 05.02.15.
6
+//  Copyright (c) 2015 David Walter. All rights reserved.
7
+//
8
+
9
+import Foundation
10
+import UIKit
11
+
12
+class Validation: NSObject {
13
+
14
+    enum ValidationCode {
15
+        case undefined
16
+        case number
17
+        case url
18
+        case phone
19
+        case sms
20
+        case email
21
+        case contact
22
+        case location
23
+    }
24
+    
25
+    class func validateString(_ string: String) -> (code: ValidationCode, text: String) {
26
+        
27
+        let function = hasFunction(string)
28
+        
29
+        switch(function.code) {
30
+        case .sms, .phone, .email:
31
+            return function
32
+        case .location:
33
+            //TODO
34
+            return function
35
+        case .contact:
36
+            //TODO
37
+            return function
38
+        default:
39
+            if (isNumber(function.text)) {
40
+                return (.number, function.text)
41
+            }
42
+            
43
+            if (isEmail(function.text)) {
44
+                return (.email, function.text)
45
+            }
46
+            
47
+            if let text = validatePhoneNumber(function.text as NSString) {
48
+                return (.phone, text)
49
+            }
50
+            
51
+            if let text = validateURL(function.text as NSString) {
52
+                return (.url, text)
53
+            }
54
+            
55
+            return (.undefined, function.text)
56
+        }
57
+    }
58
+    
59
+    class func checkStringForSet(_ text: NSString, set: CharacterSet) -> Bool {
60
+        let range = text.rangeOfCharacter(from: set.inverted)
61
+        
62
+        if (range.location == NSNotFound) {
63
+            return true
64
+        }
65
+        
66
+        return false
67
+    }
68
+    
69
+    class func hasFunction(_ text: String) -> (code: ValidationCode, text: String) {
70
+        let array = [("mailto:", ValidationCode.email),
71
+                     ("matmsg:to:", ValidationCode.email),
72
+                     ("tel:", ValidationCode.phone),
73
+                     ("sms:", ValidationCode.sms),
74
+                     //("smsto:", ValidationCode.SMS),
75
+                     ("geo:", ValidationCode.location),
76
+                     ("begin:vcard", ValidationCode.contact)]
77
+        
78
+        for (prefix, code) in array {
79
+            if (text.lowercased().hasPrefix(prefix)) {
80
+                if (code == ValidationCode.contact) { return (code, text) }
81
+                
82
+                var v = text.replacingOccurrences(of: prefix, with: "")
83
+                v = v.replacingOccurrences(of: prefix.uppercased(), with: "")
84
+                
85
+                if (prefix == "matmsg:to:") {
86
+                    
87
+                    v = v.substring(with: (v.startIndex ..< v.characters.index(v.endIndex, offsetBy: -2)))
88
+                    
89
+                    let range = v.range(of: ";")
90
+                    if (range?.isEmpty == false) {
91
+                        v = v.replacingCharacters(in: range!, with: "?")
92
+                    }
93
+                    
94
+                    v = v.replacingOccurrences(of: ":", with: "=")
95
+                    v = v.replacingOccurrences(of: ";", with: "&")
96
+                    v = v.replacingOccurrences(of: "SUB", with: "subject")
97
+                    v = v.replacingOccurrences(of: " ", with: "%20")
98
+                    v = v.replacingOccurrences(of: "\n", with: "%0A")
99
+                }
100
+                
101
+                return (code, v)
102
+            }
103
+        }
104
+        
105
+        return (.undefined, text)
106
+    }
107
+    
108
+    class func isNumber(_ string: String) -> Bool {
109
+        let set = CharacterSet(charactersIn: "0123456789")
110
+        return checkStringForSet(string as NSString, set: set)
111
+    }
112
+    
113
+    class func isEmail(_ text: String) -> Bool {
114
+        let emailRegex = "[A-Z0-9a-z._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,6}"
115
+        let emailTest = NSPredicate(format: "SELF MATCHES %@", emailRegex)
116
+        
117
+        return (emailTest.evaluate(with: text))
118
+    }
119
+    
120
+    class func validatePhoneNumber(_ text: NSString) -> String? {
121
+        let prefix = text.hasPrefix("+")
122
+        var phone = text.replacingOccurrences(of: " ", with: "")
123
+        phone = phone.replacingOccurrences(of: "(", with: "")
124
+        phone = phone.replacingOccurrences(of: ")", with: "")
125
+        phone = phone.replacingOccurrences(of: "-", with: "")
126
+        phone = phone.replacingOccurrences(of: "/", with: "")
127
+        phone = phone.replacingOccurrences(of: "+", with: "")
128
+        
129
+        let set = CharacterSet(charactersIn: "0123456789")
130
+        if (checkStringForSet(phone as NSString, set: set) == false) {
131
+            return nil
132
+        }
133
+        
134
+        if (prefix) {
135
+            phone = "+" + phone
136
+        }
137
+        
138
+        return phone
139
+    }
140
+    
141
+    class func validateURL(_ url: NSString) -> String? {
142
+        
143
+        let set = CharacterSet(charactersIn: "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789:/.#?&+=-_")
144
+        if (checkStringForSet(url, set: set) == false) {
145
+            return nil
146
+        }
147
+        
148
+        if (!url.contains(".") || (url.contains(":") && !url.contains("/"))){
149
+            return nil
150
+        }
151
+    
152
+        if ((url.contains("http") || url.contains("ftp")) && url.contains("://")) {
153
+            return url as String
154
+        } else {
155
+            return "http://" + (url as String)
156
+        }
157
+    }
158
+}

+ 163
- 0
CodeReader/ViewController.swift View File

@@ -0,0 +1,163 @@
1
+//
2
+//  ViewController.swift
3
+//  CodeReader
4
+//
5
+//  Created by David Walter on 29.01.15.
6
+//  Copyright (c) 2015 David Walter. All rights reserved.
7
+//
8
+
9
+import UIKit
10
+import AVFoundation
11
+import iAd
12
+
13
+class ViewController: UIViewController, AVCaptureMetadataOutputObjectsDelegate, ADBannerViewDelegate {
14
+    
15
+    @IBOutlet var cameraView : UIView?
16
+    @IBOutlet var flashButton : UIBarButtonItem?
17
+    @IBOutlet var banner : ADBannerView?
18
+    
19
+    var codeReader : CodeReader?
20
+    var camFocus : CameraFocusSquare?
21
+    
22
+    override func viewDidLoad() {
23
+        super.viewDidLoad()
24
+        
25
+        if (AVCaptureDevice.authorizationStatus(forMediaType: AVMediaTypeVideo) == AVAuthorizationStatus.notDetermined) {
26
+            AVCaptureDevice.requestAccess(forMediaType: AVMediaTypeVideo, completionHandler: nil)
27
+        }
28
+        
29
+        if (AVCaptureDevice.authorizationStatus(forMediaType: AVMediaTypeVideo) == AVAuthorizationStatus.authorized && codeReader == nil) {
30
+            codeReader = CodeReader(delegate: self)
31
+            
32
+            let tap = UITapGestureRecognizer(target: self, action: #selector(ViewController.focusTap(_:)))
33
+            tap.numberOfTapsRequired = 1
34
+            tap.numberOfTouchesRequired = 1
35
+            cameraView?.addGestureRecognizer(tap)
36
+        }
37
+    }
38
+    
39
+    override func viewWillAppear(_ animated: Bool) {
40
+        banner?.isHidden = Settings.HideAds()
41
+        codeReader?.Continue()
42
+    }
43
+    
44
+    override func viewDidAppear(_ animated: Bool) {
45
+        codeReader?.isReady = true
46
+    }
47
+
48
+    override func didReceiveMemoryWarning() {
49
+        super.didReceiveMemoryWarning()
50
+    }
51
+    
52
+    func bannerView(_ banner: ADBannerView!, didFailToReceiveAdWithError error: Error!) {
53
+        banner.isHidden = true
54
+    }
55
+    
56
+    func bannerViewDidLoadAd(_ banner: ADBannerView!) {
57
+        banner.isHidden = Settings.HideAds()
58
+    }
59
+    
60
+    override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
61
+        
62
+        codeReader?.flashLightOff()
63
+        flashButton?.tintColor = UIColor.white
64
+        
65
+        if let identifier = segue.identifier {
66
+            switch(identifier) {
67
+            case "CodeDetail":
68
+                let object = sender as! AVMetadataMachineReadableCodeObject
69
+                var codeTitle = "Code"
70
+                
71
+                let range = object.type.range(of: ".", options: NSString.CompareOptions.backwards)
72
+                if let r = range {
73
+                    codeTitle = object.type.substring(from: r.lowerBound)
74
+                    codeTitle = codeTitle.replacingOccurrences(of: ".", with: "")
75
+                }
76
+                
77
+                let destination = segue.destination as! DetailViewController
78
+                destination.navigationItem.title = codeTitle
79