Skip to content
This repository has been archived by the owner on Mar 9, 2022. It is now read-only.

Commit

Permalink
Added HTTP listener. Updated UI for 4” display and iOS 7
Browse files Browse the repository at this point in the history
  • Loading branch information
snej committed Oct 8, 2013
1 parent dfe7427 commit e979641
Show file tree
Hide file tree
Showing 8 changed files with 164 additions and 535 deletions.
264 changes: 50 additions & 214 deletions App/Application.xib
@@ -1,214 +1,50 @@
<?xml version="1.0" encoding="UTF-8"?>
<archive type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="8.00">
<data>
<int key="IBDocument.SystemTarget">1280</int>
<string key="IBDocument.SystemVersion">11C57</string>
<string key="IBDocument.InterfaceBuilderVersion">1934</string>
<string key="IBDocument.AppKitVersion">1138.21</string>
<string key="IBDocument.HIToolboxVersion">567.00</string>
<object class="NSMutableDictionary" key="IBDocument.PluginVersions">
<string key="NS.key.0">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="NS.object.0">931</string>
</object>
<array key="IBDocument.IntegratedClassDependencies">
<string>IBProxyObject</string>
<string>IBUINavigationController</string>
<string>IBUIViewController</string>
<string>IBUICustomObject</string>
<string>IBUIWindow</string>
<string>IBUINavigationBar</string>
<string>IBUINavigationItem</string>
</array>
<array key="IBDocument.PluginDependencies">
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
</array>
<object class="NSMutableDictionary" key="IBDocument.Metadata">
<string key="NS.key.0">PluginDependencyRecalculationVersion</string>
<integer value="1" key="NS.object.0"/>
</object>
<array class="NSMutableArray" key="IBDocument.RootObjects" id="1000">
<object class="IBProxyObject" id="841351856">
<string key="IBProxiedObjectIdentifier">IBFilesOwner</string>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
</object>
<object class="IBProxyObject" id="450319686">
<string key="IBProxiedObjectIdentifier">IBFirstResponder</string>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
</object>
<object class="IBUICustomObject" id="987256611">
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
</object>
<object class="IBUIWindow" id="380026005">
<reference key="NSNextResponder"/>
<int key="NSvFlags">1316</int>
<object class="NSPSMatrix" key="NSFrameMatrix"/>
<string key="NSFrameSize">{320, 480}</string>
<reference key="NSSuperview"/>
<reference key="NSNextKeyView"/>
<bool key="IBUIOpaque">NO</bool>
<bool key="IBUIClearsContextBeforeDrawing">NO</bool>
<object class="IBUISimulatedStatusBarMetrics" key="IBUISimulatedStatusBarMetrics"/>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
<bool key="IBUIResizesToFullScreen">YES</bool>
</object>
<object class="IBUINavigationController" id="871102733">
<object class="IBUISimulatedNavigationBarMetrics" key="IBUISimulatedTopBarMetrics">
<int key="IBUIBarStyle">2</int>
<bool key="IBUIPrompted">NO</bool>
</object>
<object class="IBUISimulatedStatusBarMetrics" key="IBUISimulatedStatusBarMetrics">
<int key="IBUIStatusBarStyle">1</int>
</object>
<object class="IBUISimulatedOrientationMetrics" key="IBUISimulatedOrientationMetrics">
<int key="IBUIInterfaceOrientation">1</int>
<int key="interfaceOrientation">1</int>
</object>
<bool key="IBUIDefinesPresentationContext">YES</bool>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
<bool key="IBUIHorizontal">NO</bool>
<object class="IBUINavigationBar" key="IBUINavigationBar" id="757990008">
<nil key="NSNextResponder"/>
<int key="NSvFlags">256</int>
<string key="NSFrame">{{0, -44}, {0, 44}}</string>
<string key="NSReuseIdentifierKey">_NS:451</string>
<bool key="IBUIOpaque">NO</bool>
<bool key="IBUIClipsSubviews">YES</bool>
<bool key="IBUIMultipleTouchEnabled">YES</bool>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
<int key="IBUIBarStyle">2</int>
</object>
<array class="NSMutableArray" key="IBUIViewControllers">
<object class="IBUIViewController" id="537979404">
<string key="IBUITitle">Worker Bee Tests</string>
<object class="IBUINavigationItem" key="IBUINavigationItem" id="653625909">
<string key="IBUITitle">Couchbase Mobile Tests</string>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
</object>
<reference key="IBUIParentViewController" ref="871102733"/>
<string key="IBUINibName">TestListController</string>
<object class="IBUISimulatedOrientationMetrics" key="IBUISimulatedOrientationMetrics">
<int key="IBUIInterfaceOrientation">1</int>
<int key="interfaceOrientation">1</int>
</object>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
<bool key="IBUIHorizontal">NO</bool>
</object>
</array>
</object>
</array>
<object class="IBObjectContainer" key="IBDocument.Objects">
<array class="NSMutableArray" key="connectionRecords">
<object class="IBConnectionRecord">
<object class="IBCocoaTouchOutletConnection" key="connection">
<string key="label">delegate</string>
<reference key="source" ref="841351856"/>
<reference key="destination" ref="987256611"/>
</object>
<int key="connectionID">5</int>
</object>
<object class="IBConnectionRecord">
<object class="IBCocoaTouchOutletConnection" key="connection">
<string key="label">window</string>
<reference key="source" ref="987256611"/>
<reference key="destination" ref="380026005"/>
</object>
<int key="connectionID">11</int>
</object>
<object class="IBConnectionRecord">
<object class="IBCocoaTouchOutletConnection" key="connection">
<string key="label">navController</string>
<reference key="source" ref="987256611"/>
<reference key="destination" ref="871102733"/>
</object>
<int key="connectionID">12</int>
</object>
</array>
<object class="IBMutableOrderedSet" key="objectRecords">
<array key="orderedObjects">
<object class="IBObjectRecord">
<int key="objectID">0</int>
<array key="object" id="0"/>
<reference key="children" ref="1000"/>
<nil key="parent"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">2</int>
<reference key="object" ref="380026005"/>
<array class="NSMutableArray" key="children"/>
<reference key="parent" ref="0"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">-1</int>
<reference key="object" ref="841351856"/>
<reference key="parent" ref="0"/>
<string key="objectName">File's Owner</string>
</object>
<object class="IBObjectRecord">
<int key="objectID">4</int>
<reference key="object" ref="987256611"/>
<reference key="parent" ref="0"/>
<string key="objectName">App Delegate</string>
</object>
<object class="IBObjectRecord">
<int key="objectID">-2</int>
<reference key="object" ref="450319686"/>
<reference key="parent" ref="0"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">7</int>
<reference key="object" ref="871102733"/>
<array class="NSMutableArray" key="children">
<reference ref="757990008"/>
<reference ref="537979404"/>
</array>
<reference key="parent" ref="0"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">8</int>
<reference key="object" ref="757990008"/>
<reference key="parent" ref="871102733"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">9</int>
<reference key="object" ref="537979404"/>
<array class="NSMutableArray" key="children">
<reference ref="653625909"/>
</array>
<reference key="parent" ref="871102733"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">10</int>
<reference key="object" ref="653625909"/>
<reference key="parent" ref="537979404"/>
</object>
</array>
</object>
<dictionary class="NSMutableDictionary" key="flattenedProperties">
<string key="-1.CustomClassName">UIApplication</string>
<string key="-1.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="-2.CustomClassName">UIResponder</string>
<string key="-2.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="10.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<dictionary class="NSMutableDictionary" key="2.IBAttributePlaceholdersKey"/>
<string key="2.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="4.CustomClassName">AppDelegate</string>
<string key="4.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="7.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="8.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="9.CustomClassName">TestListController</string>
<string key="9.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
</dictionary>
<dictionary class="NSMutableDictionary" key="unlocalizedProperties"/>
<nil key="activeLocalization"/>
<dictionary class="NSMutableDictionary" key="localizations"/>
<nil key="sourceID"/>
<int key="maxID">12</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes"/>
<int key="IBDocument.localizationMode">0</int>
<string key="IBDocument.TargetRuntimeIdentifier">IBCocoaTouchFramework</string>
<bool key="IBDocument.PluginDeclaredDependenciesTrackSystemTargetVersion">YES</bool>
<int key="IBDocument.defaultPropertyAccessControl">3</int>
<string key="IBCocoaTouchPluginVersion">931</string>
</data>
</archive>
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="4511" systemVersion="13A598" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none">
<dependencies>
<deployment defaultVersion="1536" identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="3745"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="UIApplication">
<connections>
<outlet property="delegate" destination="4" id="5"/>
</connections>
</placeholder>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<customObject id="4" userLabel="App Delegate" customClass="AppDelegate">
<connections>
<outlet property="navController" destination="7" id="12"/>
<outlet property="window" destination="2" id="11"/>
</connections>
</customObject>
<window opaque="NO" clearsContextBeforeDrawing="NO" contentMode="scaleToFill" id="2">
<rect key="frame" x="0.0" y="0.0" width="320" height="480"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<simulatedStatusBarMetrics key="simulatedStatusBarMetrics"/>
</window>
<navigationController definesPresentationContext="YES" id="7">
<extendedEdge key="edgesForExtendedLayout"/>
<simulatedStatusBarMetrics key="simulatedStatusBarMetrics" statusBarStyle="lightContent"/>
<simulatedNavigationBarMetrics key="simulatedTopBarMetrics" barStyle="black" translucent="NO" prompted="NO"/>
<nil key="simulatedBottomBarMetrics"/>
<simulatedOrientationMetrics key="simulatedOrientationMetrics"/>
<nil key="simulatedDestinationMetrics"/>
<navigationBar key="navigationBar" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" translucent="NO" id="8">
<rect key="frame" x="0.0" y="-44" width="0.0" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<color key="barTintColor" white="0.66420506386861311" alpha="1" colorSpace="calibratedWhite"/>
</navigationBar>
<viewControllers>
<viewController title="Worker Bee Tests" nibName="TestListController" id="9" customClass="TestListController">
<extendedEdge key="edgesForExtendedLayout"/>
<navigationItem key="navigationItem" title="Couchbase Lite Tests" id="10"/>
<nil key="simulatedStatusBarMetrics"/>
<nil key="simulatedTopBarMetrics"/>
<nil key="simulatedBottomBarMetrics"/>
<simulatedOrientationMetrics key="simulatedOrientationMetrics"/>
<nil key="simulatedDestinationMetrics"/>
</viewController>
</viewControllers>
</navigationController>
</objects>
</document>
2 changes: 2 additions & 0 deletions App/Info.plist
Expand Up @@ -48,6 +48,8 @@
<string>Application</string>
<key>UIFileSharingEnabled</key>
<true/>
<key>UILaunchImageFile</key>
<string>Default</string>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
Expand Down
1 change: 1 addition & 0 deletions App/TestListController.h
Expand Up @@ -14,6 +14,7 @@
@property(nonatomic, strong) IBOutlet UITableView *tableView;
@property(nonatomic, strong) IBOutlet UILabel *savedRunCountLabel;
@property(nonatomic, strong) IBOutlet UIButton *uploadButton;
@property(nonatomic, strong) IBOutlet UILabel* listenerInfo;

- (IBAction) uploadSavedRuns:(id)sender;

Expand Down
29 changes: 28 additions & 1 deletion App/TestListController.m
Expand Up @@ -11,12 +11,16 @@
#import "BeeTest.h"
#import "BeeTestController.h"
#import "SavedTestRun.h"
#import <CouchbaseLiteListener/CBLListener.h>


// Set this to a URL to a database to which saved tests should be uploaded.
//#define kUpstreamSavedTestDatabaseURL @"http://example.com/workerbee-tests"


#define kListenerPort 59840


@interface TestListController ()
- (void) updateSavedTestUI;
@end
Expand All @@ -25,6 +29,7 @@ - (void) updateSavedTestUI;
@implementation TestListController
{
NSMutableDictionary* _activeTestByClass;
CBLListener* _listener;
}

static UIColor* kBGColor;
Expand Down Expand Up @@ -70,6 +75,8 @@ - (void)viewDidLoad
[_savedRunCountLabel setHidden: YES];
[_uploadButton setHidden: YES];

[self startListener];

// Uncomment the following line to preserve selection between presentations.
// self.clearsSelectionOnViewWillAppear = NO;

Expand Down Expand Up @@ -132,6 +139,22 @@ - (void) updateSavedTestUI {
}


- (void) startListener {
CBLManager* manager = [CBLManager sharedInstance];
_listener = [[CBLListener alloc] initWithManager: manager port: kListenerPort];
[_listener setBonjourName: @"" type: @"_cbl._tcp."];
NSString* message;
NSError* error;
if ([_listener start: &error]) {
message = [NSString stringWithFormat: @"Listener starting on port %d...", _listener.port];
[_listener addObserver: self forKeyPath: @"bonjourURL" options: 0 context: NULL];
} else{ //FIX: Show alert
message = [NSString stringWithFormat: @"Listener failed to start: %@", error.localizedDescription];
}
_listenerInfo.text = message;
}


#pragma mark - Table view data source

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
Expand Down Expand Up @@ -201,7 +224,11 @@ - (void) observeValueForKeyPath:(NSString *)keyPath
change:(NSDictionary *)change
context:(void *)context
{
if ([object isKindOfClass: [BeeTest class]]) {
if (object == _listener) {
_listenerInfo.text = [NSString stringWithFormat: @"Listener available at %@",
_listener.bonjourURL];

} else if ([object isKindOfClass: [BeeTest class]]) {
// Test "running" state changed:
BOOL running = [object running];
Class testClass = [object class];
Expand Down

0 comments on commit e979641

Please sign in to comment.