Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Update to HTSP lib v0.0.1a12
This includes a few more reliability fixes and cleaner error
handling for common errors.
  • Loading branch information
kiall committed Feb 21, 2017
1 parent f532ae3 commit 549ba00
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 5 deletions.
2 changes: 1 addition & 1 deletion app/build.gradle
Expand Up @@ -68,7 +68,7 @@ repositories {
}

dependencies {
compile 'ie.macinnes.htsp:android-htsp:v0.0.1a11'
compile 'ie.macinnes.htsp:android-htsp:v0.0.1a12'
// Used for testing local HTSP lib builds
// compile(name: 'library-release', ext: 'aar')
compile fileTree(include: ['*.jar'], dir: 'libs')
Expand Down
Expand Up @@ -384,6 +384,9 @@ public void onConnectionStateChange(@NonNull HtspConnection.State state) {
Bundle args = getArguments();
args.putString(Constants.KEY_ERROR_MESSAGE, "Failed to connect to HTSP server");

// Stop the connection
mConnection.stop();

// Move to the failed step
GuidedStepFragment fragment = new FailedFragment();
fragment.setArguments(args);
Expand All @@ -395,7 +398,7 @@ public void onConnectionStateChange(@NonNull HtspConnection.State state) {
public void onAuthenticationStateChange(@NonNull Authenticator.State state) {
if (state == Authenticator.State.AUTHENTICATED) {
// Close the connection, it's no longer needed
mConnection.closeConnection();
mConnection.stop();

// Store the account
final Account account = new Account(mAccountName, mAccountType);
Expand All @@ -422,6 +425,9 @@ public void onAuthenticationStateChange(@NonNull Authenticator.State state) {
} else {
Log.w(TAG, "Failed to validate credentials");

// Stop the connection
mConnection.stop();

Bundle args = getArguments();
args.putString(Constants.KEY_ERROR_MESSAGE, "Failed to validate HTSP Credentials");

Expand Down
Expand Up @@ -394,7 +394,7 @@ public void onStart() {

@Override
public void onStop() {
mConnection.closeConnection();
mConnection.stop();
super.onStop();
}

Expand Down
Expand Up @@ -143,7 +143,7 @@ protected void initHtspConnection() {
protected void closeConnection() {
if (mConnection != null) {
Log.d(TAG, "Closing HTSP connection");
mConnection.closeConnection();
mConnection.stop();
}

cleanupConnection();
Expand Down
Expand Up @@ -123,7 +123,7 @@ protected void initHtspConnection() {
protected void closeConnection() {
if (mConnection != null) {
Log.d(TAG, "Closing HTSP connection");
mConnection.closeConnection();
mConnection.stop();
}

cleanupConnection();
Expand Down

0 comments on commit 549ba00

Please sign in to comment.