@@ -72,9 +72,6 @@ module App =
73 type Msg =
73 type Msg =
74 | SetPage of Page
74 | SetPage of Page
75− | SetCompose of string
76− | SetContactPubkey of string
77− | SetContactNickname of string
78 | GenIdentity
75 | GenIdentity
79 | SetServerUrl of string
76 | SetServerUrl of string
80 | DoConnect
77 | DoConnect
@@ -89,8 +86,6 @@ module App =
89 | CopyPubKey
86 | CopyPubKey
90 | DismissError
87 | DismissError
91 | StateLoaded of StateLoadResult
88 | StateLoaded of StateLoadResult
92− | SetProfileDisplayName of string
93− | SetProfileBio of string
94 | DoPickPhoto
89 | DoPickPhoto
95 | PhotoPicked of string
90 | PhotoPicked of string
96 | DoSaveProfile
91 | DoSaveProfile
@@ -207,19 +202,6 @@ module App =
207 match msg with
202 match msg with
208 | SetPage page -> { model with Page = page }, []
203 | SetPage page -> { model with Page = page }, []
210− | SetCompose text ->
211− match model.Page with
212− | Chat(pk, _) -> { model with Page = Chat(pk, text) }, []
214− | SetContactPubkey pk ->
215− match model.Page with
216− | AddContact(_, nn) -> { model with Page = AddContact(pk, nn) }, []
218− | SetContactNickname nn ->
219− match model.Page with
220− | AddContact(pk, _) -> { model with Page = AddContact(pk, nn) }, []
223 | GenIdentity ->
205 | GenIdentity ->
224 let identity = Crypto.generateIdentity ()
206 let identity = Crypto.generateIdentity ()
225 { model with Auth = Identified(identity, Offline); Page = Settings },
207 { model with Auth = Identified(identity, Offline); Page = Settings },
@@ -310,16 +292,6 @@ module App =
311 | DismissError -> { model with Error = None }, []
293 | DismissError -> { model with Error = None }, []
313− | SetProfileDisplayName name ->
314− match model.Page with
315− | EditProfile(_, bio, photo) -> { model with Page = EditProfile(name, bio, photo) }, []
318− | SetProfileBio bio ->
319− match model.Page with
320− | EditProfile(name, _, photo) -> { model with Page = EditProfile(name, bio, photo) }, []
323 | DoPickPhoto -> model, [ CmdPickPhoto ]
295 | DoPickPhoto -> model, [ CmdPickPhoto ]
325 | PhotoPicked photo ->
297 | PhotoPicked photo ->
@@ -476,7 +448,7 @@ module App =
476 | Message -> Some(decryptEvent session.Identity.PrivKey evt.Payload)
448 | Message -> Some(decryptEvent session.Identity.PrivKey evt.Payload)
477 | UnknownEvent _ -> None)
449 | UnknownEvent _ -> None)
479− let events = results |> Array.choose (function Ok e -> Some e | _ -> None) |> Array.toList
451+ let events = results |> Array.choose Result.toOption |> Array.toList
480 let errors = results |> Array.choose (function Error e -> Some e | _ -> None) |> Array.toList
452 let errors = results |> Array.choose (function Error e -> Some e | _ -> None) |> Array.toList
482 if not ackIds.IsEmpty then
454 if not ackIds.IsEmpty then
@@ -690,7 +662,7 @@ module App =
690 .font(size = 14.)
662 .font(size = 14.)
692 HStack(spacing = 8.) {
664 HStack(spacing = 8.) {
693− Entry(compose, SetCompose)
665+ Entry(compose, fun text -> SetPage(Chat(pk, text)))
694 .placeholder("Message...")
666 .placeholder("Message...")
696 Button("Send", DoSend)
668 Button("Send", DoSend)
@@ -712,11 +684,11 @@ module App =
712 viewErrorBanner model.Error
684 viewErrorBanner model.Error
714 Label("Public Key:")
686 Label("Public Key:")
715− Entry(cpk, SetContactPubkey)
687+ Entry(cpk, fun text -> SetPage(AddContact(text, cnn)))
716 .placeholder("sampel-palnet-...")
688 .placeholder("sampel-palnet-...")
718 Label("Nickname:")
690 Label("Nickname:")
719− Entry(cnn, SetContactNickname)
691+ Entry(cnn, fun text -> SetPage(AddContact(cpk, text)))
721 Button("Save Contact", DoSaveContact)
693 Button("Save Contact", DoSaveContact)
722 .centerHorizontal()
694 .centerHorizontal()
@@ -749,11 +721,11 @@ module App =
749 Button("Change Photo", DoPickPhoto).centerHorizontal()
721 Button("Change Photo", DoPickPhoto).centerHorizontal()
751 Label("Display Name:")
723 Label("Display Name:")
752− Entry(displayName, SetProfileDisplayName)
724+ Entry(displayName, fun text -> SetPage(EditProfile(text, bio, photo)))
753 .placeholder("Your name")
725 .placeholder("Your name")
755 Label("Bio:")
727 Label("Bio:")
756− Entry(bio, SetProfileBio)
728+ Entry(bio, fun text -> SetPage(EditProfile(displayName, text, photo)))
757 .placeholder("Tell something about yourself")
729 .placeholder("Tell something about yourself")
759 Button("Save Profile", DoSaveProfile).centerHorizontal()
731 Button("Save Profile", DoSaveProfile).centerHorizontal()