Skip to content

Commit 3397c14

Browse files
v2.14-beta:
- Added help button for the QR mode - Removed Instructions button - Improved color theming code
1 parent 9e7f975 commit 3397c14

16 files changed

+162
-163
lines changed

Questions/Base.lproj/Main.storyboard

Lines changed: 19 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@
110110
<rect key="frame" x="-12" y="53" width="438" height="697"/>
111111
</imageView>
112112
<button opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="arZ-7k-Uja">
113-
<rect key="frame" x="117" y="247" width="180" height="46"/>
113+
<rect key="frame" x="117" y="265" width="180" height="46"/>
114114
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
115115
<color key="backgroundColor" red="0.0" green="0.58823529409999997" blue="0.53333333329999999" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
116116
<fontDescription key="fontDescription" name="HelveticaNeue-CondensedBold" family="Helvetica Neue" pointSize="24"/>
@@ -131,7 +131,7 @@
131131
</connections>
132132
</button>
133133
<button opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="49H-XB-RgC">
134-
<rect key="frame" x="117" y="468" width="180" height="46"/>
134+
<rect key="frame" x="117" y="421" width="180" height="46"/>
135135
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
136136
<color key="backgroundColor" red="0.0" green="0.58823529411764708" blue="0.53333333333333333" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
137137
<fontDescription key="fontDescription" name="HelveticaNeue-CondensedBold" family="Helvetica Neue" pointSize="24"/>
@@ -151,7 +151,7 @@
151151
</connections>
152152
</button>
153153
<button opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="4v5-8h-lZW">
154-
<rect key="frame" x="117" y="323" width="180" height="46"/>
154+
<rect key="frame" x="117" y="345" width="180" height="46"/>
155155
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
156156
<color key="backgroundColor" red="0.0" green="0.58823529409999997" blue="0.53333333329999999" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
157157
<fontDescription key="fontDescription" name="HelveticaNeue-CondensedBold" family="Helvetica Neue" pointSize="24"/>
@@ -167,25 +167,8 @@
167167
<segue destination="I6B-9U-azf" kind="show" identifier="QRScannerVC" id="MLK-gp-ovr"/>
168168
</connections>
169169
</button>
170-
<button opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="glT-nY-qNM">
171-
<rect key="frame" x="117" y="400" width="180" height="46"/>
172-
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
173-
<color key="backgroundColor" red="0.0" green="0.58823529409999997" blue="0.53333333329999999" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
174-
<fontDescription key="fontDescription" name="HelveticaNeue-CondensedBold" family="Helvetica Neue" pointSize="24"/>
175-
<state key="normal" title="INSTRUCTIONS">
176-
<color key="titleColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
177-
</state>
178-
<userDefinedRuntimeAttributes>
179-
<userDefinedRuntimeAttribute type="number" keyPath="layer.cornerRadius">
180-
<integer key="value" value="15"/>
181-
</userDefinedRuntimeAttribute>
182-
</userDefinedRuntimeAttributes>
183-
<connections>
184-
<action selector="showInstructions" destination="Uw9-Bc-kPM" eventType="touchUpInside" id="vdp-am-yhS"/>
185-
</connections>
186-
</button>
187170
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" text="🏆 ?pts" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="bwC-Rs-rzS">
188-
<rect key="frame" x="145" y="542" width="124" height="22"/>
171+
<rect key="frame" x="145" y="515" width="124" height="22"/>
189172
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
190173
<fontDescription key="fontDescription" style="UICTFontTextStyleTitle3"/>
191174
<color key="textColor" white="0.33333333333333331" alpha="1" colorSpace="calibratedWhite"/>
@@ -204,7 +187,6 @@
204187
</view>
205188
<navigationItem key="navigationItem" title="Main Menu" id="4da-ip-kPT"/>
206189
<connections>
207-
<outlet property="instructionsButton" destination="glT-nY-qNM" id="cnG-q4-g2F"/>
208190
<outlet property="readQRCodeButton" destination="4v5-8h-lZW" id="F2j-e6-43e"/>
209191
<outlet property="scoreLabel" destination="bwC-Rs-rzS" id="Wda-9L-ElF"/>
210192
<outlet property="settingsButton" destination="49H-XB-RgC" id="wp2-0o-qhG"/>
@@ -375,6 +357,7 @@ Incorrect answers: X
375357
<constraint firstItem="anA-G4-TTq" firstAttribute="centerY" secondItem="rBG-xV-rLD" secondAttribute="centerY" constant="0.25" id="oe6-AN-ki1"/>
376358
</constraints>
377359
</tableViewCellContentView>
360+
<color key="backgroundColor" cocoaTouchSystemColor="tableCellGroupedBackgroundColor"/>
378361
</tableViewCell>
379362
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" id="sQA-3P-jBE">
380363
<rect key="frame" x="0.0" y="255" width="414" height="44"/>
@@ -483,10 +466,10 @@ Incorrect answers: X
483466
</objects>
484467
<point key="canvasLocation" x="-1020" y="483"/>
485468
</scene>
486-
<!--Scanner Controller-->
469+
<!--Scanner View Controller-->
487470
<scene sceneID="ZsB-0h-1jt">
488471
<objects>
489-
<viewController storyboardIdentifier="QRScannerVC" id="I6B-9U-azf" customClass="QRScannerController" customModule="Questions" customModuleProvider="target" sceneMemberID="viewController">
472+
<viewController storyboardIdentifier="QRScannerVC" id="I6B-9U-azf" customClass="QRScannerViewController" customModule="Questions" customModuleProvider="target" sceneMemberID="viewController">
490473
<layoutGuides>
491474
<viewControllerLayoutGuide type="top" id="N5n-ZC-GmR"/>
492475
<viewControllerLayoutGuide type="bottom" id="eJ0-2H-qhf"/>
@@ -496,22 +479,33 @@ Incorrect answers: X
496479
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
497480
<subviews>
498481
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="enF-0f-cBp">
499-
<rect key="frame" x="111" y="350.66666666666669" width="192" height="36"/>
482+
<rect key="frame" x="111" y="350" width="192" height="36"/>
500483
<fontDescription key="fontDescription" style="UICTFontTextStyleTitle3"/>
501484
<state key="normal" title="Allow Camera access"/>
502485
<connections>
503486
<action selector="allowCameraAction" destination="I6B-9U-azf" eventType="touchUpInside" id="Eho-Ae-oMO"/>
504487
</connections>
505488
</button>
489+
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="IpZ-Da-QvA">
490+
<rect key="frame" x="376" y="72" width="30" height="40"/>
491+
<fontDescription key="fontDescription" type="boldSystem" pointSize="23"/>
492+
<state key="normal" title="?"/>
493+
<connections>
494+
<action selector="helpButtonAction" destination="I6B-9U-azf" eventType="touchUpInside" id="SCE-d0-9yz"/>
495+
</connections>
496+
</button>
506497
</subviews>
507498
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
508499
<constraints>
509500
<constraint firstItem="enF-0f-cBp" firstAttribute="centerY" secondItem="qne-cH-WDM" secondAttribute="centerY" id="88q-4t-T3R"/>
501+
<constraint firstItem="IpZ-Da-QvA" firstAttribute="top" secondItem="N5n-ZC-GmR" secondAttribute="bottom" constant="8" id="E2I-0r-DO9"/>
502+
<constraint firstAttribute="trailingMargin" secondItem="IpZ-Da-QvA" secondAttribute="trailing" constant="-12" id="axg-M1-lHS"/>
510503
<constraint firstItem="enF-0f-cBp" firstAttribute="centerX" secondItem="qne-cH-WDM" secondAttribute="centerX" id="kgr-IM-QLn"/>
511504
</constraints>
512505
</view>
513506
<connections>
514507
<outlet property="allowCameraButton" destination="enF-0f-cBp" id="URO-hX-rCO"/>
508+
<outlet property="helpButton" destination="IpZ-Da-QvA" id="83N-vv-MMm"/>
515509
<segue destination="w1d-Yh-0lm" kind="presentation" identifier="unwindToQuestions" id="5HC-8S-knP"/>
516510
</connections>
517511
</viewController>

Questions/LicensesViewController.swift

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,9 @@ class LicensesViewController: UIViewController {
3636
// MARK: Convenience
3737

3838
func loadCurrentTheme() {
39-
let darkModeEnabled = Settings.sharedInstance.darkThemeEnabled
40-
textView.backgroundColor = darkModeEnabled ? .gray : .white
41-
textView.textColor = darkModeEnabled ? .white : .black
42-
textView.tintColor = darkModeEnabled ? .warmYellow : .coolBlue
39+
textView.backgroundColor = .themeStyle(dark: .gray, light: .white)
40+
textView.textColor = .themeStyle(dark: .white, light: .black)
41+
textView.tintColor = .themeStyle(dark: .warmYellow, light: .coolBlue)
4342
}
4443

4544
func setFrame() {

Questions/MainViewController.swift

Lines changed: 8 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ class MainViewController: UIViewController {
66
// MARK: Properties
77

88
@IBOutlet weak var startButton: UIButton!
9-
@IBOutlet weak var instructionsButton: UIButton!
109
@IBOutlet weak var settingsButton: UIButton!
1110
@IBOutlet weak var readQRCodeButton: UIButton!
1211
@IBOutlet weak var scoreLabel: UILabel!
@@ -64,18 +63,6 @@ class MainViewController: UIViewController {
6463
}
6564
}
6665

67-
// MARK: Alerts
68-
69-
@IBAction func showInstructions() {
70-
71-
let alertViewController = UIAlertController(title: "Instructions".localized,
72-
message: "INSTRUCTIONS_TEXT".localized,
73-
preferredStyle: .alert)
74-
75-
alertViewController.addAction(title: "OK".localized, style: .default, handler: nil)
76-
present(alertViewController, animated: true, completion: nil)
77-
}
78-
7966
// MARK: UnwindSegue
8067

8168
@IBAction func unwindToMainMenu(_ unwindSegue: UIStoryboardSegue) {
@@ -104,7 +91,6 @@ class MainViewController: UIViewController {
10491
func initializeLables() {
10592
startButton.setTitle("START GAME".localized, for: .normal)
10693
readQRCodeButton.setTitle("READ QR CODE".localized, for: .normal)
107-
instructionsButton.setTitle("INSTRUCTIONS".localized, for: .normal)
10894
settingsButton.setTitle("SETTINGS".localized, for: .normal)
10995
self.navigationItem.title = "Main menu".localized
11096
}
@@ -116,31 +102,29 @@ class MainViewController: UIViewController {
116102
let buttonsWidth = UIScreen.main.bounds.maxX / (isPortrait ? 1.85 : 2.0)
117103
var buttonsHeight = UIScreen.main.bounds.maxY * 0.08
118104

119-
if let fontSize = instructionsButton.titleLabel?.font.pointSize {
105+
if let fontSize = startButton.titleLabel?.font.pointSize {
120106
buttonsHeight = fontSize * 2.0
121107
}
122108

123109
let spaceBetweenButtons = buttonsHeight * 1.4
124110
let xPosition = (UIScreen.main.bounds.maxX / 2.0) - (buttonsWidth / 2.0)
125111
let yPosition = UIScreen.main.bounds.maxY / 2.0
126-
127-
startButton.frame = CGRect(x: xPosition, y: yPosition - spaceBetweenButtons*1.5, width: buttonsWidth, height: buttonsHeight)
128-
readQRCodeButton.frame = CGRect(x: xPosition, y: yPosition - spaceBetweenButtons/2.0, width: buttonsWidth, height: buttonsHeight)
129-
instructionsButton.frame = CGRect(x: xPosition, y: yPosition + spaceBetweenButtons/2.0, width: buttonsWidth, height: buttonsHeight)
130-
settingsButton.frame = CGRect(x: xPosition, y: yPosition + spaceBetweenButtons*1.5, width: buttonsWidth, height: buttonsHeight)
112+
113+
startButton.frame = CGRect(x: xPosition, y: yPosition - spaceBetweenButtons, width: buttonsWidth, height: buttonsHeight)
114+
readQRCodeButton.frame = CGRect(x: xPosition, y: yPosition, width: buttonsWidth, height: buttonsHeight)
115+
settingsButton.frame = CGRect(x: xPosition, y: yPosition + spaceBetweenButtons, width: buttonsWidth, height: buttonsHeight)
131116

132117
// ScoreLabel values
133118
let scoreLabelHeight = scoreLabel.frame.height
134119
let scoreLabelWidth = scoreLabel.frame.width
135120
let xPosition2 = (UIScreen.main.bounds.maxX / 2.0) - (scoreLabelWidth / 2.0)
136121

137-
scoreLabel.frame = CGRect(x: xPosition2, y: yPosition + spaceBetweenButtons*2.5, width: scoreLabelWidth, height: scoreLabelHeight)
122+
scoreLabel.frame = CGRect(x: xPosition2, y: yPosition + spaceBetweenButtons*2, width: scoreLabelWidth, height: scoreLabelHeight)
138123
}
139124

140125
func loadTheme() {
141-
let darkThemeEnabled = Settings.sharedInstance.darkThemeEnabled
142-
self.navigationController?.navigationBar.barStyle = darkThemeEnabled ? .black : .default
143-
self.navigationController?.navigationBar.tintColor = darkThemeEnabled ? .orange : .defaultTintColor
126+
self.navigationController?.navigationBar.barStyle = .themeStyle(dark: .black, light: .default)
127+
self.navigationController?.navigationBar.tintColor = .themeStyle(dark: .orange, light: .defaultTintColor)
144128
}
145129

146130
static func addParallax(toView view: UIView?) {

0 commit comments

Comments
 (0)