Commit 89d0431b authored by Zach Knox's avatar Zach Knox
Browse files

Merge branch 'issue49-infobubble-favorites' into 'dev-1.2.1'

Issue49 infobubble favorites

See merge request !40
parents b0de008f f4ed62c8
......@@ -37,6 +37,8 @@
924840F81EA915F200DBFF4E /* FacilityCollectionViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 924840F71EA915F200DBFF4E /* FacilityCollectionViewCell.swift */; };
924E0E312085851400C1F2AF /* DetailViewButtonsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 924E0E302085851400C1F2AF /* DetailViewButtonsViewController.swift */; };
924E0E322085851500C1F2AF /* DetailViewButtonsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 924E0E302085851400C1F2AF /* DetailViewButtonsViewController.swift */; };
92544659220BB8E0002B6872 /* HUDViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 92544658220BB8E0002B6872 /* HUDViewController.swift */; };
9254465A220BB8E7002B6872 /* HUDViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 92544658220BB8E0002B6872 /* HUDViewController.swift */; };
92554183207ECEC30058E420 /* SelectOneDefaultTableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9259134420784D66002E50B1 /* SelectOneDefaultTableViewController.swift */; };
92589A6221612D0D0002814F /* NotificationCenter.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 92589A6121612D0D0002814F /* NotificationCenter.framework */; };
92589A6521612D0E0002814F /* TodayViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 92589A6421612D0E0002814F /* TodayViewController.swift */; };
......@@ -201,6 +203,7 @@
92182EC31E95C38400192ABA /* FacilityDetailViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FacilityDetailViewController.swift; sourceTree = "<group>"; };
924840F71EA915F200DBFF4E /* FacilityCollectionViewCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FacilityCollectionViewCell.swift; sourceTree = "<group>"; };
924E0E302085851400C1F2AF /* DetailViewButtonsViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DetailViewButtonsViewController.swift; sourceTree = "<group>"; };
92544658220BB8E0002B6872 /* HUDViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HUDViewController.swift; sourceTree = "<group>"; };
9255C5AA21556E410094C947 /* WhatsOpenKit.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WhatsOpenKit.h; sourceTree = "<group>"; };
9255C5AB21556E410094C947 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
92589A6021612D0D0002814F /* TodayWidget.appex */ = {isa = PBXFileReference; explicitFileType = "wrapper.app-extension"; includeInIndex = 0; path = TodayWidget.appex; sourceTree = BUILT_PRODUCTS_DIR; };
......@@ -400,6 +403,7 @@
920D17961F6C5CD200D63295 /* Views */ = {
isa = PBXGroup;
children = (
92544658220BB8E0002B6872 /* HUDViewController.swift */,
92A2757220C8993200E1A102 /* Filters Views */,
9255418520857CF40058E420 /* CollectionViewCells */,
9255418420857CE40058E420 /* TableViewCells */,
......@@ -836,7 +840,6 @@
};
928EC2512160475900D8F9FE = {
CreatedOnToolsVersion = 10.0;
DevelopmentTeam = N5GM564QWL;
ProvisioningStyle = Automatic;
};
929680A921FBBE2F00A87E86 = {
......@@ -1283,6 +1286,7 @@
9203CB922023D51A006ACC3B /* FacilityCollectionViewCell.swift in Sources */,
9203CB932023D51A006ACC3B /* SettingTableViewCell.swift in Sources */,
9203CB952023D51A006ACC3B /* FiltersTableViewController.swift in Sources */,
9254465A220BB8E7002B6872 /* HUDViewController.swift in Sources */,
9203CB962023D51A006ACC3B /* PullingViewController.swift in Sources */,
9273EEF62165B2D000CE63DC /* Intents.intentdefinition in Sources */,
92554183207ECEC30058E420 /* SelectOneDefaultTableViewController.swift in Sources */,
......@@ -1359,6 +1363,7 @@
924840F81EA915F200DBFF4E /* FacilityCollectionViewCell.swift in Sources */,
9265F3A11F2969E500A54A21 /* SettingTableViewCell.swift in Sources */,
927C80DC1EB18B89009079AD /* FiltersTableViewController.swift in Sources */,
92544659220BB8E0002B6872 /* HUDViewController.swift in Sources */,
92B89E302009444E00928284 /* PullingViewController.swift in Sources */,
9273EEF52165B2CF00CE63DC /* Intents.intentdefinition in Sources */,
9259134520784D66002E50B1 /* SelectOneDefaultTableViewController.swift in Sources */,
......@@ -1943,7 +1948,7 @@
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = N5GM564QWL;
DEVELOPMENT_TEAM = "";
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
DYLIB_INSTALL_NAME_BASE = "@rpath";
......@@ -1980,7 +1985,7 @@
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = N5GM564QWL;
DEVELOPMENT_TEAM = "";
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
DYLIB_INSTALL_NAME_BASE = "@rpath";
......@@ -2016,7 +2021,7 @@
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = K5MMVK2UFR;
DEVELOPMENT_TEAM = "";
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
DYLIB_INSTALL_NAME_BASE = "@rpath";
......
{
"images" : [
{
"idiom" : "universal",
"filename" : "empty_heart_big.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "empty_heart_big@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "empty_heart_big@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
},
"properties" : {
"template-rendering-intent" : "template"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "universal",
"filename" : "filled_heart_big.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "filled_heart_big@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "filled_heart_big@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
},
"properties" : {
"template-rendering-intent" : "template"
}
}
\ No newline at end of file
......@@ -565,6 +565,82 @@
</objects>
<point key="canvasLocation" x="-6034.3999999999996" y="-349.47526236881561"/>
</scene>
<!--View Controller-->
<scene sceneID="khr-c9-006">
<objects>
<viewController storyboardIdentifier="HUD" useStoryboardIdentifierAsRestorationIdentifier="YES" id="cDM-Uq-x0e" customClass="HUDViewController" customModule="WhatsOpen" customModuleProvider="target" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="a15-aB-bD0">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<visualEffectView opaque="NO" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Lgh-hp-DYn">
<rect key="frame" x="67.5" y="173.5" width="240" height="240"/>
<view key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" insetsLayoutMarginsFromSafeArea="NO" id="4AQ-Us-J9W">
<rect key="frame" x="0.0" y="0.0" width="240" height="240"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<visualEffectView opaque="NO" contentMode="scaleToFill" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="c52-15-fQn">
<rect key="frame" x="0.0" y="-8" width="240" height="240"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<view key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" ambiguous="YES" insetsLayoutMarginsFromSafeArea="NO" id="Dus-NM-gD9">
<rect key="frame" x="0.0" y="0.0" width="240" height="240"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="4E3-3w-Ok6">
<rect key="frame" x="54" y="39" width="120" height="120"/>
<constraints>
<constraint firstAttribute="width" secondItem="4E3-3w-Ok6" secondAttribute="height" multiplier="1:1" id="0VL-p9-vbu"/>
<constraint firstAttribute="height" constant="120" id="Pvz-Zl-HEY"/>
<constraint firstAttribute="width" constant="120" id="q8e-Vl-Hvr"/>
</constraints>
</imageView>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" misplaced="YES" text="Added to Favorites" textAlignment="center" lineBreakMode="tailTruncation" numberOfLines="2" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="7K0-OX-ykH">
<rect key="frame" x="28" y="181" width="184" height="51"/>
<color key="tintColor" white="0.0" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<fontDescription key="fontDescription" type="system" weight="semibold" pointSize="20"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<constraints>
<constraint firstItem="4E3-3w-Ok6" firstAttribute="top" secondItem="Dus-NM-gD9" secondAttribute="top" constant="39" id="4RV-pU-Zqd"/>
<constraint firstItem="4E3-3w-Ok6" firstAttribute="centerX" secondItem="Dus-NM-gD9" secondAttribute="centerX" id="Ai8-Wj-cd8"/>
<constraint firstItem="7K0-OX-ykH" firstAttribute="top" secondItem="4E3-3w-Ok6" secondAttribute="bottom" constant="21" id="BzJ-ey-c6S"/>
<constraint firstItem="7K0-OX-ykH" firstAttribute="leading" secondItem="Dus-NM-gD9" secondAttribute="leading" constant="28" id="D4g-Gx-XEX"/>
<constraint firstItem="7K0-OX-ykH" firstAttribute="centerX" secondItem="Dus-NM-gD9" secondAttribute="centerX" id="MFb-bJ-x3a"/>
<constraint firstAttribute="trailing" secondItem="7K0-OX-ykH" secondAttribute="trailing" constant="28" id="PuM-Xj-zAJ"/>
</constraints>
</view>
<vibrancyEffect>
<blurEffect style="light"/>
</vibrancyEffect>
</visualEffectView>
</subviews>
</view>
<constraints>
<constraint firstAttribute="width" secondItem="Lgh-hp-DYn" secondAttribute="height" multiplier="1:1" id="SNx-c5-tvi"/>
<constraint firstAttribute="width" constant="240" id="dxp-B5-4SX"/>
</constraints>
<blurEffect style="light"/>
</visualEffectView>
</subviews>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints>
<constraint firstItem="Lgh-hp-DYn" firstAttribute="centerX" secondItem="swk-nm-L3Z" secondAttribute="centerX" id="CSR-rf-44F"/>
<constraint firstItem="Lgh-hp-DYn" firstAttribute="centerY" secondItem="swk-nm-L3Z" secondAttribute="centerY" constant="-50" id="f0r-Rm-WHc"/>
</constraints>
<viewLayoutGuide key="safeArea" id="swk-nm-L3Z"/>
</view>
<connections>
<outlet property="hudBox" destination="Lgh-hp-DYn" id="gD1-AA-bgM"/>
<outlet property="image" destination="4E3-3w-Ok6" id="1AW-0L-P1F"/>
<outlet property="label" destination="7K0-OX-ykH" id="tSt-Ro-NTD"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="oEh-NT-2HJ" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="-5271.1999999999998" y="-352.17391304347831"/>
</scene>
<!--Pulling View Controller-->
<scene sceneID="9g0-2V-iaL">
<objects>
......
......@@ -16,6 +16,9 @@ class DetailViewButtonsViewController: UIViewController, INUIAddVoiceShortcutVie
@IBOutlet var facilityDetailView: UIView!
private var infoHUD: HUDViewController!
private var isInfoHUDDisplayed = false
var detailViewController: WOPFacilityDetailViewController?
var facility: WOPFacility!
......@@ -37,13 +40,63 @@ class DetailViewButtonsViewController: UIViewController, INUIAddVoiceShortcutVie
if(WOPUtilities.isFavoriteFacility(facility)) { // if the facility is a favorite
_ = WOPUtilities.removeFavoriteFacility(facility) // remove it from favorites
if !isInfoHUDDisplayed {
isInfoHUDDisplayed = true
loadChild("Removed from Favorites", image: UIImage(named: "empty_heart_big"))
DispatchQueue.main.asyncAfter(deadline: .now() + 1.1) { [weak self] in
self?.unloadChild()
self?.isInfoHUDDisplayed = false
}
}
}
else { // else add it to favorites
_ = WOPUtilities.addFavoriteFacility(facility)
if !isInfoHUDDisplayed {
isInfoHUDDisplayed = true
loadChild("Added to Favorites", image: UIImage(named: "filled_heart_big"))
DispatchQueue.main.asyncAfter(deadline: .now() + 1.1) { [weak self] in
self?.unloadChild()
self?.isInfoHUDDisplayed = false
}
}
}
setFavoriteButtonText()
}
func loadChild(_ title: String, image: UIImage?) {
DispatchQueue.main.async {
self.addSubview(self.infoHUD.view, toView: (self.detailViewController?.view)!)
self.infoHUD.view.alpha = 0
self.detailViewController!.addChild(self.infoHUD)
self.infoHUD.didMove(toParent: self.detailViewController)
UIView.animate(withDuration: 0.35, animations: {
self.infoHUD.view.alpha = 1
})
self.infoHUD.label.text = title
self.infoHUD.image.image = image
}
}
func unloadChild() {
DispatchQueue.main.async {
UIView.animate(withDuration: 0.35, animations: {
self.infoHUD.view.alpha = 0
}, completion: { (completed) in
self.infoHUD.willMove(toParent: nil)
self.infoHUD.removeFromParent()
self.infoHUD.view.removeFromSuperview()
})
}
}
func getDirections(_ sender: Any) {
let appToUse = WOPDatabaseController.getDefaults().value(forKey: "mapsApp") as? String
......@@ -129,7 +182,10 @@ class DetailViewButtonsViewController: UIViewController, INUIAddVoiceShortcutVie
let interaction = INInteraction(intent: facility.createIntent(), response: WOPViewFacilityIntentUtils.getIntentResponse(facility, userActivity: activity))
interaction.donate(completion: nil)
infoHUD = storyboard?.instantiateViewController(withIdentifier: "HUD") as! HUDViewController
// Do any additional setup after loading the view.
// yah yah, yah yAH
}
func setActivityUp() {
......@@ -191,6 +247,8 @@ class DetailViewButtonsViewController: UIViewController, INUIAddVoiceShortcutVie
// Pass the selected object to the new view controller.
}
*/
}
......
//
// HUDViewController.swift
// WhatsOpen
//
// Created by Zach Knox on 2/6/19.
// Copyright © 2019 SRCT. All rights reserved.
//
import UIKit
class HUDViewController: UIViewController {
@IBOutlet var image: UIImageView!
@IBOutlet var label: UILabel!
@IBOutlet var hudBox: UIVisualEffectView!
override func viewDidLoad() {
super.viewDidLoad()
image.tintColor = .red
label.textColor = .black
hudBox.clipsToBounds = true
hudBox.layer.cornerRadius = 10
// Do any additional setup after loading the view.
}
/*
// MARK: - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
// Get the new view controller using segue.destination.
// Pass the selected object to the new view controller.
}
*/
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment