on master help sign in
Send profile on first outgoing message to new contact
e4d8d76iko
client/App.fs+6−2
@@ -219,7 +219,11 @@ module App =
219 Timestamp = DateTimeOffset.UtcNow
219 Timestamp = DateTimeOffset.UtcNow
220 Direction = Outgoing DeliveryStatus.Sent }
220 Direction = Outgoing DeliveryStatus.Sent }
221
221
222− let isFirstInteraction = model.Messages |> messagesFor pk |> List.isEmpty
222+ let neverSentTo =
223+ model.Messages
224+ |> messagesFor pk
225+ |> List.exists (fun m -> match m.Direction with Outgoing _ -> true | _ -> false)
226+ |> not
223
227
224 let model' =
228 let model' =
225 { model with
229 { model with
@@ -229,7 +233,7 @@ module App =
229 model',
233 model',
230 [ CmdEnqueue(pk, Envelope.TextMessage(id, body))
234 [ CmdEnqueue(pk, Envelope.TextMessage(id, body))
231 match model.Profile with
235 match model.Profile with
232− | Some profile when isFirstInteraction -> CmdEnqueue(pk, Envelope.ProfileMessage profile)
236+ | Some profile when neverSentTo -> CmdEnqueue(pk, Envelope.ProfileMessage profile)
233 | _ -> ()
237 | _ -> ()
234 saveCmdMsg model' ]
238 saveCmdMsg model' ]
235 | _ -> model, []
239 | _ -> model, []