Skip to content

Commit

Permalink
Merge pull request #1185 from microsoft/develop
Browse files Browse the repository at this point in the history
Version 2.1.0
  • Loading branch information
chethanreddyvelverti authored Jun 11, 2019
2 parents e9ed6f9 + 3102a56 commit 1f7a318
Show file tree
Hide file tree
Showing 175 changed files with 3,497 additions and 1,301 deletions.
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[submodule "apps/sasquatch/src/main/cpp/google-breakpad"]
path = apps/sasquatch/src/main/cpp/google-breakpad
url = https://github.com/Microsoft/AppCenter-SDK-Android-Breakpad.git
url = https://github.com/microsoft/appcenter-sdk-android-breakpad.git
40 changes: 39 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,43 @@
# App Center SDK for Android Change Log

## Version 2.1.0

### App Center

* **[Fix]** Handle incorrect usage of `AppCenter.setLogUrl` API to provide readable error message.
* **[Fix]** Fix decrypting values that have been stored for more than a year (such as the in-app update token).

### App Center Analytics

* **[Feature]** Support setting latency of sending events via `Analytics.setTransmissionInterval`.

### App Center Auth

* **[Feature]** Expose the ID Token and Access Token (as raw JWT format) in the `UserInformation` object returned from the sign-in method.
* **[Fix]** Fix missing proguard rules so that the app does not have to specify them.
* **[Fix]** Fix crash on silently refreshing token if initialization of MSAL fails.
* **[Fix]** Fix sign-in before start auth service never ends and blocks every next try.
* **[Breaking change]** The `UserInformation` class has been moved from the `appcenter` module to the `appcenter-auth` module and must now be imported as `import com.microsoft.appcenter.auth.UserInformation`.

### App Center Data

* **[Fix]** Fix an issue where invalid characters in the document ID are accepted at creation time but causing errors while trying to read or delete the document. The characters are `#`, `\`, `/`, `?`, and all whitespaces.

### App Center Crashes

* **[Fix]** Fix a crash that could sometimes occur while processing native crash reports.

### App Center Distribute

* **[Feature]** Add `Distribute.setEnabledForDebuggableBuild(boolean)` method to allow in-app updates in debuggable builds.
* **[Fix]** Fix duplicate in-app update dialog when restarting (or switching) activity quickly after clicking download. Also fixes a crash when choosing "Ask me in a day" in the duplicate dialog.
* **[Fix]** Fix a crash that could occur when downloading the update with a customized dialog and then calling `Distribute.notifyUserConfirmation(UpdateAction.POSTPONE)` right after calling `Distribute.notifyUserConfirmation(UpdateAction.UPDATE)`.
* **[Fix]** Fix a crash that could occur while trying to open the browser on some devices.

### App Center Push

* **[Fix]** Update Firebase dependency and AppCenter push logic to avoid a runtime issue with the latest Firebase messaging version 18.0.0.

## Version 2.0.0

Version 2 of the App Center SDK includes two new modules: Auth and Data.
Expand All @@ -14,7 +52,7 @@ The App Center Data service provides functionality enabling developers to persis

### AppCenterCrashes

* **[Feature]** After calling `Auth.signIn`, the next crashes are associated with an `accountId` corresponding to the signed in user. This is a different field than the `userId` set by `AppCenter.setUserId`. Calling `Auth.signOut` stops the `accountId` association for the next crashes.
* **[Feature]** After calling `Auth.signIn`, the next crashes are associated with an `accountId` corresponding to the signed in user. This is a different field than the `userId` set by `AppCenter.setUserId`. Calling `Auth.signOut` stops the `accountId` association for the next crashes.

### AppCenterDistribute

Expand Down
2 changes: 1 addition & 1 deletion ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Thanks for your interest in using the App Center SDK for Android.
If your issue is not related to using our Android SDK but rather about the product experience like the portal or CI,
please create a ticket using the blue chat button on any page of the https://appcenter.ms portal instead.
If you are using Xamarin, please report the issue on https://github.com/Microsoft/AppCenter-SDK-DotNet instead.
If you are using Xamarin, please report the issue on https://github.com/microsoft/appcenter-sdk-dotnet instead.
-->

### **Description**
Expand Down
2 changes: 1 addition & 1 deletion PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Cheers!
The App Center team -->

Please have a look at our [guidelines for contributions](https://github.com/Microsoft/AppCenter-SDK-Android/blob/develop/CONTRIBUTING.md) and consider the following before you submit the PR:
Please have a look at our [guidelines for contributions](https://github.com/microsoft/appcenter-sdk-android/blob/develop/CONTRIBUTING.md) and consider the following before you submit the PR:

* [ ] Has `CHANGELOG.md` been updated?
* [ ] Are tests passing locally?
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[![Coverage Status](https://coveralls.io/repos/github/Microsoft/AppCenter-SDK-Android/badge.svg?branch=develop)](https://coveralls.io/github/Microsoft/AppCenter-SDK-Android?branch=develop)
[![GitHub Release](https://img.shields.io/github/release/Microsoft/AppCenter-SDK-Android.svg)](https://github.com/Microsoft/AppCenter-SDK-Android/releases/latest)
[![Coverage Status](https://coveralls.io/repos/github/microsoft/appcenter-sdk-android/badge.svg?branch=develop)](https://coveralls.io/github/microsoft/appcenter-sdk-android?branch=develop)
[![GitHub Release](https://img.shields.io/github/release/microsoft/appcenter-sdk-android.svg)](https://github.com/microsoft/appcenter-sdk-android/releases/latest)
[![Bintray](https://api.bintray.com/packages/vsappcenter/appcenter/appcenter/images/download.svg)](https://bintray.com/vsappcenter/appcenter)
[![license](https://img.shields.io/badge/license-MIT%20License-00AAAA.svg)](https://github.com/Microsoft/AppCenter-SDK-Android/blob/master/license.txt)
[![license](https://img.shields.io/badge/license-MIT%20License-00AAAA.svg)](https://github.com/microsoft/appcenter-sdk-android/blob/master/license.txt)

# Visual Studio App Center SDK for Android

Expand Down
12 changes: 11 additions & 1 deletion apps/sasquatch/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -91,4 +91,14 @@ dependencies {
def taskRequests = getGradle().getStartParameter().getTaskRequests().toString()
if (!taskRequests.contains("sasquatch") || taskRequests.contains("Firebase")) {
apply plugin: 'com.google.gms.google-services'
}
}

/*
* Project and jcenter conflict since they are not using same version of Push and
* somehow affects the plugin when building.
* If we build project alone (commenting jcenter dependencies), the problem is solved.
* So until we release the SDK with the push update, disable version check.
* TODO remove this after SDK release.
*/
//noinspection UnnecessaryQualifiedReference
com.google.gms.googleservices.GoogleServicesPlugin.config.disableVersionCheck = true
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ public class CrashesTest {

private Context mContext;

@SuppressWarnings("rawtypes")
private static Matcher<Object> withCrashTitle(@StringRes final int titleId) {
return new BoundedMatcher<Object, CrashActivity.Crash>(CrashActivity.Crash.class) {

Expand Down Expand Up @@ -160,7 +159,6 @@ public void variableMessageTest() throws InterruptedException {
* @param titleId Title string resource to find list item.
* @throws InterruptedException If the current thread is interrupted.
*/
@SuppressWarnings("ThrowableResultOfMethodCallIgnored")
private void crashTest(@StringRes int titleId) throws InterruptedException {

/* Crash. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@

import static android.support.test.espresso.Espresso.onData;
import static android.support.test.espresso.assertion.ViewAssertions.matches;
import static org.hamcrest.Matchers.allOf;
import static org.hamcrest.Matchers.anything;
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.instanceOf;
import static org.hamcrest.Matchers.allOf;
import static org.junit.Assert.assertNotNull;

@SuppressWarnings("unused")
Expand Down Expand Up @@ -58,7 +58,6 @@ private static Matcher<Object> withInfoTitle(String expectedTitle) {
return withInfoTitle(equalTo(expectedTitle));
}

@SuppressWarnings("rawtypes")
private static Matcher<Object> withInfoTitle(final Matcher<String> itemTitleMatcher) {
assertNotNull(itemTitleMatcher);
return new BoundedMatcher<Object, DeviceInfoActivity.DeviceInfoDisplayModel>(DeviceInfoActivity.DeviceInfoDisplayModel.class) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,200 @@
/*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License.
*/

package com.microsoft.appcenter.sasquatch.activities;

import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AlertDialog;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.view.View;
import android.widget.ListView;

import com.microsoft.appcenter.UserInformation;
import com.microsoft.appcenter.analytics.AuthenticationProvider;
import com.microsoft.appcenter.auth.Auth;
import com.microsoft.appcenter.auth.SignInResult;
import com.microsoft.appcenter.sasquatch.R;
import com.microsoft.appcenter.sasquatch.features.TestFeatures;
import com.microsoft.appcenter.sasquatch.features.TestFeaturesListAdapter;
import com.microsoft.appcenter.utils.async.AppCenterConsumer;

import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.List;

import static com.microsoft.appcenter.sasquatch.SasquatchConstants.ACCOUNT_ID;
import static com.microsoft.appcenter.sasquatch.SasquatchConstants.USER_INFORMATION_ACCESS_TOKEN;
import static com.microsoft.appcenter.sasquatch.SasquatchConstants.USER_INFORMATION_ID;
import static com.microsoft.appcenter.sasquatch.SasquatchConstants.USER_INFORMATION_ID_TOKEN;
import static com.microsoft.appcenter.sasquatch.activities.MainActivity.LOG_TAG;

public class AuthenticationProviderActivity extends AppCompatActivity {

private boolean mUserLeaving;

private static UserInformation sUserInformation;

private TestFeatures.TestFeature mAuthInfoTestFeature;

private List<TestFeatures.TestFeatureModel> mFeatureList;

private ListView mListView;

@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_auth_provider_list);

/* Populate UI. */
mFeatureList = new ArrayList<>();
mFeatureList.add(new TestFeatures.TestFeatureTitle(R.string.msa_title));
mFeatureList.add(new TestFeatures.TestFeature(R.string.msa_compact_title, R.string.msa_compact_description, new View.OnClickListener() {

@Override
public void onClick(View v) {
startMSALoginActivity(AuthenticationProvider.Type.MSA_COMPACT);
}
}));
mFeatureList.add(new TestFeatures.TestFeature(R.string.msa_delegate_title, R.string.msa_delegate_description, new View.OnClickListener() {

@Override
public void onClick(View v) {
startMSALoginActivity(AuthenticationProvider.Type.MSA_DELEGATE);
}
}));
mFeatureList.add(new TestFeatures.TestFeature(R.string.b2c_sign_in_title, R.string.b2c_sign_in_description, new View.OnClickListener() {

@Override
public void onClick(View v) {
Auth.signIn().thenAccept(new AppCenterConsumer<SignInResult>() {

@Override
public void accept(SignInResult signInResult) {
try {
Exception exception = signInResult.getException();
if (exception != null) {
throw exception;
}
sUserInformation = signInResult.getUserInformation();
loadAuthStatus(false);
String accountId = sUserInformation.getAccountId();
SharedPreferences.Editor edit = MainActivity.sSharedPreferences.edit();
edit.putString("accountId", accountId);
edit.apply();
Log.i(LOG_TAG, "Auth.signIn succeeded, accountId=" + accountId);
} catch (Exception e) {
sUserInformation = null;
loadAuthStatus(false);
Log.e(LOG_TAG, "Auth.signIn failed", e);
}
}
});
}
}));
mFeatureList.add(new TestFeatures.TestFeature(R.string.b2c_sign_out_title, R.string.b2c_sign_out_description, new View.OnClickListener() {

@Override
public void onClick(View v) {
try {
Auth.signOut();
sUserInformation = null;
loadAuthStatus(false);
SharedPreferences.Editor edit = MainActivity.sSharedPreferences.edit();
edit.putString(ACCOUNT_ID, null);
edit.apply();
} catch (Exception e) {
Log.e(LOG_TAG, "Auth.signOut failed", e);
}
}
}));
mListView = findViewById(R.id.list);
loadAuthStatus(sUserInformation == null);
mListView.setOnItemClickListener(TestFeatures.getOnItemClickListener());
}

private static boolean isAuthenticated() {
return sUserInformation != null;
}

private void loadAuthStatus(boolean loadDefaultStatus) {
if (mAuthInfoTestFeature != null) {
mFeatureList.remove(mAuthInfoTestFeature);
}
mAuthInfoTestFeature = getAuthenticationDefaultTestFeature();
if (!loadDefaultStatus) {
mAuthInfoTestFeature = isAuthenticated() ? getAuthenticatedTestFeature() : getNotAuthenticatedTestFeature();
}
mFeatureList.add(mAuthInfoTestFeature);
mListView.setAdapter(new TestFeaturesListAdapter(mFeatureList));
}

private TestFeatures.TestFeature getAuthenticationDefaultTestFeature() {
return getAuthenticationTestFeature(R.string.b2c_authentication_status_description);
}

private TestFeatures.TestFeature getAuthenticatedTestFeature() {
return getAuthenticationTestFeature(R.string.b2c_authentication_status_authenticated);
}

private TestFeatures.TestFeature getNotAuthenticatedTestFeature() {
return getAuthenticationTestFeature(R.string.b2c_authentication_status_not_authenticated);
}

private TestFeatures.TestFeature getAuthenticationTestFeature(int valueStringId) {
return new TestFeatures.TestFeature(R.string.b2c_authentication_status_title, valueStringId, new View.OnClickListener() {

@Override
public void onClick(View v) {
if (isAuthenticated()) {
startUserInfoActivity(sUserInformation);
} else {
AlertDialog.Builder builder = new AlertDialog.Builder(AuthenticationProviderActivity.this);
builder.setTitle(R.string.b2c_authentication_status_dialog_unavailable_title)
.setMessage(R.string.b2c_authentication_status_dialog_unavailable_description)
.setPositiveButton(R.string.alert_ok, new DialogInterface.OnClickListener() {

@Override
public void onClick(DialogInterface dialogInterface, int i) {
dialogInterface.dismiss();
}
});
builder.create().show();
}
}
});
}

private void startMSALoginActivity(AuthenticationProvider.Type type) {
Intent intent = new Intent(getApplication(), MSALoginActivity.class);
intent.putExtra(AuthenticationProvider.Type.class.getName(), type);
startActivity(intent);
}

private void startUserInfoActivity(UserInformation userInformation) {
Intent intent = new Intent(getApplication(), UserInformationActivity.class);
intent.putExtra(USER_INFORMATION_ID, userInformation.getAccountId());
startActivity(intent);
}

@Override
protected void onUserLeaveHint() {
mUserLeaving = true;
}

@Override
protected void onRestart() {

/* When coming back from browser, finish this intermediate menu screen too. */
super.onRestart();
if (mUserLeaving) {
finish();
}
}
}
1 change: 1 addition & 0 deletions apps/sasquatch/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
android:theme="@style/AppTheme"
tools:ignore="AllowBackup,GoogleAppIndexingWarning,UnpackedNativeCode"
tools:targetApi="n">
<activity android:name=".activities.UserInformationActivity" />
<activity
android:name=".activities.MainActivity"
android:launchMode="singleTop">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,20 @@ public class SasquatchConstants {
public static final String DOCUMENT_PARTITION = "documentPartition";

public static final String DOCUMENT_ID = "documentId";

public static final String DOCUMENT_CONTENT = "documentContent";

public static final String DOCUMENT_DATE = "documentDate";

public static final String DOCUMENT_STATE = "documentState";

public static final String DOCUMENT_ERROR = "documentError";

public static final String DOCUMENT_ERROR_NULL_STATUS = "documentErrorNullStatus";

public static final String USER_INFORMATION_ID = "userInfoId";

public static final String USER_INFORMATION_ID_TOKEN = "userInfoIdToken";

public static final String USER_INFORMATION_ACCESS_TOKEN = "userInfoAccessToken";
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,18 @@

final class ActivityConstants {

final static String EXTRA_TARGET_SELECTED = "TARGET_SELECTED";
/**
* A name of extra for target position in intent that is used when configuring target property.
*/
static final String EXTRA_TARGET_SELECTED = "TARGET_SELECTED";

/**
* Shared preference key to store Analytics transmission interval.
*/
static final String ANALYTICS_TRANSMISSION_INTERVAL_KEY = "analyticsTransmissionInterval";

/**
* Default Analytics transmission interval in seconds.
*/
static final int DEFAULT_TRANSMISSION_INTERVAL_IN_SECONDS = 3;
}
Loading

0 comments on commit 1f7a318

Please sign in to comment.