Skip to content

Commit 105ec35

Browse files
committed
'dev'->'master'
2 parents 4fd5cbd + 48c56ff commit 105ec35

23 files changed

+582
-314
lines changed

NdnCon copy-Info.plist

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@
1717
<key>CFBundlePackageType</key>
1818
<string>APPL</string>
1919
<key>CFBundleShortVersionString</key>
20-
<string>0.6.10</string>
20+
<string>0.7.2</string>
2121
<key>CFBundleSignature</key>
2222
<string>????</string>
2323
<key>CFBundleVersion</key>
24-
<string>27</string>
24+
<string>32</string>
2525
<key>LSApplicationCategoryType</key>
2626
<string>public.app-category.video</string>
2727
<key>LSMinimumSystemVersion</key>

ndncon/AppDelegate.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
#import "MASPreferencesWindowController.h"
1414
#import "NCPreferencesController.h"
1515

16+
extern NSString* const kNCDaemonConnectionStatusUpdate;
17+
1618
@interface AppDelegate : NSObject
1719
<NSApplicationDelegate, SUUpdaterDelegate, BITHockeyManagerDelegate>
1820

@@ -24,8 +26,11 @@
2426

2527
@property (nonatomic, strong) MASPreferencesWindowController* preferencesWindowController;
2628
@property (nonatomic, readonly) NCPreferencesController *preferences;
29+
@property (nonatomic) BOOL isConnected;
30+
@property (nonatomic) BOOL isPublishing;
2731

2832
- (IBAction)saveAction:(id)sender;
2933
- (BOOL)commitManagedContext;
34+
-(void)initConnection;
3035

3136
@end

ndncon/AppDelegate.mm

Lines changed: 87 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
// Copyright 2013-2015 Regents of the University of California.
77
//
88

9+
#include <signal.h>
10+
911
#import "AppDelegate.h"
1012

1113
#import "NCNdnRtcLibraryController.h"
@@ -21,7 +23,14 @@
2123
#import "NSDictionary+NCAdditions.h"
2224
#import "NSArray+NCAdditions.h"
2325
#import "NSString+NCAdditions.h"
26+
#import "NCFaceSingleton.h"
27+
28+
NSString* const kNCDaemonConnectionStatusUpdate = @"kNCDaemonConnectionStatusUpdate";
2429

30+
//******************************************************************************
31+
void signalHandler(int signal);
32+
33+
//******************************************************************************
2534
@interface AppDelegate()
2635

2736
@property (weak) IBOutlet SUUpdater *sparkleUpdater;
@@ -36,6 +45,8 @@ @implementation AppDelegate
3645

3746
+(void)initialize
3847
{
48+
signal(SIGPIPE, signalHandler);
49+
3950
[NCPreferencesController sharedInstanceWithDefaultsFile:@"settings"];
4051
}
4152

@@ -80,10 +91,20 @@ - (void)applicationDidFinishLaunching:(NSNotification *)aNotification
8091
[self setupAutoFetch];
8192
[self setupAutoPublishParams];
8293

83-
[[NCNdnRtcLibraryController sharedInstance] startSession];
84-
[NCChatLibraryController sharedInstance];
85-
[NCUserDiscoveryController sharedInstance];
86-
[NCChatroomDiscoveryController sharedInstance];
94+
[self initConnection];
95+
[[NCUserDiscoveryController sharedInstance]
96+
addObserver:self
97+
forKeyPaths:NSStringFromSelector(@selector(isInitialized)), nil];
98+
[[NCChatroomDiscoveryController sharedInstance]
99+
addObserver:self
100+
forKeyPaths:NSStringFromSelector(@selector(isInitialized)), nil];
101+
[self subscribeForNotificationsAndSelectors:
102+
NCLocalSessionStatusUpdateNotification, @selector(onLocalSessionUpdate:),
103+
kNCFetchedStreamsAddedNotification, @selector(onFetchingActivityChanged:),
104+
kNCFetchedStreamsRemovedNotification, @selector(onFetchingActivityChanged:),
105+
kNCFetchedUserAddedNotification, @selector(onFetchingActivityChanged:),
106+
kNCFetchedUserRemovedNotification, @selector(onFetchingActivityChanged:),
107+
nil];
87108

88109
[self setupAutoPublishStreams];
89110
}
@@ -287,7 +308,57 @@ -(BOOL)commitManagedContext
287308
return YES;
288309
}
289310

311+
-(BOOL)isConnected
312+
{
313+
return [NCUserDiscoveryController sharedInstance].isInitialized &&
314+
[NCChatroomDiscoveryController sharedInstance].isInitialized &&
315+
[NCNdnRtcLibraryController sharedInstance].sessionStatus != SessionStatusOffline;
316+
}
317+
318+
-(BOOL)hasActivity
319+
{
320+
return ([NCNdnRtcLibraryController sharedInstance].sessionStatus == SessionStatusOnlinePublishing) ||
321+
([NCStreamingController sharedInstance].allFetchedStreams.count > 0);
322+
}
323+
290324
//******************************************************************************
325+
-(void)initConnection
326+
{
327+
[[NCFaceSingleton sharedInstance] startProcessingEvents];
328+
[[NCNdnRtcLibraryController sharedInstance] startSession];
329+
[NCChatLibraryController sharedInstance];
330+
[NCUserDiscoveryController sharedInstance];
331+
[NCChatroomDiscoveryController sharedInstance];
332+
}
333+
334+
-(void)observeValueForKeyPath:(NSString *)keyPath
335+
ofObject:(id)object
336+
change:(NSDictionary<NSString *,id> *)change
337+
context:(void *)context
338+
{
339+
if ([keyPath isEqualToString:NSStringFromSelector(@selector(isInitialized))])
340+
{
341+
[self willChangeValueForKey:NSStringFromSelector(@selector(isConnected))];
342+
[self didChangeValueForKey:NSStringFromSelector(@selector(isConnected))];
343+
[self notifyNowWithNotificationName:kNCDaemonConnectionStatusUpdate
344+
andUserInfo:nil];
345+
}
346+
}
347+
348+
-(void)onLocalSessionUpdate:(NSNotification*)notification
349+
{
350+
[self willChangeValueForKey:NSStringFromSelector(@selector(isConnected))];
351+
[self didChangeValueForKey:NSStringFromSelector(@selector(isConnected))];
352+
[self willChangeValueForKey:NSStringFromSelector(@selector(hasActivity))];
353+
[self didChangeValueForKey:NSStringFromSelector(@selector(hasActivity))];
354+
}
355+
356+
-(void)onFetchingActivityChanged:(NSNotification*)notification
357+
{
358+
[self willChangeValueForKey:NSStringFromSelector(@selector(hasActivity))];
359+
[self didChangeValueForKey:NSStringFromSelector(@selector(hasActivity))];
360+
}
361+
291362
-(void)cleanup
292363
{
293364
[[NCStreamingController sharedInstance] stopPublishingStreams:[[NCStreamingController sharedInstance] allPublishedStreams]];
@@ -444,3 +515,15 @@ -(NSString*)userNameForHockeyManager:(BITHockeyManager *)hockeyManager
444515

445516
@end
446517

518+
//******************************************************************************
519+
void signalHandler(int signal)
520+
{
521+
switch (signal) {
522+
case SIGPIPE:
523+
NSLog(@"SIGPIPE caught!!!");
524+
break;
525+
default:
526+
break;
527+
}
528+
}
529+

ndncon/Base.lproj/MainMenu.xib

Lines changed: 41 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2-
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="8191" systemVersion="14F27" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
2+
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="9059" systemVersion="14F1021" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
33
<dependencies>
44
<deployment identifier="macosx"/>
5-
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="8191"/>
5+
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="9059"/>
66
</dependencies>
77
<objects>
88
<customObject id="-2" userLabel="File's Owner" customClass="NSApplication">
@@ -430,7 +430,7 @@ CA
430430
</textFieldCell>
431431
</textField>
432432
<button toolTip="Video-only filter" translatesAutoresizingMaskIntoConstraints="NO" id="6Vb-38-b3f" customClass="NCToggleButton">
433-
<rect key="frame" x="310" y="5" width="22" height="22"/>
433+
<rect key="frame" x="320" y="5" width="22" height="22"/>
434434
<constraints>
435435
<constraint firstAttribute="height" constant="22" id="Gei-ix-1zh"/>
436436
<constraint firstAttribute="width" constant="22" id="duo-iG-rif"/>
@@ -450,7 +450,7 @@ CA
450450
</connections>
451451
</button>
452452
<button toolTip="Audio-only filter" translatesAutoresizingMaskIntoConstraints="NO" id="jyZ-Jj-6ff" customClass="NCToggleButton">
453-
<rect key="frame" x="284" y="5" width="22" height="22"/>
453+
<rect key="frame" x="294" y="5" width="22" height="22"/>
454454
<constraints>
455455
<constraint firstAttribute="height" constant="22" id="VJR-gx-WIu"/>
456456
<constraint firstAttribute="width" constant="22" id="VNh-jd-OJj"/>
@@ -733,13 +733,39 @@ CA
733733
</scroller>
734734
</scrollView>
735735
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="2Bb-xE-Nje">
736-
<rect key="frame" x="164" y="9" width="114" height="14"/>
736+
<rect key="frame" x="174" y="9" width="114" height="14"/>
737737
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="media streams filters" id="j0m-QO-wf7">
738738
<font key="font" metaFont="smallSystem"/>
739739
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
740740
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
741741
</textFieldCell>
742742
</textField>
743+
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="uYw-oU-Ztw">
744+
<rect key="frame" x="26" y="9" width="120" height="14"/>
745+
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="no connection to NFD" id="rW7-kP-vf5">
746+
<font key="font" metaFont="smallSystem"/>
747+
<color key="textColor" red="1" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
748+
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
749+
</textFieldCell>
750+
<connections>
751+
<binding destination="Voe-Tx-rLC" name="hidden" keyPath="self.isConnected" id="Ow8-jK-ZJL"/>
752+
</connections>
753+
</textField>
754+
<button toolTip="Reconnect" verticalHuggingPriority="750" allowsExpansionToolTips="YES" translatesAutoresizingMaskIntoConstraints="NO" id="IJB-AK-lER">
755+
<rect key="frame" x="8" y="9" width="16" height="16"/>
756+
<constraints>
757+
<constraint firstAttribute="height" constant="16" id="9Fs-Z7-ANG"/>
758+
<constraint firstAttribute="width" constant="16" id="oRc-Kh-9mz"/>
759+
</constraints>
760+
<buttonCell key="cell" type="squareTextured" bezelStyle="texturedSquare" image="NSRefreshFreestandingTemplate" imagePosition="only" alignment="center" imageScaling="proportionallyDown" inset="2" id="4kh-cL-Jt5">
761+
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
762+
<font key="font" metaFont="system"/>
763+
</buttonCell>
764+
<connections>
765+
<action selector="reconnect:" target="zW4-r6-vjY" id="L4W-ud-8Xu"/>
766+
<binding destination="Voe-Tx-rLC" name="hidden" keyPath="self.isConnected" id="F4k-hc-FUL"/>
767+
</connections>
768+
</button>
743769
</subviews>
744770
<constraints>
745771
<constraint firstItem="j1t-fK-0dB" firstAttribute="leading" secondItem="Reg-Bg-aTn" secondAttribute="leading" id="1OY-yS-LZg"/>
@@ -750,19 +776,23 @@ CA
750776
<constraint firstItem="PMo-X4-yCs" firstAttribute="top" secondItem="zIx-sC-YAp" secondAttribute="bottom" constant="1" id="KOd-3Q-1Ot"/>
751777
<constraint firstAttribute="bottom" secondItem="GPi-Zz-25f" secondAttribute="bottom" constant="31" id="KfX-Ah-efd"/>
752778
<constraint firstAttribute="trailing" secondItem="j1t-fK-0dB" secondAttribute="trailing" id="L0e-fM-may"/>
779+
<constraint firstItem="IJB-AK-lER" firstAttribute="leading" secondItem="Reg-Bg-aTn" secondAttribute="leading" constant="8" id="ORE-3g-02u"/>
753780
<constraint firstItem="PMo-X4-yCs" firstAttribute="leading" secondItem="Reg-Bg-aTn" secondAttribute="leading" id="Sdm-PA-Sg7"/>
754781
<constraint firstItem="zIx-sC-YAp" firstAttribute="leading" secondItem="Reg-Bg-aTn" secondAttribute="leading" constant="8" id="VJE-eh-alD"/>
755782
<constraint firstItem="jyZ-Jj-6ff" firstAttribute="leading" secondItem="2Bb-xE-Nje" secondAttribute="trailing" constant="8" id="VPH-yp-g3c"/>
756783
<constraint firstAttribute="trailing" secondItem="PMo-X4-yCs" secondAttribute="trailing" id="XKW-J4-ve2"/>
757784
<constraint firstItem="jyZ-Jj-6ff" firstAttribute="centerY" secondItem="2Bb-xE-Nje" secondAttribute="centerY" id="XhX-QK-vtF"/>
758-
<constraint firstAttribute="trailing" secondItem="6Vb-38-b3f" secondAttribute="trailing" constant="18" id="dJx-6P-Gpu"/>
785+
<constraint firstItem="2Bb-xE-Nje" firstAttribute="baseline" secondItem="uYw-oU-Ztw" secondAttribute="baseline" id="a5Q-Pa-We4"/>
786+
<constraint firstAttribute="trailing" secondItem="6Vb-38-b3f" secondAttribute="trailing" constant="8" id="dJx-6P-Gpu"/>
759787
<constraint firstItem="GPi-Zz-25f" firstAttribute="leading" secondItem="Reg-Bg-aTn" secondAttribute="leading" id="eVM-Tq-YJY"/>
760788
<constraint firstItem="6Vb-38-b3f" firstAttribute="centerY" secondItem="jyZ-Jj-6ff" secondAttribute="centerY" id="mXS-fL-fb0"/>
761789
<constraint firstAttribute="trailing" secondItem="BdF-lK-Exv" secondAttribute="trailing" id="mo7-zo-oid"/>
790+
<constraint firstItem="IJB-AK-lER" firstAttribute="baseline" secondItem="uYw-oU-Ztw" secondAttribute="baseline" id="o4x-7v-krG"/>
762791
<constraint firstItem="zIx-sC-YAp" firstAttribute="top" secondItem="j1t-fK-0dB" secondAttribute="bottom" constant="5" id="raC-gL-ubc"/>
763792
<constraint firstAttribute="bottom" secondItem="6Vb-38-b3f" secondAttribute="bottom" constant="5" id="vLf-5b-91W"/>
764793
<constraint firstItem="j1t-fK-0dB" firstAttribute="top" secondItem="BdF-lK-Exv" secondAttribute="bottom" id="y8L-WT-3ea"/>
765794
<constraint firstItem="BdF-lK-Exv" firstAttribute="leading" secondItem="Reg-Bg-aTn" secondAttribute="leading" id="yrB-Bh-kc7"/>
795+
<constraint firstItem="uYw-oU-Ztw" firstAttribute="leading" secondItem="IJB-AK-lER" secondAttribute="trailing" constant="4" id="zBC-ga-kHk"/>
766796
</constraints>
767797
</view>
768798
<contentBorderThickness minY="32"/>
@@ -957,7 +987,7 @@ CA
957987
<scrollView ambiguous="YES" misplaced="YES" borderType="none" horizontalLineScroll="10" horizontalPageScroll="10" verticalLineScroll="10" verticalPageScroll="10" hasVerticalScroller="NO" usesPredominantAxisScrolling="NO" verticalScrollElasticity="none" scrollerKnobStyle="light" translatesAutoresizingMaskIntoConstraints="NO" id="dlc-cC-15F" userLabel="Local Streams View">
958988
<rect key="frame" x="50" y="630" width="564" height="100"/>
959989
<clipView key="contentView" ambiguous="YES" copiesOnScroll="NO" id="qhT-Do-cAZ" customClass="NCClipView">
960-
<rect key="frame" x="1" y="1" width="548" height="118"/>
990+
<rect key="frame" x="0.0" y="0.0" width="564" height="100"/>
961991
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
962992
<subviews>
963993
<view fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="UyR-Bn-0WQ">
@@ -985,7 +1015,7 @@ CA
9851015
<scrollView misplaced="YES" borderType="none" horizontalLineScroll="10" horizontalPageScroll="10" verticalLineScroll="10" verticalPageScroll="10" hasVerticalScroller="NO" usesPredominantAxisScrolling="NO" verticalScrollElasticity="none" scrollerKnobStyle="light" translatesAutoresizingMaskIntoConstraints="NO" id="1Ys-n5-d4v" userLabel="Remote Streams View">
9861016
<rect key="frame" x="0.0" y="0.0" width="614" height="100"/>
9871017
<clipView key="contentView" copiesOnScroll="NO" id="O4N-0f-WHh" customClass="NCClipView">
988-
<rect key="frame" x="1" y="1" width="548" height="118"/>
1018+
<rect key="frame" x="0.0" y="0.0" width="614" height="100"/>
9891019
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
9901020
<subviews>
9911021
<view fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="EIq-nB-q8S">
@@ -1114,7 +1144,7 @@ CA
11141144
<customView translatesAutoresizingMaskIntoConstraints="NO" id="Ccd-Oc-lWv">
11151145
<rect key="frame" x="0.0" y="0.0" width="177" height="100"/>
11161146
<subviews>
1117-
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" setsMaxLayoutWidthAtFirstLayout="YES" translatesAutoresizingMaskIntoConstraints="NO" id="fMC-HZ-SA4">
1147+
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" misplaced="YES" setsMaxLayoutWidthAtFirstLayout="YES" translatesAutoresizingMaskIntoConstraints="NO" id="fMC-HZ-SA4">
11181148
<rect key="frame" x="18" y="62" width="141" height="28"/>
11191149
<textFieldCell key="cell" sendsActionOnEndEditing="YES" alignment="center" title="you are not publishing any media" id="IbM-1S-EEo">
11201150
<font key="font" metaFont="smallSystem"/>
@@ -1205,7 +1235,7 @@ CA
12051235
<customView translatesAutoresizingMaskIntoConstraints="NO" id="TEV-7R-2BF">
12061236
<rect key="frame" x="0.0" y="0.0" width="177" height="100"/>
12071237
<subviews>
1208-
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" setsMaxLayoutWidthAtFirstLayout="YES" translatesAutoresizingMaskIntoConstraints="NO" id="IX1-EF-18I">
1238+
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" misplaced="YES" setsMaxLayoutWidthAtFirstLayout="YES" translatesAutoresizingMaskIntoConstraints="NO" id="IX1-EF-18I">
12091239
<rect key="frame" x="18" y="36" width="141" height="28"/>
12101240
<textFieldCell key="cell" sendsActionOnEndEditing="YES" alignment="center" title="you are not fetching any media" id="9Yq-to-gEo">
12111241
<font key="font" metaFont="smallSystem"/>
@@ -1225,6 +1255,7 @@ CA
12251255
</customView>
12261256
</objects>
12271257
<resources>
1258+
<image name="NSRefreshFreestandingTemplate" width="14" height="14"/>
12281259
<image name="fetch" width="60" height="60"/>
12291260
<image name="pref" width="60" height="60"/>
12301261
<image name="publish" width="60" height="60"/>

0 commit comments

Comments
 (0)