Skip to content
This repository was archived by the owner on Dec 4, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,9 @@ public CompletableFuture<Void> onTurn(TurnContext turnContext) {
case ActivityTypes.EVENT:
return onEventActivity(turnContext);

case ActivityTypes.INSTALLATION_UPDATE:
return onInstallationUpdate(turnContext);

case ActivityTypes.INVOKE:
return onInvokeActivity(turnContext).thenCompose(invokeResponse -> {
// If OnInvokeActivityAsync has already sent an InvokeResponse, do not send
Expand Down Expand Up @@ -487,6 +490,17 @@ protected CompletableFuture<Void> onEvent(TurnContext turnContext) {
return CompletableFuture.completedFuture(null);
}

/**
* Override this in a derived class to provide logic specific to
* ActivityTypes.InstallationUpdate activities.
*
* @param turnContext The context object for this turn.
* @return A task that represents the work queued to execute.
*/
protected CompletableFuture<Void> onInstallationUpdate(TurnContext turnContext) {
return CompletableFuture.completedFuture(null);
}

/**
* Invoked when an activity other than a message, conversation update, or event
* is received when the base behavior of {@link #onTurn(TurnContext)} is used.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,18 @@ public void TestMessageActivity() {
Assert.assertEquals("onMessageActivity", bot.getRecord().get(0));
}

@Test
public void TestOnInstallationUpdate() {
Activity activity = new Activity(ActivityTypes.INSTALLATION_UPDATE);
TurnContext turnContext = new TurnContextImpl(new NotImplementedAdapter(), activity);

TestActivityHandler bot = new TestActivityHandler();
bot.onTurn(turnContext).join();

Assert.assertEquals(1, bot.getRecord().size());
Assert.assertEquals("onInstallationUpdate", bot.getRecord().get(0));
}

@Test
public void TestMemberAdded1() {
Activity activity = new Activity() {
Expand Down Expand Up @@ -431,6 +443,12 @@ protected CompletableFuture onEvent(TurnContext turnContext) {
return super.onEvent(turnContext);
}

@Override
protected CompletableFuture onInstallationUpdate(TurnContext turnContext) {
record.add("onInstallationUpdate");
return super.onInstallationUpdate(turnContext);
}

@Override
protected CompletableFuture onUnrecognizedActivityType(TurnContext turnContext) {
record.add("onUnrecognizedActivityType");
Expand Down