Skip to content

Commit

Permalink
[demo-patch] Using HokeyApp to check for the demo.
Browse files Browse the repository at this point in the history
  • Loading branch information
FranRiadigos committed Aug 17, 2018
1 parent 6e55e14 commit 5182640
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 9 deletions.
24 changes: 23 additions & 1 deletion demo/build.gradle
Original file line number Diff line number Diff line change
@@ -1,15 +1,37 @@
buildscript {
repositories {
jcenter()
maven { url "https://dl.bintray.com/chattylabs/maven" }
}
}

repositories {
maven { url "https://dl.bintray.com/chattylabs/maven" }
}

apply plugin: 'com.android.application'
apply plugin: 'com.chattylabs.versioning'
apply from: '../buildsystem/android.gradle'

versioning {

tagPrefix "demo-version/"

keywords {
minor "[demo-feature]"
patch "[demo-bug]", "[demo-patch]"
}
}

android {
defaultConfig {
applicationId "com.chattylabs.demo.user.assistant"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"

//manifestPlaceholders = [HOCKEYAPP_APP_ID: "658862d7f4d34d89b96ae8356aafdb05"]
versionCode versioning.code()
versionName versioning.name()

manifestPlaceholders = [HOCKEYAPP_APP_ID: "7932ed83b1af4cfba145be87d56c41fd"]
}
signingConfigs {
debug {
Expand Down
1 change: 1 addition & 0 deletions demo/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
android:supportsRtl="true"
android:theme="@style/AppTheme"
android:name=".DemoApplication">
<meta-data android:name="net.hockeyapp.android.appIdentifier" android:value="${HOCKEYAPP_APP_ID}" />
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.chattylabs.demo.user.assistant;

import android.app.Activity;
import android.content.Context;
import android.support.annotation.ArrayRes;
import android.support.annotation.StringRes;
Expand All @@ -12,6 +13,8 @@
import com.chattylabs.android.user.interaction.ChatNode;
import com.chattylabs.sdk.android.voice.ConversationalFlowComponent;

import net.hockeyapp.android.FeedbackManager;


class ChatInteractionHelper {

Expand Down Expand Up @@ -51,7 +54,9 @@ public ChatInteractionComponent create() {

private ChatNode buildFlow() {
assistant.addNode(new ChatMessage.Builder(WELCOME_ID)
.setText(getString(R.string.demo_welcome)).build());
.setText(getString(R.string.demo_welcome))
.setOnLoaded(() ->
FeedbackManager.setActivityForScreenshot((Activity) context)).build());

assistant.addNode(new ChatMessage.Builder(QUIET_PLACE_ID)
.setText(getString(R.string.demo_ask_for_quiet_place)).build());
Expand Down Expand Up @@ -84,7 +89,9 @@ private ChatNode buildFlow() {
.setContentDescriptions(getStringArray(R.array.satisfied)).build());

assistant.addNode(new ChatMessage.Builder(DONE_ID)
.setText(getString(R.string.demo_done)).build());
.setText(getString(R.string.demo_done))
.setOnLoaded(() ->
FeedbackManager.setActivityForScreenshot((Activity) context)).build());

assistant.addNode(new ChatAction.Builder(LIKED_YES_ID)
.setText(getString(R.string.demo_thumbs_up))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@
import com.chattylabs.sdk.android.voice.AndroidSpeechSynthesizer;
import com.chattylabs.sdk.android.voice.ConversationalFlowComponent;

import net.hockeyapp.android.CrashManager;
import net.hockeyapp.android.FeedbackManager;
import net.hockeyapp.android.UpdateManager;

import javax.inject.Inject;

import dagger.android.support.DaggerAppCompatActivity;
Expand Down Expand Up @@ -42,6 +46,22 @@ protected void onCreate(Bundle savedInstanceState) {
() -> onRequestPermissionsResult(
PermissionsHelper.REQUEST_CODE, perms,
new int[] {PackageManager.PERMISSION_GRANTED}));

// HokeyApp Events
UpdateManager.register(this);
FeedbackManager.register(this);
}

@Override
protected void onStart() {
super.onStart();
if (assistantComponent != null) assistantComponent.resume();
}

@Override
protected void onResume() {
super.onResume();
CrashManager.register(this);
}

@SuppressLint("MissingPermission")
Expand All @@ -62,15 +82,10 @@ protected void onStop() {
if (assistantComponent != null) assistantComponent.pause();
}

@Override
protected void onStart() {
super.onStart();
if (assistantComponent != null) assistantComponent.resume();
}

@Override
protected void onDestroy() {
super.onDestroy();
UpdateManager.unregister();
if (assistantComponent != null) {
assistantComponent.release();
assistantComponent.reset();
Expand Down

0 comments on commit 5182640

Please sign in to comment.