Skip to content

Commit

Permalink
Merge branch 'develop' of https://github.com/yagiz/Bagel
Browse files Browse the repository at this point in the history
  • Loading branch information
yagiz committed Feb 27, 2019
2 parents 7f21e32 + 8f30d7c commit f491ca1
Show file tree
Hide file tree
Showing 11 changed files with 315 additions and 127 deletions.
4 changes: 4 additions & 0 deletions iOS/Bagel.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
3760A47321F1383F004D1E07 /* BagelURLConnectionInjector.m in Sources */ = {isa = PBXBuildFile; fileRef = 3760A45921F1383F004D1E07 /* BagelURLConnectionInjector.m */; };
3760A47421F1383F004D1E07 /* BagelBaseModel.h in Headers */ = {isa = PBXBuildFile; fileRef = 3760A45A21F1383F004D1E07 /* BagelBaseModel.h */; settings = {ATTRIBUTES = (Public, ); }; };
3760A47B21F13A47004D1E07 /* CocoaAsyncSocket.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3760A47A21F13A47004D1E07 /* CocoaAsyncSocket.framework */; };
51102CE2220B87290067EB63 /* BagelCarrierDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = 51102CE1220B857E0067EB63 /* BagelCarrierDelegate.h */; settings = {ATTRIBUTES = (Public, ); }; };
/* End PBXBuildFile section */

/* Begin PBXFileReference section */
Expand Down Expand Up @@ -66,6 +67,7 @@
3760A45A21F1383F004D1E07 /* BagelBaseModel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BagelBaseModel.h; sourceTree = "<group>"; };
3760A47521F13872004D1E07 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = SOURCE_ROOT; };
3760A47A21F13A47004D1E07 /* CocoaAsyncSocket.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CocoaAsyncSocket.framework; path = Carthage/Build/iOS/CocoaAsyncSocket.framework; sourceTree = SOURCE_ROOT; };
51102CE1220B857E0067EB63 /* BagelCarrierDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = BagelCarrierDelegate.h; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
Expand Down Expand Up @@ -107,6 +109,7 @@
3760A44A21F1383F004D1E07 /* BagelBaseModel.m */,
3760A45821F1383F004D1E07 /* BagelBrowser.h */,
3760A44C21F1383F004D1E07 /* BagelBrowser.m */,
51102CE1220B857E0067EB63 /* BagelCarrierDelegate.h */,
3760A44621F1383F004D1E07 /* BagelConfiguration.h */,
3760A45621F1383F004D1E07 /* BagelConfiguration.m */,
3760A44321F1383F004D1E07 /* BagelController.h */,
Expand Down Expand Up @@ -147,6 +150,7 @@
buildActionMask = 2147483647;
files = (
3760A46F21F1383F004D1E07 /* Bagel.h in Headers */,
51102CE2220B87290067EB63 /* BagelCarrierDelegate.h in Headers */,
3760A45D21F1383F004D1E07 /* BagelController.h in Headers */,
3760A47221F1383F004D1E07 /* BagelBrowser.h in Headers */,
3760A46021F1383F004D1E07 /* BagelConfiguration.h in Headers */,
Expand Down
36 changes: 36 additions & 0 deletions iOS/Source/BagelCarrierDelegate.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
//
// Copyright (c) 2018 Bagel (https://github.com/yagiz/Bagel)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.

#import "BagelRequestPacket.h"

@protocol BagelCarrierDelegate <NSObject>

@optional

/**
Called right before Bagel sends a request packet to the Mac app.
Allows your delegate to modify the packet on the fly, or abort the operation.
Return a modified request packet, or nil if you want to filter it out.
*/
- (nullable BagelRequestPacket*)bagelCarrierWillSendRequest:(nonnull BagelRequestPacket*)request;

@end
3 changes: 3 additions & 0 deletions iOS/Source/BagelConfiguration.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
// THE SOFTWARE.

#import <Foundation/Foundation.h>
#import "BagelCarrierDelegate.h"
#import "BagelProjectModel.h"
#import "BagelDeviceModel.h"
#import "BagelUtility.h"
Expand All @@ -29,6 +30,8 @@
@property (nonatomic, strong) BagelProjectModel* project;
@property (nonatomic, strong) BagelDeviceModel* device;

@property (nonatomic, weak) id<BagelCarrierDelegate> carrierDelegate;

@property (nonatomic) uint16_t netservicePort;
@property (nonatomic, strong) NSString* netserviceType;
@property (nonatomic, strong) NSString* netserviceDomain;
Expand Down
9 changes: 9 additions & 0 deletions iOS/Source/BagelController.m
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,15 @@ - (void)sendCarrier:(BagelRequestCarrier*)carrier
packet.project = self.configuration.project;
packet.device = self.configuration.device;

id<BagelCarrierDelegate> carrierDelegate = self.configuration.carrierDelegate;
if ([carrierDelegate respondsToSelector:@selector(bagelCarrierWillSendRequest:)]) {
packet = [carrierDelegate bagelCarrierWillSendRequest:packet];

if (packet == nil) {
return;
}
}

[self.browser sendPacket:packet];
}

Expand Down
30 changes: 15 additions & 15 deletions mac/Bagel/Components/Details/Details.storyboard
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
<fragment content="Test">
<attributes>
<color key="NSColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<font key="NSFont" size="13" name="DroidSansMono"/>
<font key="NSFont" metaFont="system"/>
<paragraphStyle key="NSParagraphStyle" alignment="natural" lineBreakMode="wordWrapping" baseWritingDirection="natural" tighteningFactorForTruncation="0.0"/>
</attributes>
</fragment>
Expand Down Expand Up @@ -304,7 +304,7 @@
<fragment content="sad kasd jasj dksad jkasjd jkasdjk asjkd jksadjk asjk djksajk jkdajk jkdsa jkdjk jkas djkkajsa dk">
<attributes>
<color key="NSColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<font key="NSFont" size="13" name="DroidSansMono"/>
<font key="NSFont" metaFont="system"/>
<paragraphStyle key="NSParagraphStyle" alignment="natural" lineBreakMode="wordWrapping" baseWritingDirection="natural" tighteningFactorForTruncation="0.0"/>
</attributes>
</fragment>
Expand Down Expand Up @@ -357,7 +357,7 @@
<rect key="frame" x="0.0" y="12" width="135" height="20"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES" flexibleMaxY="YES"/>
<textFieldCell key="cell" lineBreakMode="truncatingTail" selectable="YES" sendsActionOnEndEditing="YES" title="Table View Cell" id="3SO-nF-Jew">
<font key="font" size="12" name="DroidSansMono"/>
<font key="font" metaFont="cellTitle"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
Expand All @@ -384,14 +384,14 @@
<tableColumnResizingMask key="resizingMask" resizeWithTable="YES" userResizable="YES"/>
<prototypeCellViews>
<tableCellView identifier="KeyValueTableCellView" id="Ze5-kZ-luS" customClass="KeyValueTableCellView" customModule="Bagel" customModuleProvider="target">
<rect key="frame" x="138.5" y="1" width="299" height="43"/>
<rect key="frame" x="139" y="1" width="299" height="43"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="ll4-xn-DEL">
<rect key="frame" x="0.0" y="12" width="299" height="20"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES" flexibleMaxY="YES"/>
<textFieldCell key="cell" lineBreakMode="truncatingTail" selectable="YES" sendsActionOnEndEditing="YES" title="Table View Cell" id="GJr-nQ-UMJ">
<font key="font" size="12" name="DroidSansMono"/>
<font key="font" metaFont="cellTitle"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
Expand Down Expand Up @@ -636,24 +636,24 @@
<autoresizingMask key="autoresizingMask"/>
<subviews>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="mm2-yo-sQB">
<rect key="frame" x="-2" y="319" width="29" height="19"/>
<rect key="frame" x="-2" y="320" width="30" height="17"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="GET" id="S1x-ff-DRQ">
<font key="font" size="13" name="EffraMedium-Regular"/>
<font key="font" metaFont="system"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<box boxType="custom" borderWidth="0.0" cornerRadius="4" title="Box" translatesAutoresizingMaskIntoConstraints="NO" id="dHd-eX-X4k" customClass="ContentBar" customModule="Bagel" customModuleProvider="target">
<rect key="frame" x="35" y="313" width="415" height="30"/>
<rect key="frame" x="36" y="313" width="414" height="30"/>
<view key="contentView" id="N8G-6p-Gm5">
<rect key="frame" x="0.0" y="0.0" width="415" height="30"/>
<rect key="frame" x="0.0" y="0.0" width="414" height="30"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<textField focusRingType="none" verticalHuggingPriority="750" horizontalCompressionResistancePriority="749" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="Baz-mg-73Q">
<rect key="frame" x="3" y="6" width="409" height="18"/>
<rect key="frame" x="3" y="6" width="408" height="18"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES" flexibleMaxY="YES"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" sendsActionOnEndEditing="YES" focusRingType="none" alignment="left" placeholderString="" id="0y6-ve-dir">
<font key="font" size="12" name="DroidSansMono"/>
<font key="font" metaFont="cellTitle"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" white="0.0" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</textFieldCell>
Expand All @@ -676,17 +676,17 @@
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="VkR-Eh-dut">
<rect key="frame" x="8" y="24" width="43" height="14"/>
<rect key="frame" x="8" y="27" width="47" height="11"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="REQUEST" id="RAI-o2-Cnk">
<font key="font" size="9" name="Effra-Regular"/>
<font key="font" metaFont="miniSystem"/>
<color key="textColor" name="secondaryLabelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" white="0.0" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</textFieldCell>
</textField>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="CjX-gd-hJy">
<rect key="frame" x="393" y="24" width="49" height="14"/>
<rect key="frame" x="389" y="27" width="53" height="11"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="RESPONSE" id="To7-5v-rDc">
<font key="font" size="9" name="Effra-Regular"/>
<font key="font" metaFont="miniSystem"/>
<color key="textColor" name="secondaryLabelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" white="0.0" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</textFieldCell>
Expand Down
Loading

0 comments on commit f491ca1

Please sign in to comment.