-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed Top notch problem + added imessage
- Loading branch information
Showing
8 changed files
with
112 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
// | ||
// imessage.swift | ||
// CrypTool | ||
// | ||
// Created by Arthur Guiot on 2020-05-25. | ||
// Copyright © 2020 Arthur Guiot. All rights reserved. | ||
// | ||
|
||
import SwiftUI | ||
import MessageUI | ||
|
||
struct MessageView: UIViewControllerRepresentable { | ||
|
||
@Environment(\.presentationMode) var presentation | ||
@Binding var result: Result<MessageComposeResult, Error>? | ||
var content: String | ||
|
||
class Coordinator: NSObject, MFMessageComposeViewControllerDelegate { | ||
func messageComposeViewController(_ controller: MFMessageComposeViewController, didFinishWith result: MessageComposeResult) { | ||
defer { | ||
$presentation.wrappedValue.dismiss() | ||
} | ||
self.result = .success(result) | ||
} | ||
|
||
|
||
@Binding var presentation: PresentationMode | ||
@Binding var result: Result<MessageComposeResult, Error>? | ||
|
||
init(presentation: Binding<PresentationMode>, | ||
result: Binding<Result<MessageComposeResult, Error>?>) { | ||
_presentation = presentation | ||
_result = result | ||
} | ||
} | ||
|
||
func makeCoordinator() -> Coordinator { | ||
return Coordinator(presentation: presentation, | ||
result: $result) | ||
} | ||
|
||
func makeUIViewController(context: UIViewControllerRepresentableContext<MessageView>) -> MFMessageComposeViewController { | ||
let vc = MFMessageComposeViewController() | ||
vc.messageComposeDelegate = context.coordinator | ||
vc.body = self.content | ||
return vc | ||
} | ||
|
||
func updateUIViewController(_ uiViewController: MFMessageComposeViewController, | ||
context: UIViewControllerRepresentableContext<MessageView>) { | ||
|
||
} | ||
} |