forked from LoopKit/Loop
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add DashKit * Remove output from copy-files phase to force update each time * Sign plugins * Remove quotes to handle empty list * Handle spaces, deref symlink, and re-enable bitcode * Comment out testing vars * Fix version for archive builds * Move plugin's frameworks to main app frameworks directory * Fix search for plugin's frameworks * Set marketing version via config * Update copy frameworks script to dereference framework symlinks * Use copy-frameworks script for extensions and learn app * Bumping build version * Add missing script * Back out development team id changes * Scripts fixes from review * Fix capitalization * Small tweaks
- Loading branch information
Showing
118 changed files
with
417 additions
and
135 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,3 @@ | ||
/* (No Comment) */ | ||
"CFBundleDisplayName" = "Loop"; | ||
|
||
/* (No Comment) */ | ||
"CFBundleName" = "$(PRODUCT_NAME)"; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,3 @@ | ||
/* Bundle display name */ | ||
"CFBundleDisplayName" = "Loop"; | ||
|
||
/* Bundle name */ | ||
"CFBundleName" = "$(PRODUCT_NAME)"; | ||
|
File renamed without changes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
// | ||
// LoopPlugins.swift | ||
// Loop | ||
// | ||
// Created by Pete Schwamb on 7/24/19. | ||
// Copyright © 2019 LoopKit Authors. All rights reserved. | ||
// | ||
|
||
import Foundation | ||
import LoopKit | ||
import LoopKitUI | ||
|
||
class PluginManager { | ||
private let pluginBundles: [Bundle] | ||
|
||
public init() { | ||
var bundles = [Bundle]() | ||
|
||
if let pluginsURL = Bundle.main.privateFrameworksURL { | ||
do { | ||
for pluginURL in try FileManager.default.contentsOfDirectory(at: pluginsURL, includingPropertiesForKeys: nil).filter{$0.path.hasSuffix(".framework")} { | ||
if let bundle = Bundle(url: pluginURL), bundle.isLoopPlugin { | ||
print("Found loop plugin at \(pluginURL)") | ||
bundles.append(bundle) | ||
} | ||
} | ||
} catch let error { | ||
print("Error loading plugins: \(String(describing: error))") | ||
} | ||
} | ||
self.pluginBundles = bundles | ||
} | ||
|
||
func getPumpManagerTypeByIdentifier(_ identifier: String) -> PumpManagerUI.Type? { | ||
for bundle in pluginBundles { | ||
if let name = bundle.object(forInfoDictionaryKey: LoopPluginBundleKey.pumpManagerIdentifier.rawValue) as? String, name == identifier { | ||
do { | ||
try bundle.loadAndReturnError() | ||
|
||
if let principalClass = bundle.principalClass as? NSObject.Type { | ||
|
||
if let plugin = principalClass.init() as? LoopUIPlugin { | ||
return plugin.pumpManagerType | ||
} else { | ||
fatalError("PrincipalClass does not conform to LoopUIPlugin") | ||
} | ||
|
||
} else { | ||
fatalError("PrincipalClass not found") | ||
} | ||
} catch let error { | ||
print(error) | ||
} | ||
} | ||
} | ||
return nil | ||
} | ||
|
||
var availablePumpManagers: [AvailableDevice] { | ||
return pluginBundles.compactMap({ (bundle) -> AvailableDevice? in | ||
guard let title = bundle.object(forInfoDictionaryKey: LoopPluginBundleKey.pumpManagerDisplayName.rawValue) as? String, | ||
let identifier = bundle.object(forInfoDictionaryKey: LoopPluginBundleKey.pumpManagerIdentifier.rawValue) as? String else { | ||
return nil | ||
} | ||
|
||
return AvailableDevice(identifier: identifier, localizedTitle: title) | ||
|
||
}) | ||
} | ||
} | ||
|
||
|
||
extension Bundle { | ||
var isLoopPlugin: Bool { | ||
return | ||
object(forInfoDictionaryKey: LoopPluginBundleKey.pumpManagerIdentifier.rawValue) as? String != nil || | ||
object(forInfoDictionaryKey: LoopPluginBundleKey.cgmManagerIdentifier.rawValue) as? String != nil | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.