Skip to content

Commit

Permalink
Merge pull request #156 from apptentive/branch_5.1.1
Browse files Browse the repository at this point in the history
Release 5.1.1
  • Loading branch information
weeeBox authored May 9, 2018
2 parents e0d3d0e + 7f76f7a commit 119329f
Show file tree
Hide file tree
Showing 7 changed files with 44 additions and 16 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# 2018-05-09 - v5.1.1

#### Bugs Fixed

* Don't export ApptentiveAttachmentFileProvider.

# 2018-05-01 - v5.1.0

#### Major changes
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,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-release-notes/)

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

#### Reporting Bugs

Expand Down
2 changes: 1 addition & 1 deletion apptentive/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<provider android:name=".debug.ApptentiveAttachmentFileProvider"
android:authorities="${applicationId}.ApptentiveAttachmentFileProvider"
android:enabled="true"
android:exported="true"
android:exported="false"
android:grantUriPermissions="true"/>
<activity android:name="com.apptentive.android.sdk.ApptentiveViewActivity"
android:theme="@style/ApptentiveTheme.Base.Versioned"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ public class ApptentiveConfiguration {
private String baseURL;
private ApptentiveLog.Level logLevel;
private boolean shouldSanitizeLogMessages;
private boolean troubleshootingModeEnabled;

public ApptentiveConfiguration(@NonNull String apptentiveKey, @NonNull String apptentiveSignature) {
if (StringUtils.isNullOrEmpty(apptentiveKey)) {
Expand All @@ -30,6 +31,7 @@ public ApptentiveConfiguration(@NonNull String apptentiveKey, @NonNull String ap
this.apptentiveSignature = apptentiveSignature.trim();
this.logLevel = ApptentiveLog.Level.INFO;
this.shouldSanitizeLogMessages = true;
this.troubleshootingModeEnabled = true;
}

public String getApptentiveKey() {
Expand Down Expand Up @@ -73,4 +75,19 @@ public boolean shouldSanitizeLogMessages() {
public void setShouldSanitizeLogMessages(boolean shouldSanitizeLogMessages) {
this.shouldSanitizeLogMessages = shouldSanitizeLogMessages;
}

/**
* Indicates if the SDK troubleshooting mode should be enabled (<code>true</code> by default).
*/
public boolean isTroubleshootingModeEnabled() {
return troubleshootingModeEnabled;
}

/**
* Overrides the SDK troubleshooting mode.
*/
public ApptentiveConfiguration setTroubleshootingModeEnabled(boolean troubleshootingModeEnabled) {
this.troubleshootingModeEnabled = troubleshootingModeEnabled;
return this;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@
import static com.apptentive.android.sdk.ApptentiveLogTag.CONVERSATION;
import static com.apptentive.android.sdk.ApptentiveLogTag.MESSAGES;
import static com.apptentive.android.sdk.ApptentiveLogTag.PUSH;
import static com.apptentive.android.sdk.ApptentiveLogTag.TROUBLESHOOT;
import static com.apptentive.android.sdk.ApptentiveNotifications.NOTIFICATION_ACTIVITY_RESUMED;
import static com.apptentive.android.sdk.ApptentiveNotifications.NOTIFICATION_ACTIVITY_STARTED;
import static com.apptentive.android.sdk.ApptentiveNotifications.NOTIFICATION_ACTIVITY_STOPPED;
Expand Down Expand Up @@ -249,11 +250,16 @@ static void createInstance(@NonNull Application application, @NonNull Apptentive
// set log level before we initialize log monitor since log monitor can override it as well
ApptentiveLog.overrideLogLevel(configuration.getLogLevel());

// initialize log writer
ApptentiveLog.initialize(application.getApplicationContext(), LOG_HISTORY_SIZE);
// troubleshooting mode
if (configuration.isTroubleshootingModeEnabled()) {
// initialize log writer
ApptentiveLog.initializeLogWriter(application.getApplicationContext(), LOG_HISTORY_SIZE);

// try initializing log monitor
LogMonitor.startSession(application.getApplicationContext(), apptentiveKey, apptentiveSignature);
// try initializing log monitor
LogMonitor.startSession(application.getApplicationContext(), apptentiveKey, apptentiveSignature);
} else {
ApptentiveLog.i(TROUBLESHOOT, "Troubleshooting is disabled in the app configuration");
}

synchronized (ApptentiveInternal.class) {
if (sApptentiveInternal == null) {
Expand Down Expand Up @@ -497,7 +503,9 @@ public void onAppEnterForeground() {
checkConversationQueue();

// Try to initialize log monitor
LogMonitor.startSession(appContext, apptentiveKey, apptentiveSignature);
if (ApptentiveLog.isLogWriterInitialized()) {
LogMonitor.startSession(appContext, apptentiveKey, apptentiveSignature);
}

// Post a notification
ApptentiveNotificationCenter.defaultCenter().postNotification(NOTIFICATION_APP_ENTERED_FOREGROUND);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,18 @@ public static Level getLogLevel() {
return logLevel;
}

static void initialize(Context context, int logHistorySize) {
static void initializeLogWriter(Context context, int logHistorySize) {
if (context == null) {
throw new IllegalArgumentException("Context is null");
}

logListener = new AsyncLogWriter(getLogsDirectory(context), logHistorySize);
}

static boolean isLogWriterInitialized() {
return logListener != null;
}

public static void overrideLogLevel(Level level) {
ApptentiveLog.logLevel = level;
}
Expand All @@ -48,13 +52,6 @@ public static void setShouldSanitizeLogMessages(boolean shouldSanitizeLogMessage
ApptentiveLog.shouldSanitizeLogMessages = shouldSanitizeLogMessages;
}

/**
* Sets a log listener which gets called every time SDK logs a message
*/
public static void setLogListener(LogListener logListener) {
ApptentiveLog.logListener = logListener;
}

public static Object hideIfSanitized(Object value) {
return value != null && shouldSanitizeLogMessages ? "<HIDDEN>" : value;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
public class Constants {

public static final int API_VERSION = 9;
private static final String APPTENTIVE_SDK_VERSION = "5.1.0";
private static final String APPTENTIVE_SDK_VERSION = "5.1.1";

public static final int DEFAULT_CONNECT_TIMEOUT_MILLIS = 45000;
public static final int DEFAULT_READ_TIMEOUT_MILLIS = 45000;
Expand Down

0 comments on commit 119329f

Please sign in to comment.