Commit b0de008f authored by Zach Knox's avatar Zach Knox

Merge branch 'dev-1.2' into 'master'

1.2

Closes #32

See merge request !39
parents 9ffdc2ea 90b5fc73
......@@ -74,5 +74,5 @@ WhatsOpen/WhatsOpen/crashlyticsbuild.sh
# and has a Slack webhook token in it
WhatsOpen/fastlane/
#Crashbuild or something?
#crashlytics file
crashlyticsbuild.sh
......@@ -34,9 +34,9 @@ Requirements:
To get started, you'll need the following installed:
* [Git](http://git-scm.com/book/en/Getting-Started-Installing-Git)
* The latest **public** build of [Xcode](https://developer.apple.com/xcode/) (and a compatible Mac). *Currently Xcode* (You can get this from the [Mac App Store](https://itunes.apple.com/us/app/xcode/id497799835?mt=12) if you want easy updates)
* The latest **public** build of [Xcode](https://developer.apple.com/xcode/) (and a compatible Mac). *Currently Xcode 10* (You can get this from the [Mac App Store](https://itunes.apple.com/us/app/xcode/id497799835?mt=12) if you want easy updates)
* The latest **public** release of Swift. *Currently Swift 4.0* (bundled with Xcode)
* The latest **public** release of Swift. *Currently Swift 4.2* (bundled with Xcode)
* Cocoapods, for dependency management. You can install this by running `sudo gem install cocoapods` in your terminal. (Dependency management may change in the future)
......@@ -61,6 +61,7 @@ What Won't Work During Development
---
- Crashlytics won't load in under the "WhatsOpen" Scheme. Use Xcode's debugger.
- Alternate app icons won't work (and will probably crash if you try to use them) due to the build method of adding them to the info.plist file. If you're an artist and have some cool alternate app icons to add, you can still do so in the `AlternateAppIcons.xcassets` file in the main project folder, and adding a cell for them in the SetIconTableViewController.
- Any App Extensions will likely be unable to connect to your database, as App Groups used for this require a special entitlement.
Troubleshooting
---
......
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="14460.31" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="M4Y-Lb-cyx">
<device id="retina4_7" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14460.20"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
<!--Notification View Controller-->
<scene sceneID="cwh-vc-ff4">
<objects>
<viewController id="M4Y-Lb-cyx" userLabel="Notification View Controller" customClass="NotificationViewController" customModule="AlertNotificationExtention" customModuleProvider="target" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" simulatedAppContext="notificationCenter" id="S3S-Oj-5AN">
<rect key="frame" x="0.0" y="0.0" width="320" height="37"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<containerView opaque="NO" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="1mD-z3-WYh">
<rect key="frame" x="0.0" y="0.0" width="320" height="37"/>
<connections>
<segue destination="9W9-6Q-a2K" kind="embed" id="XVL-2A-S2F"/>
</connections>
</containerView>
</subviews>
<color key="backgroundColor" red="0.45882353186607361" green="0.74901962280273438" blue="0.66666668653488159" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstItem="1mD-z3-WYh" firstAttribute="height" secondItem="S3S-Oj-5AN" secondAttribute="height" id="Dmj-pC-GXQ"/>
<constraint firstItem="1mD-z3-WYh" firstAttribute="centerX" secondItem="2BE-c3-nQJ" secondAttribute="centerX" id="SNc-7e-O8z"/>
<constraint firstItem="1mD-z3-WYh" firstAttribute="centerY" secondItem="2BE-c3-nQJ" secondAttribute="centerY" id="dul-Ck-Oww"/>
<constraint firstItem="1mD-z3-WYh" firstAttribute="width" secondItem="S3S-Oj-5AN" secondAttribute="width" id="r24-qT-usG"/>
</constraints>
<viewLayoutGuide key="safeArea" id="2BE-c3-nQJ"/>
</view>
<extendedEdge key="edgesForExtendedLayout"/>
<freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
<size key="freeformSize" width="320" height="37"/>
<connections>
<outlet property="containerView" destination="1mD-z3-WYh" id="FhD-cv-isU"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="vXp-U4-Rya" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="41.600000000000001" y="25.637181409295355"/>
</scene>
<!--View Controller-->
<scene sceneID="8Dg-Dp-Wr9">
<objects>
<viewController id="9W9-6Q-a2K" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="iRA-Nc-NVT">
<rect key="frame" x="0.0" y="0.0" width="320" height="37"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</view>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="yGU-sF-ZdX" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="42" y="200"/>
</scene>
</scenes>
</document>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleDisplayName</key>
<string>AlertNotificationExtention</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>XPC!</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>NSExtension</key>
<dict>
<key>NSExtensionAttributes</key>
<dict>
<key>UNNotificationExtensionCategory</key>
<string>alertNotify</string>
<key>UNNotificationExtensionInitialContentSizeRatio</key>
<integer>1</integer>
<key>UNNotificationExtensionDefaultContentHidden</key>
<true/>
</dict>
<key>NSExtensionMainStoryboard</key>
<string>MainInterface</string>
<key>NSExtensionPointIdentifier</key>
<string>com.apple.usernotifications.content-extension</string>
</dict>
</dict>
</plist>
//
// NotificationViewController.swift
// AlertNotificationExtention
//
// Created by Zach Knox on 1/25/19.
// Copyright © 2019 SRCT. All rights reserved.
//
import UIKit
import UserNotifications
import UserNotificationsUI
import RealmSwift
import WhatsOpenKit
class NotificationViewController: UIViewController, UNNotificationContentExtension {
@IBOutlet var label: UILabel?
@IBOutlet var containerView: UIView!
override func viewDidLoad() {
super.viewDidLoad()
// Do any required interface initialization here.
}
func didReceive(_ notification: UNNotification) {
let realm = try! Realm(configuration: WOPDatabaseController.getConfig())
let results = realm.objects(WOPFacilitiesModel.self)
if results.count > 0 {
let model = results[0]
let alerts = model.alerts
let objs = alerts.filter(NSPredicate(format: "id = \((notification.request.content.userInfo["alertID"])!)"))
if objs.count > 0 {
let alert = objs.first
let storyboard = UIStoryboard(name: "WOPSharedUI", bundle: Bundle(for: WOPAlertDetailViewController.self))
let detailVC = storyboard.instantiateViewController(withIdentifier: "detailView") as! WOPAlertDetailViewController
detailVC.alert = alert
self.addChild(detailVC)
self.addSubview(detailVC.view, toView: containerView)
//attachChild(detailVC)
} else {
return
}
} else {
return
}
}
func addSubview(_ subView: UIView, toView parentView: UIView) {
parentView.addSubview(subView)
var viewBindingsDict = [String: AnyObject]()
viewBindingsDict["subView"] = subView
parentView.addConstraints(NSLayoutConstraint.constraints(withVisualFormat: "H:|[subView]|",
options: [], metrics: nil, views: viewBindingsDict))
parentView.addConstraints(NSLayoutConstraint.constraints(withVisualFormat: "V:|[subView]|",
options: [], metrics: nil, views: viewBindingsDict))
}
// Taken from Apple's SoupChef sample code
private func attachChild(_ viewController: UIViewController) {
addChild(viewController)
if let subview = viewController.view {
view.addSubview(subview)
subview.translatesAutoresizingMaskIntoConstraints = false
// Set the child controller's view to be the exact same size as the parent controller's view.
subview.widthAnchor.constraint(equalTo: view.widthAnchor).isActive = true
subview.heightAnchor.constraint(equalTo: view.heightAnchor).isActive = true
subview.centerXAnchor.constraint(equalTo: view.centerXAnchor).isActive = true
subview.centerYAnchor.constraint(equalTo: view.centerYAnchor).isActive = true
}
viewController.didMove(toParent: self)
}
}
# Uncomment this line to define a global platform for your project
# platform :ios, '8.0'
# Uncomment this line if you're using Swift
platform :ios, '11.0'
platform :ios, '12.0'
use_frameworks!
def ios_pods
def important_pods
pod 'RealmSwift'
#pod 'ObjectMapper', '~> 3.2'
# TEMPORARY BECAUSE Xcode 10
pod 'ObjectMapper', :git => 'https://github.com/alecdoconnor/ObjectMapper.git', :branch => 'Swift-4.2'
pod 'ObjectMapper'
pod "ObjectMapper+Realm"
end
def ios_pods
#pod 'Segmentio', '~> 2.1'
pod 'DeckTransition', '~> 2.0'
pod 'DeckTransition'
pod 'Fabric'
pod 'Crashlytics'
......@@ -22,13 +22,34 @@ end
target 'WhatsOpen' do
important_pods
ios_pods
end
target 'WhatsOpen - AppStore' do
important_pods
ios_pods
end
target 'WhatsOpenKit' do
important_pods
end
target 'TodayWidget' do
important_pods
end
target 'ShortcutsExtension' do
important_pods
end
target 'ShortcutsExtensionUI' do
important_pods
end
target 'AlertNotificationExtention' do
important_pods
end
post_install do |installer|
installer.pods_project.targets.each do |target|
......
PODS:
- Crashlytics (3.10.2):
- Fabric (~> 1.7.7)
- DeckTransition (2.0.0)
- Fabric (1.7.7)
- ObjectMapper (3.2.0)
- ObjectMapper+Realm (0.6):
- Crashlytics (3.12.0):
- Fabric (~> 1.9.0)
- DeckTransition (2.1.0)
- Fabric (1.9.0)
- ObjectMapper (3.4.2)
- "ObjectMapper+Realm (0.6)":
- ObjectMapper
- RealmSwift
- Realm (3.7.1):
- Realm/Headers (= 3.7.1)
- Realm/Headers (3.7.1)
- RealmSwift (3.7.1):
- Realm (= 3.7.1)
- Realm (3.13.1):
- Realm/Headers (= 3.13.1)
- Realm/Headers (3.13.1)
- RealmSwift (3.13.1):
- Realm (= 3.13.1)
DEPENDENCIES:
- Crashlytics
- DeckTransition (~> 2.0)
- DeckTransition
- Fabric
- ObjectMapper (from `https://github.com/alecdoconnor/ObjectMapper.git`, branch `Swift-4.2`)
- ObjectMapper+Realm
- ObjectMapper
- "ObjectMapper+Realm"
- RealmSwift
EXTERNAL SOURCES:
ObjectMapper:
:branch: Swift-4.2
:git: https://github.com/alecdoconnor/ObjectMapper.git
CHECKOUT OPTIONS:
ObjectMapper:
:commit: af7966b567860596fad270bb44b27f495cd8691d
:git: https://github.com/alecdoconnor/ObjectMapper.git
SPEC REPOS:
https://github.com/cocoapods/specs.git:
- Crashlytics
- DeckTransition
- Fabric
- ObjectMapper
- "ObjectMapper+Realm"
- Realm
- RealmSwift
SPEC CHECKSUMS:
Crashlytics: 0360624eea1c978a743feddb2fb1ef8b37fb7a0d
DeckTransition: 2300694f94fbeca2c103f365dc9dc09ffae14a4f
Fabric: bda89e242bce1b7b8ab264248cf3407774ce0095
ObjectMapper: 5cccd2de6f253eda859df8116a5a554d9769e859
ObjectMapper+Realm: 4cf44ed3202a73f08594e21e13eb3f8aa9b5a664
Realm: 906be37d52f17f25484ac01643a7f26a9d3bfbd5
RealmSwift: 1c2b6bae3dc55bb87e080ffa96537d71442f6dce
Crashlytics: 07fb167b1694128c1c9a5a5cc319b0e9c3ca0933
DeckTransition: ca707456e3d83928c895fed6f458cbf68c5cac84
Fabric: f988e33c97f08930a413e08123064d2e5f68d655
ObjectMapper: 0d4402610f4e468903ae64629eec4784531e5c51
"ObjectMapper+Realm": 4cf44ed3202a73f08594e21e13eb3f8aa9b5a664
Realm: 50071da38fe079e0735e47c9f2eae738c68c5996
RealmSwift: 8a1e6a02b7a08cd17a31e3115143fb69fe5f3fb9
PODFILE CHECKSUM: f77678c4bb98cdb953f0eb4226354e2455803d42
PODFILE CHECKSUM: 0589552d0fa556d4bb7ac2395184d9884a95f850
COCOAPODS: 1.4.0
COCOAPODS: 1.6.0.beta.2
......@@ -15,7 +15,7 @@ Hereʼs a GIF showing it in action.
## Requirements
- Swift 4
- Swift 4.2
- iOS 9 or later
## Installation
......@@ -100,6 +100,7 @@ It's worth noting that updating the snapshot is an expensive process and should
- [Petty](https://zachsim.one/projects/petty) by [Zach Simone](https://twitter.com/zachsimone)
- [Bitbook](https://bitbookapp.com) by [Sammy Gutierrez](https://sammygutierrez.com)
- [BookPlayer](https://github.com/GianniCarlo/Audiobook-Player) by [Gianni Carlo](https://twitter.com/GCarlo89)
- [What's Open for iOS](https://git.gmu.edu/srct/whats-open-ios) by [Mason SRCT](https://srct.gmu.edu/)
Feel free to submit a PR if you’re using this library in your apps
......
......@@ -65,7 +65,7 @@ final class DeckPresentationController: UIPresentationController, UIGestureRecog
self.dismissAnimation = dismissAnimation
self.dismissCompletion = dismissCompletion
NotificationCenter.default.addObserver(self, selector: #selector(updateForStatusBar), name: .UIApplicationDidChangeStatusBarFrame, object: nil)
NotificationCenter.default.addObserver(self, selector: #selector(updateForStatusBar), name: UIApplication.didChangeStatusBarFrameNotification, object: nil)
}
// MARK: - Public methods
......@@ -287,7 +287,7 @@ final class DeckPresentationController: UIPresentationController, UIGestureRecog
}
updateSnapshotViewAspectRatio()
containerView.bringSubview(toFront: roundedViewForPresentedView)
containerView.bringSubviewToFront(roundedViewForPresentedView)
if presentedViewController.view.isDescendant(of: containerView) {
UIView.animate(withDuration: 0.1) { [weak self] in
......@@ -586,7 +586,8 @@ final class DeckPresentationController: UIPresentationController, UIGestureRecog
animations: {
self.presentedView?.transform = .identity
})
scrollViewUpdater = nil
default: break
}
......
......@@ -55,6 +55,10 @@ final class ScrollViewDetector {
return scrollView
}
if let scrollView = viewController.view as? UIScrollView {
return scrollView
}
for subview in viewController.view.subviews {
if let scrollView = subview as? UIScrollView {
return scrollView
......
......@@ -55,9 +55,9 @@ final class ScrollViewUpdater {
/// `safeAreaInsets.top` is 0, so that is adjusted for here.
let offset: CGFloat = {
if #available(iOS 11, *) {
return scrollView.contentOffset.y + scrollView.safeAreaInsets.top
return scrollView.contentOffset.y + scrollView.contentInset.top + scrollView.safeAreaInsets.top
} else {
return scrollView.contentOffset.y
return scrollView.contentOffset.y + scrollView.contentInset.top
}
}()
......
PODS:
- Crashlytics (3.10.2):
- Fabric (~> 1.7.7)
- DeckTransition (2.0.0)
- Fabric (1.7.7)
- ObjectMapper (3.2.0)
- ObjectMapper+Realm (0.6):
- Crashlytics (3.12.0):
- Fabric (~> 1.9.0)
- DeckTransition (2.1.0)
- Fabric (1.9.0)
- ObjectMapper (3.4.2)
- "ObjectMapper+Realm (0.6)":
- ObjectMapper
- RealmSwift
- Realm (3.7.1):
- Realm/Headers (= 3.7.1)
- Realm/Headers (3.7.1)
- RealmSwift (3.7.1):
- Realm (= 3.7.1)
- Realm (3.13.1):
- Realm/Headers (= 3.13.1)
- Realm/Headers (3.13.1)
- RealmSwift (3.13.1):
- Realm (= 3.13.1)
DEPENDENCIES:
- Crashlytics
- DeckTransition (~> 2.0)
- DeckTransition
- Fabric
- ObjectMapper (from `https://github.com/alecdoconnor/ObjectMapper.git`, branch `Swift-4.2`)
- ObjectMapper+Realm
- ObjectMapper
- "ObjectMapper+Realm"