summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicoleYarroch <nicole@livio.io>2018-05-14 15:19:58 -0400
committerNicoleYarroch <nicole@livio.io>2018-05-14 15:19:58 -0400
commitc670715bf9761677210929f89355adebf186c2e6 (patch)
tree1ef2fd86a47b53c0df3f672a5391b35dd3af88c4
parentd14da1aea699b161e5454b8084f340b2f18004e5 (diff)
downloadsdl_ios-c670715bf9761677210929f89355adebf186c2e6.tar.gz
Added phone icon to the menu in the Swift and Obj-C apps
Signed-off-by: NicoleYarroch <nicole@livio.io>
-rw-r--r--SmartDeviceLink_Example/AppConstants.h2
-rw-r--r--SmartDeviceLink_Example/AppConstants.m2
-rw-r--r--SmartDeviceLink_Example/Classes/ProxyManager.m6
-rw-r--r--SmartDeviceLink_Example/Images.xcassets/microphone.imageset/Contents.json21
-rw-r--r--SmartDeviceLink_Example/Images.xcassets/microphone.imageset/microphone.pngbin0 -> 2608 bytes
-rw-r--r--SmartDeviceLink_Example/Images.xcassets/phone.imageset/Contents.json21
-rw-r--r--SmartDeviceLink_Example/Images.xcassets/phone.imageset/phone.pngbin0 -> 3434 bytes
-rw-r--r--SmartDeviceLink_Example/MenuManager.swift4
-rw-r--r--SmartDeviceLink_Example/ProxyManager.swift2
-rw-r--r--SmartDeviceLink_Example/RPCPermissionsManager.swift14
10 files changed, 60 insertions, 12 deletions
diff --git a/SmartDeviceLink_Example/AppConstants.h b/SmartDeviceLink_Example/AppConstants.h
index 58baf85d6..c38b1b70b 100644
--- a/SmartDeviceLink_Example/AppConstants.h
+++ b/SmartDeviceLink_Example/AppConstants.h
@@ -82,6 +82,8 @@ extern NSString * const WheelIconImageName;
extern NSString * const SpeakBWIconImageName;
extern NSString * const CarBWIconImageName;
extern NSString * const MenuBWIconImageName;
+extern NSString * const PhoneBWIconImageName;
+extern NSString * const MicrophoneBWIconImageName;
#pragma mark - SDL App Name in Different Languages
extern NSString * const ExampleAppNameSpanish;
diff --git a/SmartDeviceLink_Example/AppConstants.m b/SmartDeviceLink_Example/AppConstants.m
index 1eecb88e8..c9ff9ad91 100644
--- a/SmartDeviceLink_Example/AppConstants.m
+++ b/SmartDeviceLink_Example/AppConstants.m
@@ -79,6 +79,8 @@ NSString * const WheelIconImageName = @"wheel_icon";
NSString * const SpeakBWIconImageName = @"speak";
NSString * const CarBWIconImageName = @"car";
NSString * const MenuBWIconImageName = @"choice_set";
+NSString * const PhoneBWIconImageName = @"phone";
+NSString * const MicrophoneBWIconImageName = @"microphone";
#pragma mark - SDL App Name in Different Languages
NSString * const ExampleAppNameSpanish = @"SDL AplicaciĆ³n de ejemplo";
diff --git a/SmartDeviceLink_Example/Classes/ProxyManager.m b/SmartDeviceLink_Example/Classes/ProxyManager.m
index 8a8e48f44..df7ddf0de 100644
--- a/SmartDeviceLink_Example/Classes/ProxyManager.m
+++ b/SmartDeviceLink_Example/Classes/ProxyManager.m
@@ -76,6 +76,8 @@ NS_ASSUME_NONNULL_BEGIN
[weakSelf sdlex_updateProxyState:ProxyStateConnected];
[RPCPermissionsManager setupPermissionsCallbacksWithManager:weakSelf.sdlManager];
[weakSelf sdlex_showInitialData];
+
+ SDLLogD(@"SDL file manager storage: %lu mb", self.sdlManager.fileManager.bytesAvailable / 1024 / 1024);
}];
}
@@ -250,11 +252,11 @@ static UInt32 choiceSetId = 100;
[VehicleDataManager getVehicleSpeedWithManager:weakself.sdlManager];
}];
- SDLMenuCell *recordInCarMicrophoneAudio = [[SDLMenuCell alloc] initWithTitle:ACRecordInCarMicrophoneAudioMenuName icon:[SDLArtwork artworkWithImage:[UIImage imageNamed:SpeakBWIconImageName] asImageFormat:SDLArtworkImageFormatPNG] voiceCommands:@[ACRecordInCarMicrophoneAudioMenuName] handler:^(SDLTriggerSource _Nonnull triggerSource) {
+ SDLMenuCell *recordInCarMicrophoneAudio = [[SDLMenuCell alloc] initWithTitle:ACRecordInCarMicrophoneAudioMenuName icon:[SDLArtwork artworkWithImage:[UIImage imageNamed:MicrophoneBWIconImageName] asImageFormat:SDLArtworkImageFormatPNG] voiceCommands:@[ACRecordInCarMicrophoneAudioMenuName] handler:^(SDLTriggerSource _Nonnull triggerSource) {
[self.audioManager startRecording];
}];
- SDLMenuCell *dialPhoneNumber = [[SDLMenuCell alloc] initWithTitle:ACDialPhoneNumberMenuName icon:nil voiceCommands:@[ACDialPhoneNumberMenuName] handler:^(SDLTriggerSource _Nonnull triggerSource) {
+ SDLMenuCell *dialPhoneNumber = [[SDLMenuCell alloc] initWithTitle:ACDialPhoneNumberMenuName icon:[SDLArtwork artworkWithImage:[UIImage imageNamed:PhoneBWIconImageName] asImageFormat:SDLArtworkImageFormatPNG] voiceCommands:@[ACDialPhoneNumberMenuName] handler:^(SDLTriggerSource _Nonnull triggerSource) {
if (![RPCPermissionsManager isDialNumberRPCAllowedWithManager:self.sdlManager]) {
[self.sdlManager sendRequest:[AlertManager alertWithMessageAndCloseButton:@"This app does not have the required permissions to dial a number" textField2:nil]];
return;
diff --git a/SmartDeviceLink_Example/Images.xcassets/microphone.imageset/Contents.json b/SmartDeviceLink_Example/Images.xcassets/microphone.imageset/Contents.json
new file mode 100644
index 000000000..4620dff89
--- /dev/null
+++ b/SmartDeviceLink_Example/Images.xcassets/microphone.imageset/Contents.json
@@ -0,0 +1,21 @@
+{
+ "images" : [
+ {
+ "idiom" : "universal",
+ "filename" : "microphone.png",
+ "scale" : "1x"
+ },
+ {
+ "idiom" : "universal",
+ "scale" : "2x"
+ },
+ {
+ "idiom" : "universal",
+ "scale" : "3x"
+ }
+ ],
+ "info" : {
+ "version" : 1,
+ "author" : "xcode"
+ }
+} \ No newline at end of file
diff --git a/SmartDeviceLink_Example/Images.xcassets/microphone.imageset/microphone.png b/SmartDeviceLink_Example/Images.xcassets/microphone.imageset/microphone.png
new file mode 100644
index 000000000..8ccae2bcb
--- /dev/null
+++ b/SmartDeviceLink_Example/Images.xcassets/microphone.imageset/microphone.png
Binary files differ
diff --git a/SmartDeviceLink_Example/Images.xcassets/phone.imageset/Contents.json b/SmartDeviceLink_Example/Images.xcassets/phone.imageset/Contents.json
new file mode 100644
index 000000000..feb2dff17
--- /dev/null
+++ b/SmartDeviceLink_Example/Images.xcassets/phone.imageset/Contents.json
@@ -0,0 +1,21 @@
+{
+ "images" : [
+ {
+ "idiom" : "universal",
+ "filename" : "phone.png",
+ "scale" : "1x"
+ },
+ {
+ "idiom" : "universal",
+ "scale" : "2x"
+ },
+ {
+ "idiom" : "universal",
+ "scale" : "3x"
+ }
+ ],
+ "info" : {
+ "version" : 1,
+ "author" : "xcode"
+ }
+} \ No newline at end of file
diff --git a/SmartDeviceLink_Example/Images.xcassets/phone.imageset/phone.png b/SmartDeviceLink_Example/Images.xcassets/phone.imageset/phone.png
new file mode 100644
index 000000000..7c7eff383
--- /dev/null
+++ b/SmartDeviceLink_Example/Images.xcassets/phone.imageset/phone.png
Binary files differ
diff --git a/SmartDeviceLink_Example/MenuManager.swift b/SmartDeviceLink_Example/MenuManager.swift
index 57bc2d9fd..f40e49081 100644
--- a/SmartDeviceLink_Example/MenuManager.swift
+++ b/SmartDeviceLink_Example/MenuManager.swift
@@ -82,7 +82,7 @@ private extension MenuManager {
class func menuCellRecordInCarMicrophoneAudio(with manager: SDLManager) -> SDLMenuCell {
if #available(iOS 10.0, *) {
let audioManager = AudioManager(sdlManager: manager)
- return SDLMenuCell(title: ACRecordInCarMicrophoneAudioMenuName, icon: SDLArtwork(image: UIImage(named: SpeakBWIconImageName)!, persistent: true, as: .PNG), voiceCommands: [ACRecordInCarMicrophoneAudioMenuName], handler: { (triggerSource) in
+ return SDLMenuCell(title: ACRecordInCarMicrophoneAudioMenuName, icon: SDLArtwork(image: UIImage(named: MicrophoneBWIconImageName)!, persistent: true, as: .PNG), voiceCommands: [ACRecordInCarMicrophoneAudioMenuName], handler: { (triggerSource) in
audioManager.startRecording()
})
}
@@ -97,7 +97,7 @@ private extension MenuManager {
/// - Parameter manager: The SDL Manager
/// - Returns: A SDLMenuCell object
class func menuCellDialNumber(with manager: SDLManager) -> SDLMenuCell {
- return SDLMenuCell(title: ACDialPhoneNumberMenuName, icon: nil, voiceCommands: [ACDialPhoneNumberMenuName], handler: { (triggerSource) in
+ return SDLMenuCell(title: ACDialPhoneNumberMenuName, icon: SDLArtwork(image: UIImage(named: PhoneBWIconImageName)!, persistent: true, as: .PNG), voiceCommands: [ACDialPhoneNumberMenuName], handler: { (triggerSource) in
guard RPCPermissionsManager.isDialNumberRPCAllowed(with: manager) else {
manager.send(AlertManager.alertWithMessageAndCloseButton("This app does not have the required permissions to dial a number"))
return
diff --git a/SmartDeviceLink_Example/ProxyManager.swift b/SmartDeviceLink_Example/ProxyManager.swift
index 9f5e2eacb..555fdc743 100644
--- a/SmartDeviceLink_Example/ProxyManager.swift
+++ b/SmartDeviceLink_Example/ProxyManager.swift
@@ -88,7 +88,7 @@ private extension ProxyManager {
/// - Returns: A SDLLogConfiguration object
class func logConfiguration() -> SDLLogConfiguration {
let logConfig = SDLLogConfiguration.default()
- let exampleLogFileModule = SDLLogFileModule(name: "SDL Example App", files: ["ProxyManager.swift", "MenuManager.swift", "ButtonManager.swift"])
+ let exampleLogFileModule = SDLLogFileModule(name: "SDL_Swift", files: ["ProxyManager", "MenuManager", "ButtonManager", "AlertManager", "RPCPermissionsManager", "VehicleDataManager", "AudioManager"])
logConfig.modules.insert(exampleLogFileModule)
_ = logConfig.targets.insert(SDLLogTargetFile()) // Logs to file
logConfig.globalLogLevel = .debug // Filters the logs
diff --git a/SmartDeviceLink_Example/RPCPermissionsManager.swift b/SmartDeviceLink_Example/RPCPermissionsManager.swift
index 7f5957cf1..72cdb8019 100644
--- a/SmartDeviceLink_Example/RPCPermissionsManager.swift
+++ b/SmartDeviceLink_Example/RPCPermissionsManager.swift
@@ -17,11 +17,11 @@ class RPCPermissionsManager {
class func setupPermissionsCallbacks(with manager: SDLManager) {
// Checks if the `SDLShow` RPC is allowed right at this moment
let showRPCName = "Show"
- let showRPCPermission = checkShowRPCCurrentPermission(with: manager, rpcName: showRPCName)
+ _ = checkCurrentPermission(with: manager, rpcName: showRPCName)
// Checks if all the RPCs need to create menus are allowed right at this moment
let menuRPCNames = ["AddCommand", "CreateInteractionChoiceSet", "PerformInteraction"]
- let menuRPCPermissions = checkCurrentGroupPermissions(with: manager, rpcNames: menuRPCNames)
+ _ = checkCurrentGroupPermissions(with: manager, rpcNames: menuRPCNames)
// Set up an observer for permissions changes to media template releated RPCs. Since the `groupType` is set to all allowed, this block is called when the group permissions changes from all allowed. This block is called immediately when created.
let mediaTemplateRPCs = ["SetMediaClockTimer", "SubscribeButton"]
@@ -31,7 +31,7 @@ class RPCPermissionsManager {
unsubscribeGroupPermissions(with: manager, observerId: allAllowedObserverId)
// Sets up a block for observing permission changes for a group of RPCs. Since the `groupType` is set to any, this block is called when the permission status changes for any of the RPCs being observed. This block is called immediately when created.
- subscribeGroupPermissions(with: manager, rpcNames: mediaTemplateRPCs, groupType: .any)
+ _ = subscribeGroupPermissions(with: manager, rpcNames: mediaTemplateRPCs, groupType: .any)
}
/// Checks if the `DialNumber` RPC is allowed
@@ -74,9 +74,9 @@ private extension RPCPermissionsManager {
/// - manager: The SDL Manager
/// - groupType: The type of changes to get notified about
/// - Returns: A unique id assigned to observer. Use the id to unsubscribe to notifications
- class func subscribeGroupPermissions(with manager: SDLManager, rpcNames: [String], groupType: SDLPermissionGroupType) -> SDLPermissionObserverIdentifier {
- let permissionAllAllowedObserverId = manager.permissionManager.addObserver(forRPCs: observedRPCGroup, groupType: groupType, withHandler: { (individualStatuses, groupStatus) in
- self.logRPCGroupPermissions(rpcNames: observedRPCGroup, groupPermissionStatus: groupStatus, individualPermissionStatuses: individualStatuses)
+ class func subscribeGroupPermissions(with manager: SDLManager, rpcNames: [String], groupType: SDLPermissionGroupType) -> UUID {
+ let permissionAllAllowedObserverId = manager.permissionManager.addObserver(forRPCs: rpcNames, groupType: groupType, withHandler: { (individualStatuses, groupStatus) in
+ self.logRPCGroupPermissions(rpcNames: rpcNames, groupPermissionStatus: groupStatus, individualPermissionStatuses: individualStatuses)
})
return permissionAllAllowedObserverId
@@ -87,7 +87,7 @@ private extension RPCPermissionsManager {
/// - Parameters:
/// - manager: The SDL Manager
/// - observerId: The unique identifier for a group of RPCs
- class func unsubscribeGroupPermissions(with manager: SDLManager, observerId: SDLPermissionObserverIdentifier) {
+ class func unsubscribeGroupPermissions(with manager: SDLManager, observerId: UUID) {
manager.permissionManager.removeObserver(forIdentifier: observerId)
}
}