v1.5.0 Release

This commit is contained in:
2024-02-22 23:56:53 +02:00
parent 1b96a031d2
commit bec08b56be
27 changed files with 968 additions and 825 deletions

View File

@ -118,7 +118,7 @@ extension AddFriendController {
alert.addAction(SDCAlertAction(title: String(localized: "add_contact_send"), style: .recommended) { [unowned self] action in
self.cachedMessage = messageView.text
let message = messageView.text.isEmpty ? "Antidote is Tox" : messageView.text
let message = messageView.text.isEmpty ? "Toxing on Antidote" : messageView.text
do {
try self.submanagerFriends.sendFriendRequest(toAddress: self.textView.text, message: message)

View File

@ -3,7 +3,7 @@
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
import UIKit
import Firebase
//import Firebase
import os
@UIApplicationMain
@ -70,9 +70,9 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
window?.backgroundColor = UIColor.white
window?.makeKeyAndVisible()
FirebaseApp.configure()
Messaging.messaging().delegate = self
// FirebaseApp.configure()
//
// Messaging.messaging().delegate = self
if #available(iOS 10.0, *) {
UNUserNotificationCenter.current().delegate = self
@ -283,18 +283,18 @@ private extension AppDelegate {
}
}
extension AppDelegate: MessagingDelegate {
func messaging(_ messaging: Messaging, didReceiveRegistrationToken fcmToken: String?) {
print("Firebase registration token: \(String(describing: fcmToken))")
let dataDict: [String: String] = ["token": fcmToken ?? ""]
NotificationCenter.default.post(
name: Notification.Name("FCMToken"),
object: nil,
userInfo: dataDict
)
}
}
//extension AppDelegate: MessagingDelegate {
// func messaging(_ messaging: Messaging, didReceiveRegistrationToken fcmToken: String?) {
// print("Firebase registration token: \(String(describing: fcmToken))")
//
// let dataDict: [String: String] = ["token": fcmToken ?? ""]
// NotificationCenter.default.post(
// name: Notification.Name("FCMToken"),
// object: nil,
// userInfo: dataDict
// )
// }
//}
// Convenience AppWide Simple Alert
extension AppDelegate {

View File

@ -81,10 +81,6 @@ extension ChatInputViewManager: ChatInputViewDelegate {
func chatInputViewSendButtonPressed(_ view: ChatInputView) {
// HINT: call OCTSubmanagerChatsImpl.m -> sendMessageToChat()
submanagerChats.sendMessage(to: chat, text: view.text, type: .normal, successBlock: nil, failureBlock: nil)
DispatchQueue.main.asyncAfter(deadline: .now() + 10) {
os_log("PUSH:10_seconds")
self.submanagerChats.sendMessagePush(to: self.chat)
}
view.text = ""
endUserInteraction()

View File

@ -61,7 +61,7 @@ class ChatPrivateController: KeyboardNotificationController, CLLocationManagerDe
fileprivate var audioButton: UIBarButtonItem!
fileprivate var videoButton: UIBarButtonItem!
fileprivate var locationButton: UIBarButtonItem!
// fileprivate var locationButton: UIBarButtonItem!
fileprivate var CallWaitingView: UIView!
fileprivate var callwaiting_running: Bool!
fileprivate var CallWaitingCancelButton: CallButton?
@ -463,10 +463,6 @@ extension ChatPrivateController {
// send a text message to trigger PUSH notification, and make friend come online (hopefully)
// HINT: call OCTSubmanagerChatsImpl.m -> sendMessageToChat()
self.submanagerChats.sendMessage(to: self.chat, text: "calling you", type: .normal, successBlock: nil, failureBlock: nil)
DispatchQueue.main.asyncAfter(deadline: .now() + 10) {
os_log("PUSH:10_seconds")
self.submanagerChats.sendMessagePush(to: self.chat)
}
self.linearBar.startAnimation(viewToAddto: self.CallWaitingView, viewToAlignToBottomOf: lb3, bottom_margin: 10)
self.CallWaitingView.bringSubview(toFront: self.linearBar)
@ -520,61 +516,61 @@ extension ChatPrivateController {
}
}
@objc func displayalert() {
var alert = UIAlertController(title: "Location Sharing", message: "Would you like to enable location sharing with this contact?\nYou can disable this feature by clicking on the location icon after it has been enabled.", preferredStyle: UIAlertControllerStyle.alert)
var action_title = "Enable"
if (AppDelegate.location_sharing_contact_pubkey != "-1")
{
alert = UIAlertController(title: "Location Sharing", message: "Disable sharing with this contact " + AppDelegate.location_sharing_contact_pubkey + " ?" , preferredStyle: UIAlertControllerStyle.alert)
action_title = "Disable"
}
alert.addAction((UIAlertAction(title: action_title, style: .default, handler: { [self] (action) -> Void in
if (action_title == "Disable")
{
AppDelegate.location_sharing_contact_pubkey = "-1"
let locationImage = UIImage(named: "location-call-medium")!.withRenderingMode(.alwaysOriginal)
locationButton.setBackgroundImage(locationImage, for: .normal, barMetrics: .default)
}
else
{
AppDelegate.location_sharing_contact_pubkey = self.friend?.publicKey ?? "-1"
let locationImage = UIImage(named: "location-call-activated-medium")!.withRenderingMode(.alwaysOriginal)
locationButton.setBackgroundImage(locationImage, for: .normal, barMetrics: .default)
DispatchQueue.global(qos: .userInitiated).async {
print("ll:location_sharing")
if self.friend != nil {
while AppDelegate.location_sharing_contact_pubkey != "-1" {
location_manager.requestLocation()
// HINT: sleep for 30 seconds
sleep(30)
}
print("ll:while_loop_end")
}
}
}
alert.dismiss(animated: true, completion: nil)
})))
alert.addAction(
UIAlertAction(title: "Cancel", style: .cancel, handler: { (action) -> Void in
alert.dismiss(animated: true, completion: nil)
}))
self.present(alert, animated: true, completion: nil)
}
// @objc func displayalert() {
// var alert = UIAlertController(title: "Location Sharing", message: "Would you like to enable location sharing with this contact?\nYou can disable this feature by clicking on the location icon after it has been enabled.", preferredStyle: UIAlertControllerStyle.alert)
// var action_title = "Enable"
//
// if (AppDelegate.location_sharing_contact_pubkey != "-1")
// {
// alert = UIAlertController(title: "Location Sharing", message: "Disable sharing with this contact " + AppDelegate.location_sharing_contact_pubkey + " ?" , preferredStyle: UIAlertControllerStyle.alert)
// action_title = "Disable"
// }
//
// alert.addAction((UIAlertAction(title: action_title, style: .default, handler: { [self] (action) -> Void in
// if (action_title == "Disable")
// {
// AppDelegate.location_sharing_contact_pubkey = "-1"
// let locationImage = UIImage(named: "location-call-medium")!.withRenderingMode(.alwaysOriginal)
// locationButton.setBackgroundImage(locationImage, for: .normal, barMetrics: .default)
// }
// else
// {
// AppDelegate.location_sharing_contact_pubkey = self.friend?.publicKey ?? "-1"
// let locationImage = UIImage(named: "location-call-activated-medium")!.withRenderingMode(.alwaysOriginal)
// locationButton.setBackgroundImage(locationImage, for: .normal, barMetrics: .default)
//
// DispatchQueue.global(qos: .userInitiated).async {
//
// print("ll:location_sharing")
// if self.friend != nil {
//
// while AppDelegate.location_sharing_contact_pubkey != "-1" {
// location_manager.requestLocation()
// // HINT: sleep for 30 seconds
// sleep(30)
// }
// print("ll:while_loop_end")
// }
// }
// }
// alert.dismiss(animated: true, completion: nil)
// })))
//
// alert.addAction(
// UIAlertAction(title: "Cancel", style: .cancel, handler: { (action) -> Void in
// alert.dismiss(animated: true, completion: nil)
// }))
//
// self.present(alert, animated: true, completion: nil)
// }
@objc func videoCallButtonPressed() {
delegate?.chatPrivateControllerCallToChat(self, enableVideo: true)
}
@objc func locationButtonPressed() {
displayalert()
}
// @objc func locationButtonPressed() {
// displayalert()
// }
@objc func editMessagesDeleteButtonPressed(_ barButtonItem: UIBarButtonItem) {
guard let selectedRows = tableView?.indexPathsForSelectedRows else {
@ -671,31 +667,11 @@ extension ChatPrivateController: UITableViewDataSource {
if let messageText = message.messageText {
let outgoingModel = ChatOutgoingTextCellModel()
if (UserDefaultsManager().DebugMode == false) {
outgoingModel.message = messageText.text ?? ""
} else {
let s1 = (messageText.text ?? "")
let s2 = (messageText.msgv3HashHex ?? "")
let s3 = (message.senderUniqueIdentifier ?? "")
let s4 = (message.chatUniqueIdentifier )
let s5 = String(messageText.isDelivered)
let s6 = String(messageText.sentPush)
let s7 = String(message.tssent)
let s8 = String(message.tsrcvd)
let s9 = String(message.dateInterval)
outgoingModel.message = s1 + "\n"
+ "msgv3HashHex:\n" + s2 + "\n"
+ "senderUniqueIdentifier:\n" + s3 + "\n"
+ "chatUniqueIdentifier:\n" + s4 + "\n"
+ "isDelivered:\n" + s5 + "\n"
+ "sentPush:\n" + s6 + "\n"
+ "tssent:\n" + s7 + "\n"
+ "tsrcvd:\n" + s8 + "\n"
+ "dateInterval:\n" + s9 + "\n"
}
outgoingModel.message = messageText.text ?? ""
outgoingModel.delivered = messageText.isDelivered
outgoingModel.sentpush = messageText.sentPush
//outgoingModel.sentpush = messageText.sentPush
model = outgoingModel
@ -717,26 +693,9 @@ extension ChatPrivateController: UITableViewDataSource {
if let messageText = message.messageText {
let incomingModel = ChatBaseTextCellModel()
if (UserDefaultsManager().DebugMode == false) {
incomingModel.message = messageText.text ?? ""
} else {
let s1 = (messageText.text ?? "")
let s2 = (messageText.msgv3HashHex ?? "")
let s3 = (message.senderUniqueIdentifier ?? "")
let s4 = (message.chatUniqueIdentifier)
let s5 = String(messageText.isDelivered)
let s6 = String(message.tssent)
let s7 = String(message.tsrcvd)
let s8 = String(message.dateInterval)
incomingModel.message = "" + s1 + "\n"
+ "msgv3HashHex:\n" + s2 + "\n"
+ "senderUniqueIdentifier:\n" + s3 + "\n"
+ "chatUniqueIdentifier:\n" + s4 + "\n"
+ "isDelivered:\n" + s5 + "\n"
+ "tssent:\n" + s6 + "\n"
+ "tsrcvd:\n" + s7 + "\n"
+ "dateInterval:\n" + s8 + "\n"
}
incomingModel.message = messageText.text ?? ""
model = incomingModel
@ -1156,7 +1115,7 @@ private extension ChatPrivateController {
titleView.connectionStatus = ConnectionStatus(connectionStatus: .none)
audioButton.isEnabled = true
videoButton.isEnabled = false
locationButton.isEnabled = true
// locationButton.isEnabled = true
chatInputView.cameraButtonEnabled = false
return
}
@ -1185,7 +1144,7 @@ private extension ChatPrivateController {
self.audioButton.isEnabled = true
self.videoButton.isEnabled = isConnected
self.locationButton.isEnabled = true
//self.locationButton.isEnabled = true
self.chatInputView.cameraButtonEnabled = isConnected
self.updateTableHeaderView()
@ -1296,7 +1255,7 @@ private extension ChatPrivateController {
}
func updateLastReadDate() {
submanagerObjects.change(chat, lastReadDateInterval: Date().timeIntervalSince1970)
submanagerObjects.change(chat, lastReadDateInterval: Date().timeIntervalSince1970 ?? 0.0)
}
func imageCellWithMessage(_ message: OCTMessageAbstract, incoming: Bool) -> (ChatMovableDateCellModel, ChatMovableDateCell) {
@ -1471,18 +1430,18 @@ private extension ChatPrivateController {
let locationImage = UIImage(named: "location-call-medium")!.withRenderingMode(.alwaysOriginal)
audioButton = UIBarButtonItem(image: audioImage, style: .plain, target: self, action: #selector(ChatPrivateController.audioCallButtonPressed))
videoButton = UIBarButtonItem(image: videoImage, style: .plain, target: self, action: #selector(ChatPrivateController.videoCallButtonPressed))
locationButton = UIBarButtonItem(image: locationImage, style: .plain, target: self, action: #selector(ChatPrivateController.locationButtonPressed))
// locationButton = UIBarButtonItem(image: locationImage, style: .plain, target: self, action: #selector(ChatPrivateController.locationButtonPressed))
if (AppDelegate.location_sharing_contact_pubkey != "-1") {
let locationImage = UIImage(named: "location-call-activated-medium")!.withRenderingMode(.alwaysOriginal)
locationButton.setBackgroundImage(locationImage, for: .normal, barMetrics: .default)
}
// if (AppDelegate.location_sharing_contact_pubkey != "-1") {
// let locationImage = UIImage(named: "location-call-activated-medium")!.withRenderingMode(.alwaysOriginal)
// locationButton.setBackgroundImage(locationImage, for: .normal, barMetrics: .default)
// }
navigationItem.leftBarButtonItems = nil
navigationItem.rightBarButtonItems = [
videoButton,
audioButton,
locationButton
audioButton//,
// locationButton
]
}
}

View File

@ -27,7 +27,7 @@ class FriendCardController: StaticTableController {
fileprivate let nameModel: StaticTableDefaultCellModel
fileprivate let statusMessageModel: StaticTableDefaultCellModel
fileprivate let publicKeyModel: StaticTableDefaultCellModel
fileprivate let capabilitiesModel: StaticTableDefaultCellModel
// fileprivate let capabilitiesModel: StaticTableDefaultCellModel
fileprivate let pushurlModel: StaticTableDefaultCellModel
init(theme: Theme, friend: OCTFriend, submanagerObjects: OCTSubmanagerObjects) {
@ -42,7 +42,7 @@ class FriendCardController: StaticTableController {
nameModel = StaticTableDefaultCellModel()
statusMessageModel = StaticTableDefaultCellModel()
publicKeyModel = StaticTableDefaultCellModel()
capabilitiesModel = StaticTableDefaultCellModel()
// capabilitiesModel = StaticTableDefaultCellModel()
pushurlModel = StaticTableDefaultCellModel()
super.init(theme: theme, style: .plain, model: [
@ -58,12 +58,12 @@ class FriendCardController: StaticTableController {
[
publicKeyModel,
],
[
capabilitiesModel,
],
[
pushurlModel,
],
// [
// capabilitiesModel,
// ],
// [
// pushurlModel,
// ],
])
updateModels()
@ -142,45 +142,6 @@ private extension FriendCardController {
publicKeyModel.value = friend.publicKey
publicKeyModel.userInteractionEnabled = false
publicKeyModel.canCopyValue = true
capabilitiesModel.title = "Tox Capabilities"
let capabilities = friend.capabilities2 ?? ""
if (capabilities.count > 0) {
let caps = NSNumber(value: UInt64(capabilities) ?? 0)
capabilitiesModel.value = capabilitiesToString(caps)
} else {
capabilitiesModel.value = "BASIC"
}
capabilitiesModel.userInteractionEnabled = false
pushurlModel.title = "Push URL"
let pushtoken = friend.pushToken ?? ""
if (pushtoken.count > 0) {
pushurlModel.value = pushtoken
} else {
pushurlModel.value = ""
}
pushurlModel.userInteractionEnabled = false
}
func capabilitiesToString(_ cap: NSNumber) -> String {
var ret: String = "BASIC"
if ((UInt(cap) & 1) > 0) {
ret = ret + " CAPABILITIES"
}
if ((UInt(cap) & 2) > 0) {
ret = ret + " MSGV2"
}
if ((UInt(cap) & 4) > 0) {
ret = ret + " H264"
}
if ((UInt(cap) & 8) > 0) {
ret = ret + " MSGV3"
}
if ((UInt(cap) & 16) > 0) {
ret = ret + " FTV2"
}
return ret;
}
}

View File

@ -75,7 +75,7 @@ class FriendListController: UIViewController {
if (UserDefaultsManager().EchobotAdded == false) {
do {
try self.submanagerFriends.sendFriendRequest(toAddress: echobotid, message: message)
//try self.submanagerFriends.sendFriendRequest(toAddress: echobotid, message: message)
UserDefaultsManager().EchobotAdded = true
}
catch let error as NSError {

View File

@ -286,7 +286,7 @@ private extension LoginCoordinator {
loginWithProfile(profileName, password: password, configurationClosure: {
if let name = username {
_ = try? $0.user.setUserName(name)
_ = try? $0.user.setUserStatusMessage("Antidote is Tox")
_ = try? $0.user.setUserStatusMessage("Toxing on Antidote")
}
}, errorClosure: { error in
handleErrorWithType(.createOCTManager, error: error)

View File

@ -3,7 +3,7 @@
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
import UIKit
import Firebase
//import Firebase
protocol ProfileMainControllerDelegate: class {
func profileMainControllerLogout(_ controller: ProfileMainController)
@ -27,7 +27,7 @@ class ProfileMainController: StaticTableController {
// fileprivate let userStatusModel = StaticTableDefaultCellModel()
fileprivate let toxIdModel = StaticTableDefaultCellModel()
fileprivate let pushurlModel = StaticTableDefaultCellModel()
fileprivate let capabilitiesModel = StaticTableDefaultCellModel()
// fileprivate let capabilitiesModel = StaticTableDefaultCellModel()
fileprivate let profileDetailsModel = StaticTableDefaultCellModel()
fileprivate let logoutModel = StaticTableButtonCellModel()
@ -50,12 +50,12 @@ class ProfileMainController: StaticTableController {
[
toxIdModel,
],
[
pushurlModel,
],
[
capabilitiesModel,
],
// [
// pushurlModel,
// ],
// [
// capabilitiesModel,
// ],
[
profileDetailsModel,
],
@ -168,19 +168,15 @@ private extension ProfileMainController {
// for debugging print own ToxID ----------------
// print("TOXID: \(submanagerUser.userAddress)")
// for debugging print own ToxID ----------------
pushurlModel.title = "Push URL"
let pushtoken = Messaging.messaging().fcmToken ?? ""
if (pushtoken.count > 0) {
pushurlModel.value = "https://tox.zoff.xyz/toxfcm/fcm.php?id=" + pushtoken + "&type=1"
} else {
pushurlModel.value = ""
}
pushurlModel.userInteractionEnabled = false
capabilitiesModel.title = "Tox Capabilities"
capabilitiesModel.value = capabilitiesToString(submanagerUser.capabilities as NSNumber)
capabilitiesModel.userInteractionEnabled = false
//
// pushurlModel.title = "Push URL"
// let pushtoken = Messaging.messaging().fcmToken ?? ""
// if (pushtoken.count > 0) {
// pushurlModel.value = "https://tox.zoff.xyz/toxfcm/fcm.php?id=" + pushtoken + "&type=1"
// } else {
// pushurlModel.value = ""
// }
// pushurlModel.userInteractionEnabled = false
profileDetailsModel.value = String(localized: "profile_details")
profileDetailsModel.didSelectHandler = showProfileDetails
@ -190,26 +186,6 @@ private extension ProfileMainController {
logoutModel.didSelectHandler = logout
}
func capabilitiesToString(_ cap: NSNumber) -> String {
var ret: String = "BASIC"
if ((UInt(cap) & 1) > 0) {
ret = ret + " CAPABILITIES"
}
if ((UInt(cap) & 2) > 0) {
ret = ret + " MSGV2"
}
if ((UInt(cap) & 4) > 0) {
ret = ret + " H264"
}
if ((UInt(cap) & 8) > 0) {
ret = ret + " MSGV3"
}
if ((UInt(cap) & 16) > 0) {
ret = ret + " FTV2"
}
return ret;
}
func logout(_: StaticTableBaseCell) {
delegate?.profileMainControllerLogout(self)
}

View File

@ -33,24 +33,24 @@ class SettingsMainController: StaticTableController {
[
autodownloadImagesModel,
],
[
longerbgModel,
],
// [
// longerbgModel,
// ],
[
notificationsModel,
dateonmessagemodeModel,
debugmodeModel,
// debugmodeModel,
],
[
advancedSettingsModel,
],
[
faqModel,
// faqModel,
aboutModel,
],
], footers: [
String(localized: "settings_autodownload_images_description"),
"This will keep the Application running for longer in the background to finish sending messages, but this will also reveal more meta data about you. It will link your IP address and your PUSH token. It's a tradeoff between convenience and metadata privacy.\n\nYou can use ProtonVPN to prevent that.\n\nSee https://protonvpn.com/free-vpn/\n\nand\n\nhttps://apps.apple.com/app/apple-store/id1437005085",
// "This will keep the Application running for longer in the background to finish sending messages, but this will also reveal more meta data about you. It will link your IP address and your PUSH token. It's a tradeoff between convenience and metadata privacy.\n\nYou can use ProtonVPN to prevent that.\n\nSee https://protonvpn.com/free-vpn/\n\nand\n\nhttps://apps.apple.com/app/apple-store/id1437005085",
nil,
nil,
nil,

View File

@ -14,7 +14,7 @@ class UserDefaultsManager {
var UDPEnabled: Bool {
get {
return boolForKey(Keys.UDPEnabled, defaultValue: false)
return boolForKey(Keys.UDPEnabled, defaultValue: true)
}
set {
setBool(newValue, forKey: Keys.UDPEnabled)
@ -23,7 +23,7 @@ class UserDefaultsManager {
var EchobotAdded: Bool {
get {
return boolForKey(Keys.EchobotAdded, defaultValue: false)
return boolForKey(Keys.EchobotAdded, defaultValue: true)
}
set {
setBool(newValue, forKey: Keys.EchobotAdded)