Skip to content
This repository was archived by the owner on Mar 30, 2024. It is now read-only.

Commit fca45e2

Browse files
committed
Swift Socket Connection for #22
1 parent ba4b508 commit fca45e2

File tree

10 files changed

+59
-15
lines changed

10 files changed

+59
-15
lines changed
Binary file not shown.
Binary file not shown.

core/platform/macos/TaskTimeTerminate.app/Contents/_CodeSignature/CodeResources

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,23 +10,23 @@
1010
</data>
1111
<key>Resources/Assets.car</key>
1212
<data>
13-
USyc/2OHjTBZyQWRKG+XMIlswAs=
13+
NqSbRDKAe2gjIPiemphKziLpAXQ=
1414
</data>
1515
<key>Resources/Base.lproj/Main.storyboardc/Info.plist</key>
1616
<data>
17-
wf0SVcas3ijylW8vaO+CdnZIGHg=
17+
RafxB6qU+Odaby0XvmSlUa8Z6A4=
1818
</data>
1919
<key>Resources/Base.lproj/Main.storyboardc/MainMenu.nib</key>
2020
<data>
21-
Hy5Ru8NWsHG+z9C8WpAxSp/xzaQ=
21+
ZYTxJGp9ZsyXlCNRsIY89FTgVAM=
2222
</data>
2323
<key>Resources/Base.lproj/Main.storyboardc/NSWindowController-B8D-0N-5wS.nib</key>
2424
<data>
25-
b/nqzxxGVvygPfK8Il5vEmDCEjQ=
25+
cwO+iJcTGJQEutjsXw6cCDy5zvc=
2626
</data>
2727
<key>Resources/Base.lproj/Main.storyboardc/XfG-lQ-9wD-view-m2S-Jp-Qdl.nib</key>
2828
<data>
29-
vbd3cIvGdJ9Fs59txJbJjC/m+F8=
29+
NHFF8I5lOcVTU/kVQwXlL9QYBmw=
3030
</data>
3131
<key>Resources/en.lproj/Main.strings</key>
3232
<dict>
@@ -51,35 +51,35 @@
5151
<dict>
5252
<key>hash2</key>
5353
<data>
54-
tbp+KnbuCRIs2C389AG1oudl+jTjrZSXFHaItZHKDsQ=
54+
uohpzbMIyEg/M+xkn/TasudjpvwnjbNcWbl/2/Zw6sY=
5555
</data>
5656
</dict>
5757
<key>Resources/Base.lproj/Main.storyboardc/Info.plist</key>
5858
<dict>
5959
<key>hash2</key>
6060
<data>
61-
roE//AZ7Gp9fViyQUZ6iPEgKqCMC3Mhem7CscxMQCXc=
61+
rDiBGlHqCAuhAov8xDSAZLg0hlsPmeZcN+oxb1zWtNc=
6262
</data>
6363
</dict>
6464
<key>Resources/Base.lproj/Main.storyboardc/MainMenu.nib</key>
6565
<dict>
6666
<key>hash2</key>
6767
<data>
68-
+AOsP4Hj/nWFwQYAZLGQ0Trngx40Th38CUUwqLEnRCA=
68+
bZVJaHe0HDd52cByL63CEYDma4rj94tMp9w7ZBL0SGU=
6969
</data>
7070
</dict>
7171
<key>Resources/Base.lproj/Main.storyboardc/NSWindowController-B8D-0N-5wS.nib</key>
7272
<dict>
7373
<key>hash2</key>
7474
<data>
75-
tNBAOEOvRFIcm+nTdK4gNINO1qRPNmOYCEGMhzuK79A=
75+
Ah/SV6/jcqGECOehzeMybK1AsKs4trYhpEDCNQG+nIg=
7676
</data>
7777
</dict>
7878
<key>Resources/Base.lproj/Main.storyboardc/XfG-lQ-9wD-view-m2S-Jp-Qdl.nib</key>
7979
<dict>
8080
<key>hash2</key>
8181
<data>
82-
AYBRFOPlLnT/sbYEIPeMlXMcQVvxBFBgKveB1alIfbA=
82+
4q8zGHJaq4ezrjCBsFCOHfY28RjBHn5Mvq93wDZCHL8=
8383
</data>
8484
</dict>
8585
<key>Resources/en.lproj/Main.strings</key>

core/platform/macos/TaskTimeTerminate/TaskTimeTerminate.xcodeproj/project.pbxproj

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,15 @@
33
archiveVersion = 1;
44
classes = {
55
};
6-
objectVersion = 50;
6+
objectVersion = 52;
77
objects = {
88

99
/* Begin PBXBuildFile section */
1010
BB1AE83D2428013300138B34 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB1AE83C2428013300138B34 /* AppDelegate.swift */; };
1111
BB1AE83F2428013300138B34 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB1AE83E2428013300138B34 /* ViewController.swift */; };
1212
BB1AE8412428013E00138B34 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = BB1AE8402428013E00138B34 /* Assets.xcassets */; };
1313
BB1AE8442428013E00138B34 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = BB1AE8422428013E00138B34 /* Main.storyboard */; };
14+
BB3550F8251158D000FC9846 /* Socket in Frameworks */ = {isa = PBXBuildFile; productRef = BB3550F7251158D000FC9846 /* Socket */; };
1415
/* End PBXBuildFile section */
1516

1617
/* Begin PBXFileReference section */
@@ -29,6 +30,7 @@
2930
isa = PBXFrameworksBuildPhase;
3031
buildActionMask = 2147483647;
3132
files = (
33+
BB3550F8251158D000FC9846 /* Socket in Frameworks */,
3234
);
3335
runOnlyForDeploymentPostprocessing = 0;
3436
};
@@ -80,6 +82,9 @@
8082
dependencies = (
8183
);
8284
name = TaskTimeTerminate;
85+
packageProductDependencies = (
86+
BB3550F7251158D000FC9846 /* Socket */,
87+
);
8388
productName = TaskTimeTerminate;
8489
productReference = BB1AE8392428013300138B34 /* TaskTimeTerminate.app */;
8590
productType = "com.apple.product-type.application";
@@ -108,6 +113,9 @@
108113
Base,
109114
);
110115
mainGroup = BB1AE8302428013200138B34;
116+
packageReferences = (
117+
BB3550F6251158D000FC9846 /* XCRemoteSwiftPackageReference "BlueSocket" */,
118+
);
111119
productRefGroup = BB1AE83A2428013300138B34 /* Products */;
112120
projectDirPath = "";
113121
projectRoot = "";
@@ -292,7 +300,7 @@
292300
isa = XCBuildConfiguration;
293301
buildSettings = {
294302
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
295-
CODE_SIGN_ENTITLEMENTS = TaskTimeTerminate/TaskTimeTerminate.entitlements;
303+
CODE_SIGN_ENTITLEMENTS = TaskTimeTerminate/TaskTimeTerminateRelease.entitlements;
296304
CODE_SIGN_IDENTITY = "-";
297305
CODE_SIGN_STYLE = Manual;
298306
COMBINE_HIDPI_IMAGES = YES;
@@ -331,6 +339,25 @@
331339
defaultConfigurationName = Release;
332340
};
333341
/* End XCConfigurationList section */
342+
343+
/* Begin XCRemoteSwiftPackageReference section */
344+
BB3550F6251158D000FC9846 /* XCRemoteSwiftPackageReference "BlueSocket" */ = {
345+
isa = XCRemoteSwiftPackageReference;
346+
repositoryURL = "https://github.com/IBM-Swift/BlueSocket.git";
347+
requirement = {
348+
kind = upToNextMajorVersion;
349+
minimumVersion = 1.0.52;
350+
};
351+
};
352+
/* End XCRemoteSwiftPackageReference section */
353+
354+
/* Begin XCSwiftPackageProductDependency section */
355+
BB3550F7251158D000FC9846 /* Socket */ = {
356+
isa = XCSwiftPackageProductDependency;
357+
package = BB3550F6251158D000FC9846 /* XCRemoteSwiftPackageReference "BlueSocket" */;
358+
productName = Socket;
359+
};
360+
/* End XCSwiftPackageProductDependency section */
334361
};
335362
rootObject = BB1AE8312428013300138B34 /* Project object */;
336363
}

core/platform/macos/TaskTimeTerminate/TaskTimeTerminate/TaskTimeTerminate.entitlements

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<plist version="1.0">
44
<dict>
55
<key>com.apple.security.app-sandbox</key>
6-
<true/>
6+
<false/>
77
<key>com.apple.security.files.user-selected.read-only</key>
88
<true/>
99
</dict>

core/platform/macos/TaskTimeTerminate/TaskTimeTerminate/ViewController.swift

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
//
88

99
import Cocoa
10+
import Socket
1011

1112
extension FileHandle : TextOutputStream {
1213
public func write(_ string: String) {
@@ -29,9 +30,11 @@ class ViewController: NSViewController {
2930
* Enter Handling on Textareas
3031
*/
3132
@IBAction func taskFieldEnter(_ sender: NSTextField) {
33+
print(getCompletions(prefix: nameInput.stringValue));
34+
/*
3235
if( timeInput.stringValue != "" && nameInput.stringValue != "" ){
3336
startClicked(nil);
34-
}
37+
}*/
3538
}
3639
@IBAction func timeFieldEnter(_ sender: NSTextField) {
3740
if( timeInput.stringValue != "" ){
@@ -63,6 +66,20 @@ class ViewController: NSViewController {
6366
NSApplication.shared.terminate(self);
6467
}
6568

69+
/**
70+
* Autocomplete
71+
*/
72+
func getCompletions(prefix : String) -> [String] {
73+
let msg = prefix + "\n";
74+
75+
var socket = try? Socket.create(family: .unix, type: .stream, proto: .tcp);
76+
try? socket?.connect( to: "/private/tmp/TaskTimeTerminateAutocomplete.sock" );
77+
try? socket?.setBlocking(mode: true);
78+
try? socket?.write(from: msg);
79+
let reponse = try? socket?.readString();
80+
return reponse?.trimmingCharacters(in: .whitespacesAndNewlines).components(separatedBy: ",") ?? []
81+
}
82+
6683
/**
6784
* On load setup, load args
6885
*/
@@ -96,9 +113,9 @@ class ViewController: NSViewController {
96113
categoryDropdown.selectItem(withTitle: lastCat);
97114

98115
nameInput.placeholderString = lastTask;
99-
100116
}
101117

118+
102119
/**
103120
* Stay in foreground
104121
*/

0 commit comments

Comments
 (0)