Files
simplex-chat/apps/ios/Shared/Views/UserSettings/SetDeliveryReceiptsView.swift
T
Evgeny Poberezkin 0f4473d272 core: delivery receipts (#2644)
* core: delivery receipts

* update simplexmq

* preference, migration

* add activated state to receipts preference, update tests

* set receiveReceipts as activated on new profiles

* update simplexmq, fix tests

* update simplexmq, fix withAckMessage

* one more option

* more

* use tryChatError in ack message

* enable all tests

* rename pref

* update item status on delivery receipts

* show receipts for tests

* remove chat preference for delivery receipts

* add user, contact and group settings for delivery receipts

* only send delivery receipts if enabled for the contact or user profile (and not disabled for the contact)

* fix tests

* reuse event, test

* configure per contact - db, api, test

* rename commands

* update simplexmq

---------

Co-authored-by: spaced4ndy <8711996+spaced4ndy@users.noreply.github.com>
2023-07-13 23:48:25 +01:00

64 lines
1.9 KiB
Swift

//
// SetDeliveryReceiptsView.swift
// SimpleX (iOS)
//
// Created by Evgeny on 12/07/2023.
// Copyright © 2023 SimpleX Chat. All rights reserved.
//
import SwiftUI
struct SetDeliveryReceiptsView: View {
@EnvironmentObject var m: ChatModel
var body: some View {
VStack(spacing: 16) {
Text("Delivery receipts!")
.font(.title)
.foregroundColor(.secondary)
.padding(.vertical)
.multilineTextAlignment(.center)
Spacer()
Button("Enable") {
m.setDeliveryReceipts = false
}
.font(.largeTitle)
Group {
if m.users.count > 1 {
Text("Delivery receipts will be enabled for all contacts in all visible chat profiles.")
} else {
Text("Delivery receipts will be enabled for all contacts.")
}
}
.multilineTextAlignment(.center)
Spacer()
Button("Enable later via Settings") {
AlertManager.shared.showAlert(Alert(
title: Text("Delivery receipts are disabled!"),
message: Text("You can enable them later via app Privacy & Security settings."),
primaryButton: .default(Text("Don't show again")) {
m.setDeliveryReceipts = false
},
secondaryButton: .default(Text("Ok")) {
m.setDeliveryReceipts = false
}
))
}
}
.padding()
.padding(.horizontal)
.frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .topLeading)
.background(Color(uiColor: .systemBackground))
}
}
struct SetDeliveryReceiptsView_Previews: PreviewProvider {
static var previews: some View {
SetDeliveryReceiptsView()
}
}