From fcfd498bc4cbf0085daddcd7460daa603e7a946f Mon Sep 17 00:00:00 2001 From: Owen Harvey Date: Fri, 3 Nov 2023 14:48:25 +1000 Subject: [PATCH 1/9] WIP --- libs/wire-api/src/Wire/API/Push/V2/Token.hs | 8 +---- .../golden/Test/Wire/API/Golden/Generated.hs | 6 ---- .../Push_2eToken_2eTransport_user.hs | 8 +---- .../golden/Test/Wire/API/Golden/Manual.hs | 4 --- .../Test/Wire/API/Golden/Manual/Token.hs | 29 ------------------- ...bject_Push_2eToken_2eTransport_user_4.json | 1 - ...bject_Push_2eToken_2eTransport_user_5.json | 1 - .../test/golden/testObject_Token_1.json | 6 ---- libs/wire-api/test/unit/Test/Wire/API/MLS.hs | 5 ++-- libs/wire-api/wire-api.cabal | 1 - services/brig/docs/swagger-v3.json | 4 +-- services/brig/docs/swagger-v4.json | 4 +-- services/gundeck/src/Gundeck/Aws.hs | 19 ++++-------- services/gundeck/src/Gundeck/Aws/Arn.hs | 4 --- services/gundeck/src/Gundeck/Instances.hs | 4 --- services/gundeck/src/Gundeck/Push.hs | 16 ++-------- .../src/Gundeck/Push/Native/Serialise.hs | 9 ------ services/gundeck/test/integration/API.hs | 5 ++-- services/gundeck/test/unit/Native.hs | 2 -- 19 files changed, 16 insertions(+), 120 deletions(-) delete mode 100644 libs/wire-api/test/golden/Test/Wire/API/Golden/Manual/Token.hs delete mode 100644 libs/wire-api/test/golden/testObject_Push_2eToken_2eTransport_user_4.json delete mode 100644 libs/wire-api/test/golden/testObject_Push_2eToken_2eTransport_user_5.json delete mode 100644 libs/wire-api/test/golden/testObject_Token_1.json diff --git a/libs/wire-api/src/Wire/API/Push/V2/Token.hs b/libs/wire-api/src/Wire/API/Push/V2/Token.hs index 0cf7b292af..79f282b4d0 100644 --- a/libs/wire-api/src/Wire/API/Push/V2/Token.hs +++ b/libs/wire-api/src/Wire/API/Push/V2/Token.hs @@ -115,8 +115,6 @@ data Transport = GCM | APNS | APNSSandbox - | APNSVoIP - | APNSVoIPSandbox deriving stock (Eq, Ord, Show, Bounded, Enum, Generic) deriving (Arbitrary) via (GenericUniform Transport) deriving (A.ToJSON, A.FromJSON, S.ToSchema) via (Schema Transport) @@ -127,9 +125,7 @@ instance ToSchema Transport where mconcat [ element "GCM" GCM, element "APNS" APNS, - element "APNS_SANDBOX" APNSSandbox, - element "APNS_VOIP" APNSVoIP, - element "APNS_VOIP_SANDBOX" APNSVoIPSandbox + element "APNS_SANDBOX" APNSSandbox ] instance FromByteString Transport where @@ -138,8 +134,6 @@ instance FromByteString Transport where "GCM" -> pure GCM "APNS" -> pure APNS "APNS_SANDBOX" -> pure APNSSandbox - "APNS_VOIP" -> pure APNSVoIP - "APNS_VOIP_SANDBOX" -> pure APNSVoIPSandbox x -> fail $ "Invalid push transport: " <> show x newtype Token = Token diff --git a/libs/wire-api/test/golden/Test/Wire/API/Golden/Generated.hs b/libs/wire-api/test/golden/Test/Wire/API/Golden/Generated.hs index a6003b36d8..52cde0922b 100644 --- a/libs/wire-api/test/golden/Test/Wire/API/Golden/Generated.hs +++ b/libs/wire-api/test/golden/Test/Wire/API/Golden/Generated.hs @@ -791,12 +791,6 @@ tests = ), ( Test.Wire.API.Golden.Generated.Push_2eToken_2eTransport_user.testObject_Push_2eToken_2eTransport_user_3, "testObject_Push_2eToken_2eTransport_user_3.json" - ), - ( Test.Wire.API.Golden.Generated.Push_2eToken_2eTransport_user.testObject_Push_2eToken_2eTransport_user_4, - "testObject_Push_2eToken_2eTransport_user_4.json" - ), - ( Test.Wire.API.Golden.Generated.Push_2eToken_2eTransport_user.testObject_Push_2eToken_2eTransport_user_5, - "testObject_Push_2eToken_2eTransport_user_5.json" ) ], testGroup "Golden: Token_user" $ diff --git a/libs/wire-api/test/golden/Test/Wire/API/Golden/Generated/Push_2eToken_2eTransport_user.hs b/libs/wire-api/test/golden/Test/Wire/API/Golden/Generated/Push_2eToken_2eTransport_user.hs index 96739ba620..fc7c1ed7f1 100644 --- a/libs/wire-api/test/golden/Test/Wire/API/Golden/Generated/Push_2eToken_2eTransport_user.hs +++ b/libs/wire-api/test/golden/Test/Wire/API/Golden/Generated/Push_2eToken_2eTransport_user.hs @@ -17,7 +17,7 @@ module Test.Wire.API.Golden.Generated.Push_2eToken_2eTransport_user where -import Wire.API.Push.Token (Transport (APNS, APNSSandbox, APNSVoIP, APNSVoIPSandbox, GCM)) +import Wire.API.Push.Token (Transport (APNS, APNSSandbox, GCM)) import Wire.API.Push.Token qualified as Push.Token (Transport) testObject_Push_2eToken_2eTransport_user_1 :: Push.Token.Transport @@ -28,9 +28,3 @@ testObject_Push_2eToken_2eTransport_user_2 = APNS testObject_Push_2eToken_2eTransport_user_3 :: Push.Token.Transport testObject_Push_2eToken_2eTransport_user_3 = APNSSandbox - -testObject_Push_2eToken_2eTransport_user_4 :: Push.Token.Transport -testObject_Push_2eToken_2eTransport_user_4 = APNSVoIP - -testObject_Push_2eToken_2eTransport_user_5 :: Push.Token.Transport -testObject_Push_2eToken_2eTransport_user_5 = APNSVoIPSandbox diff --git a/libs/wire-api/test/golden/Test/Wire/API/Golden/Manual.hs b/libs/wire-api/test/golden/Test/Wire/API/Golden/Manual.hs index 2760f871da..6a8e528ad2 100644 --- a/libs/wire-api/test/golden/Test/Wire/API/Golden/Manual.hs +++ b/libs/wire-api/test/golden/Test/Wire/API/Golden/Manual.hs @@ -39,7 +39,6 @@ import Test.Wire.API.Golden.Manual.QualifiedUserClientPrekeyMap import Test.Wire.API.Golden.Manual.SearchResultContact import Test.Wire.API.Golden.Manual.SubConversation import Test.Wire.API.Golden.Manual.TeamSize -import Test.Wire.API.Golden.Manual.Token import Test.Wire.API.Golden.Manual.UserClientPrekeyMap import Test.Wire.API.Golden.Manual.UserIdList import Test.Wire.API.Golden.Runner @@ -141,9 +140,6 @@ tests = testGroup "GroupId" $ testObjects [(testObject_GroupId_1, "testObject_GroupId_1.json")], - testGroup "PushToken" $ - testObjects - [(testObject_Token_1, "testObject_Token_1.json")], testGroup "TeamSize" $ testObjects [ (testObject_TeamSize_1, "testObject_TeamSize_1.json"), diff --git a/libs/wire-api/test/golden/Test/Wire/API/Golden/Manual/Token.hs b/libs/wire-api/test/golden/Test/Wire/API/Golden/Manual/Token.hs deleted file mode 100644 index edf7a8edd7..0000000000 --- a/libs/wire-api/test/golden/Test/Wire/API/Golden/Manual/Token.hs +++ /dev/null @@ -1,29 +0,0 @@ --- This file is part of the Wire Server implementation. --- --- Copyright (C) 2022 Wire Swiss GmbH --- --- This program is free software: you can redistribute it and/or modify it under --- the terms of the GNU Affero 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 Affero General Public License for more --- details. --- --- You should have received a copy of the GNU Affero General Public License along --- with this program. If not, see . - -module Test.Wire.API.Golden.Manual.Token where - -import Data.Id -import Wire.API.Push.V2.Token - -testObject_Token_1 :: PushToken -testObject_Token_1 = - pushToken - APNSVoIPSandbox - (AppName {appNameText = "j{\110746\SOH_\1084873M"}) - (Token {tokenText = "K"}) - (ClientId {client = "6"}) diff --git a/libs/wire-api/test/golden/testObject_Push_2eToken_2eTransport_user_4.json b/libs/wire-api/test/golden/testObject_Push_2eToken_2eTransport_user_4.json deleted file mode 100644 index d177fe0e9d..0000000000 --- a/libs/wire-api/test/golden/testObject_Push_2eToken_2eTransport_user_4.json +++ /dev/null @@ -1 +0,0 @@ -"APNS_VOIP" diff --git a/libs/wire-api/test/golden/testObject_Push_2eToken_2eTransport_user_5.json b/libs/wire-api/test/golden/testObject_Push_2eToken_2eTransport_user_5.json deleted file mode 100644 index fd689b4ac1..0000000000 --- a/libs/wire-api/test/golden/testObject_Push_2eToken_2eTransport_user_5.json +++ /dev/null @@ -1 +0,0 @@ -"APNS_VOIP_SANDBOX" diff --git a/libs/wire-api/test/golden/testObject_Token_1.json b/libs/wire-api/test/golden/testObject_Token_1.json deleted file mode 100644 index 36f8ff69bd..0000000000 --- a/libs/wire-api/test/golden/testObject_Token_1.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "app": "j{𛂚\u0001_􈷉M", - "client": "6", - "token": "K", - "transport": "APNS_VOIP_SANDBOX" -} diff --git a/libs/wire-api/test/unit/Test/Wire/API/MLS.hs b/libs/wire-api/test/unit/Test/Wire/API/MLS.hs index 74652d8662..024e345e42 100644 --- a/libs/wire-api/test/unit/Test/Wire/API/MLS.hs +++ b/libs/wire-api/test/unit/Test/Wire/API/MLS.hs @@ -29,6 +29,7 @@ import Data.Qualified import Data.Text qualified as T import Data.Text qualified as Text import Data.UUID.V4 qualified as UUID +import Debug.Trace qualified as T import Imports import System.Exit import System.FilePath (()) @@ -122,7 +123,7 @@ testParseApplication = do qcid <- B8.unpack . encodeMLS' <$> randomIdentity msgData <- withSystemTempDirectory "mls" $ \tmp -> do void $ spawn (cli qcid tmp ["init", qcid]) Nothing - groupJSON <- spawn (cli qcid tmp ["group", "create", "Zm9v"]) Nothing + groupJSON <- spawn (T.traceShowId (cli qcid tmp ["group", "create", "Zm9v"])) Nothing spawn (cli qcid tmp ["message", "--group-in", "-", "hello"]) (Just groupJSON) msg <- case decodeMLS' @Message msgData of @@ -301,7 +302,7 @@ spawn cp minput = do in snd <$> concurrently writeInput readOutput case (mout, ex) of (Just out, ExitSuccess) -> pure out - _ -> assertFailure "Failed spawning process" + _ -> assertFailure $ "Failed spawning process\n" <> show mout <> "\n" <> show ex cli :: String -> FilePath -> [String] -> CreateProcess cli store tmp args = diff --git a/libs/wire-api/wire-api.cabal b/libs/wire-api/wire-api.cabal index 9329777297..972a2e1202 100644 --- a/libs/wire-api/wire-api.cabal +++ b/libs/wire-api/wire-api.cabal @@ -581,7 +581,6 @@ test-suite wire-api-golden-tests Test.Wire.API.Golden.Manual.SearchResultContact Test.Wire.API.Golden.Manual.SubConversation Test.Wire.API.Golden.Manual.TeamSize - Test.Wire.API.Golden.Manual.Token Test.Wire.API.Golden.Manual.UserClientPrekeyMap Test.Wire.API.Golden.Manual.UserIdList Test.Wire.API.Golden.Protobuf diff --git a/services/brig/docs/swagger-v3.json b/services/brig/docs/swagger-v3.json index e252a73971..b844341e75 100644 --- a/services/brig/docs/swagger-v3.json +++ b/services/brig/docs/swagger-v3.json @@ -14,9 +14,7 @@ "enum": [ "GCM", "APNS", - "APNS_SANDBOX", - "APNS_VOIP", - "APNS_VOIP_SANDBOX" + "APNS_SANDBOX" ], "type": "string" }, diff --git a/services/brig/docs/swagger-v4.json b/services/brig/docs/swagger-v4.json index 937aafdefc..7ff1394f34 100644 --- a/services/brig/docs/swagger-v4.json +++ b/services/brig/docs/swagger-v4.json @@ -4828,9 +4828,7 @@ "enum": [ "GCM", "APNS", - "APNS_SANDBOX", - "APNS_VOIP", - "APNS_VOIP_SANDBOX" + "APNS_SANDBOX" ], "type": "string" }, diff --git a/services/gundeck/src/Gundeck/Aws.hs b/services/gundeck/src/Gundeck/Aws.hs index ab8dd27c69..bc90ab2948 100644 --- a/services/gundeck/src/Gundeck/Aws.hs +++ b/services/gundeck/src/Gundeck/Aws.hs @@ -367,17 +367,12 @@ newtype Attributes = Attributes -- Note [VoIP TTLs] -- ~~~~~~~~~~~~~~~~ --- The TTL message attributes for APNS_VOIP and APNS_VOIP_SANDBOX are not --- documented but appear to work. The reason might be that TTLs were --- introduced before support for VoIP notifications. There is a catch, --- however. For GCM, APNS and APNS_SANDBOX, SNS treats the TTL "0" +-- For GCM, APNS and APNS_SANDBOX, SNS treats the TTL "0" -- specially, i.e. it forwards it to the provider where it has a special --- meaning. That does not appear to be the case for APNS_VOIP and --- APNS_VOIP_SANDBOX, for which the TTL is interpreted normally, which means --- if the TTL is lower than the "dwell time" in SNS, the notification is --- never sent to the provider. So we must specify a reasonably large TTL --- for transient VoIP notifications, so that they are not discarded --- already by SNS. +-- meaning. Which means if the TTL is lower than the "dwell time" in SNS, +-- the notification is never sent to the provider. So we must specify a +-- reasonably large TTL for transient VoIP notifications, so that they are +-- not discarded already by SNS. -- -- cf. http://docs.aws.amazon.com/sns/latest/dg/sns-ttl.html @@ -393,13 +388,9 @@ timeToLive t s = Attributes (Endo (ttlAttr s)) ttlNow GCM = "0" ttlNow APNS = "0" ttlNow APNSSandbox = "0" - ttlNow APNSVoIP = "15" -- See note [VoIP TTLs] - ttlNow APNSVoIPSandbox = "15" -- See note [VoIP TTLs] ttlKey GCM = "AWS.SNS.MOBILE.GCM.TTL" ttlKey APNS = "AWS.SNS.MOBILE.APNS.TTL" ttlKey APNSSandbox = "AWS.SNS.MOBILE.APNS_SANDBOX.TTL" - ttlKey APNSVoIP = "AWS.SNS.MOBILE.APNS_VOIP.TTL" - ttlKey APNSVoIPSandbox = "AWS.SNS.MOBILE.APNS_VOIP_SANDBOX.TTL" publish :: EndpointArn -> LT.Text -> Attributes -> Amazon (Either PublishError ()) publish arn txt attrs = do diff --git a/services/gundeck/src/Gundeck/Aws/Arn.hs b/services/gundeck/src/Gundeck/Aws/Arn.hs index c0be6380d7..7a559314f6 100644 --- a/services/gundeck/src/Gundeck/Aws/Arn.hs +++ b/services/gundeck/src/Gundeck/Aws/Arn.hs @@ -134,8 +134,6 @@ arnTransportText :: Transport -> Text arnTransportText GCM = "GCM" arnTransportText APNS = "APNS" arnTransportText APNSSandbox = "APNS_SANDBOX" -arnTransportText APNSVoIP = "APNS_VOIP" -arnTransportText APNSVoIPSandbox = "APNS_VOIP_SANDBOX" -- Parsers -------------------------------------------------------------------- @@ -159,7 +157,5 @@ endpointTopicParser = do transportParser :: Parser Transport transportParser = string "GCM" $> GCM - <|> string "APNS_VOIP_SANDBOX" $> APNSVoIPSandbox - <|> string "APNS_VOIP" $> APNSVoIP <|> string "APNS_SANDBOX" $> APNSSandbox <|> string "APNS" $> APNS diff --git a/services/gundeck/src/Gundeck/Instances.hs b/services/gundeck/src/Gundeck/Instances.hs index 83ab2a692b..ab70ccc440 100644 --- a/services/gundeck/src/Gundeck/Instances.hs +++ b/services/gundeck/src/Gundeck/Instances.hs @@ -40,15 +40,11 @@ instance Cql Transport where toCql GCM = CqlInt 0 toCql APNS = CqlInt 1 toCql APNSSandbox = CqlInt 2 - toCql APNSVoIP = CqlInt 3 - toCql APNSVoIPSandbox = CqlInt 4 fromCql (CqlInt i) = case i of 0 -> pure GCM 1 -> pure APNS 2 -> pure APNSSandbox - 3 -> pure APNSVoIP - 4 -> pure APNSVoIPSandbox n -> Left $ "unexpected transport: " ++ show n fromCql _ = Left "transport: int expected" diff --git a/services/gundeck/src/Gundeck/Push.hs b/services/gundeck/src/Gundeck/Push.hs index 02c6984873..1681149d27 100644 --- a/services/gundeck/src/Gundeck/Push.hs +++ b/services/gundeck/src/Gundeck/Push.hs @@ -382,20 +382,8 @@ nativeTargets psh rcps' alreadySent = where pick pr a = case a ^. addrTransport of GCM -> True - APNS -> pr == ApsStdPreference || notAny a APNSVoIP - APNSSandbox -> pr == ApsStdPreference || notAny a APNSVoIPSandbox - APNSVoIP -> pr == ApsVoIPPreference || notAny a APNS - APNSVoIPSandbox -> pr == ApsVoIPPreference || notAny a APNSSandbox - notAny a t = - not - ( any - ( \a' -> - addrEqualClient a a' - && a ^. addrApp == a' ^. addrApp - && a' ^. addrTransport == t - ) - as - ) + APNS -> pr == ApsStdPreference + APNSSandbox -> pr == ApsStdPreference defPreference = case psh ^. pushNativePriority of LowPriority -> ApsStdPreference HighPriority -> ApsVoIPPreference diff --git a/services/gundeck/src/Gundeck/Push/Native/Serialise.hs b/services/gundeck/src/Gundeck/Push/Native/Serialise.hs index bf9e0e491c..07f783c36d 100644 --- a/services/gundeck/src/Gundeck/Push/Native/Serialise.hs +++ b/services/gundeck/src/Gundeck/Push/Native/Serialise.hs @@ -54,8 +54,6 @@ renderText t prio x = case t of GCM -> trim "GCM" (jsonString gcmJson) APNS -> trim "APNS" (jsonString stdApnsJson) APNSSandbox -> trim "APNS_SANDBOX" (jsonString stdApnsJson) - APNSVoIP -> trim "APNS_VOIP" (jsonString voipApnsJson) - APNSVoIPSandbox -> trim "APNS_VOIP_SANDBOX" (jsonString voipApnsJson) where gcmJson = object @@ -67,11 +65,6 @@ renderText t prio x = case t of [ "aps" .= apsDict, "data" .= x ] - voipApnsJson = - object - [ "aps" .= object [], - "data" .= x - ] -- https://developer.apple.com/documentation/usernotifications/modifying_content_in_newly_delivered_notifications -- Must contain `mutable-content: 1` and include an alert dictionary with title, subtitle, or body information. -- Since we have no useful data here, we send a default payload that gets overridden by the client @@ -94,8 +87,6 @@ maxPayloadSize :: Transport -> Int64 maxPayloadSize GCM = 4096 maxPayloadSize APNS = 4096 maxPayloadSize APNSSandbox = 4096 -maxPayloadSize APNSVoIP = 5120 -maxPayloadSize APNSVoIPSandbox = 5120 gcmPriority :: Priority -> Text gcmPriority LowPriority = "normal" diff --git a/services/gundeck/test/integration/API.hs b/services/gundeck/test/integration/API.hs index 930d83fa1c..051afeb7d0 100644 --- a/services/gundeck/test/integration/API.hs +++ b/services/gundeck/test/integration/API.hs @@ -838,9 +838,8 @@ testSharePushToken = do gcmTok <- Token . T.decodeUtf8 . toByteString' <$> randomId apsTok <- Token . T.decodeUtf8 . B16.encode <$> randomBytes 32 let tok1 = pushToken GCM "test" gcmTok - let tok2 = pushToken APNSVoIP "com.wire.dev.ent" apsTok - let tok3 = pushToken APNS "com.wire.int.ent" apsTok - forM_ [tok1, tok2, tok3] $ \tk -> do + let tok2 = pushToken APNS "com.wire.int.ent" apsTok + forM_ [tok1, tok2] $ \tk -> do u1 <- randomUser u2 <- randomUser c1 <- randomClientId diff --git a/services/gundeck/test/unit/Native.hs b/services/gundeck/test/unit/Native.hs index 51d56aac59..030d01c976 100644 --- a/services/gundeck/test/unit/Native.hs +++ b/services/gundeck/test/unit/Native.hs @@ -73,8 +73,6 @@ instance FromJSON SnsNotification where [("GCM", String n)] -> parseGcm n [("APNS", String n)] -> parseApns APNS n [("APNS_SANDBOX", String n)] -> parseApns APNSSandbox n - [("APNS_VOIP", String n)] -> parseApns APNSVoIP n - [("APNS_VOIP_SANDBOX", String n)] -> parseApns APNSVoIPSandbox n _ -> mempty where parseApns t n = From 45246e1192d0e5456e1bfea9a4b077ba7b10f74b Mon Sep 17 00:00:00 2001 From: Owen Harvey Date: Fri, 3 Nov 2023 16:26:33 +1000 Subject: [PATCH 2/9] WIP --- libs/gundeck-types/src/Gundeck/Types/Push/V2.hs | 3 --- libs/ropes/src/Ropes/Twilio.hs | 2 -- libs/wire-api/test/unit/Test/Wire/API/MLS.hs | 6 +++--- services/gundeck/src/Gundeck/Push.hs | 7 ++----- 4 files changed, 5 insertions(+), 13 deletions(-) diff --git a/libs/gundeck-types/src/Gundeck/Types/Push/V2.hs b/libs/gundeck-types/src/Gundeck/Types/Push/V2.hs index ab9ac4de26..f38723fe9e 100644 --- a/libs/gundeck-types/src/Gundeck/Types/Push/V2.hs +++ b/libs/gundeck-types/src/Gundeck/Types/Push/V2.hs @@ -178,16 +178,13 @@ newtype ApsLocKey = ApsLocKey {fromLocKey :: Text} data ApsPreference = ApsStdPreference - | ApsVoIPPreference deriving (Eq, Show) instance ToJSON ApsPreference where - toJSON ApsVoIPPreference = "voip" toJSON ApsStdPreference = "std" instance FromJSON ApsPreference where parseJSON = withText "ApsPreference" $ \case - "voip" -> pure ApsVoIPPreference "std" -> pure ApsStdPreference x -> fail $ "Invalid preference: " ++ show x diff --git a/libs/ropes/src/Ropes/Twilio.hs b/libs/ropes/src/Ropes/Twilio.hs index e9a935b730..11cb8c2d4e 100644 --- a/libs/ropes/src/Ropes/Twilio.hs +++ b/libs/ropes/src/Ropes/Twilio.hs @@ -129,7 +129,6 @@ data CarrierInfo = CarrierInfo data PhoneType = Landline | Mobile - | VoIp deriving (Eq, Show) instance FromJSON LookupResult where @@ -148,7 +147,6 @@ instance FromJSON PhoneType where parseJSON = withText "PhoneType" $ \case "mobile" -> pure Mobile "landline" -> pure Landline - "voip" -> pure VoIp x -> fail $ "Unexpected phone type: " ++ show x -- * Functions diff --git a/libs/wire-api/test/unit/Test/Wire/API/MLS.hs b/libs/wire-api/test/unit/Test/Wire/API/MLS.hs index 024e345e42..6fe9fdf9e7 100644 --- a/libs/wire-api/test/unit/Test/Wire/API/MLS.hs +++ b/libs/wire-api/test/unit/Test/Wire/API/MLS.hs @@ -122,9 +122,9 @@ testParseApplication :: IO () testParseApplication = do qcid <- B8.unpack . encodeMLS' <$> randomIdentity msgData <- withSystemTempDirectory "mls" $ \tmp -> do - void $ spawn (cli qcid tmp ["init", qcid]) Nothing - groupJSON <- spawn (T.traceShowId (cli qcid tmp ["group", "create", "Zm9v"])) Nothing - spawn (cli qcid tmp ["message", "--group-in", "-", "hello"]) (Just groupJSON) + void $ spawn (T.traceShowId $ cli qcid tmp ["init", qcid]) Nothing + groupJSON <- spawn (T.traceShowId $ cli qcid tmp ["group", "create", "Zm9v"]) Nothing + spawn (T.traceShowId $ cli qcid tmp ["message", "--group", "-", "hello"]) (Just groupJSON) msg <- case decodeMLS' @Message msgData of Left err -> assertFailure (T.unpack err) diff --git a/services/gundeck/src/Gundeck/Push.hs b/services/gundeck/src/Gundeck/Push.hs index 1681149d27..bc015b809a 100644 --- a/services/gundeck/src/Gundeck/Push.hs +++ b/services/gundeck/src/Gundeck/Push.hs @@ -374,8 +374,7 @@ nativeTargets psh rcps' alreadySent = null (psh ^. pushConnections) || a ^. addrConn `elem` psh ^. pushConnections -- Apply transport preference in case of alternative transports for the - -- same client (currently only APNS vs APNS VoIP). If no explicit - -- preference is given, the default preference depends on the priority. + -- same client. If no explicit preference is given, the default preference depends on the priority. preference as = let pref = psh ^. pushNativeAps >>= view apsPreference in filter (pick (fromMaybe defPreference pref)) as @@ -384,9 +383,7 @@ nativeTargets psh rcps' alreadySent = GCM -> True APNS -> pr == ApsStdPreference APNSSandbox -> pr == ApsStdPreference - defPreference = case psh ^. pushNativePriority of - LowPriority -> ApsStdPreference - HighPriority -> ApsVoIPPreference + defPreference = ApsStdPreference check :: Either SomeException [a] -> m [a] check (Left e) = mntgtLogErr e >> pure [] check (Right r) = pure r From e818bea0e5ce054e7c267db2c04ff4cf06fe238e Mon Sep 17 00:00:00 2001 From: Owen Harvey Date: Fri, 3 Nov 2023 18:08:31 +1000 Subject: [PATCH 3/9] WPB-5330: Removing more command args that are upsetting mls-test-cli --- changelog.d/3-bug-fixes/WPB-5330 | 1 + integration/test/MLS/Util.hs | 2 +- services/galley/test/integration/API/MLS/Util.hs | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) create mode 100644 changelog.d/3-bug-fixes/WPB-5330 diff --git a/changelog.d/3-bug-fixes/WPB-5330 b/changelog.d/3-bug-fixes/WPB-5330 new file mode 100644 index 0000000000..fafbef2190 --- /dev/null +++ b/changelog.d/3-bug-fixes/WPB-5330 @@ -0,0 +1 @@ +Updating tests to fix an issue calling `mls-test-cli` \ No newline at end of file diff --git a/integration/test/MLS/Util.hs b/integration/test/MLS/Util.hs index 17ffca1b70..da74ea37bb 100644 --- a/integration/test/MLS/Util.hs +++ b/integration/test/MLS/Util.hs @@ -747,7 +747,7 @@ createApplicationMessage cid messageContent = do message <- mlscli cid - ["message", "--group-in", "", messageContent, "--group-out", ""] + ["message", "--group", "", messageContent] Nothing pure diff --git a/services/galley/test/integration/API/MLS/Util.hs b/services/galley/test/integration/API/MLS/Util.hs index f15e326db3..435c4f0c6a 100644 --- a/services/galley/test/integration/API/MLS/Util.hs +++ b/services/galley/test/integration/API/MLS/Util.hs @@ -647,7 +647,7 @@ createApplicationMessage cid messageContent = do message <- mlscli cid - ["message", "--group-in", "", messageContent, "--group-out", ""] + ["message", "--group", "", messageContent] Nothing pure $ From 8d8447c1fa8ce43bc573465b42f5f6fbf06d2ea1 Mon Sep 17 00:00:00 2001 From: Owen Harvey Date: Tue, 7 Nov 2023 16:03:49 +1000 Subject: [PATCH 4/9] WPB-5204: Reverting changes to mls-test-cli calls --- integration/test/MLS/Util.hs | 2 +- libs/wire-api/test/unit/Test/Wire/API/MLS.hs | 7 +++---- services/galley/test/integration/API/MLS/Util.hs | 2 +- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/integration/test/MLS/Util.hs b/integration/test/MLS/Util.hs index da74ea37bb..17ffca1b70 100644 --- a/integration/test/MLS/Util.hs +++ b/integration/test/MLS/Util.hs @@ -747,7 +747,7 @@ createApplicationMessage cid messageContent = do message <- mlscli cid - ["message", "--group", "", messageContent] + ["message", "--group-in", "", messageContent, "--group-out", ""] Nothing pure diff --git a/libs/wire-api/test/unit/Test/Wire/API/MLS.hs b/libs/wire-api/test/unit/Test/Wire/API/MLS.hs index 6fe9fdf9e7..348dbc4fdc 100644 --- a/libs/wire-api/test/unit/Test/Wire/API/MLS.hs +++ b/libs/wire-api/test/unit/Test/Wire/API/MLS.hs @@ -29,7 +29,6 @@ import Data.Qualified import Data.Text qualified as T import Data.Text qualified as Text import Data.UUID.V4 qualified as UUID -import Debug.Trace qualified as T import Imports import System.Exit import System.FilePath (()) @@ -122,9 +121,9 @@ testParseApplication :: IO () testParseApplication = do qcid <- B8.unpack . encodeMLS' <$> randomIdentity msgData <- withSystemTempDirectory "mls" $ \tmp -> do - void $ spawn (T.traceShowId $ cli qcid tmp ["init", qcid]) Nothing - groupJSON <- spawn (T.traceShowId $ cli qcid tmp ["group", "create", "Zm9v"]) Nothing - spawn (T.traceShowId $ cli qcid tmp ["message", "--group", "-", "hello"]) (Just groupJSON) + void $ spawn (cli qcid tmp ["init", qcid]) Nothing + groupJSON <- spawn (cli qcid tmp ["group", "create", "Zm9v"]) Nothing + spawn (cli qcid tmp ["message", "--group-in", "-", "hello"]) (Just groupJSON) msg <- case decodeMLS' @Message msgData of Left err -> assertFailure (T.unpack err) diff --git a/services/galley/test/integration/API/MLS/Util.hs b/services/galley/test/integration/API/MLS/Util.hs index 435c4f0c6a..f15e326db3 100644 --- a/services/galley/test/integration/API/MLS/Util.hs +++ b/services/galley/test/integration/API/MLS/Util.hs @@ -647,7 +647,7 @@ createApplicationMessage cid messageContent = do message <- mlscli cid - ["message", "--group", "", messageContent] + ["message", "--group-in", "", messageContent, "--group-out", ""] Nothing pure $ From 0e7a0374109a920e26978ccce5377e6aab14bdfa Mon Sep 17 00:00:00 2001 From: Owen Harvey Date: Tue, 7 Nov 2023 16:44:17 +1000 Subject: [PATCH 5/9] WPB-5204: Adding changelog --- changelog.d/5-internal/WPB-5204 | 1 + 1 file changed, 1 insertion(+) create mode 100644 changelog.d/5-internal/WPB-5204 diff --git a/changelog.d/5-internal/WPB-5204 b/changelog.d/5-internal/WPB-5204 new file mode 100644 index 0000000000..57f2d333fd --- /dev/null +++ b/changelog.d/5-internal/WPB-5204 @@ -0,0 +1 @@ +Removed APNS_VOIP code. \ No newline at end of file From 7f2a02917358d3a20ce2a9ef358f0bb52862fafa Mon Sep 17 00:00:00 2001 From: Owen Harvey Date: Tue, 7 Nov 2023 16:46:36 +1000 Subject: [PATCH 6/9] Removing a changelog from a prior merge --- changelog.d/3-bug-fixes/WPB-5330 | 1 - 1 file changed, 1 deletion(-) delete mode 100644 changelog.d/3-bug-fixes/WPB-5330 diff --git a/changelog.d/3-bug-fixes/WPB-5330 b/changelog.d/3-bug-fixes/WPB-5330 deleted file mode 100644 index fafbef2190..0000000000 --- a/changelog.d/3-bug-fixes/WPB-5330 +++ /dev/null @@ -1 +0,0 @@ -Updating tests to fix an issue calling `mls-test-cli` \ No newline at end of file From 81b45d92fdfbf53d14728637f6d801041440f912 Mon Sep 17 00:00:00 2001 From: Sven Tennie Date: Wed, 8 Nov 2023 10:13:49 +0100 Subject: [PATCH 7/9] Hi CI From 32f66e5c697b391e7b01f841545dfa4d19fbe91f Mon Sep 17 00:00:00 2001 From: Sven Tennie Date: Wed, 8 Nov 2023 13:36:56 +0100 Subject: [PATCH 8/9] Update changelog.d/5-internal/WPB-5204 Add more context to explain what's this about. --- changelog.d/5-internal/WPB-5204 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/changelog.d/5-internal/WPB-5204 b/changelog.d/5-internal/WPB-5204 index 57f2d333fd..3faeaf6c37 100644 --- a/changelog.d/5-internal/WPB-5204 +++ b/changelog.d/5-internal/WPB-5204 @@ -1 +1 @@ -Removed APNS_VOIP code. \ No newline at end of file +Removed APNS_VOIP code. (APNS_VOIP is a native push notification channel which we aren't using anymore.) \ No newline at end of file From e4780e6aabdb51277096bcfc56c1afe2679c9681 Mon Sep 17 00:00:00 2001 From: Sven Tennie Date: Wed, 8 Nov 2023 13:45:49 +0100 Subject: [PATCH 9/9] Revert Twilio changes Twilio is unrelated to the current task. This partly reverts commit 45246e1192d0e5456e1bfea9a4b077ba7b10f74b. --- libs/ropes/src/Ropes/Twilio.hs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libs/ropes/src/Ropes/Twilio.hs b/libs/ropes/src/Ropes/Twilio.hs index 11cb8c2d4e..e9a935b730 100644 --- a/libs/ropes/src/Ropes/Twilio.hs +++ b/libs/ropes/src/Ropes/Twilio.hs @@ -129,6 +129,7 @@ data CarrierInfo = CarrierInfo data PhoneType = Landline | Mobile + | VoIp deriving (Eq, Show) instance FromJSON LookupResult where @@ -147,6 +148,7 @@ instance FromJSON PhoneType where parseJSON = withText "PhoneType" $ \case "mobile" -> pure Mobile "landline" -> pure Landline + "voip" -> pure VoIp x -> fail $ "Unexpected phone type: " ++ show x -- * Functions