Skip to content
This repository has been archived by the owner on Feb 19, 2020. It is now read-only.

Commit

Permalink
Merge pull request #229 from bitstadium/release/4.1.4
Browse files Browse the repository at this point in the history
Release/4.1.4
  • Loading branch information
Benjamin Scholtysik (Reimold) authored Apr 27, 2017
2 parents 5ed5b31 + 7aef817 commit 54f5b05
Show file tree
Hide file tree
Showing 29 changed files with 277 additions and 147 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ android:
- platform-tools

# Use the desired build tools
- build-tools-25.0.2
- build-tools-25.0.3

# Project target SDK
- android-25
Expand Down
18 changes: 9 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[![Build Status](https://travis-ci.org/bitstadium/HockeySDK-Android.svg?branch=develop)](https://travis-ci.org/bitstadium/HockeySDK-Android)
[![Slack Status](https://slack.hockeyapp.net/badge.svg)](https://slack.hockeyapp.net)

## Version 4.1.3
## Version 4.1.4

## Introduction

Expand Down Expand Up @@ -53,7 +53,7 @@ This document contains the following sections:
## 1. Requirements

1. We assume that you already have an Android project in Android Studio or another Android IDE.
2. The SDK runs on devices with Android 2.3 or later, but you need to build your app with Android SDK 3.0 (Level 11) or later for the integration with HockeySDK.
2. The SDK runs on devices with Android 2.3 or later, but you need to build your app with Android SDK 3.0 (Level 11) or later.

<a id="setup"></a>
## 2. Setup
Expand All @@ -75,7 +75,7 @@ Please see the "[How to create a new app](http://support.hockeyapp.net/kb/about-
Add the SDK to your app module's dependencies in Android Studio by adding the following line to your `dependencies { ... }` configuration:

```groovy
compile 'net.hockeyapp.android:HockeySDK:4.1.3'
compile 'net.hockeyapp.android:HockeySDK:4.1.4'
```

<a id="integrate-sdk"></a>
Expand Down Expand Up @@ -314,7 +314,7 @@ If you don't want to use Gradle or Maven dependency management you can also down
4. Configure your development tools to use the .aar/.jar file.
5. In Android Studio, create a new module via `File > New > New Module`
6. Select **Import .JAR/.AAR Package** and click **Next**.
7. In the next menu select the .aar/.jar file you just copied to the libs folder. You can rename the module to whatever you want, but we in general recommend leaving it as is. If you don't rename the module, it will match the name of the .aar/.jar file, in this case **HockeySDK-4.1.3**. This way you'll quickly know which version of the SDK you are using in the future.
7. In the next menu select the .aar/.jar file you just copied to the libs folder. You can rename the module to whatever you want, but we in general recommend leaving it as is. If you don't rename the module, it will match the name of the .aar/.jar file, in this case **HockeySDK-4.1.4**. This way you'll quickly know which version of the SDK you are using in the future.
8. Make sure Android Studio added the necessary code to integrate the HockeySDK:

Head over to your app's `build.gradle` to verify the dependency was added correctly. It should look like this:
Expand All @@ -324,19 +324,19 @@ dependencies {
//your other dependencies
//...
compile project(':HockeySDK-4.1.3')
compile project(':HockeySDK-4.1.4')
}
```
Next, make sure your `settings.gradle` contains the new module:

```groovy
include ':app', ':HockeySDK-4.1.3'
include ':app', ':HockeySDK-4.1.4'
```

Finally, check the `build.gradle` of the newly added module:
```groovy
configurations.maybeCreate("default")
artifacts.add("default", file('HockeySDK-4.1.3.aar'))
artifacts.add("default", file('HockeySDK-4.1.4.aar'))
```

Once you have verified that everything necessary has been added, proceed with [SDK integration](#integrate-sdk).
Expand Down Expand Up @@ -527,7 +527,7 @@ However, if you provide a custom user interface fragment for the update distribu
<a id="documentation"></a>
## 5. Documentation

Our documentation can be found on [HockeyApp](http://hockeyapp.net/help/sdk/android/4.1.3/index.html).
Our documentation can be found on [HockeyApp](http://hockeyapp.net/help/sdk/android/4.1.4/index.html).

<a id="troubleshooting"></a>
## 6.Troubleshooting
Expand All @@ -536,7 +536,7 @@ Our documentation can be found on [HockeyApp](http://hockeyapp.net/help/sdk/andr

2. Check if the `applicationId` in your `build.gradle` file matches the Bundle Identifier of the app in HockeyApp. HockeyApp accepts crashes only if both the App ID and the bundle identifier match their corresponding values in your app. Please note that the package value in your `AndroidManifest.xml` file might differ from the bundle identifier.

3. If your app crashes and you start it again, does the dialog show up which asks the user to send the crash report? If not, please crash your app again, then connect the debugger and set a break point in `CrashManager.java`'s [register](https://github.com/bitstadium/HockeySDK-Android/blob/master/src/main/java/net/hockeyapp/android/CrashManager.java#L100)-method to see why the dialog is not shown.
3. If your app crashes and you start it again, does the dialog show up which asks the user to send the crash report? If not, please crash your app again, then connect the debugger and set a break point in `CrashManager.java`'s [register](https://github.com/bitstadium/HockeySDK-Android/blob/master/src/main/java/net/hockeyapp/android/CrashManager.java#L100) method to see why the dialog is not shown.

4. If you continue to encouter issues, please [contact us](http://support.hockeyapp.net/discussion/new).

Expand Down
6 changes: 3 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,14 @@ allprojects {

ext {
ARTIFACT_ID = 'HockeySDK'
VERSION_NAME = '4.1.3'
VERSION_CODE = 10
VERSION_NAME = '4.1.4'
VERSION_CODE = 11
SITE_URL = 'https://github.com/bitstadium/hockeysdk-android'
GIT_URL = 'https://github.com/bitstadium/HockeySDK-Android.git'
BINTRAY_USER = HOCKEYAPP_BINTRAY_USER
GROUP_NAME = 'net.hockeyapp.android'
COMPILE_SDK = 25
BUILD_TOOLS = '25.0.2'
BUILD_TOOLS = '25.0.3'
IS_UPLOADING = project.getGradle().startParameter.taskNames.any{it.contains('bintrayUpload')}
DESCRIPTION = 'HockeySDK-Android implements support for using HockeyApp in your Android application. The following features are currently supported:\n' +
'\n' +
Expand Down
2 changes: 1 addition & 1 deletion hockeysdk/build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apply plugin: 'com.android.library'
apply plugin: 'com.novoda.bintray-release' // must be applied after your artifact generating plugin (eg. java / com.android.library)

def supportLibVersion = "25.2.0"
def supportLibVersion = "25.3.1"

android {
compileSdkVersion COMPILE_SDK
Expand Down
20 changes: 17 additions & 3 deletions hockeysdk/src/main/java/net/hockeyapp/android/CrashManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -79,12 +79,23 @@ public class CrashManager {
*/
public static void register(Context context) {
String appIdentifier = Util.getAppIdentifier(context);
if (TextUtils.isEmpty(appIdentifier)) {
throw new IllegalArgumentException("HockeyApp app identifier was not configured correctly in manifest or build configuration.");
}
register(context, appIdentifier);
}

/**
* Registers new crash manager and handles existing crash logs.
* HockeyApp App Identifier is read from configuration values in AndroidManifest.xml
*
* @param context The context to use. Usually your Activity object. If
* context is not an instance of Activity (or a subclass of it),
* crashes will be sent automatically.
* @param listener Implement for callback functions.
*/
public static void register(Context context, CrashManagerListener listener) {
String appIdentifier = Util.getAppIdentifier(context);
register(context, appIdentifier, listener);
}

/**
* Registers new crash manager and handles existing crash logs. If
* context is not an instance of Activity (or a subclass of it),
Expand Down Expand Up @@ -575,6 +586,9 @@ private static void sendCrashes(final WeakReference<Context> weakContext, final
Context ctx = weakContext.get();
if (ctx != null && !Util.isConnectedToNetwork(ctx)) {
// Not connected to network, not trying to submit stack traces
if(listener != null) {
listener.onCrashesNotSent();
}
return;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@
* <h3>Description</h3>
*
* Activity to show the feedback form.
*
**/
public class FeedbackActivity extends Activity implements OnClickListener {

Expand Down Expand Up @@ -496,6 +495,8 @@ protected void configureFeedbackView(boolean haveToken) {
mSubjectInput = (EditText) findViewById(R.id.input_subject);
mTextInput = (EditText) findViewById(R.id.input_message);

configureHints();

/** Check to see if the Name and Email are saved in {@link SharedPreferences} */
if (!mFeedbackViewInitialized) {
String nameEmailSubject = PrefsUtil.getInstance().getNameEmailFromPrefs(mContext);
Expand Down Expand Up @@ -596,6 +597,17 @@ private boolean addAttachment(int request) {
} else return false;
}

private void configureHints() {
if (FeedbackManager.getRequireUserName() == FeedbackUserDataElement.REQUIRED) {
mNameInput.setHint(getString(R.string.hockeyapp_feedback_name_hint_required));
}
if (FeedbackManager.getRequireUserEmail() == FeedbackUserDataElement.REQUIRED) {
mEmailInput.setHint(getString(R.string.hockeyapp_feedback_email_hint_required));
}
mSubjectInput.setHint(getString(R.string.hockeyapp_feedback_subject_hint_required));
mTextInput.setHint(getString(R.string.hockeyapp_feedback_message_hint_required));
}

private void configureAppropriateView() {
/** Try to retrieve the Feedback Token from {@link SharedPreferences} */
if (!mForceNewThread || mInSendFeedback) {
Expand Down Expand Up @@ -671,6 +683,7 @@ public void run() {
try {
date = format.parse(mFeedbackMessages.get(0).getCreatedAt());
mLastUpdatedTextView.setText(String.format(getString(R.string.hockeyapp_feedback_last_updated_text), formatNew.format(date)));
mLastUpdatedTextView.setContentDescription(mLastUpdatedTextView.getText());
mLastUpdatedTextView.setVisibility(View.VISIBLE);
} catch (ParseException e1) {
e1.printStackTrace();
Expand Down
15 changes: 12 additions & 3 deletions hockeysdk/src/main/java/net/hockeyapp/android/FeedbackManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -105,12 +105,21 @@ public class FeedbackManager {
*/
public static void register(Context context) {
String appIdentifier = Util.getAppIdentifier(context);
if (appIdentifier == null || appIdentifier.length() == 0) {
throw new IllegalArgumentException("HockeyApp app identifier was not configured correctly in manifest or build configuration.");
}
register(context, appIdentifier);
}

/**
* Registers new Feedback manager.
* HockeyApp App Identifier is read from configuration values in AndroidManifest.xml
*
* @param context The context to use. Usually your Activity object.
* @param listener Implement for callback functions.
*/
public static void register(Context context, FeedbackManagerListener listener) {
String appIdentifier = Util.getAppIdentifier(context);
register(context, appIdentifier, listener);
}

/**
* Registers new Feedback manager.
*
Expand Down
28 changes: 20 additions & 8 deletions hockeysdk/src/main/java/net/hockeyapp/android/LoginManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -95,20 +95,32 @@ public class LoginManager {
*/
public static void register(final Context context, String appSecret, int mode) {
String appIdentifier = Util.getAppIdentifier(context);
if (TextUtils.isEmpty(appIdentifier)) {
throw new IllegalArgumentException("HockeyApp app identifier was not configured correctly in manifest or build configuration.");
}
register(context, appIdentifier, appSecret, mode, (Class<?>) null);
}

/**
* Registers new login manager.
* HockeyApp App Identifier is read from configuration values in AndroidManifest.xml.
*
* @param context The context to use. Usually your Activity object. Has to be
* of class Activity or subclass for interactive login.
* @param appSecret The App Secret of your app on HockeyApp.
* @param mode The login mode to use.
* @param listener Instance of LoginListener
*/
public static void register(final Context context, String appSecret, int mode, LoginManagerListener listener) {
String appIdentifier = Util.getAppIdentifier(context);
register(context, appIdentifier, appSecret, mode, listener);
}

/**
* Registers new LoginManager.
*
* @param context the context to use. Usually your Activity object.
* @param appIdentifier the App ID of your app on HockeyApp.
* @param appSecret the App Secret of your app on HockeyApp.
* @param mode the login mode.
* @param listener instance of LoginListener
* @param context The context to use. Usually your Activity object.
* @param appIdentifier The App ID of your app on HockeyApp.
* @param appSecret The App Secret of your app on HockeyApp.
* @param mode The login mode.
* @param listener Instance of LoginListener
*/
public static void register(final Context context, String appIdentifier, String appSecret, int mode, LoginManagerListener listener) {
LoginManager.listener = listener;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,7 @@ public void onClick(View v) {
protected void configureView() {
TextView nameLabel = (TextView) findViewById(R.id.label_title);
nameLabel.setText(getAppName());
nameLabel.setContentDescription(getAppName());

final TextView versionLabel = (TextView) findViewById(R.id.label_version);
final String versionString = "Version " + mVersionHelper.getVersionString();
Expand All @@ -240,6 +241,7 @@ public void downloadSuccessful(DownloadFileTask task) {
long appSize = ((GetFileSizeTask) task).getSize();
String appSizeString = String.format(Locale.US, "%.2f", appSize / (1024.0f * 1024.0f)) + " MB";
versionLabel.setText(getString(R.string.hockeyapp_update_version_details_label, versionString, fileDate, appSizeString));
versionLabel.setContentDescription(versionLabel.getText());
}
}
});
Expand Down
15 changes: 12 additions & 3 deletions hockeysdk/src/main/java/net/hockeyapp/android/UpdateManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,21 @@ public class UpdateManager {
*/
public static void register(Activity activity) {
String appIdentifier = Util.getAppIdentifier(activity);
if (TextUtils.isEmpty(appIdentifier)) {
throw new IllegalArgumentException("HockeyApp app identifier was not configured correctly in manifest or build configuration.");
}
register(activity, appIdentifier);
}

/**
* Registers new update manager.
* HockeyApp app identifier is read from AndroidManifest.xml.
*
* @param activity The parent activity to return to.
* @param listener Implement for callback functions.
*/
public static void register(Activity activity, UpdateManagerListener listener) {
String appIdentifier = Util.getAppIdentifier(activity);
register(activity, appIdentifier, listener);
}

/**
* Registers new update manager.
*
Expand Down
22 changes: 14 additions & 8 deletions hockeysdk/src/main/java/net/hockeyapp/android/metrics/Sender.java
Original file line number Diff line number Diff line change
Expand Up @@ -138,24 +138,32 @@ protected void sendAvailableFiles() {
protected void send(HttpURLConnection connection, File file, String persistedData) {
// TODO Why does this get the file and persistedData reference, even though everything is in the connection?
// TODO Looks like this will have to be rewritten for its own AsyncTask subclass.
logRequest(connection, persistedData);
if (connection != null && file != null && persistedData != null) {
mRequestCount.getAndIncrement();
try {
mRequestCount.getAndIncrement();
logRequest(connection, persistedData);
// Starts the query
connection.connect();
// read the response code while we're ready to catch the IO exception
int responseCode = connection.getResponseCode();
// process the response
onResponse(connection, responseCode, persistedData, file);
} catch (IOException e) {
//Probably offline
HockeyLog.debug(TAG, "Couldn't send data with IOException: " + e.toString());
// Probably offline
HockeyLog.debug(TAG, "Couldn't send data with " + e.toString());
mRequestCount.getAndDecrement();
if (this.getPersistence() != null) {
HockeyLog.debug(TAG, "Persisting because of IOException: We're probably offline.");
this.getPersistence().makeAvailable(file); //send again later
}
} catch (SecurityException e) {
// Permission denied
HockeyLog.debug(TAG, "Couldn't send data with " + e.toString());
mRequestCount.getAndDecrement();
if (this.getPersistence() != null) {
HockeyLog.debug(TAG, "Persisting because of SecurityException: Missing INTERNET permission or the user might have removed the internet permission.");
this.getPersistence().makeAvailable(file); //send again later
}
}
}
}
Expand Down Expand Up @@ -309,20 +317,18 @@ protected void onUnexpected(HttpURLConnection connection, int responseCode, Stri
* @param connection the connection
* @param payload the payload of telemetry data
*/
private void logRequest(HttpURLConnection connection, String payload) {
private void logRequest(HttpURLConnection connection, String payload) throws IOException, SecurityException {
// TODO Rename this to reflect the true nature of this method: Sending the payload
Writer writer = null;
try {
if ((connection != null) && (payload != null)) {
if (connection != null && payload != null) {
HockeyLog.debug(TAG, "Sending payload:\n" + payload);
HockeyLog.debug(TAG, "Using URL:" + connection.getURL().toString());
//the following 3 lines actually appends the payload to the connection
writer = getWriter(connection);
writer.write(payload);
writer.flush();
}
} catch (IOException e) {
HockeyLog.debug(TAG, "Couldn't log data with: " + e.toString());
} finally {
if (writer != null) {
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,23 +161,11 @@ protected void configApplicationContext() {
// App version
String version = "unknown";
mPackageName = "";

try {
final PackageManager manager = mContext.getPackageManager();
final PackageInfo info = manager
.getPackageInfo(mContext.getPackageName(), 0);

if (info.packageName != null) {
mPackageName = info.packageName;
}

String appBuild = Integer.toString(info.versionCode);
version = String.format("%s (%S)", info.versionName, appBuild);
} catch (PackageManager.NameNotFoundException e) {
HockeyLog.debug(TAG, "Could not get application context");
} finally {
setAppVersion(version);
if (Constants.APP_PACKAGE != null) {
mPackageName = Constants.APP_PACKAGE;
}
version = String.format("%s (%S)", Constants.APP_VERSION_NAME, Constants.APP_VERSION);
setAppVersion(version);

// Hockey SDK version
String sdkVersionString = BuildConfig.VERSION_NAME;
Expand Down
Loading

0 comments on commit 54f5b05

Please sign in to comment.