Skip to content
This repository was archived by the owner on Sep 20, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 7 additions & 8 deletions Classes/Settings/Settings.storyboard
Original file line number Diff line number Diff line change
Expand Up @@ -110,20 +110,19 @@
<color key="textColor" red="0.63921568627450975" green="0.66666666666666663" blue="0.69411764705882351" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<view hidden="YES" clipsSubviews="YES" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="1mP-Dr-7rt">
<imageView hidden="YES" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="Wqw-0q-16V">
<rect key="frame" x="270" y="15" width="14" height="14"/>
<color key="backgroundColor" red="0.73725490196078436" green="0.73333333333333328" blue="0.75686274509803919" alpha="1" colorSpace="calibratedRGB"/>
<constraints>
<constraint firstAttribute="height" constant="14" id="LRa-0r-Kib"/>
<constraint firstAttribute="width" constant="14" id="hum-9p-JUR"/>
<constraint firstAttribute="width" constant="14" id="ZDk-Zk-GPk"/>
<constraint firstAttribute="height" constant="14" id="w9v-uc-7PB"/>
</constraints>
</view>
</imageView>
</subviews>
<constraints>
<constraint firstAttribute="trailing" secondItem="rIC-a2-0GF" secondAttribute="trailing" id="C2A-Af-SXu"/>
<constraint firstItem="Tnv-Bx-YAk" firstAttribute="leading" secondItem="oVx-yt-y92" secondAttribute="leading" constant="16" id="VE8-RG-Yq6"/>
<constraint firstItem="1mP-Dr-7rt" firstAttribute="centerY" secondItem="oVx-yt-y92" secondAttribute="centerY" id="ejb-XH-Hbe"/>
<constraint firstItem="rIC-a2-0GF" firstAttribute="leading" secondItem="1mP-Dr-7rt" secondAttribute="trailing" constant="4" id="hiY-5o-Tap"/>
<constraint firstItem="Wqw-0q-16V" firstAttribute="centerY" secondItem="oVx-yt-y92" secondAttribute="centerY" id="a87-PV-1BY"/>
<constraint firstItem="rIC-a2-0GF" firstAttribute="leading" secondItem="Wqw-0q-16V" secondAttribute="trailing" constant="4" id="fB0-DK-2Oz"/>
<constraint firstItem="Tnv-Bx-YAk" firstAttribute="centerY" secondItem="oVx-yt-y92" secondAttribute="centerY" id="mc6-XY-pYG"/>
<constraint firstItem="rIC-a2-0GF" firstAttribute="centerY" secondItem="oVx-yt-y92" secondAttribute="centerY" id="npa-sd-pci"/>
</constraints>
Expand Down Expand Up @@ -463,7 +462,7 @@
<connections>
<outlet property="accountsCell" destination="64O-sw-wTx" id="UPX-Wa-mYM"/>
<outlet property="apiStatusLabel" destination="rIC-a2-0GF" id="ceC-Ij-CrY"/>
<outlet property="apiStatusView" destination="1mP-Dr-7rt" id="f66-HG-AkG"/>
<outlet property="apiStatusView" destination="Wqw-0q-16V" id="ir1-9k-Esu"/>
<outlet property="badgeCell" destination="pnm-5p-yC5" id="hdC-aO-QSy"/>
<outlet property="badgeSettingsButton" destination="36B-Ge-m5V" id="7Sw-oi-5Ra"/>
<outlet property="badgeSwitch" destination="FvK-93-raA" id="twy-bl-O1q"/>
Expand Down
5 changes: 3 additions & 2 deletions Classes/Settings/SettingsViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ GitHubSessionListener {
@IBOutlet weak var markReadSwitch: UISwitch!
@IBOutlet weak var accountsCell: StyledTableCell!
@IBOutlet weak var apiStatusLabel: UILabel!
@IBOutlet weak var apiStatusView: UIView!
@IBOutlet weak var apiStatusView: UIImageView!
@IBOutlet weak var signatureSwitch: UISwitch!
@IBOutlet weak var defaultReactionLabel: UILabel!
@IBOutlet weak var pushSwitch: UISwitch!
Expand All @@ -54,6 +54,7 @@ GitHubSessionListener {
versionLabel.text = Bundle.main.prettyVersionString
markReadSwitch.isOn = NotificationModelController.readOnOpen
apiStatusView.layer.cornerRadius = 7
apiStatusView.image = .from(color: Styles.Colors.Gray.border.color)
signatureSwitch.isOn = Signature.enabled
openExternalLinksSwitch.isOn = UserDefaults.standard.shouldOpenExternalLinksInSafari
pushSettingsButton.accessibilityLabel = NSLocalizedString("How we send push notifications in GitHawk", comment: "")
Expand Down Expand Up @@ -98,7 +99,7 @@ GitHubSessionListener {
color = Styles.Colors.Red.medium.color
}
strongSelf.apiStatusView.isHidden = false
strongSelf.apiStatusView.backgroundColor = color
strongSelf.apiStatusView.image = .from(color: color)
strongSelf.apiStatusLabel.text = text
strongSelf.apiStatusLabel.textColor = color
}
Expand Down
23 changes: 23 additions & 0 deletions Classes/Utility/UIImage+Color.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
//
// UIImage+Color.swift
// Freetime
//
// Created by Viktoras Laukevicius on 06/02/2019.
// Copyright © 2019 Ryan Nystrom. All rights reserved.
//

import UIKit

extension UIImage {

class func from(color: UIColor) -> UIImage {
let size = CGSize(width: 1, height: 1)
UIGraphicsBeginImageContext(size)
let context = UIGraphicsGetCurrentContext()
context?.setFillColor(color.cgColor)
context?.fill(CGRect(origin: .zero, size: size))
let image = UIGraphicsGetImageFromCurrentImageContext()!
UIGraphicsEndImageContext()
return image
}
}
4 changes: 4 additions & 0 deletions Freetime.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
objects = {

/* Begin PBXBuildFile section */
031E0241220B433C00A329F1 /* UIImage+Color.swift in Sources */ = {isa = PBXBuildFile; fileRef = 031E0240220B433C00A329F1 /* UIImage+Color.swift */; };
03C127B8220993300062F7C9 /* InboxZeroLoaderTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 03C127B7220993300062F7C9 /* InboxZeroLoaderTests.swift */; };
03E8D824221D339200EB792A /* GithubURL.swift in Sources */ = {isa = PBXBuildFile; fileRef = 03E8D823221D339200EB792A /* GithubURL.swift */; };
03E8D826221D358000EB792A /* GithubURLTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 03E8D825221D358000EB792A /* GithubURLTests.swift */; };
Expand Down Expand Up @@ -596,6 +597,7 @@
/* End PBXCopyFilesBuildPhase section */

/* Begin PBXFileReference section */
031E0240220B433C00A329F1 /* UIImage+Color.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIImage+Color.swift"; sourceTree = "<group>"; };
03C127B7220993300062F7C9 /* InboxZeroLoaderTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InboxZeroLoaderTests.swift; sourceTree = "<group>"; };
03E8D823221D339200EB792A /* GithubURL.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GithubURL.swift; sourceTree = "<group>"; };
03E8D825221D358000EB792A /* GithubURLTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GithubURLTests.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -2299,6 +2301,7 @@
C0E3CD4A21BAE49B00185B57 /* NSRegularExpression+StaticString.swift */,
C0E3CD4C21BAE65000185B57 /* UIImage+StaticString.swift */,
298C7E2721D80BAF00DD2A60 /* Error+GraphQLForbidden.swift */,
031E0240220B433C00A329F1 /* UIImage+Color.swift */,
03E8D823221D339200EB792A /* GithubURL.swift */,
);
path = Utility;
Expand Down Expand Up @@ -3260,6 +3263,7 @@
29DAA7AB20202A1A0029277A /* PullRequestReviewReplySectionController.swift in Sources */,
29792B1D1FFB2FC6007A0C57 /* IssueManagingNavSectionController.swift in Sources */,
2905AFAB1F7357B40015AE32 /* RepositoryOverviewViewController.swift in Sources */,
031E0241220B433C00A329F1 /* UIImage+Color.swift in Sources */,
29999734203135E100995FFD /* IssueMergeContextCell.swift in Sources */,
29EDFE821F661562005BCCEB /* RepositoryReadmeModel.swift in Sources */,
29EDFE841F661776005BCCEB /* RepositoryReadmeSectionController.swift in Sources */,
Expand Down