diff --git a/Antidote.xcodeproj/project.pbxproj b/Antidote.xcodeproj/project.pbxproj index 592729e..7bfb3b9 100644 --- a/Antidote.xcodeproj/project.pbxproj +++ b/Antidote.xcodeproj/project.pbxproj @@ -578,6 +578,7 @@ AFA023F4274C069100FBFCC0 /* ConnectionStatus.swift in Sources */ = {isa = PBXBuildFile; fileRef = AFA023F3274C069100FBFCC0 /* ConnectionStatus.swift */; }; AFA024022753CC9000FBFCC0 /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = AFA024012753CC9000FBFCC0 /* GoogleService-Info.plist */; }; D4F896D05F7EAA7C321A2AA8 /* libPods-Antidote.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 034E57B3AE56E352BBAA0487 /* libPods-Antidote.a */; }; + F1D850AB2B8FD3D8000CE8FB /* dark-theme.yaml in Resources */ = {isa = PBXBuildFile; fileRef = F1D850AA2B8FD3D8000CE8FB /* dark-theme.yaml */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -983,6 +984,7 @@ AFA024012753CC9000FBFCC0 /* GoogleService-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "GoogleService-Info.plist"; sourceTree = ""; }; B3C17AF8CE3B4AD1B68F2B5B /* Pods-Antidote.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Antidote.release.xcconfig"; path = "Pods/Target Support Files/Pods-Antidote/Pods-Antidote.release.xcconfig"; sourceTree = ""; }; CEC32120B965BE40E0029DB1 /* Pods-AntidoteTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-AntidoteTests.release.xcconfig"; path = "Pods/Target Support Files/Pods-AntidoteTests/Pods-AntidoteTests.release.xcconfig"; sourceTree = ""; }; + F1D850AA2B8FD3D8000CE8FB /* dark-theme.yaml */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.yaml; path = "dark-theme.yaml"; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -1518,6 +1520,7 @@ 9CEA6A1E1D957EFC0045F000 /* antidote-acknowledgements.html */, 1131D6C71CA9D8BC00B4531C /* import-profile.html */, 1173F0711BC5D9DA00B88B7B /* default-theme.yaml */, + F1D850AA2B8FD3D8000CE8FB /* dark-theme.yaml */, 9C7475C01BC698110098B1A4 /* Localizable.strings */, 113E96461E4BB302000282FC /* AppStoreLocalizable.strings */, 116634CE1C70E46C0072C980 /* Launch Screen.storyboard */, @@ -1793,6 +1796,7 @@ 116634CF1C70E46C0072C980 /* Launch Screen.storyboard in Resources */, 1131D6C51CA9D8BC00B4531C /* import-profile.html in Resources */, 11B253521C4AD9CF0068F47C /* isotoxin_NewMessage.aac in Resources */, + F1D850AB2B8FD3D8000CE8FB /* dark-theme.yaml in Resources */, 1164764519794D3300DB20B8 /* Images.xcassets in Resources */, 11B253511C4AD9CF0068F47C /* isotoxin_Hangup.aac in Resources */, ); @@ -2771,6 +2775,7 @@ CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; CODE_SIGN_IDENTITY = "iPhone Developer"; COPY_PHASE_STRIP = NO; + CURRENT_PROJECT_VERSION = 105001; ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_TESTABILITY = YES; GCC_C_LANGUAGE_STANDARD = gnu99; @@ -2790,6 +2795,7 @@ GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; IPHONEOS_DEPLOYMENT_TARGET = 12.0; + MARKETING_VERSION = 1.5.1; ONLY_ACTIVE_ARCH = YES; PROVISIONING_PROFILE = ""; SDKROOT = iphoneos; @@ -2828,6 +2834,7 @@ CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; CODE_SIGN_IDENTITY = "iPhone Developer"; COPY_PHASE_STRIP = YES; + CURRENT_PROJECT_VERSION = 105001; ENABLE_NS_ASSERTIONS = NO; ENABLE_STRICT_OBJC_MSGSEND = YES; GCC_C_LANGUAGE_STANDARD = gnu99; @@ -2840,6 +2847,7 @@ GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; IPHONEOS_DEPLOYMENT_TARGET = 12.0; + MARKETING_VERSION = 1.5.1; SDKROOT = iphoneos; SWIFT_COMPILATION_MODE = wholemodule; SWIFT_OPTIMIZATION_LEVEL = "-O"; @@ -2857,7 +2865,7 @@ CODE_SIGN_ENTITLEMENTS = Antidote/Antidote.entitlements; CODE_SIGN_IDENTITY = "iPhone Developer"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - CURRENT_PROJECT_VERSION = 105000; + CURRENT_PROJECT_VERSION = "$(CURRENT_PROJECT_VERSION)"; DEVELOPMENT_TEAM = Y46L589C5C; ENABLE_BITCODE = NO; GCC_PRECOMPILE_PREFIX_HEADER = YES; @@ -2869,7 +2877,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 1.5.0; + MARKETING_VERSION = "$(MARKETING_VERSION)"; PRODUCT_BUNDLE_IDENTIFIER = "org.zoxcore.${PRODUCT_NAME:rfc1034identifier}"; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE = ""; @@ -2893,7 +2901,7 @@ CODE_SIGN_ENTITLEMENTS = Antidote/Antidote.entitlements; CODE_SIGN_IDENTITY = "iPhone Developer"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - CURRENT_PROJECT_VERSION = 105000; + CURRENT_PROJECT_VERSION = "$(CURRENT_PROJECT_VERSION)"; DEVELOPMENT_TEAM = Y46L589C5C; ENABLE_BITCODE = NO; GCC_PRECOMPILE_PREFIX_HEADER = YES; @@ -2905,7 +2913,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 1.5.0; + MARKETING_VERSION = "$(MARKETING_VERSION)"; PRODUCT_BUNDLE_IDENTIFIER = "org.zoxcore.${PRODUCT_NAME:rfc1034identifier}"; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE = ""; diff --git a/Antidote/Antidote-Info.plist b/Antidote/Antidote-Info.plist index 137bf7e..0095d52 100644 --- a/Antidote/Antidote-Info.plist +++ b/Antidote/Antidote-Info.plist @@ -1,10 +1,7 @@ - - NSLocationWhenInUseUsageDescription - Used to share your location with your contacts CFBundleDevelopmentRegion en CFBundleDisplayName @@ -50,6 +47,10 @@ NSCameraUsageDescription You can use video calls, send photos and videos, scan QR codes. + NSFaceIDUsageDescription + Used in order to unlock the app instead of using a PIN pattern. + NSLocationWhenInUseUsageDescription + Used to share your location with your contacts NSMicrophoneUsageDescription You can use audio and video calls. NSPhotoLibraryUsageDescription @@ -59,6 +60,7 @@ audio fetch location + processing remote-notification voip diff --git a/Antidote/AppDelegate.swift b/Antidote/AppDelegate.swift index fe819a0..3557e3c 100644 --- a/Antidote/AppDelegate.swift +++ b/Antidote/AppDelegate.swift @@ -3,7 +3,7 @@ // file, You can obtain one at http://mozilla.org/MPL/2.0/. import UIKit -//import Firebase +import UserNotifications import os @UIApplicationMain @@ -70,10 +70,17 @@ class AppDelegate: UIResponder, UIApplicationDelegate { window?.backgroundColor = UIColor.white window?.makeKeyAndVisible() -// FirebaseApp.configure() -// -// Messaging.messaging().delegate = self + UNUserNotificationCenter.current().requestAuthorization(options: [.alert, .sound, .badge]) { (granted, error) in + if granted { + DispatchQueue.main.async { + UIApplication.shared.registerForRemoteNotifications() + } + } else { + print("Permission for push notifications denied.") + } + } + if #available(iOS 10.0, *) { UNUserNotificationCenter.current().delegate = self @@ -89,8 +96,8 @@ class AppDelegate: UIResponder, UIApplicationDelegate { } application.registerForRemoteNotifications() - // HINT: try to go online every 47 minutes - let bgfetchInterval: TimeInterval = 47 * 60 + // HINT: try to go online every 5 minutes + let bgfetchInterval: TimeInterval = 5 * 60 application.setMinimumBackgroundFetchInterval(bgfetchInterval); os_log("AppDelegate:didFinishLaunchingWithOptions:end") @@ -122,7 +129,6 @@ class AppDelegate: UIResponder, UIApplicationDelegate { os_log("AppDelegate:applicationDidEnterBackground:PushSelf:start") let coord = self.coordinator.activeCoordinator let runcoord = coord as! RunningCoordinator - runcoord.activeSessionCoordinator?.toxManager.chats.sendOwnPush() } else { os_log("AppDelegate:applicationDidEnterBackground:PushSelf:longer-bg-mode not active in settings") } @@ -237,6 +243,9 @@ class AppDelegate: UIResponder, UIApplicationDelegate { func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) { + let token = deviceToken.map { String(format: "%02.2hhx", $0) }.joined() + // TODO(Tha_14): Save the token in db. + print("Device Token: \(token)") print("APNs token retrieved: \(deviceToken)") os_log("AppDelegate:didRegisterForRemoteNotificationsWithDeviceToken") } diff --git a/Antidote/SettingsAdvancedController.swift b/Antidote/SettingsAdvancedController.swift index 6ea0d94..d2bd13a 100644 --- a/Antidote/SettingsAdvancedController.swift +++ b/Antidote/SettingsAdvancedController.swift @@ -46,6 +46,8 @@ private extension SettingsAdvancedController { restoreDefaultsModel.title = String(localized: "settings_restore_default") restoreDefaultsModel.didSelectHandler = restoreDefaultsSettings + + //TODO(Tha_14): Add description text regarding use with tor, UDP required Disabled. } func UDPChanged(_ on: Bool) { diff --git a/Antidote/UserStatus.swift b/Antidote/UserStatus.swift index 5afdedf..09a659c 100644 --- a/Antidote/UserStatus.swift +++ b/Antidote/UserStatus.swift @@ -20,6 +20,8 @@ enum UserStatus { self = .away case (_, .busy): self = .busy + default: + self = .offline } } diff --git a/Antidote/dark-theme.yaml b/Antidote/dark-theme.yaml new file mode 100644 index 0000000..41b7c47 --- /dev/null +++ b/Antidote/dark-theme.yaml @@ -0,0 +1,86 @@ +version: 1 + +colors: + white: FFFFFF + transparent_white: FFFFFF55 + transparent_dark_gray: 413839DD + black: "000000" + gray: CCCCCC + lightgraypink: EFEFF4 + darkgray: AAAAAA + color_offline_status: "A3A3A3" + darkgray2: 8C8C8C + lightgrayblue: EDF3F5 + simpleblue: 2E76D3 + mediumblue: 00A7E9 + lightblue: 9CBDE9 + purple: 575CCF + green: 85B452 + green_bright: 00D116 + yellow: FFF300 + pushyellow: FFC533 + red: E94F42 + palered: C56258 + rust: B7410E + +values: + login-background: white + login-gradient: lightblue + login-tox-logo: simpleblue + login-button-text: white + login-button-background: simpleblue + login-description-label: white + login-form-background: white + login-form-text: black + login-link-color: white + + # Color used for fullscreen translucent views background, e.g. fullscreen picker + translucent-background: transparent_white + + # normal background color used all over application + normal-background: white + normal-text: black + link-text: simpleblue + connecting-background: simpleblue + connecting-text: white + separators-and-borders: gray + rounded-button-text: white + rounded-positive-button-background: simpleblue + rounded-negative-button-background: gray + offline-status: color_offline_status + online-status: green_bright + away-status: yellow + busy-status: palered + status-background: white + friend-cell-status: darkgray2 + chat-list-cell-message: darkgray + chat-list-cell-unread-background: lightgrayblue + chat-input-background: lightgrayblue + chat-incoming-bubble: lightgrayblue + chat-outgoing-bubble: purple + chat-outgoing-unread-bubble: rust + chat-outgoing-sentpush-bubble: pushyellow + chat-information-text: darkgray2 + tab-badge-background: palered + tab-badge-text: white + tab-item-active: simpleblue + tab-item-inactive: darkgray2 + notification-background: transparent_dark_gray + notification-text: white + settings-background: lightgraypink + call-text-color: white + call-decline-button-background: red + call-answer-button-background: green + call-control-background: simpleblue + call-control-selected-background: white + call-button-icon-color: white + call-button-selected-icon-color: simpleblue + call-video-preview-background: black + empty-screen-placeholder-text: darkgray + file-image-background-active: darkgray + file-image-cancelled-text: white + file-image-accept-button-tint: white + file-image-cancel-button-tint: black + lock-gradient-top: mediumblue + lock-gradient-bottom: purple + chat-list-cell-arrow-unread-background: red diff --git a/Podfile b/Podfile index 607eb9e..6e0044e 100644 --- a/Podfile +++ b/Podfile @@ -15,7 +15,6 @@ def common_pods pod 'JGProgressHUD', '~> 1.4.0' pod 'SnapKit', '~> 5.6.0' pod 'Yaml', '~> 3.4.4' - pod 'Firebase/Messaging', '~> 8.15.0' end target :Antidote do diff --git a/local_pod_repo/objcTox/Classes/Private/Manager/Submanagers/OCTSubmanagerChatsImpl.m b/local_pod_repo/objcTox/Classes/Private/Manager/Submanagers/OCTSubmanagerChatsImpl.m index 5e62b3b..dfda1ea 100644 --- a/local_pod_repo/objcTox/Classes/Private/Manager/Submanagers/OCTSubmanagerChatsImpl.m +++ b/local_pod_repo/objcTox/Classes/Private/Manager/Submanagers/OCTSubmanagerChatsImpl.m @@ -12,7 +12,7 @@ #import "OCTSendMessageOperation.h" #import "OCTTox+Private.h" #import "OCTToxOptions+Private.h" -#import "Firebase.h" +//#import "Firebase.h" @interface OCTSubmanagerChatsImpl () @@ -71,18 +71,6 @@ - (void)sendOwnPush { - NSLog(@"PUSH:sendOwnPush"); - NSString *token = [FIRMessaging messaging].FCMToken; - if (token.length > 0) - { - NSString *my_pushToken = [NSString stringWithFormat:@"https://tox.zoff.xyz/toxfcm/fcm.php?id=%@&type=1", token]; - // NSLog(@"token push url=%@", my_pushToken); - triggerPush(my_pushToken, nil, nil, nil); - } - else - { - NSLog(@"PUSH:sendOwnPush:no token"); - } } - (void)sendMessagePushToChat:(OCTChat *)chat @@ -499,13 +487,6 @@ triggerPush(NSString *used_pushToken, NSString *publicKey = [[self.dataSource managerGetTox] publicKeyFromFriendNumber:friendNumber error:nil]; OCTFriend *friend = [realmManager friendWithPublicKey:publicKey]; - if (friend.msgv3Capability == YES) - { - // HINT: if friend has msgV3 capability, we ignore the low level ACK and keep waiting for the high level ACK - OCTLogInfo(@"messageDelivered ignoring low level ACK %@", friend); - return; - } - OCTChat *chat = [realmManager getOrCreateChatWithFriend:friend]; NSPredicate *predicate = [NSPredicate predicateWithFormat:@"chatUniqueIdentifier == %@ AND messageText.messageId == %d", diff --git a/local_pod_repo/objcTox/Classes/Private/Manager/Submanagers/OCTSubmanagerFriendsImpl.m b/local_pod_repo/objcTox/Classes/Private/Manager/Submanagers/OCTSubmanagerFriendsImpl.m index b29d87b..303a3ff 100644 --- a/local_pod_repo/objcTox/Classes/Private/Manager/Submanagers/OCTSubmanagerFriendsImpl.m +++ b/local_pod_repo/objcTox/Classes/Private/Manager/Submanagers/OCTSubmanagerFriendsImpl.m @@ -8,7 +8,7 @@ #import "OCTFriend.h" #import "OCTFriendRequest.h" #import "OCTRealmManager.h" -#import "Firebase.h" +//#import "Firebase.h" @implementation OCTSubmanagerFriendsImpl @synthesize dataSource = _dataSource; @@ -232,12 +232,11 @@ NSString *publicKey = [[self.dataSource managerGetTox] publicKeyFromFriendNumber:friendNumber error:nil]; OCTFriend *friend = [realmManager friendWithPublicKey:publicKey]; - if (friend.msgv3Capability != msgv3Capability) - { - [realmManager updateObject:friend withBlock:^(OCTFriend *theFriend) { - theFriend.msgv3Capability = msgv3Capability; - }]; - } + //TODO(Tha_14): Remove this after removing msgv3 stuff + [realmManager updateObject:friend withBlock:^(OCTFriend *theFriend) { + theFriend.msgv3Capability = 0; + }]; + } - (void)tox:(OCTTox *)tox friendConnectionStatusChanged:(OCTToxConnectionStatus)status friendNumber:(OCTToxFriendNumber)friendNumber @@ -255,26 +254,11 @@ { // Friend is coming online now - OCTToxCapabilities f_caps = [tox friendGetCapabilitiesWithFriendNumber:friendNumber]; - OCTLogVerbose(@"f_caps=%lu", f_caps); - NSString* cap_string = [NSString stringWithFormat:@"%lu", f_caps]; - theFriend.capabilities2 = cap_string; +// OCTToxCapabilities f_caps = [tox friendGetCapabilitiesWithFriendNumber:friendNumber]; +// OCTLogVerbose(@"f_caps=%lu", f_caps); +// NSString* cap_string = [NSString stringWithFormat:@"%lu", f_caps]; +// theFriend.capabilities2 = cap_string; - NSString *token = [FIRMessaging messaging].FCMToken; - if (token.length > 0) - { - // HINT: prepend a dummy "A" char as placeholder for Tox Packet ID. - // it will be replaced in sendLosslessPacketWithFriendNumber by pktid - NSString *data = [NSString stringWithFormat:@"Ahttps://tox.zoff.xyz/toxfcm/fcm.php?id=%@&type=1", token]; - // NSLog(@"token push url=%@", data); - NSError *error; - - // HINT: pktid 181 is for sending push urls to friends - BOOL result = [tox sendLosslessPacketWithFriendNumber:friendNumber - pktid:181 - data:data - error:&error]; - } } theFriend.isConnected = (status != OCTToxConnectionStatusNone); theFriend.connectionStatus = status; diff --git a/pushextension/Info.plist b/pushextension/Info.plist index 7e6e493..2851cbe 100644 --- a/pushextension/Info.plist +++ b/pushextension/Info.plist @@ -17,9 +17,9 @@ CFBundlePackageType $(PRODUCT_BUNDLE_PACKAGE_TYPE) CFBundleShortVersionString - 1.4.28 + $(MARKETING_VERSION) CFBundleVersion - 142800 + $(CURRENT_PROJECT_VERSION) NSExtension NSExtensionPointIdentifier