diff --git a/CMakeLists.txt b/CMakeLists.txt index c1d0d8f2f907830f3a9fcf06e6ee82a585325922..ad4aaad038abff1993d84bba037b0e6aa5f3001a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -223,13 +223,6 @@ list (APPEND opendht_SOURCES src/thread_pool.cpp ) -if (APPLE) - list (APPEND opendht_SOURCES - src/compat/apple/apple_utils.h - src/compat/apple/apple_utils.mm - ) -endif() - list (APPEND opendht_HEADERS include/opendht/def.h include/opendht/utils.h diff --git a/configure.ac b/configure.ac index 61b565bd28977be99ae531f417324669cb9aaf9a..4afaad1e91edb0d38836ffda5ea5b18f826e0a4b 100644 --- a/configure.ac +++ b/configure.ac @@ -32,7 +32,6 @@ LT_INIT() LT_LANG(C++) AC_LANG(C++) AC_PROG_CXX -AC_PROG_OBJCXX AX_CXX_COMPILE_STDCXX(17,[noext],[mandatory]) dnl Check for logs @@ -92,7 +91,6 @@ case "${host_os}" in SYS=linux ;; darwin*) - APPLE=1 SYS=darwin ;; mingw32*) @@ -112,7 +110,6 @@ case "${host_os}" in ;; esac -AM_CONDITIONAL(APPLE, [test "x$SYS" = "xdarwin"]) AM_CONDITIONAL(WIN32, [test "x$SYS" = "xmingw32"]) AS_IF([test "x$SYS" = "xandroid"], [], [LDFLAGS="${LDFLAGS} -lpthread"]) @@ -191,7 +188,6 @@ AM_COND_IF([PROXY_CLIENT_OR_SERVER], [ ]) CXXFLAGS="${CXXFLAGS} -DMSGPACK_NO_BOOST -DMSGPACK_DISABLE_LEGACY_NIL -DMSGPACK_DISABLE_LEGACY_CONVERT" -OBJCXX="$CXX $CXXFLAGS" AC_ARG_ENABLE([tools], AS_HELP_STRING([--disable-tools],[Disable tools (CLI DHT node)]),,build_tools=yes) AM_CONDITIONAL(ENABLE_TOOLS, test x$build_tools == xyes) diff --git a/include/opendht/dht_proxy_server.h b/include/opendht/dht_proxy_server.h index 742a5e7f7a87b666e3ba889094c259997b9737c1..63d527c2d7b103b24447dda913b5820a06c5b151 100644 --- a/include/opendht/dht_proxy_server.h +++ b/include/opendht/dht_proxy_server.h @@ -40,8 +40,7 @@ namespace dht { enum class PushType { None = 0, Android, - iOS, - iOSLegacy + iOS }; } MSGPACK_ADD_ENUM(dht::PushType) diff --git a/src/Makefile.am b/src/Makefile.am index e7a23ad7b9edf128d2a9fb6691599248a85acab5..acaccf79620963c78278408aeca154b1c830cf2b 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -30,12 +30,6 @@ libopendht_la_SOURCES = \ network_utils.cpp \ thread_pool.cpp -if APPLE -libopendht_la_SOURCES += \ - compat/apple/apple_utils.h \ - compat/apple/apple_utils.mm -endif - if WIN32 libopendht_la_SOURCES += rng.cpp endif diff --git a/src/compat/apple/apple_utils.h b/src/compat/apple/apple_utils.h deleted file mode 100644 index e308398a30146f4b10827abad30bc5f4c239d0de..0000000000000000000000000000000000000000 --- a/src/compat/apple/apple_utils.h +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright (C) 2014-2022 Savoir-faire Linux Inc. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -#include <string> - -namespace dht { -namespace apple_utils { - -std::string getPlatformVersion(); - -} -} diff --git a/src/compat/apple/apple_utils.mm b/src/compat/apple/apple_utils.mm deleted file mode 100644 index 427f4f1ca84b517ca486a2ae99f6ab2c22f3fb68..0000000000000000000000000000000000000000 --- a/src/compat/apple/apple_utils.mm +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (C) 2014-2022 Savoir-faire Linux Inc. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -#include "apple_utils.h" - -#ifdef __APPLE__ -#include <Foundation/Foundation.h> -#include "TargetConditionals.h" -#endif - -namespace dht { -namespace apple_utils { - -std::string -getPlatformVersion() { -#ifdef __APPLE__ - #if TARGET_OS_IPHONE - if (@available(iOS 14.5, *)) { - return "ios"; - } - return "apple"; - #elif TARGET_OS_MAC - return "macos"; - #endif -#endif - return ""; -} - -} -} /* dht */ diff --git a/src/dht_proxy_client.cpp b/src/dht_proxy_client.cpp index 6930da8cc64111ccf490aea7605817dbcf11db1b..6085741c4c93ed5e3389c19b8827f968816b393a 100644 --- a/src/dht_proxy_client.cpp +++ b/src/dht_proxy_client.cpp @@ -22,9 +22,6 @@ #include "dhtrunner.h" #include "op_cache.h" #include "utils.h" -#ifdef __APPLE__ -#include "compat/apple/apple_utils.h" -#endif #include <http_parser.h> #include <deque> @@ -1308,7 +1305,7 @@ DhtProxyClient::getPushRequest(Json::Value& body) const #endif #ifdef __APPLE__ body["topic"] = notificationTopic_; - body["platform"] = apple_utils::getPlatformVersion(); + body["platform"] = "ios"; #endif } diff --git a/src/dht_proxy_server.cpp b/src/dht_proxy_server.cpp index f391fa6f12e102d750072ab0b0d7a83cd97981ac..5b1fbb0bda580db694d1ca08645bff178dcfbf9c 100644 --- a/src/dht_proxy_server.cpp +++ b/src/dht_proxy_server.cpp @@ -756,20 +756,12 @@ DhtProxyServer::getTypeFromString(const std::string& type) { return PushType::Android; else if (type == "ios") return PushType::iOS; - else if (type == "apple") - return PushType::iOSLegacy; // proxy_client is not updated or using ios < 14.5 return PushType::None; } std::string DhtProxyServer::getDefaultTopic(PushType type) { - if (bundleId_.empty()) - return {}; - if (type == PushType::iOS) - return bundleId_; - else if (type == PushType::iOSLegacy) - return bundleId_ + ".voip"; - return {}; + return bundleId_; } RequestStatus @@ -1045,19 +1037,15 @@ DhtProxyServer::sendPushNotification(const std::string& token, Json::Value&& jso notification["expiration"] = exp; if (!topic.empty()) notification["topic"] = topic; - if (type == PushType::iOS) { - if (highPriority) { - Json::Value alert(Json::objectValue); - alert["title"]="hello"; - notification["push_type"] = "alert"; - notification["alert"] = alert; - notification["mutable_content"] = true; - } else { - notification["push_type"] = "background"; - notification["content_available"] = true; - } - } else if (type == PushType::iOSLegacy) { - notification["push_type"] = "voip"; + if (highPriority) { + Json::Value alert(Json::objectValue); + alert["title"]="hello"; + notification["push_type"] = "alert"; + notification["alert"] = alert; + notification["mutable_content"] = true; + } else { + notification["push_type"] = "background"; + notification["content_available"] = true; } }