Skip to content
Closed
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
11 changes: 11 additions & 0 deletions Frameless.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
0DAB64411A09FDD00046287E /* SettingsTableViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SettingsTableViewController.swift; sourceTree = "<group>"; };
0DD7EC1B1A72FC0F00BED2DC /* JSSAlertView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = JSSAlertView.swift; sourceTree = "<group>"; };
0DD869F41A08A7A000BF196E /* SettingsViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SettingsViewController.swift; sourceTree = "<group>"; };
1E92D37F1B22778D00E2B45E /* libPods-Frameless-GPUImage.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = "libPods-Frameless-GPUImage.a"; path = "Pods/../build/Debug-iphoneos/libPods-Frameless-GPUImage.a"; sourceTree = "<group>"; };
5ABAB4BA5DBE39442812DB61 /* libPods-Frameless.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-Frameless.a"; sourceTree = BUILT_PRODUCTS_DIR; };
5DC7091992089D05BD351118 /* Pods-Frameless.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Frameless.release.xcconfig"; path = "Pods/Target Support Files/Pods-Frameless/Pods-Frameless.release.xcconfig"; sourceTree = "<group>"; };
DAC237240666B2261B5088CD /* Pods-Frameless.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Frameless.debug.xcconfig"; path = "Pods/Target Support Files/Pods-Frameless/Pods-Frameless.debug.xcconfig"; sourceTree = "<group>"; };
Expand Down Expand Up @@ -173,6 +174,7 @@
3B605A57B8762CE7D092BD2D /* Frameworks */ = {
isa = PBXGroup;
children = (
1E92D37F1B22778D00E2B45E /* libPods-Frameless-GPUImage.a */,
5ABAB4BA5DBE39442812DB61 /* libPods-Frameless.a */,
);
name = Frameworks;
Expand Down Expand Up @@ -436,6 +438,7 @@
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_OPTIMIZATION_LEVEL = 3;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
Expand All @@ -460,6 +463,10 @@
INFOPLIST_FILE = Frameless/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
LIBRARY_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/build/Debug-iphoneos",
);
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE = "";
SWIFT_OBJC_BRIDGING_HEADER = "Frameless/Frameless-Bridging-Header.h";
Expand All @@ -479,6 +486,10 @@
INFOPLIST_FILE = Frameless/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
LIBRARY_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/build/Debug-iphoneos",
);
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE = "";
SWIFT_OBJC_BRIDGING_HEADER = "Frameless/Frameless-Bridging-Header.h";
Expand Down
2 changes: 2 additions & 0 deletions Frameless/AppDefaults.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ enum AppDefaultKeys: String {
case TripleTapGesture = "tripleTap"
case FramerBonjour = "framerConnect"
case KeepAwake = "keepAwake"
case ScreenIdleTimeout = "screenIdleTimeout"
case MotionDetection = "motionDetection"
}


22 changes: 21 additions & 1 deletion Frameless/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,12 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
let isIdleTimer = NSUserDefaults.standardUserDefaults().objectForKey(AppDefaultKeys.KeepAwake.rawValue) as? Bool
UIApplication.sharedApplication().idleTimerDisabled = isIdleTimer!
}
if NSUserDefaults.standardUserDefaults().objectForKey(AppDefaultKeys.ScreenIdleTimeout.rawValue) == nil {
NSUserDefaults.standardUserDefaults().setValue("", forKey: AppDefaultKeys.ScreenIdleTimeout.rawValue)
}
if NSUserDefaults.standardUserDefaults().objectForKey(AppDefaultKeys.MotionDetection.rawValue) == nil {
NSUserDefaults.standardUserDefaults().setValue(false, forKey: AppDefaultKeys.MotionDetection.rawValue)
}
}

func createIntroViewController() -> OnboardingViewController {
Expand Down Expand Up @@ -122,25 +128,39 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
func applicationWillResignActive(application: UIApplication) {
// 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.
// 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.
if let appViewController = self.window?.rootViewController as? ViewController {
appViewController.resetScreenIdleTimer(fadeScreen: false)
}
}

func applicationDidEnterBackground(application: UIApplication) {
// 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.
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
if let appViewController = self.window?.rootViewController as? ViewController {
appViewController.resetScreenIdleTimer(fadeScreen: false)
}
}

func applicationWillEnterForeground(application: UIApplication) {
// 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.
if let appViewController = self.window?.rootViewController as? ViewController {
appViewController.resetScreenIdleTimer(fadeScreen: false)
}
}

func applicationDidBecomeActive(application: UIApplication) {
// 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.
if let appViewController = self.window?.rootViewController as? ViewController {
appViewController.resetScreenIdleTimer(fadeScreen: false)
}
}

func applicationWillTerminate(application: UIApplication) {
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
// Saves changes in the application's managed object context before the application terminates.
if let appViewController = self.window?.rootViewController as? ViewController {
appViewController.resetScreenIdleTimer(fadeScreen: false)
}
}

}

71 changes: 71 additions & 0 deletions Frameless/Base.lproj/Main.storyboard
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@
<string>ClearSans</string>
<string>ClearSans</string>
<string>ClearSans</string>
<string>ClearSans</string>
<string>ClearSans</string>
<string>ClearSans</string>
<string>ClearSans</string>
</mutableArray>
</customFonts>
<scenes>
Expand Down Expand Up @@ -293,6 +297,71 @@
</constraints>
</tableViewCellContentView>
</tableViewCell>
<tableViewCell contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" rowHeight="56" id="VOa-EK-z8D">
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="VOa-EK-z8D" id="vSO-th-4zx">
<autoresizingMask key="autoresizingMask"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" text="Screen timeout" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="pmR-J0-RHs">
<rect key="frame" x="16" y="7" width="116" height="23"/>
<fontDescription key="fontDescription" name="ClearSans" family="Clear Sans" pointSize="17"/>
<color key="textColor" red="0.55673807860000002" green="0.55652600529999996" blue="0.57718861099999996" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" text="Timeout in seconds until screen goes blank" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Soo-8r-9Ge">
<rect key="frame" x="16" y="26" width="233" height="23"/>
<fontDescription key="fontDescription" name="ClearSans" family="Clear Sans" pointSize="12"/>
<color key="textColor" red="0.55673807860000002" green="0.55652600529999996" blue="0.57718861099999996" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
</label>
<textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" ambiguous="YES" misplaced="YES" contentHorizontalAlignment="right" contentVerticalAlignment="center" borderStyle="roundedRect" minimumFontSize="17" clearButtonMode="whileEditing" translatesAutoresizingMaskIntoConstraints="NO" id="QqS-AU-0LP">
<rect key="frame" x="431" y="13" width="161" height="30"/>
<accessibility key="accessibilityConfiguration">
<accessibilityTraits key="traits" none="YES" link="YES"/>
</accessibility>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<textInputTraits key="textInputTraits" autocorrectionType="no" spellCheckingType="no" keyboardType="numberPad" enablesReturnKeyAutomatically="YES"/>
<connections>
<action selector="screenIdleTimeoutChanged:" destination="lCY-Sl-eE7" eventType="editingDidEnd" id="0SH-xR-6tE"/>
</connections>
</textField>
</subviews>
<constraints>
<constraint firstAttribute="trailing" secondItem="QqS-AU-0LP" secondAttribute="trailing" constant="16" id="fb8-rV-eUE"/>
</constraints>
</tableViewCellContentView>
</tableViewCell>
<tableViewCell contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" rowHeight="56" id="4ra-ki-ipo">
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="4ra-ki-ipo" id="6ea-i7-LjW">
<autoresizingMask key="autoresizingMask"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" text="Motion detection" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Sag-AS-86B">
<rect key="frame" x="16" y="7" width="129" height="23"/>
<fontDescription key="fontDescription" name="ClearSans" family="Clear Sans" pointSize="17"/>
<color key="textColor" red="0.55673807860000002" green="0.55652600529999996" blue="0.57718861099999996" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" text="Use front camera to detect motion and stop screen blanking" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="PnV-jG-RPa">
<rect key="frame" x="16" y="26" width="324" height="23"/>
<fontDescription key="fontDescription" name="ClearSans" family="Clear Sans" pointSize="12"/>
<color key="textColor" red="0.55673807860000002" green="0.55652600529999996" blue="0.57718861099999996" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
</label>
<switch opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" misplaced="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" on="YES" translatesAutoresizingMaskIntoConstraints="NO" id="t6P-T8-tMY">
<rect key="frame" x="531" y="12" width="51" height="31"/>
<color key="onTintColor" red="0.61937248710000004" green="0.51502001289999999" blue="0.90843188760000004" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<connections>
<action selector="motionDetectionSwitch:" destination="lCY-Sl-eE7" eventType="valueChanged" id="Bdy-3R-BTg"/>
</connections>
</switch>
</subviews>
<constraints>
<constraint firstAttribute="trailingMargin" secondItem="t6P-T8-tMY" secondAttribute="trailing" constant="5" id="dy6-ly-o4V"/>
<constraint firstItem="t6P-T8-tMY" firstAttribute="top" secondItem="6ea-i7-LjW" secondAttribute="topMargin" constant="4" id="rN1-6m-9PY"/>
</constraints>
</tableViewCellContentView>
</tableViewCell>
</cells>
</tableViewSection>
</sections>
Expand All @@ -304,6 +373,8 @@
<connections>
<outlet property="_browserSwitch" destination="fIL-z9-y1y" id="hd6-Uz-FAr"/>
<outlet property="_framerSwitch" destination="Vyj-7R-UEs" id="3vh-0s-wr9"/>
<outlet property="_motionDetectionSwitch" destination="t6P-T8-tMY" id="A4x-EU-lUa"/>
<outlet property="_screenIdleTimeoutTextField" destination="QqS-AU-0LP" id="S3s-SX-apr"/>
<outlet property="_shakeSwitch" destination="4yd-mc-Ohq" id="hVN-0x-IGW"/>
<outlet property="_sleepSwitch" destination="rM4-QM-crQ" id="EkR-N9-K6T"/>
<outlet property="_swipeUpSwitch" destination="bpD-iZ-A9f" id="yal-l5-dtx"/>
Expand Down
1 change: 1 addition & 0 deletions Frameless/Frameless-Bridging-Header.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@

#import "AppearanceBridge.h"
#import <Onboard/OnboardingViewController.h>
#import <GPUImage/GPUImage.h>
#import <arpa/inet.h>
6 changes: 4 additions & 2 deletions Frameless/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,12 @@
<string>ClearSans-Bold.ttf</string>
<string>ClearSans-BoldItalic.ttf</string>
</array>
<key>UIBackgroundModes</key>
<array>
<string>fetch</string>
</array>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIMainStoryboardFile</key>
<string></string>
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>armv7</string>
Expand Down
14 changes: 14 additions & 0 deletions Frameless/SettingsTableViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ class SettingsTableViewController: UITableViewController {
@IBOutlet weak var _browserSwitch: UISwitch!
@IBOutlet weak var _framerSwitch: UISwitch!
@IBOutlet weak var _sleepSwitch: UISwitch!
@IBOutlet weak var _screenIdleTimeoutTextField: UITextField!
@IBOutlet weak var _motionDetectionSwitch: UISwitch!

override func viewDidLoad() {
super.viewDidLoad()
Expand All @@ -26,6 +28,8 @@ class SettingsTableViewController: UITableViewController {
_browserSwitch.on = NSUserDefaults.standardUserDefaults().objectForKey(AppDefaultKeys.ForwardBackGesture.rawValue) as! Bool
_framerSwitch.on = NSUserDefaults.standardUserDefaults().objectForKey(AppDefaultKeys.FramerBonjour.rawValue) as! Bool
_sleepSwitch.on = NSUserDefaults.standardUserDefaults().objectForKey(AppDefaultKeys.KeepAwake.rawValue) as! Bool
_screenIdleTimeoutTextField.text = NSUserDefaults.standardUserDefaults().objectForKey(AppDefaultKeys.ScreenIdleTimeout.rawValue) as! String
_motionDetectionSwitch.on = NSUserDefaults.standardUserDefaults().objectForKey(AppDefaultKeys.MotionDetection.rawValue) as! Bool
}

override func didReceiveMemoryWarning() {
Expand Down Expand Up @@ -79,6 +83,16 @@ class SettingsTableViewController: UITableViewController {
NSUserDefaults.standardUserDefaults().setValue(value, forKey: AppDefaultKeys.KeepAwake.rawValue)
}

@IBAction func screenIdleTimeoutChanged(sender: AnyObject) {
var value = (sender as! UITextField).text
NSUserDefaults.standardUserDefaults().setValue(value, forKey: AppDefaultKeys.ScreenIdleTimeout.rawValue)
}

@IBAction func motionDetectionSwitch(sender: AnyObject) {
var value = (sender as! UISwitch).on
NSUserDefaults.standardUserDefaults().setValue(value, forKey: AppDefaultKeys.MotionDetection.rawValue)
}

func checkControlsSettings() -> Bool {
var arr = [_shakeSwitch.on, _swipeUpSwitch.on, _tripleTapSwitch.on]
let filtered = arr.filter { $0 == true }
Expand Down
Loading