Commit a7f5d4c9 authored by Aral Balkan's avatar Aral Balkan
Browse files

All Friends timeline native notifications now show the sender’s profile image.

parent 8a25cfe9
......@@ -123,11 +123,25 @@ public class NativeNotification: NSObject, NSUserNotificationCenterDelegate
// n.actionButtonTitle = "View"
// n.otherButtonTitle = "Dismiss"
// Display the sender’s profile photo (in place of the app’s identity image).
// This is a private API and could result in a rejection on the app store.
// Leaving it in for now as it’s an experience issue.
n.setValue(SetupData.photoWithRoundedCorners, forKey: "_identityImage")
n.setValue(false, forKey: "_identityImageHasBorder")
// Leaving it in for now as it’s an experience issue and quite possibly a security issue also.
let sendersProfileImagePath = NSHomeDirectory().stringByAppendingPathComponent("Pulse/Sync").stringByAppendingPathComponent("3. All your friends/from/").stringByAppendingPathComponent(fromPerson).stringByAppendingPathComponent("about/me.jpg")
if let sendersProfileImageURL = NSURL(fileURLWithPath: sendersProfileImagePath, isDirectory: false), sendersProfileImage = NSImage(contentsOfURL: sendersProfileImageURL)
// This is just so ugly that I am ashamed of it before I’ve even written it and yet
// it’s almost midnight, so…
// TODO: Move this method into its own singleton or something.
let sendersProfileImageWithRoundedCorners = SetupData.roundCorners(sendersProfileImage, width: sendersProfileImage.size.width, height: sendersProfileImage.size.height)
n.setValue(sendersProfileImageWithRoundedCorners, forKey: "_identityImage")
n.setValue(false, forKey: "_identityImageHasBorder")
n.userInfo = ["type": NativeNotificationType.named(.AllFriendsTimelineMessage)] //,"accountHandle": accountHandle, "name": fullName, "deviceID": deviceID]
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment