Skip to content

Commit

Permalink
Subscription and broadcast support
Browse files Browse the repository at this point in the history
  • Loading branch information
stevedekorte committed Aug 17, 2014
1 parent cfd0d5f commit b6bc674
Show file tree
Hide file tree
Showing 13 changed files with 136 additions and 34 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,82 +5,82 @@
<key>IDESourceControlProjectFavoriteDictionaryKey</key>
<false/>
<key>IDESourceControlProjectIdentifier</key>
<string>F71B5391-E790-4138-B7F1-B9B41F7A200C</string>
<string>9FFDFD47-8665-4613-8229-726D69CACADE</string>
<key>IDESourceControlProjectName</key>
<string>Bitmessage</string>
<key>IDESourceControlProjectOriginsDictionary</key>
<dict>
<key>19328783-A5C1-4CDE-995D-0D1FFB1A1D80</key>
<string>ssh://github.com/stevedekorte/BitmessageKit.git</string>
<key>2A90CA7E-9D87-4514-B988-98953B02D3AF</key>
<string>ssh://github.com/stevedekorte/Bitpost.git</string>
<key>445485AD-966A-41E4-9C60-9E43A90AA216</key>
<string>ssh://github.com/stevedekorte/FoundationCategoriesKit.git</string>
<key>4E864411-9983-4B80-A176-C4CBD5ED423C</key>
<string>ssh://github.com/stevedekorte/NavNodeKit.git</string>
<key>9BAB094A-4042-4A73-A1FE-76999AEC9AD8</key>
<string>ssh://github.com/stevedekorte/NavKit.git</string>
<key>06DD255D-4D18-4390-BFD0-D6C1582E7F54</key>
<string>https://github.com/stevedekorte/FoundationCategoriesKit.git</string>
<key>14C2F55A-B6E5-426E-966C-9781ECFD470E</key>
<string>https://github.com/stevedekorte/NavNodeKit.git</string>
<key>AD9E840A-7CC7-4D00-BE5D-4B3E83169EA2</key>
<string>https://github.com/stevedekorte/NavKit.git</string>
<key>D02D8626-54C9-453D-81A8-997C09AE4A44</key>
<string>https://github.com/stevedekorte/BitmessageClient.git</string>
<key>F1007B74-D60E-4B07-9046-7FAECA8C213E</key>
<string>https://github.com/stevedekorte/BitmessageKit.git</string>
</dict>
<key>IDESourceControlProjectPath</key>
<string>Bitmessage.xcodeproj/project.xcworkspace</string>
<key>IDESourceControlProjectRelativeInstallPathDictionary</key>
<dict>
<key>19328783-A5C1-4CDE-995D-0D1FFB1A1D80</key>
<string>../../../BitmessageKit</string>
<key>2A90CA7E-9D87-4514-B988-98953B02D3AF</key>
<string>../..</string>
<key>445485AD-966A-41E4-9C60-9E43A90AA216</key>
<key>06DD255D-4D18-4390-BFD0-D6C1582E7F54</key>
<string>../../../FoundationCategoriesKit</string>
<key>4E864411-9983-4B80-A176-C4CBD5ED423C</key>
<key>14C2F55A-B6E5-426E-966C-9781ECFD470E</key>
<string>../../../NavNodeKit</string>
<key>9BAB094A-4042-4A73-A1FE-76999AEC9AD8</key>
<key>AD9E840A-7CC7-4D00-BE5D-4B3E83169EA2</key>
<string>../../../NavKit</string>
<key>D02D8626-54C9-453D-81A8-997C09AE4A44</key>
<string>../..</string>
<key>F1007B74-D60E-4B07-9046-7FAECA8C213E</key>
<string>../../../BitmessageKit</string>
</dict>
<key>IDESourceControlProjectURL</key>
<string>ssh://github.com/stevedekorte/Bitpost.git</string>
<string>https://github.com/stevedekorte/BitmessageClient.git</string>
<key>IDESourceControlProjectVersion</key>
<integer>110</integer>
<key>IDESourceControlProjectWCCIdentifier</key>
<string>2A90CA7E-9D87-4514-B988-98953B02D3AF</string>
<string>D02D8626-54C9-453D-81A8-997C09AE4A44</string>
<key>IDESourceControlProjectWCConfigurations</key>
<array>
<dict>
<key>IDESourceControlRepositoryExtensionIdentifierKey</key>
<string>public.vcs.git</string>
<key>IDESourceControlWCCIdentifierKey</key>
<string>19328783-A5C1-4CDE-995D-0D1FFB1A1D80</string>
<string>D02D8626-54C9-453D-81A8-997C09AE4A44</string>
<key>IDESourceControlWCCName</key>
<string>BitmessageKit</string>
<string>Bitmessage</string>
</dict>
<dict>
<key>IDESourceControlRepositoryExtensionIdentifierKey</key>
<string>public.vcs.git</string>
<key>IDESourceControlWCCIdentifierKey</key>
<string>2A90CA7E-9D87-4514-B988-98953B02D3AF</string>
<string>F1007B74-D60E-4B07-9046-7FAECA8C213E</string>
<key>IDESourceControlWCCName</key>
<string>Bitpost</string>
<string>BitmessageKit</string>
</dict>
<dict>
<key>IDESourceControlRepositoryExtensionIdentifierKey</key>
<string>public.vcs.git</string>
<key>IDESourceControlWCCIdentifierKey</key>
<string>445485AD-966A-41E4-9C60-9E43A90AA216</string>
<string>06DD255D-4D18-4390-BFD0-D6C1582E7F54</string>
<key>IDESourceControlWCCName</key>
<string>FoundationCategoriesKit</string>
</dict>
<dict>
<key>IDESourceControlRepositoryExtensionIdentifierKey</key>
<string>public.vcs.git</string>
<key>IDESourceControlWCCIdentifierKey</key>
<string>9BAB094A-4042-4A73-A1FE-76999AEC9AD8</string>
<string>AD9E840A-7CC7-4D00-BE5D-4B3E83169EA2</string>
<key>IDESourceControlWCCName</key>
<string>NavKit</string>
</dict>
<dict>
<key>IDESourceControlRepositoryExtensionIdentifierKey</key>
<string>public.vcs.git</string>
<key>IDESourceControlWCCIdentifierKey</key>
<string>4E864411-9983-4B80-A176-C4CBD5ED423C</string>
<string>14C2F55A-B6E5-426E-966C-9781ECFD470E</string>
<key>IDESourceControlWCCName</key>
<string>NavNodeKit</string>
</dict>
Expand Down
29 changes: 29 additions & 0 deletions Bitmessage/Classes/Browser/Controllers/BMAboutNode.m
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,35 @@ - (void)setup
package.nodeSubtitle = @"Karl Moskowski";
[others addChild:package];
}


{
NavInfoNode *help = [[NavInfoNode alloc] init];
help.nodeTitle = @"Help";
//what.nodeSubtitle = @"Designer";
[about addChild:help];

{
NavInfoNode *how = [[NavInfoNode alloc] init];
how.nodeTitle = @"How does this work?";
//what.nodeSubtitle = @"Designer";
[help addChild:how];
}

{
NavInfoNode *how = [[NavInfoNode alloc] init];
how.nodeTitle = @"How to protect your privacy";
//what.nodeSubtitle = @"Designer";
[help addChild:how];
}

{
NavInfoNode *how = [[NavInfoNode alloc] init];
how.nodeTitle = @"How to contribute";
//what.nodeSubtitle = @"Designer";
[help addChild:how];
}
}
}

@end
1 change: 1 addition & 0 deletions Bitmessage/Classes/Browser/Controllers/BMAppController.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@
@interface BMAppController : NavAppController

- (IBAction)compose:(id)sender; // just for menu shortcut action
- (IBAction)composeBroadcast:(id)sender; // just for menu shortcut action

@end
5 changes: 5 additions & 0 deletions Bitmessage/Classes/Browser/Controllers/BMAppController.m
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,11 @@ - (IBAction)compose:(id)sender // hack - consolidate into BMDraftController
[(BMClient *)self.rootNode compose];
}

- (IBAction)composeBroadcast:(id)sender // hack - consolidate into BMDraftController
{
[(BMClient *)self.rootNode composeBroadcast];
}

- (void)composeFromURL:(NSAppleEventDescriptor *)event
{
NSURL *url = [NSURL URLWithString:[[event paramDescriptorForKeyword:keyDirectObject] stringValue]];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,16 @@
@property (strong, nonatomic) BMAddressCompletor *fromCompletor;
@property (strong, nonatomic) BMAddressCompletor *toCompletor;

@property (assign, nonatomic) BOOL isBroadcast;

+ (BMDraftController *)openNewDraft;
+ (BMDraftController *)openNewBroadcast;

- (IBAction)send:(id)sender;

- (void)setCursorForReply;
- (void)setCursorOnTo;
- (void)setCursorOnBody;

- (void)open;

Expand Down
33 changes: 30 additions & 3 deletions Bitmessage/Classes/Browser/Controllers/Draft/BMDraftController.m
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,17 @@ + (BMDraftController *)openNewDraft
return draft;
}

+ (BMDraftController *)openNewBroadcast
{
BMDraftController *draft = [[BMDraftController alloc] initWithNibName:@"Compose" bundle:nil];
[[[self class] drafts] addObject:draft];
[draft setIsBroadcast:YES];
[draft view]; // to force lazy load
[draft open];
return draft;
}


- (void)placeWindow
{
NSRect f = [[NSApplication sharedApplication] mainWindow].frame;
Expand Down Expand Up @@ -117,6 +128,19 @@ - (void)setupViewPositions

[self.subject setThemePath:@"draft/field"];
[self.subjectLabel setThemePath:@"draft/fieldTitle"];

[self.from setNextKeyView:self.to];
[self.to setNextKeyView:self.subject];
[self.subject setNextKeyView:self.bodyText];

if (self.isBroadcast)
{
[self.to setStringValue:@"[Broadcast]"];
[self.to setEditable:NO];
[self.to setSelectable:NO];
[self.to setThemePath:@"draft/field-uneditable"];
[self.from setNextKeyView:self.subject];
}
}

- (void)setupHighlightColors
Expand Down Expand Up @@ -249,9 +273,6 @@ - (void)updateSendButton

- (void)open
{
[self.from setNextKeyView:self.to];
[self.to setNextKeyView:self.subject];
[self.subject setNextKeyView:self.bodyText];
[self setAddressesToLabels];
[self placeWindow];
[self updateSendButton];
Expand Down Expand Up @@ -285,6 +306,12 @@ - (void)setCursorOnTo
[self.to becomeFirstResponder];
}

- (void)setCursorOnBody
{
[self setCursorForReply];
}


// --- delegate ---

- (BOOL)hasValidAddresses
Expand Down
2 changes: 2 additions & 0 deletions Bitmessage/Classes/Browser/Inspectors/BMClient+NodeView.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
@interface BMClient (NodeView)

- (void)compose;
- (void)composeBroadcast;

- (void)composeWithAddress:(NSString *)address;
- (void)export;
- (void)import;
Expand Down
8 changes: 8 additions & 0 deletions Bitmessage/Classes/Browser/Inspectors/BMClient+NodeView.m
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,14 @@ - (void)compose
[draft open];
}

- (void)composeBroadcast
{
BMDraftController *draft = [BMDraftController openNewBroadcast];
[draft setDefaultFrom];
[draft setCursorOnBody];
[draft open];
}

- (void)composeWithAddress:(NSString *)address
{
BMDraftController *draft = [BMDraftController openNewDraft];
Expand Down
3 changes: 0 additions & 3 deletions Bitmessage/Classes/Browser/Inspectors/Message/BMMessageView.m
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
#import <BitMessageKit/BitMessageKit.h>
#import <NavKit/NavKit.h>


@implementation BMMessageView

- (id)initWithFrame:(NSRect)frameRect
Expand Down Expand Up @@ -43,7 +42,6 @@ - (NSDictionary *)infoAttributes
return [NavTheme.sharedNavTheme attributesDictForPath:@"message/subtitle"];
}


- (NSDictionary *)bodyAttributes
{
NSDictionary *themeDict = [NavTheme.sharedNavTheme attributesDictForPath:@"message/body"];
Expand All @@ -57,7 +55,6 @@ - (NSDictionary *)linkAttributes
return [NavTheme.sharedNavTheme attributesDictForPath:@"message/link"];
}


- (NSMutableAttributedString *)linkForAddress:(NSString *)address
{
NSMutableDictionary *att = [NSMutableDictionary dictionaryWithDictionary:[self infoAttributes]];
Expand Down
8 changes: 8 additions & 0 deletions Bitmessage/resources/themes/themes.json
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,14 @@
"align": "left",
},

"field-uneditable" :
{
"fontName" : "Open Sans",
"fontSize" : 13,
"color" : "#8F8F8F",
"align": "left",
},

"fieldError" :
{
"fontName" : "Open Sans Bold",
Expand Down
7 changes: 6 additions & 1 deletion Bitmessage/resources/xibs/MainMenu.xib
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="5056" systemVersion="13D65" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none">
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="5056" systemVersion="13E28" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="5056"/>
</dependencies>
Expand Down Expand Up @@ -74,6 +74,11 @@
<action selector="compose:" target="494" id="0AL-JO-QUA"/>
</connections>
</menuItem>
<menuItem title="New Broadcast" keyEquivalent="m" id="ONg-S6-Tej">
<connections>
<action selector="composeBroadcast:" target="-1" id="y4e-dS-eOc"/>
</connections>
</menuItem>
<menuItem title="Open…" keyEquivalent="o" id="72">
<connections>
<action selector="openDocument:" target="-1" id="374"/>
Expand Down
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,20 @@ For more info see:

* https://bitmessage.org

Direct Messages, Channels and Subscriptions (as I understand them)
-------------------------------------------------------

- signed with sender's private key

Direct Message:
- encrypted with recipients public key

Channel:
- encrypted with Channel's private key

Subscription (aka Broadcast):
- encrypted with Subscription's public key
-

Tech details
-----------------
Expand Down
2 changes: 2 additions & 0 deletions Todo.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ One shot ids for sending messages to channels (send and then delete id)
- [UX] make links in messages clickable but with security alert panel
- [feature] support for bitmessage:// links from browsers, etc

- change "Today" to "2:34pm Today" etc

==============

- [cleanup] move app support files for BitmessageKit framework to their own folder
Expand Down

0 comments on commit b6bc674

Please sign in to comment.