Upgrade to Pro — share decks privately, control downloads, hide ads and more …

徹底解説!Communication Notification / How to handle Communication Notification.

徹底解説!Communication Notification / How to handle Communication Notification.

徹底解説!!Communication Notification!!

まつじ (松本淳之介)/LINE株式会社 iOS/Android エクスペリエンスチーム
奈良出身。20卒の新卒としてLINEに入社。Early Bird TFなどiOS特有の機能を取り入れるチームでLINE iOSの開発を担当。業務の前後に行っている個人開発ではAppStore無料総合ランキング1位を (一瞬) 記録。その時の2位はLINE。趣味は囲碁で囲碁友達募集中。

※この資料は以下のイベントで発表した内容です。
https://line.connpass.com/event/228428/

A3966f193f4bef226a0d3e3c1f728d7f?s=128

LINE Developers
PRO

November 02, 2021
Tweet

More Decks by LINE Developers

Other Decks in Technology

Transcript

  1. $PNNVOJDBUJPO/PUJGJDBUJPO పఈղઆʂ ·ͭ͡ -*/&

  2. ໊લ ·ͭ͡ দຊ३೭հ ࣗݾ঺հ ୲౰ -*/&J04 νʔϜ J04"OESPJEΤΫεϖϦΤϯενʔϜ झຯ ݸਓΞϓϦ։ൃɺғޟ

  3. IUUQTFOHJOFFSJOHMJOFDPSQDPNKBCMPHHFUUJOHUIFMBUFTUJPTGFBUVSFTJOUPMJOF

  4. 8IBUJT$PNNVOJDBUJPO/PUJGJDBUJPO

  5. J04Ͱಋೖ͞Εͨίϛϡχέʔγϣϯ༻ͷ௨஌

  6. $PNNVOJDBUJPO/PUJGJDBUJPOͷಛ௃ ௨஌ʹ૬खͷը૾΍αϒλΠτϧ άϧʔϓ໊ ͕දࣔͰ͖Δ 

  7. $PNNVOJDBUJPO/PUJGJDBUJPOͷಛ௃ ʮ௨஌ͷཁ໿ʯΛಥഁͰ͖Δ Ϣʔβʔ ௨ৗͷ௨஌ ௨஌ͷཁ໿ ࣌ࠩ 

  8. $PNNVOJDBUJPO/PUJGJDBUJPOͷಛ௃ Ϣʔβʔ ௨ৗͷ௨஌ ௨஌ͷཁ໿ ࣌ࠩ $PNNVOJDBUJPO/PUJGJDBUJPO ͙͢ʹ௨஌ ʮ௨஌ͷཁ໿ʯΛಥഁͰ͖Δ 

  9. $PNNVOJDBUJPO/PUJGJDBUJPOͷಛ௃ Ϣʔβʔ͕બΜͩ༑ୡ͔Βͷ௨஌ͷΈʮूதϞʔυʯΛಥഁͰ͖Δ Ϣʔβʔ ௨ৗͷ௨஌ ௨஌ͷཁ໿ ࣌ࠩ $PNNVOJDBUJPO/PUJGJDBUJPO "͞Μ͔Βͷ௨஌ͷΈڐՄ͢ΔूதϞʔυ 

  10. $PNNVOJDBUJPO/PUJGJDBUJPOͷಛ௃ Ϣʔβʔ͕બΜͩ༑ୡ͔Βͷ௨஌ͷΈʮूதϞʔυʯΛಥഁͰ͖Δ Ϣʔβʔ ௨ৗͷ௨஌ ௨஌ͷཁ໿ ࣌ࠩ $PNNVOJDBUJPO/PUJGJDBUJPO ͙͢ʹ௨஌ "͞Μ͔Βͷ௨஌ͷΈڐՄ͢ΔूதϞʔυ "͞Μ

    
  11. $PNNVOJDBUJPO/PUJGJDBUJPOͷಛ௃ Ϣʔβʔ ௨ৗͷ௨஌ ௨஌ͷཁ໿ ࣌ࠩ $PNNVOJDBUJPO/PUJGJDBUJPO ͙͢ʹ௨஌ "͞Μ͔Βͷ௨஌ͷΈڐՄ͢ΔूதϞʔυ "͞Μ #͞Μ

    ूதϞʔυղআ࣌ʹදࣔ Ϣʔβʔ͕બΜͩ༑ୡ͔Βͷ௨஌ͷΈʮूதϞʔυʯΛಥഁͰ͖Δ 
  12. *NQMFNFOUBUJPO

  13. ࣮૷खॱ  ૹ৴ऀΛද͢*/1FSTPOΛ༻ҙ  ϝοηʔδͷड৴Λද͢*/4FOE.FTTBHF*OUFOUΛ༻ҙ  */4FOE.FTTBHF*OUFOUΛEPOBUF  */4FOE.FTTBHF*OUFOUΛ࢖ͬͯ௨஌Λߋ৽

  14. ࣮૷खॱ  ૹ৴ऀΛද͢*/1FSTPOΛ༻ҙ  ϝοηʔδͷड৴Λද͢*/4FOE.FTTBHF*OUFOUΛ༻ҙ  */4FOE.FTTBHF*OUFOUΛEPOBUF  */4FOE.FTTBHF*OUFOUΛ࢖ͬͯ௨஌Λߋ৽

  15. */1FSTPOͷ४උ let sender = INPerson( personHandle: .init(value: "matsuji@example.com", type: .emailAddress),

    nameComponents: nil, displayName: "まつじ", image: image, contactIdentifier: nil, customIdentifier: "xxxxxxxx", isContactSuggestion: false, suggestionType: .socialProfile )
  16. */1FSTPOͷ४උ let sender = INPerson( personHandle: .init(value: "matsuji@example.com", type: .emailAddress),

    nameComponents: nil, displayName: "まつじ", image: image, contactIdentifier: nil, customIdentifier: "xxxxxxxx", isContactSuggestion: false, suggestionType: .socialProfile ) 4JSJ͕ೝࣝͰ͖Δࣝผࢠ Ϣʔβʔ͔Βݟ͑ΔͷͰ஫ҙ • ి࿩൪߸ • ϝʔϧΞυϨε • ͦͷଞ
  17. */1FSTPOͷ४උ let sender = INPerson( personHandle: .init(value: "matsuji@example.com", type: .emailAddress),

    nameComponents: nil, displayName: "まつじ", image: image, contactIdentifier: nil, customIdentifier: "xxxxxxxx", isContactSuggestion: false, suggestionType: .socialProfile ) ௨஌ͷλΠτϧʹදࣔ͞ΕΔૹ৴ऀ໊
  18. */1FSTPOͷ४උ let sender = INPerson( personHandle: .init(value: "matsuji@example.com", type: .emailAddress),

    nameComponents: nil, displayName: "まつじ", image: image, contactIdentifier: nil, customIdentifier: "xxxxxxxx", isContactSuggestion: false, suggestionType: .socialProfile ) ૹ৴ऀͷΞΠίϯ
  19. */1FSTPOͷ४උ let sender = INPerson( personHandle: .init(value: "matsuji@example.com", type: .emailAddress),

    nameComponents: nil, displayName: "まつじ", image: image, contactIdentifier: nil, customIdentifier: "xxxxxxxx", isContactSuggestion: false, suggestionType: .socialProfile ) ΞϓϦଆͰॲཧͰ͖Δࣝผࢠ
  20. ࣮૷खॱ  ૹ৴ऀΛද͢*/1FSTPOΛ༻ҙ  ϝοηʔδͷड৴Λද͢*/4FOE.FTTBHF*OUFOUΛ༻ҙ  */4FOE.FTTBHF*OUFOUΛEPOBUF  */4FOE.FTTBHF*OUFOUΛ࢖ͬͯ௨஌Λߋ৽

  21. */4FOE.FTTBHF*OUFOUͷ४උ let intent = INSendMessageIntent( recipients: nil, outgoingMessageType: .outgoingMessageText, content:

    "通知の内容", speakableGroupName: nil, conversationIdentifier: "xxxxx", serviceName: nil, sender: sender, attachments: nil )
  22. */4FOE.FTTBHF*OUFOUͷ४උ let intent = INSendMessageIntent( recipients: nil, outgoingMessageType: .outgoingMessageText, content:

    "通知の内容", speakableGroupName: nil, conversationIdentifier: "xxxxx", serviceName: nil, sender: sender, attachments: nil ) ͖ͬ͞༻ҙͨ͠*/1FSTPO
  23. */4FOE.FTTBHF*OUFOUͷ४උ let intent = INSendMessageIntent( recipients: nil, outgoingMessageType: .outgoingMessageText, content:

    "通知の内容", speakableGroupName: nil, conversationIdentifier: "xxxxx", serviceName: nil, sender: sender, attachments: nil ) ௨஌ͷຊจʹදࣔ͞ΕΔ಺༰
  24. ࣮૷खॱ  ૹ৴ऀΛද͢*/1FSTPOΛ༻ҙ  ϝοηʔδͷड৴Λද͢*/4FOE.FTTBHF*OUFOUΛ༻ҙ  */4FOE.FTTBHF*OUFOUΛEPOBUF  */4FOE.FTTBHF*OUFOUΛ࢖ͬͯ௨஌Λߋ৽

  25. */4FOE.FTTBHF*OUFOUΛEPOBUF͢Δ let interaction = INInteraction(intent: intent, response: nil) interaction.direction =

    .incoming interaction.donate(completion: nil)
  26. ࣮૷खॱ  ૹ৴ऀΛද͢*/1FSTPOΛ༻ҙ  ϝοηʔδͷड৴Λද͢*/4FOE.FTTBHF*OUFOUΛ༻ҙ  */4FOE.FTTBHF*OUFOUΛEPOBUF  */4FOE.FTTBHF*OUFOUΛ࢖ͬͯ௨஌Λߋ৽

  27. */4FOE.FTTBHF*OUFOUΛ࢖ͬͯ௨஌Λߋ৽ var content: UNNotificationContent = UNMutableNotificationContent() let updatedContent = try!

    content.updating(from: intent) // notification service extension contentHandler(updatedcontent) // local notification let request = UNNotificationRequest( identifier: UUID().uuidString, content: updatedcontent, trigger: nil ) UNUserNotificationCenter.current().add(request)
  28. None
  29. (SPVQ$PNNVOJDBUJPO/PUJGJDBUJPO

  30. None
  31. ૹ৴ऀͱ͸ผͷΞΠίϯ άϧʔϓͷ໊લ

  32. (SPVQ$PNNVOJDBUJPO/PUJGJDBUJPO let intent = INSendMessageIntent( recipients: nil, outgoingMessageType: .outgoingMessageText, content:

    "通知の内容", speakableGroupName: INSpeakableString(spokenPhrase: "グループ名"), conversationIdentifier: "xxxxx", serviceName: nil, sender: sender, attachments: nil ) intent.setImage(groupImage, forParameterNamed: ¥.speakableGroupName)
  33. (SPVQ$PNNVOJDBUJPO/PUJGJDBUJPO let intent = INSendMessageIntent( recipients: nil, outgoingMessageType: .outgoingMessageText, content:

    "通知の内容", speakableGroupName: INSpeakableString(spokenPhrase: "グループ名"), conversationIdentifier: "xxxxx", serviceName: nil, sender: sender, attachments: nil ) intent.setImage(groupImage, forParameterNamed: .speakableGroupName) αϒλΠτϧʹग़͢άϧʔϓ໊
  34. (SPVQ$PNNVOJDBUJPO/PUJGJDBUJPO let intent = INSendMessageIntent( recipients: nil, outgoingMessageType: .outgoingMessageText, content:

    "通知の内容", speakableGroupName: INSpeakableString(spokenPhrase: "グループ名"), conversationIdentifier: "xxxxx", serviceName: nil, sender: sender, attachments: nil ) intent.setImage(groupImage, forParameterNamed: .speakableGroupName) άϧʔϓͷΞΠίϯ
  35. None
  36. άϧʔϓ໊͕ग़͍ͯͳ͍  ΞΠίϯ͕άϧʔϓ༻ʹมΘ͍ͬͯͳ͍

  37. (SPVQ$PNNVOJDBUJPO/PUJGJDBUJPO let intent = INSendMessageIntent( recipients: nil, outgoingMessageType: .outgoingMessageText, content:

    "通知の内容", speakableGroupName: INSpeakableString(spokenPhrase: "グループ名"), conversationIdentifier: "xxxxx", serviceName: nil, sender: sender, attachments: nil ) intent.setImage(groupImage, forParameterNamed: ¥.speakableGroupName)
  38. (SPVQ$PNNVOJDBUJPO/PUJGJDBUJPO let intent = INSendMessageIntent( recipients: nil, outgoingMessageType: .outgoingMessageText, content:

    "通知の内容", speakableGroupName: INSpeakableString(spokenPhrase: "グループ名"), conversationIdentifier: "xxxxx", serviceName: nil, sender: sender, attachments: nil ) intent.setImage(groupImage, forParameterNamed: ¥.speakableGroupName)
  39. (SPVQ$PNNVOJDBUJPO/PUJGJDBUJPO let intent = INSendMessageIntent( recipients: [personA, personB], outgoingMessageType: .outgoingMessageText,

    content: "通知の内容", speakableGroupName: INSpeakableString(spokenPhrase: "グループ名"), conversationIdentifier: "xxxxx", serviceName: nil, sender: sender, attachments: nil ) intent.setImage(groupImage, forParameterNamed: .speakableGroupName) άϧʔϓͷଞͷड৴ऀ ࣗ෼͸ؚΊͳ͍ ࣗ෼͕ड৴ऀͳͷ͸ࣗ໌ͳͷͰؚΊͯ΋ແࢹ͞ΕΔ ʂ ஫ҙ
  40. ิ଍ */1FSTPOʹ͓͚Δʮࣗ෼ʯͱ͸ʁ let me = INPerson( personHandle: .init(value: "matsuji@example.com", type:

    .emailAddress), nameComponents: nil, displayName: "まつじ", image: image, contactIdentifier: nil, customIdentifier: "xxxxxxx", isMe: true, suggestionType: .none )
  41. ิ଍ */1FSTPOʹ͓͚Δʮࣗ෼ʯͱ͸ʁ let me = INPerson( personHandle: .init(value: "matsuji@example.com", type:

    .emailAddress), nameComponents: nil, displayName: "まつじ", image: image, contactIdentifier: nil, customIdentifier: "xxxxxxx", isMe: true, suggestionType: .none ) σϑΥϧτ͸GBMTF
  42. (SPVQ$PNNVOJDBUJPO/PUJGJDBUJPO let intent = INSendMessageIntent( recipients: [personA, personB], outgoingMessageType: .outgoingMessageText,

    content: "通知の内容", speakableGroupName: INSpeakableString(spokenPhrase: "グループ名"), conversationIdentifier: "xxxxx", serviceName: nil, sender: sender, attachments: nil ) intent.setImage(groupImage, forParameterNamed: .speakableGroupName)
  43. (SPVQ$PNNVOJDBUJPO/PUJGJDBUJPO let intent = INSendMessageIntent( recipients: [personA, personB], outgoingMessageType: .outgoingMessageText,

    content: "通知の内容", speakableGroupName: INSpeakableString(spokenPhrase: "グループ名"), conversationIdentifier: "xxxxx", serviceName: nil, sender: sender, attachments: nil ) intent.setImage(groupImage, forParameterNamed: .speakableGroupName) ड৴ऀ͕ଟ͍৔߹ɺϝϞϦͷ৺഑͕
  44. */4FOE.FTTBHF*OUFOU%POBUJPO.FUBEBUB

  45. @available(iOS 15.0, *) open class INSendMessageIntentDonationMetadata : INIntentDonationMetadata { open

    var mentionsCurrentUser: Bool open var isReplyToCurrentUser: Bool open var notifyRecipientAnyway: Bool open var recipientCount: Int public init() }
  46. @available(iOS 15.0, *) open class INSendMessageIntentDonationMetadata : INIntentDonationMetadata { open

    var mentionsCurrentUser: Bool open var isReplyToCurrentUser: Bool open var notifyRecipientAnyway: Bool open var recipientCount: Int public init() } ࣗ෼͕ϝϯγϣϯ͞Ε͍ͯΔ͔Ͳ͏͔
  47. @available(iOS 15.0, *) open class INSendMessageIntentDonationMetadata : INIntentDonationMetadata { open

    var mentionsCurrentUser: Bool open var isReplyToCurrentUser: Bool open var notifyRecipientAnyway: Bool open var recipientCount: Int public init() } ࣗ෼ͷϝοηʔδʹฦ৴͔ͨ͠Ͳ͏͔
  48. @available(iOS 15.0, *) open class INSendMessageIntentDonationMetadata : INIntentDonationMetadata { open

    var mentionsCurrentUser: Bool open var isReplyToCurrentUser: Bool open var notifyRecipientAnyway: Bool open var recipientCount: Int public init() } ڧ੍తʹ௨஌͢Δϝοηʔδ͔Ͳ͏͔
  49. @available(iOS 15.0, *) open class INSendMessageIntentDonationMetadata : INIntentDonationMetadata { open

    var mentionsCurrentUser: Bool open var isReplyToCurrentUser: Bool open var notifyRecipientAnyway: Bool open var recipientCount: Int public init() } ड৴ऀͷ਺ ࠓճ͸͜ΕΛ࢖͏
  50. */4FOE.FTTBHF*OUFOU%POBUJPO.FUBEBUB let intent = INSendMessageIntent( recipients: [personA, personB], ... )

  51. */4FOE.FTTBHF*OUFOU%POBUJPO.FUBEBUB let intent = INSendMessageIntent( recipients: nil, ... ) OJMʹ໭͢

  52. */4FOE.FTTBHF*OUFOU%POBUJPO.FUBEBUB let intent = INSendMessageIntent( recipients: nil, ... ) let

    metadata = INSendMessageIntentDonationMetadata() metadata.recipientCount = 2 intent.donationMetadata = metadata
  53. */4FOE.FTTBHF*OUFOU%POBUJPO.FUBEBUB let intent = INSendMessageIntent( recipients: nil, ... ) let

    metadata = INSendMessageIntentDonationMetadata() metadata.recipientCount = 2 intent.donationMetadata = metadata ͜ͷ஋͕Ҏ্ͳΒ (SPVQ$PNNVOJDBUJPO/PUJGJDBUJPOʹʂ
  54. None
  55. ·ͱΊ • $PNNVOJDBUJPO/PUJGJDBUJPOͷ࣮૷ࣗମ͸؆୯ • ֤ͨͩ͠ύϥϝʔλͷ໾ׂ΍ӨڹΛཧղ͢Δͷ͸݁ߏେม "QQMFͷυΩϡϝϯτʹ༗༻ͳ৘ใ͕গͳ͍

  56. ·ͱΊ • $PNNVOJDBUJPO/PUJGJDBUJPOͷ࣮૷ࣗମ͸؆୯ • ֤ͨͩ͠ύϥϝʔλͷ໾ׂ΍ӨڹΛཧղ͢Δͷ͸݁ߏେม "QQMFͷυΩϡϝϯτʹ༗༻ͳ৘ใ͕গͳ͍ ͱࢥͬͨΒɺ"QQMF͕͠ΕͬͱυΩϡϝϯτΛ ެ։͍ͯͨ͠ͷͰͦͪΒΛࢀߟʹʂ

  57. IUUQTEFWFMPQFSBQQMFDPNEPDVNFOUBUJPOVTFSOPUJGJDBUJPOTJNQMFNFOUJOH@DPNNVOJDBUJPO@OPUJGJDBUJPOT

  58. IUUQTEFWFMPQFSBQQMFDPNEPDVNFOUBUJPOVTFSOPUJGJDBUJPOTJNQMFNFOUJOH@DPNNVOJDBUJPO@OPUJGJDBUJPOT ׬