Skip to content

Commit

Permalink
Merge pull request #404 from apptentive/next
Browse files Browse the repository at this point in the history
Prepare for 3.4.1 release
  • Loading branch information
skykelsey authored Mar 3, 2017
2 parents ec184c5 + b7dad84 commit 816cf7e
Show file tree
Hide file tree
Showing 44 changed files with 1,995 additions and 78 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ build/
*.iml
.idea/tasks.xml
.idea/gradle.xml
.idea/markdown-navigator.xml
.idea/markdown-navigator/
.idea/misc.xml
.idea/modules.xml
.idea/encodings.xml
.idea/vcs.xml
Expand Down
46 changes: 0 additions & 46 deletions .idea/misc.xml

This file was deleted.

8 changes: 7 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# 2017-03-02 - 3.4.1

#### Improvements

* Added an internal method `Apptentive.dismissAllInteraction()` for closing Apptentive UI.

# 2016-12-07 - 3.4.0

#### Improvements
Expand All @@ -10,7 +16,7 @@

* Fixed a bug where the Profile Card in Message Center wouldn't let a user focus the email field.
* Fixed a bug where the Survey "thank you" message text was the wrong color.

# 2016-10-21 - 3.3.0

#### Improvements
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ use your app, to talk to them at the right time, and in the right way.

##### [Release Notes](https://learn.apptentive.com/knowledge-base/android-sdk-releases-notes/)

##### Binary releases are hosted for Maven [here](http://search.maven.org/#artifactdetails|com.apptentive|apptentive-android|3.4.0|aar)
##### Binary releases are hosted for Maven [here](http://search.maven.org/#artifactdetails|com.apptentive|apptentive-android|3.4.1|aar)

#### Reporting Bugs

Expand Down
24 changes: 24 additions & 0 deletions apptentive/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,16 @@ dependencies {
compile 'com.android.support:appcompat-v7:24.2.1'
compile 'com.android.support:cardview-v7:24.2.1'
compile 'com.android.support:design:24.2.1'
testCompile 'junit:junit:4.12'
testCompile "org.powermock:powermock-module-junit4:1.6.2"
testCompile "org.powermock:powermock-module-junit4-rule:1.6.2"
testCompile "org.powermock:powermock-api-mockito:1.6.2"
testCompile "org.powermock:powermock-classloading-xstream:1.6.2"

// Required for instrumented tests
androidTestCompile 'com.android.support:support-annotations:24.2.1'
androidTestCompile 'com.android.support.test:runner:0.5'
androidTestCompile 'com.android.support.test:rules:0.5'
}

android {
Expand All @@ -24,16 +34,30 @@ android {
versionCode System.getenv("BUILD_NUMBER") as Integer ?: 1
versionName project.version
consumerProguardFiles 'consumer-proguard-rules.pro'
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}

lintOptions {
abortOnError false
}

sourceSets {
test {
java.srcDirs = ['src/test/java', 'src/testCommon/java']
}
androidTest {
java.srcDirs = ['src/androidTest/java', 'src/testCommon/java']
}
}

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}

testOptions {
unitTests.returnDefaultValues = true
}
}

apply plugin: 'maven'
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
/*
* Copyright (c) 2017, Apptentive, Inc. All Rights Reserved.
* Please refer to the LICENSE file for the terms and conditions
* under which redistribution and use of this file is permitted.
*/

package com.apptentive.android.sdk.util.threading;

import android.support.test.runner.AndroidJUnit4;

import com.apptentive.android.sdk.TestCaseBase;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;

@RunWith(AndroidJUnit4.class)
public class ConcurrentDispatchQueueTest extends TestCaseBase {
private DispatchQueue dispatchQueue;

@Before
public void setUp() {
dispatchQueue = DispatchQueue.createBackgroundQueue("Test Queue", DispatchQueueType.Concurrent);
}

@After
public void tearDown() {
dispatchQueue.stop();
}

@Test
public void testDispatch() {
dispatchQueue.dispatchAsync(new DispatchTask() {
@Override
protected void execute() {
sleep(500);
addResult("task-1");
}
});
dispatchQueue.dispatchAsync(new DispatchTask() {
@Override
protected void execute() {
sleep(200);
addResult("task-2");
}
});
dispatchQueue.dispatchAsync(new DispatchTask() {
@Override
protected void execute() {
addResult("task-3");
}
});
sleep(1000); // give tasks a chance to finish
assertResult("task-3", "task-2", "task-1"); // task should be executed concurrently
}

@Test
public void testStoppingDispatchDelayed() {
dispatchQueue.dispatchAsync(new DispatchTask() {
@Override
protected void execute() {
addResult("task");
}
}, 100);
dispatchQueue.stop();
sleep(1000); // wait just for the case if the task still runs

assertResult(); // no tasks should run
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
/*
* Copyright (c) 2017, Apptentive, Inc. All Rights Reserved.
* Please refer to the LICENSE file for the terms and conditions
* under which redistribution and use of this file is permitted.
*/

package com.apptentive.android.sdk.util.threading;

import android.support.test.runner.AndroidJUnit4;

import com.apptentive.android.sdk.TestCaseBase;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;

@RunWith(AndroidJUnit4.class)
public class SerialDispatchQueueTest extends TestCaseBase {

private DispatchQueue dispatchQueue;

@Before
public void setUp() {
dispatchQueue = DispatchQueue.createBackgroundQueue("Test Queue", DispatchQueueType.Serial);
}

@After
public void tearDown() {
dispatchQueue.stop();
}

@Test
public void testDispatch() {
dispatchQueue.dispatchAsync(new DispatchTask() {
@Override
protected void execute() {
sleep(500);
addResult("task-1");
}
});
dispatchQueue.dispatchAsync(new DispatchTask() {
@Override
protected void execute() {
sleep(100);
addResult("task-2");
}
});
dispatchQueue.dispatchAsync(new DispatchTask() {
@Override
protected void execute() {
addResult("task-3");
}
});
sleep(1000); // give tasks a chance to finish
assertResult("task-1", "task-2", "task-3"); // task should be executed serially
}

@Test
public void testStoppingDispatch() {
dispatchQueue.dispatchAsync(new DispatchTask() {
@Override
protected void execute() {
sleep(500);
addResult("task-1");
}
});
dispatchQueue.dispatchAsync(new DispatchTask() {
@Override
protected void execute() {
addResult("task-2");
}
});
dispatchQueue.stop();
sleep(1000); // wait for the first task to finish

assertResult("task-1"); // task-2 should not run
}

@Test
public void testStoppingDispatchDelayed() {
dispatchQueue.dispatchAsync(new DispatchTask() {
@Override
protected void execute() {
addResult("task");
}
}, 100);
dispatchQueue.stop();
sleep(1000); // wait just for the case if the task still runs

assertResult(); // no tasks should run
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
package com.apptentive.android.sdk;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;

import com.apptentive.android.sdk.notifications.ApptentiveNotification;
import com.apptentive.android.sdk.notifications.ApptentiveNotificationCenter;
import com.apptentive.android.sdk.notifications.ApptentiveNotificationObserver;

import static com.apptentive.android.sdk.ApptentiveInternal.NOTIFICATION_INTERACTIONS_SHOULD_DISMISS;

/** A base class for any SDK activity */
public class ApptentiveBaseActivity extends AppCompatActivity implements ApptentiveNotificationObserver {

//region Activity life cycle

@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
registerNotifications();
}

@Override
protected void onDestroy() {
super.onDestroy();
unregisterNotification();
}

//endregion

//region Notifications

private void registerNotifications() {
ApptentiveNotificationCenter.defaultCenter().addObserver(NOTIFICATION_INTERACTIONS_SHOULD_DISMISS, this);
}

private void unregisterNotification() {
ApptentiveNotificationCenter.defaultCenter().removeObserver(this);
}

//endregion

//region ApptentiveNotificationObserver

@Override
public void onReceiveNotification(ApptentiveNotification notification) {
// handle notification in subclasses
}

//endregion
}
Loading

0 comments on commit 816cf7e

Please sign in to comment.