Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adobe Campaign Classic clean up #630

Merged
merged 11 commits into from
Dec 22, 2021

Conversation

calebk1
Copy link
Collaborator

@calebk1 calebk1 commented Sep 3, 2021

No description provided.

@emdobrin
Copy link
Collaborator

@calebk1 we provided some feedback on this PR, let us know if you are still working on it or when you need the final review.

@swarna04 swarna04 self-requested a review November 29, 2021 22:00
using-mobile-extensions/adobe-campaignclassic/README.md Outdated Show resolved Hide resolved
using-mobile-extensions/adobe-campaignclassic/README.md Outdated Show resolved Hide resolved
@@ -240,19 +249,27 @@ public void onResume() {
{% endtab %}

{% tab title="iOS" %}
### trackNotificationClick
{% hint style="info"}
You can pass the `launchOptions` that was received before opening the application or `userInfo`, which contains the received push payload in `trackInfo`. If `trackInfo` is null or does not contain the necessary tracking identifiers, `broadlogId` (`_mId`) and `deliveryId` (`_dId`), a track request is **not** sent.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

... launchOptions dictionary that was received upon opening the application...


The `registerDevice` API registers a device with your Campaign Classic registration server. It takes the APNS token as a parameter with a user key that identifies a user, such as an email address or a login name. You can also provide a map of the custom key-value pairs that you want to associate with the registration. A boolean value is returned in the callback, which signals whether the registration was successful.
{% endhint %}

### Swift
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have we done this change in other extension docs too? I find this format a little odd

Swift -> Example
Objective-C - > Syntax, Example

(1) We should include syntax with Swift too; or
(2) Keep syntax first (Objective-C only in case of 2.x) and then include Swift/ Objective-C examples. Refer to - https://aep-sdks.gitbook.io/docs/using-mobile-extensions/adobe-target/target-api-reference#displayedlocations

Thoughts?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I should also include the syntax for it - that being said, I didn't have the syntax, which is why I wasn't sure what to add.

**Syntax**

```swift
func registerDevice(deviceToken: Token, userKey: String, additionalParams: @escaping (Bool) -> Void)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The correct syntax here is

func registerDevice(_ token: Data, userKey: String?, additionalParams: [String: Any]?, callback: ((Bool) -> Void)?)

**Syntax**

```swift
func trackNotificationReceive(trackInfo: [String: String])
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The correct syntax here is

func trackNotificationReceive(_ trackInfo: [String: String])

**Syntax**

```swift
func trackNotificationClick(trackInfo: [String: String])
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The correct syntax here is

func trackNotificationClick(_ trackInfo: [String: String])


#### Syntax
```swift
ACPCampaignClassic.trackNotificationClick(trackInfo[String:String])
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Example

func userNotificationCenter(_ center: UNUserNotificationCenter, didReceive response: UNNotificationResponse, withCompletionHandler completionHandler: @escaping () -> Void) {
      guard let userInfo = response.notification.request.content.userInfo as? [String: String] else {
          return
      }
      ACPCampaignClassic.trackNotificationClick(userInfo)
      completionHandler()
}

func registerDevice(deviceToken: Token, userKey: String, additionalParams: @escaping (Bool) -> Void)
```

**Example**
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Example

func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {
        let params: [String: Any] = [
            "name": "John",
            "serial": 12345,
            "premium": true
        ]
        ACPCampaignClassic.registerDevice(deviceToken, userKey: "johndoe@gmail.com", additionalParams: params) { result in
            print("Registration status: \(result)")
        }
}

@emdobrin
Copy link
Collaborator

@calebk1 thank you for all the updates so far, can you please review the final round of feedback from Swarna?

@calebk1
Copy link
Collaborator Author

calebk1 commented Dec 21, 2021

Oooh somehow I didn't notice the last set of comments - I should be able to get to this some time tomorrow!

Copy link
Collaborator

@emdobrin emdobrin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@calebk1 looks good with minor suggestions, feel free to merge once resolved.

"serial": 12345,
"premium": true
]
ACPCampaignClassic.registerDevice(deviceToken, userKey: "johndoe@gmail.com", additionalParams: params) { result in
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we update this to john@example.com and any other occurrences?

"deviceManufacturer": "unknown",
"deviceUuid": "00000000-3398-7b70-0000-000033987b70"
},
"userKey": "john.doe@adobe.com"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

}
ACPCampaignClassic.trackNotificationClick(userInfo)
completionHandler()
}
```

### Objective-C
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the format for the obj-c example below is a little off L330-331, can we fix that too?

[ACPCampaignClassic trackNotificationClick:response.notification.request.content.userInfo];
completionHandler();

@calebk1 calebk1 merged commit 020c194 into Adobe-Marketing-Cloud:master Dec 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants