Skip to content

Commit

Permalink
Add more instrumentation
Browse files Browse the repository at this point in the history
  • Loading branch information
robbiet480 committed Sep 16, 2016
1 parent 5ea0bbd commit 2b4531b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
5 changes: 5 additions & 0 deletions HomeAssistant/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -126,9 +126,12 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
sns.setEndpointAttributes(updateRequest).continue({ (task: AWSTask!) -> Any? in
if task.error != nil {
print("Unable to update the endpoint: ", task.error)
CLSLogv("Unable to update SNS endpoint with userData: %@", getVaList([task.error!.localizedDescription]))
Crashlytics.sharedInstance().recordError(task.error!)
return nil
} else {
print("Successfully updated endpoint attributes!")
CLSLogv("Updated SNS endpoint attributes", getVaList([]))
self.prefs.set(true, forKey: "snsUserDataSet")
return nil
}
Expand All @@ -147,6 +150,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
} else {
let createEndpointResponse = task.result!
print("Registered SNS endpoint:", createEndpointResponse.endpointArn!)
CLSLogv("Registered SNS endpoint:", getVaList([createEndpointResponse.endpointArn!]))
Crashlytics.sharedInstance().setObjectValue(createEndpointResponse.endpointArn!, forKey: "endpointArn")
Crashlytics.sharedInstance().setUserIdentifier(createEndpointResponse.endpointArn!.components(separatedBy: "/").last!)
self.prefs.setValue(createEndpointResponse.endpointArn!, forKey: "endpointARN")
Expand All @@ -161,6 +165,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
Crashlytics.sharedInstance().recordError(subTask.error!)
} else {
print("Subscribed endpoint to broadcast topic")
CLSLogv("Subscribed endpoint to broadcast topic:", getVaList([]))
}

return nil
Expand Down
9 changes: 9 additions & 0 deletions HomeAssistant/HAAPI.swift
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,15 @@ public class HomeAssistantAPI {
prefs.setValue(config.Version, forKey: "version")

Crashlytics.sharedInstance().setObjectValue(config.Version, forKey: "hass_version")
Crashlytics.sharedInstance().setObjectValue(self.loadedComponents.joined(separator: ","), forKey: "loadedComponents")

var permissionsContainer : [String] = []
for status in PermissionScope().permissionStatuses([NotificationsPermission().type, LocationAlwaysPermission().type]) {
if status.1 == .authorized {
permissionsContainer.append(status.0.prettyDescription.lowercased())
}
}
Crashlytics.sharedInstance().setObjectValue(permissionsContainer.joined(separator: ","), forKey: "allowedPermissions")

let _ = self.GetStates()

Expand Down

0 comments on commit 2b4531b

Please sign in to comment.