Skip to content
Snippets Groups Projects
Commit ae34ba5e authored by Oliver Wiese's avatar Oliver Wiese
Browse files

update censor mail

parent 8aaade27
Branches
Tags
No related merge requests found
Showing
with 62 additions and 20 deletions
{
"images" : [
{
"idiom" : "universal",
"filename" : "invite_censorReceiver.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "invite_censorReceiver@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "invite_censorReceiver@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "universal",
"filename" : "invite_censorSender.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "invite_censorSender@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "invite_censorSender@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
......@@ -30,15 +30,13 @@ enum DialogOption {
case .invitationCode : return nil
case .invitationWelcome :
if StudySettings.invitationsmode == InvitationMode.Censorship {
if let ani = UIImage.animatedImageNamed("bg_invitation_censor", duration: 4){
return ani
}
var images = [UIImage]()
images.append(UIImage(named: "letter_open")!)
images.append(UIImage(named: "letter_corrupted")!)
if let sender = UIImage(named: "bg_inviation_censor_sender"), let receiver = UIImage(named: "bg_inviation_censor_receiver") {
images.append(sender)
images.append(receiver)
return UIImage.animatedImage(with: images, duration: 3)
}
let ani = UIImage.animatedImage(with: images, duration: 10)
return
}
return UIImage(named: "bg_inviation")
case .invitationStep : return nil
......
......@@ -88,7 +88,7 @@ extension DialogViewController {
self.iconImageView?.image = option.icon?.withRenderingMode(.alwaysTemplate)
self.iconBackgroundView?.isHidden = option.icon == nil
self.iconBackgroundImageView?.image = option.titleImage
if (self.iconBackgroundImageView?.isAnimating)! {
if let animated = self.iconBackgroundImageView?.isAnimating, animated == true {
self.iconBackgroundImageView?.animationRepeatCount = -1
}
self.ctaButton?.backgroundColor = option.color
......
......@@ -13,12 +13,9 @@ import UIKit
/*
TODO:
Code Berechnung und Darstellung optional
Code speichern (pro Kontakt)
Erklärung was genau passiert?
Text überarbeiten
Text Onboarding popup (Verschlüsseln-> verbergen)
InviteMode == Enc || InviteMode == Censor -> Was dann mit Einladebutton?
InviteMode == Enc || InviteMode == Censor -> Einladebutton wird zu Infobutton
FreiText -> Popup -> leere E-Mail
*/
struct InvitationSelection {
......@@ -53,7 +50,7 @@ extension SendViewController {
}.map { (range) -> String in
return (text as NSString).substring(with: range)
}
let cipherText = SwiftPGP().symmetricEncrypt(textToEncrypt: [textsToEncrypt.joined(separator: "\n")], armored: true)
let cipherText = SwiftPGP().symmetricEncrypt(textToEncrypt: [textsToEncrypt.joined(separator: "\n")], armored: true, password: nil)
let texts = textsToEncrypt.map { _ -> String in
// Change text in mail body
if isCensored{
......@@ -88,8 +85,6 @@ extension SendViewController {
}
}
print(text)
if (self.invitationSelection.code == nil && StudySettings.invitationsmode == InvitationMode.PasswordEnc) {
self.invitationSelection.code = cipherText.password
}
......
......@@ -499,13 +499,16 @@ class SwiftPGP: Encryption{
/*
encrypt a array of strings with one password. Returns encrypted strings and the password for decryption
*/
func symmetricEncrypt(textToEncrypt: [String], armored: Bool) -> (chiphers: [String], password: String){
let password = generatePW(arc4: 8)
func symmetricEncrypt(textToEncrypt: [String], armored: Bool, password: String?) -> (chiphers: [String], password: String){
var pw = generatePW(size: 8, splitInBlocks: true)
if let p = password{
pw = p
}
var chiphers = [String]()
for text in textToEncrypt{
if let data = text.data(using: .utf8){
if let chipher = try? ObjectivePGP.symmetricEncrypt(data, signWith: nil, encryptionKey: password, passphrase: password, armored: false){
if let chipher = try? ObjectivePGP.symmetricEncrypt(data, signWith: nil, encryptionKey: password, passphrase: pw, armored: false){
if armored{
chiphers.append(Armor.armored(chipher, as: PGPArmorType.message))
}
......@@ -515,7 +518,7 @@ class SwiftPGP: Encryption{
}
}
}
return (chiphers, password)
return (chiphers, pw)
}
func symmetricDecrypt(chipherTexts: [String], password: String) -> [String]{
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment