Skip to content

Commit 4e8dabd

Browse files
authored
Merge pull request #5 from tidepool-org/Task/LOOP-929/plugin
Task/LOOP-929/plugins
2 parents 511f438 + 28a928f commit 4e8dabd

File tree

5 files changed

+268
-0
lines changed

5 files changed

+268
-0
lines changed

ShareClient.xcodeproj/project.pbxproj

Lines changed: 152 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,9 @@
4444
A9ED4D9E225EB4D30080DEBA /* ShareClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 432B0E8B1CDFC3C50045347B /* ShareClient.h */; settings = {ATTRIBUTES = (Public, ); }; };
4545
A9ED4DA0225EB4D30080DEBA /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = 43AB5125213315D300B3D58D /* Localizable.strings */; };
4646
A9ED4DAF225EB93A0080DEBA /* HealthKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A9ED4DAE225EB9390080DEBA /* HealthKit.framework */; };
47+
B40BF26623ABD4E700A43CEE /* ShareClientPlugin.swift in Sources */ = {isa = PBXBuildFile; fileRef = B40BF26523ABD4E700A43CEE /* ShareClientPlugin.swift */; };
48+
B40BF26823ABD55200A43CEE /* OSLog.swift in Sources */ = {isa = PBXBuildFile; fileRef = B40BF26723ABD55200A43CEE /* OSLog.swift */; };
49+
B40BF26923ABD55200A43CEE /* OSLog.swift in Sources */ = {isa = PBXBuildFile; fileRef = B40BF26723ABD55200A43CEE /* OSLog.swift */; };
4750
C17D3CC62184CC26003458C8 /* LoopKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 43A8EC7B210E661400A81379 /* LoopKit.framework */; };
4851
/* End PBXBuildFile section */
4952

@@ -62,6 +65,13 @@
6265
remoteGlobalIDString = 432B0E871CDFC3C50045347B;
6366
remoteInfo = ShareClient;
6467
};
68+
B40BF26A23ABD5E100A43CEE /* PBXContainerItemProxy */ = {
69+
isa = PBXContainerItemProxy;
70+
containerPortal = 432B0E7F1CDFC3C50045347B /* Project object */;
71+
proxyType = 1;
72+
remoteGlobalIDString = 43A8EC81210E664300A81379;
73+
remoteInfo = ShareClientUI;
74+
};
6575
/* End PBXContainerItemProxy section */
6676

6777
/* Begin PBXFileReference section */
@@ -112,6 +122,11 @@
112122
43C418AE1CE0488900405B6A /* ShareClient.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ShareClient.swift; sourceTree = "<group>"; };
113123
A9ED4DA4225EB4D30080DEBA /* ShareClient.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = ShareClient.framework; sourceTree = BUILT_PRODUCTS_DIR; };
114124
A9ED4DAE225EB9390080DEBA /* HealthKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = HealthKit.framework; path = Platforms/WatchOS.platform/Developer/SDKs/WatchOS.sdk/System/Library/Frameworks/HealthKit.framework; sourceTree = DEVELOPER_DIR; };
125+
B40BF25E23ABD47400A43CEE /* ShareClientPlugin.loopplugin */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = ShareClientPlugin.loopplugin; sourceTree = BUILT_PRODUCTS_DIR; };
126+
B40BF26023ABD47400A43CEE /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
127+
B40BF26423ABD4E600A43CEE /* ShareClientPlugin-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "ShareClientPlugin-Bridging-Header.h"; sourceTree = "<group>"; };
128+
B40BF26523ABD4E700A43CEE /* ShareClientPlugin.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ShareClientPlugin.swift; sourceTree = "<group>"; };
129+
B40BF26723ABD55200A43CEE /* OSLog.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OSLog.swift; sourceTree = "<group>"; };
115130
/* End PBXFileReference section */
116131

117132
/* Begin PBXFrameworksBuildPhase section */
@@ -153,6 +168,13 @@
153168
);
154169
runOnlyForDeploymentPostprocessing = 0;
155170
};
171+
B40BF25B23ABD47400A43CEE /* Frameworks */ = {
172+
isa = PBXFrameworksBuildPhase;
173+
buildActionMask = 2147483647;
174+
files = (
175+
);
176+
runOnlyForDeploymentPostprocessing = 0;
177+
};
156178
/* End PBXFrameworksBuildPhase section */
157179

158180
/* Begin PBXGroup section */
@@ -163,6 +185,7 @@
163185
432B0E8A1CDFC3C50045347B /* ShareClient */,
164186
432B0E961CDFC3C50045347B /* ShareClientTests */,
165187
43A8EC83210E664300A81379 /* ShareClientUI */,
188+
B40BF25F23ABD47400A43CEE /* ShareClientPlugin */,
166189
432B0E891CDFC3C50045347B /* Products */,
167190
43A8EC7A210E661300A81379 /* Frameworks */,
168191
);
@@ -175,6 +198,7 @@
175198
432B0E921CDFC3C50045347B /* ShareClientTests.xctest */,
176199
43A8EC82210E664300A81379 /* ShareClientUI.framework */,
177200
A9ED4DA4225EB4D30080DEBA /* ShareClient.framework */,
201+
B40BF25E23ABD47400A43CEE /* ShareClientPlugin.loopplugin */,
178202
);
179203
name = Products;
180204
sourceTree = "<group>";
@@ -191,6 +215,7 @@
191215
4325E9D0210E6A3D00969CE5 /* TimeInterval.swift */,
192216
432B0E8B1CDFC3C50045347B /* ShareClient.h */,
193217
432B0E8D1CDFC3C50045347B /* Info.plist */,
218+
B40BF26723ABD55200A43CEE /* OSLog.swift */,
194219
);
195220
path = ShareClient;
196221
sourceTree = "<group>";
@@ -239,6 +264,16 @@
239264
path = Common;
240265
sourceTree = "<group>";
241266
};
267+
B40BF25F23ABD47400A43CEE /* ShareClientPlugin */ = {
268+
isa = PBXGroup;
269+
children = (
270+
B40BF26023ABD47400A43CEE /* Info.plist */,
271+
B40BF26523ABD4E700A43CEE /* ShareClientPlugin.swift */,
272+
B40BF26423ABD4E600A43CEE /* ShareClientPlugin-Bridging-Header.h */,
273+
);
274+
path = ShareClientPlugin;
275+
sourceTree = "<group>";
276+
};
242277
/* End PBXGroup section */
243278

244279
/* Begin PBXHeadersBuildPhase section */
@@ -343,6 +378,24 @@
343378
productReference = A9ED4DA4225EB4D30080DEBA /* ShareClient.framework */;
344379
productType = "com.apple.product-type.framework";
345380
};
381+
B40BF25D23ABD47400A43CEE /* ShareClientPlugin */ = {
382+
isa = PBXNativeTarget;
383+
buildConfigurationList = B40BF26323ABD47400A43CEE /* Build configuration list for PBXNativeTarget "ShareClientPlugin" */;
384+
buildPhases = (
385+
B40BF25A23ABD47400A43CEE /* Sources */,
386+
B40BF25B23ABD47400A43CEE /* Frameworks */,
387+
B40BF25C23ABD47400A43CEE /* Resources */,
388+
);
389+
buildRules = (
390+
);
391+
dependencies = (
392+
B40BF26B23ABD5E100A43CEE /* PBXTargetDependency */,
393+
);
394+
name = ShareClientPlugin;
395+
productName = ShareClientPlugin;
396+
productReference = B40BF25E23ABD47400A43CEE /* ShareClientPlugin.loopplugin */;
397+
productType = "com.apple.product-type.bundle";
398+
};
346399
/* End PBXNativeTarget section */
347400

348401
/* Begin PBXProject section */
@@ -366,6 +419,11 @@
366419
LastSwiftMigration = 1000;
367420
ProvisioningStyle = Automatic;
368421
};
422+
B40BF25D23ABD47400A43CEE = {
423+
CreatedOnToolsVersion = 11.0;
424+
LastSwiftMigration = 1100;
425+
ProvisioningStyle = Automatic;
426+
};
369427
};
370428
};
371429
buildConfigurationList = 432B0E821CDFC3C50045347B /* Build configuration list for PBXProject "ShareClient" */;
@@ -394,6 +452,7 @@
394452
A9ED4D91225EB4D30080DEBA /* ShareClient-watchOS */,
395453
432B0E911CDFC3C50045347B /* ShareClientTests */,
396454
43A8EC81210E664300A81379 /* ShareClientUI */,
455+
B40BF25D23ABD47400A43CEE /* ShareClientPlugin */,
397456
);
398457
};
399458
/* End PBXProject section */
@@ -430,6 +489,13 @@
430489
);
431490
runOnlyForDeploymentPostprocessing = 0;
432491
};
492+
B40BF25C23ABD47400A43CEE /* Resources */ = {
493+
isa = PBXResourcesBuildPhase;
494+
buildActionMask = 2147483647;
495+
files = (
496+
);
497+
runOnlyForDeploymentPostprocessing = 0;
498+
};
433499
/* End PBXResourcesBuildPhase section */
434500

435501
/* Begin PBXShellScriptBuildPhase section */
@@ -462,6 +528,7 @@
462528
files = (
463529
4325E9CF210E6A0A00969CE5 /* HKUnit.swift in Sources */,
464530
4325E9D1210E6A3D00969CE5 /* TimeInterval.swift in Sources */,
531+
B40BF26823ABD55200A43CEE /* OSLog.swift in Sources */,
465532
43A8EC9D210E68CE00A81379 /* ShareClientManager.swift in Sources */,
466533
43AB51362133177800B3D58D /* LocalizedString.swift in Sources */,
467534
43A8EC9B210E68BA00A81379 /* ShareGlucose+GlucoseKit.swift in Sources */,
@@ -506,6 +573,15 @@
506573
);
507574
runOnlyForDeploymentPostprocessing = 0;
508575
};
576+
B40BF25A23ABD47400A43CEE /* Sources */ = {
577+
isa = PBXSourcesBuildPhase;
578+
buildActionMask = 2147483647;
579+
files = (
580+
B40BF26923ABD55200A43CEE /* OSLog.swift in Sources */,
581+
B40BF26623ABD4E700A43CEE /* ShareClientPlugin.swift in Sources */,
582+
);
583+
runOnlyForDeploymentPostprocessing = 0;
584+
};
509585
/* End PBXSourcesBuildPhase section */
510586

511587
/* Begin PBXTargetDependency section */
@@ -519,6 +595,11 @@
519595
target = 432B0E871CDFC3C50045347B /* ShareClient */;
520596
targetProxy = A9E521F6225E949400EDDEF2 /* PBXContainerItemProxy */;
521597
};
598+
B40BF26B23ABD5E100A43CEE /* PBXTargetDependency */ = {
599+
isa = PBXTargetDependency;
600+
target = 43A8EC81210E664300A81379 /* ShareClientUI */;
601+
targetProxy = B40BF26A23ABD5E100A43CEE /* PBXContainerItemProxy */;
602+
};
522603
/* End PBXTargetDependency section */
523604

524605
/* Begin PBXVariantGroup section */
@@ -886,6 +967,68 @@
886967
};
887968
name = Release;
888969
};
970+
B40BF26123ABD47400A43CEE /* Debug */ = {
971+
isa = XCBuildConfiguration;
972+
buildSettings = {
973+
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
974+
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
975+
CLANG_ENABLE_MODULES = YES;
976+
CLANG_ENABLE_OBJC_WEAK = YES;
977+
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
978+
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
979+
CODE_SIGN_STYLE = Automatic;
980+
COMBINE_HIDPI_IMAGES = YES;
981+
GCC_C_LANGUAGE_STANDARD = gnu11;
982+
INFOPLIST_FILE = ShareClientPlugin/Info.plist;
983+
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Bundles";
984+
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
985+
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
986+
MACH_O_TYPE = mh_dylib;
987+
MACOSX_DEPLOYMENT_TARGET = 10.15;
988+
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
989+
MTL_FAST_MATH = YES;
990+
PRODUCT_BUNDLE_IDENTIFIER = org.tidepool.ShareClientPlugin;
991+
PRODUCT_NAME = "$(TARGET_NAME)";
992+
SDKROOT = iphoneos;
993+
SKIP_INSTALL = YES;
994+
SWIFT_OBJC_BRIDGING_HEADER = "ShareClientPlugin/ShareClientPlugin-Bridging-Header.h";
995+
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
996+
SWIFT_VERSION = 5.0;
997+
TARGETED_DEVICE_FAMILY = 1;
998+
WRAPPER_EXTENSION = loopplugin;
999+
};
1000+
name = Debug;
1001+
};
1002+
B40BF26223ABD47400A43CEE /* Release */ = {
1003+
isa = XCBuildConfiguration;
1004+
buildSettings = {
1005+
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
1006+
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
1007+
CLANG_ENABLE_MODULES = YES;
1008+
CLANG_ENABLE_OBJC_WEAK = YES;
1009+
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
1010+
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
1011+
CODE_SIGN_STYLE = Automatic;
1012+
COMBINE_HIDPI_IMAGES = YES;
1013+
GCC_C_LANGUAGE_STANDARD = gnu11;
1014+
INFOPLIST_FILE = ShareClientPlugin/Info.plist;
1015+
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Bundles";
1016+
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
1017+
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
1018+
MACH_O_TYPE = mh_dylib;
1019+
MACOSX_DEPLOYMENT_TARGET = 10.15;
1020+
MTL_FAST_MATH = YES;
1021+
PRODUCT_BUNDLE_IDENTIFIER = org.tidepool.ShareClientPlugin;
1022+
PRODUCT_NAME = "$(TARGET_NAME)";
1023+
SDKROOT = iphoneos;
1024+
SKIP_INSTALL = YES;
1025+
SWIFT_OBJC_BRIDGING_HEADER = "ShareClientPlugin/ShareClientPlugin-Bridging-Header.h";
1026+
SWIFT_VERSION = 5.0;
1027+
TARGETED_DEVICE_FAMILY = 1;
1028+
WRAPPER_EXTENSION = loopplugin;
1029+
};
1030+
name = Release;
1031+
};
8891032
/* End XCBuildConfiguration section */
8901033

8911034
/* Begin XCConfigurationList section */
@@ -934,6 +1077,15 @@
9341077
defaultConfigurationIsVisible = 0;
9351078
defaultConfigurationName = Release;
9361079
};
1080+
B40BF26323ABD47400A43CEE /* Build configuration list for PBXNativeTarget "ShareClientPlugin" */ = {
1081+
isa = XCConfigurationList;
1082+
buildConfigurations = (
1083+
B40BF26123ABD47400A43CEE /* Debug */,
1084+
B40BF26223ABD47400A43CEE /* Release */,
1085+
);
1086+
defaultConfigurationIsVisible = 0;
1087+
defaultConfigurationName = Release;
1088+
};
9371089
/* End XCConfigurationList section */
9381090
};
9391091
rootObject = 432B0E7F1CDFC3C50045347B /* Project object */;

ShareClient/OSLog.swift

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
//
2+
// OSLog.swift
3+
// ShareClient
4+
//
5+
// Created by Nathaniel Hamming on 2019-12-19.
6+
// Copyright © 2019 Mark Wilson. All rights reserved.
7+
//
8+
9+
import os.log
10+
11+
12+
extension OSLog {
13+
convenience init(category: String) {
14+
self.init(subsystem: "com.loopkit.ShareClient", category: category)
15+
}
16+
17+
func debug(_ message: StaticString, _ args: CVarArg...) {
18+
log(message, type: .debug, args)
19+
}
20+
21+
func info(_ message: StaticString, _ args: CVarArg...) {
22+
log(message, type: .info, args)
23+
}
24+
25+
func `default`(_ message: StaticString, _ args: CVarArg...) {
26+
log(message, type: .default, args)
27+
}
28+
29+
func error(_ message: StaticString, _ args: CVarArg...) {
30+
log(message, type: .error, args)
31+
}
32+
33+
private func log(_ message: StaticString, type: OSLogType, _ args: [CVarArg]) {
34+
switch args.count {
35+
case 0:
36+
os_log(message, log: self, type: type)
37+
case 1:
38+
os_log(message, log: self, type: type, args[0])
39+
case 2:
40+
os_log(message, log: self, type: type, args[0], args[1])
41+
case 3:
42+
os_log(message, log: self, type: type, args[0], args[1], args[2])
43+
case 4:
44+
os_log(message, log: self, type: type, args[0], args[1], args[2], args[3])
45+
case 5:
46+
os_log(message, log: self, type: type, args[0], args[1], args[2], args[3], args[4])
47+
default:
48+
os_log(message, log: self, type: type, args)
49+
}
50+
}
51+
}

ShareClientPlugin/Info.plist

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>CFBundleDevelopmentRegion</key>
6+
<string>$(DEVELOPMENT_LANGUAGE)</string>
7+
<key>CFBundleExecutable</key>
8+
<string>$(EXECUTABLE_NAME)</string>
9+
<key>CFBundleIdentifier</key>
10+
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
11+
<key>CFBundleInfoDictionaryVersion</key>
12+
<string>6.0</string>
13+
<key>CFBundleName</key>
14+
<string>$(PRODUCT_NAME)</string>
15+
<key>CFBundlePackageType</key>
16+
<string>FMWK</string>
17+
<key>CFBundleShortVersionString</key>
18+
<string>1.0</string>
19+
<key>CFBundleVersion</key>
20+
<string>1</string>
21+
<key>NSHumanReadableCopyright</key>
22+
<string>Copyright © 2019 Mark Wilson. All rights reserved.</string>
23+
<key>NSPrincipalClass</key>
24+
<string>ShareClientPlugin</string>
25+
<key>com.loopkit.Loop.CGMManagerDisplayName</key>
26+
<string>Dexcom Share</string>
27+
<key>com.loopkit.Loop.CGMManagerIdentifier</key>
28+
<string>ShareClient</string>
29+
</dict>
30+
</plist>
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
//
2+
// Use this file to import your target's public headers that you would like to expose to Swift.
3+
//
4+
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
//
2+
// ShareClientPlugin.swift
3+
// ShareClientPlugin
4+
//
5+
// Created by Nathaniel Hamming on 2019-12-19.
6+
// Copyright © 2019 Mark Wilson. All rights reserved.
7+
//
8+
9+
import Foundation
10+
import LoopKitUI
11+
import ShareClient
12+
import ShareClientUI
13+
import os.log
14+
15+
class ShareClientPlugin: NSObject, LoopUIPlugin {
16+
17+
private let log = OSLog(category: "ShareClientPlugin")
18+
19+
public var pumpManagerType: PumpManagerUI.Type? {
20+
return nil
21+
}
22+
23+
public var cgmManagerType: CGMManagerUI.Type? {
24+
return ShareClientManager.self
25+
}
26+
27+
override init() {
28+
super.init()
29+
log.default("ShareClientPlugin Instantiated")
30+
}
31+
}

0 commit comments

Comments
 (0)