From ac051fc89e2a04d74547abf5eb9877d34100ffd9 Mon Sep 17 00:00:00 2001
From: Matthew Chen <matthew@signal.org>
Date: Wed, 31 Oct 2018 12:44:53 -0400
Subject: [PATCH] Inform linked devices about profile changes.

---
 SignalMessaging/profiles/OWSProfileManager.m | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/SignalMessaging/profiles/OWSProfileManager.m b/SignalMessaging/profiles/OWSProfileManager.m
index e846fff17..917ca246f 100644
--- a/SignalMessaging/profiles/OWSProfileManager.m
+++ b/SignalMessaging/profiles/OWSProfileManager.m
@@ -227,6 +227,14 @@ typedef void (^ProfileManagerFailureBlock)(NSError *error);
     void (^failureBlock)(void) = ^{
         OWSLogError(@"Updating service with profile failed.");
 
+        // We use a "self-only" contact sync to indicate to desktop
+        // that we've changed our profile and that it should do a
+        // profile fetch for "self".
+        //
+        // NOTE: We also inform the desktop in the failure case,
+        //       since that _may have_ affected service state.
+        [self.syncManager syncLocalContact];
+
         dispatch_async(dispatch_get_main_queue(), ^{
             failureBlockParameter();
         });
@@ -234,6 +242,11 @@ typedef void (^ProfileManagerFailureBlock)(NSError *error);
     void (^successBlock)(void) = ^{
         OWSLogInfo(@"Successfully updated service with profile.");
 
+        // We use a "self-only" contact sync to indicate to desktop
+        // that we've changed our profile and that it should do a
+        // profile fetch for "self".
+        [self.syncManager syncLocalContact];
+
         dispatch_async(dispatch_get_main_queue(), ^{
             successBlockParameter();
         });