Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/blinksh/blink
Browse files Browse the repository at this point in the history
  • Loading branch information
yury committed Jul 16, 2017
2 parents ad4102d + ae9d47a commit 046a393
Show file tree
Hide file tree
Showing 86 changed files with 3,981 additions and 589 deletions.
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,6 @@
[submodule "Frameworks/MBProgressHUD"]
path = Frameworks/MBProgressHUD
url = https://github.com/blinksh/MBProgressHUD.git
[submodule "Frameworks/PasscodeLock"]
path = Frameworks/PasscodeLock
url = https://github.com/blinksh/SwiftPasscodeLock.git
File renamed without changes.
229 changes: 218 additions & 11 deletions Blink.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

13 changes: 11 additions & 2 deletions Blink/AppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@
////////////////////////////////////////////////////////////////////////////////

#import "AppDelegate.h"
#import "BKiCloudSyncHandler.h"
#import "BKTouchIDAuthManager.h"
#import "ScreenController.h"
@import CloudKit;

#if HOCKEYSDK
@import HockeySDK;
Expand All @@ -43,7 +47,7 @@ @implementation AppDelegate

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{

[[BKTouchIDAuthManager sharedManager]registerforDeviceLockNotif];
// Override point for customization after application launch.
#if HOCKEYSDK
NSString *hockeyID = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"HockeyID"];
Expand All @@ -54,8 +58,10 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(
//[[BITHockeyManager sharedHockeyManager] setDebugLogEnabled: YES];
[[BITHockeyManager sharedHockeyManager] startManager];
[[BITHockeyManager sharedHockeyManager].authenticator authenticateInstallation]; // This line is obsolete in the crash only build
#endif
#endif

[[ScreenController shared] setup];

return YES;
}

Expand Down Expand Up @@ -86,4 +92,7 @@ - (void)applicationWillTerminate:(UIApplication *)application
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
}

- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler{
[[BKiCloudSyncHandler sharedHandler]checkForReachabilityAndSync:nil];
}
@end
17 changes: 10 additions & 7 deletions Blink/Base.lproj/Main.storyboard
Original file line number Diff line number Diff line change
@@ -1,22 +1,25 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="10117" systemVersion="15E65" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="BYZ-38-t0r">
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="11762" systemVersion="16C67" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="BYZ-38-t0r">
<device id="retina4_7" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="10085"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="11757"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
<!--Space Controller-->
<scene sceneID="tne-QT-ifu">
<objects>
<viewController id="BYZ-38-t0r" customClass="SpaceController" sceneMemberID="viewController">
<viewController storyboardIdentifier="SpaceController" id="BYZ-38-t0r" customClass="SpaceController" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="y3c-jy-aDJ"/>
<viewControllerLayoutGuide type="bottom" id="wfy-db-euE"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="8bC-Xf-vdC">
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</view>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder"/>
Expand Down
12 changes: 12 additions & 0 deletions Blink/Blink.entitlements
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,18 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>aps-environment</key>
<string>development</string>
<key>com.apple.developer.icloud-container-identifiers</key>
<array>
<string>iCloud.com.carloscabanero.blinkshell</string>
</array>
<key>com.apple.developer.icloud-services</key>
<array>
<string>CloudKit</string>
</array>
<key>com.apple.developer.ubiquity-kvstore-identifier</key>
<string>$(TeamIdentifierPrefix)$(CFBundleIdentifier)</string>
<key>keychain-access-groups</key>
<array>
<string>$(AppIdentifierPrefix)Com.CarlosCabanero.Blink</string>
Expand Down
13 changes: 8 additions & 5 deletions Blink/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,23 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>3.0.55</string>
<string>7.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>55</string>
<string>1</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>UIBackgroundModes</key>
<array>
<string>fetch</string>
<string>remote-notification</string>
</array>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIMainStoryboardFile</key>
<string>Main</string>
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>arm64</string>
<string>armv7</string>
</array>
<key>UISupportedInterfaceOrientations</key>
<array>
Expand Down
45 changes: 45 additions & 0 deletions Blink/ScreenController.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
////////////////////////////////////////////////////////////////////////////////
//
// B L I N K
//
// Copyright (C) 2016 Blink Mobile Shell Project
//
// This file is part of Blink.
//
// Blink is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Blink is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Blink. If not, see <http://www.gnu.org/licenses/>.
//
// In addition, Blink is also subject to certain additional terms under
// GNU GPL version 3 section 7.
//
// You should have received a copy of these additional terms immediately
// following the terms and conditions of the GNU General Public License
// which accompanied the Blink Source Code. If not, see
// <http://www.github.com/blinksh/blink>.
//
////////////////////////////////////////////////////////////////////////////////

#import <Foundation/Foundation.h>

@interface ScreenController : NSObject

+ (ScreenController *)shared;

@property (nonatomic, readonly, strong) UIViewController *mainScreenRootViewController;

- (void)setup;
- (void)switchToOtherScreen;
- (void)moveCurrentShellToOtherScreen;


@end
178 changes: 178 additions & 0 deletions Blink/ScreenController.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,178 @@
////////////////////////////////////////////////////////////////////////////////
//
// B L I N K
//
// Copyright (C) 2016 Blink Mobile Shell Project
//
// This file is part of Blink.
//
// Blink is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Blink is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Blink. If not, see <http://www.gnu.org/licenses/>.
//
// In addition, Blink is also subject to certain additional terms under
// GNU GPL version 3 section 7.
//
// You should have received a copy of these additional terms immediately
// following the terms and conditions of the GNU General Public License
// which accompanied the Blink Source Code. If not, see
// <http://www.github.com/blinksh/blink>.
//
////////////////////////////////////////////////////////////////////////////////

#import <UIKit/UIKit.h>
#import "ScreenController.h"
#import "SpaceController.h"

@interface UIWindow (ScreenController)
- (SpaceController *)spaceController;
@end

@implementation UIWindow (ScreenController)
- (SpaceController *)spaceController
{
return (SpaceController *)self.rootViewController;
}
@end


@implementation ScreenController
{
NSMutableArray<UIWindow *> *_windows;
}

+ (ScreenController *)shared {
static ScreenController *ctrl = nil;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
ctrl = [[self alloc] init];
});
return ctrl;
}

- (instancetype)init
{
self = [super init];
if (self) {
_windows = [[NSMutableArray alloc] init];
}
return self;
}

- (UIViewController *)mainScreenRootViewController {
return [[_windows firstObject] rootViewController];
}

- (void)subscribeForScreenNotifications
{
NSNotificationCenter *defaultCenter = [NSNotificationCenter defaultCenter];

[defaultCenter addObserver:self
selector:@selector(screenDidConnect:)
name:UIScreenDidConnectNotification
object:nil];
[defaultCenter addObserver:self
selector:@selector(screenDidDisconnect:)
name:UIScreenDidDisconnectNotification
object:nil];
}

- (void)setup
{
[self subscribeForScreenNotifications];

[self setupWindowForScreen:[UIScreen mainScreen]];

[[_windows firstObject] makeKeyAndVisible];

// We have already connected external screen
if ([UIScreen screens].count > 1) {
[self setupWindowForScreen:[[UIScreen screens] lastObject]];
}
}

- (void)setupWindowForScreen:(UIScreen *)screen
{
UIWindow *window = [[UIWindow alloc] initWithFrame:[screen bounds]];
[_windows addObject:window];

window.screen = screen;
window.rootViewController = [self createSpaceController];
window.hidden = NO;
}

- (SpaceController *)createSpaceController
{
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle: nil];
return [storyboard instantiateViewControllerWithIdentifier:@"SpaceController"];
}

- (void)screenDidConnect:(NSNotification *) notification
{
UIScreen *screen = (UIScreen *)notification.object;
[self setupWindowForScreen:screen];
}

- (void)screenDidDisconnect:(NSNotification *) notification
{
SpaceController *mainSC = _windows.firstObject.spaceController;
SpaceController *removingSC = _windows.lastObject.spaceController;

[mainSC moveAllShellsFromSpaceController:removingSC];
[_windows removeLastObject];
}

- (UIWindow *)keyWindow
{
if ([[_windows firstObject] isKeyWindow]) {
return [_windows firstObject];
} else {
return [_windows lastObject];
}
}

- (UIWindow *)nonKeyWindow
{
if ([[_windows firstObject] isKeyWindow]) {
return [_windows lastObject];
} else {
return [_windows firstObject];
}
}

- (void)switchToOtherScreen
{
if ([_windows count] == 1) {
return;
}

UIWindow *willBeKeyWindow = [self nonKeyWindow];

[[willBeKeyWindow spaceController] viewScreenWillBecomeActive];

[willBeKeyWindow makeKeyAndVisible];
}

- (void)moveCurrentShellToOtherScreen
{
if ([_windows count] == 1) {
return;
}

SpaceController *keySpaceCtrl = [[self keyWindow] spaceController];
SpaceController *nonKeySpaceCtrl = [[self nonKeyWindow] spaceController];

[nonKeySpaceCtrl moveCurrentShellFromSpaceController:keySpaceCtrl];
}


@end
2 changes: 1 addition & 1 deletion Blink/SmartKeys/SmartKeys.xib
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="SmartKeys">
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="SmartKeysController">
<connections>
<outlet property="view" destination="i5M-Pr-FkT" id="ucO-u4-ccI"/>
</connections>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ extern NSString *const SpecialCursorKeyEnd;
extern NSString *const SpecialCursorKeyPgUp;
extern NSString *const SpecialCursorKeyPgDown;

@interface SmartKeys : UIViewController <SmartKeysDelegate>
@interface SmartKeysController : UIViewController <SmartKeysDelegate>

@property(nonatomic, weak) id< UIKeyInput > textInputDelegate;
@property(strong, nonatomic) SmartKeysView *view;
Expand Down
Loading

0 comments on commit 046a393

Please sign in to comment.