Skip to content

Commit

Permalink
Merge pull request #1210 from microsoft/develop
Browse files Browse the repository at this point in the history
Version 2.2.0
  • Loading branch information
MatkovIvan authored Jul 10, 2019
2 parents 08f8e2d + 2f3c3b7 commit e0ba412
Show file tree
Hide file tree
Showing 81 changed files with 2,775 additions and 1,698 deletions.
22 changes: 22 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,27 @@
# App Center SDK for Android Change Log

## Version 2.2.0

### App Center

* **[Fix]** Remove unsecure UUID fallback when UUID generation theorically fails, in reality it never fails.
* **[Fix]** Check for running in App Center Test will now work when using AndroidX instead of the support library.
* **[Feature]** Add `AppCenter.isRunningInAppCenterTestCloud` to provide method to check if the application is running in Test Cloud.
* **[Fix]** Allow null for `ReadOptions` and `WriteOptions` parameters.

### App Center Crashes

* **[Fix]** The in memory cache of error reports is now cleared when disabling Crashes.

### App Center Data

* **[Feature]** Add support for offline list of documents.
* **[Feature]** Change the default time-to-live (TTL) from 1 day to infinite (never expire).
* **[Fix]** Fix `isExpired` method in `LocalDocument` for incorrect handling of the `TimeToLive.INFINITE` value.
* **[Feature]** Add `ReadOptions` parameter to the `list` API.
* **[Feature]** Serialize `null` document values.
* **[Fix]** Fix declaring `gson` as a build time dependency instead of runtime.

## Version 2.1.0

### App Center
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -189,9 +189,6 @@ public void onItemClick(int position) {
startActivity(intent);
}
});
showProgress();
mAppDocumentsLoading = true;
Data.list(Map.class, DefaultPartitions.APP_DOCUMENTS).thenAccept(mUploadApp);

/* List the user documents. */
mAdapterUser = new CustomItemAdapter(new ArrayList<DocumentWrapper<Map>>(), this);
Expand Down Expand Up @@ -222,7 +219,6 @@ public void accept(DocumentWrapper<Void> voidDocument) {
});
}
});
loadUserDocuments();

/* Selector for App VS User documents. */
ArrayAdapter<String> typeAdapter = new ArrayAdapter<>(this, android.R.layout.simple_spinner_dropdown_item, getResources().getStringArray(R.array.document_type_names));
Expand Down Expand Up @@ -262,6 +258,14 @@ private void fillIntentWithDocDetails(Intent intent, DocumentWrapper document, S
intent.putExtra(DOCUMENT_STATE, document.isFromDeviceCache());
}

private void loadAppDocuments() {

/* List readonly documents. */
mAppDocumentsLoading = true;
showProgress();
Data.list(Map.class, DefaultPartitions.APP_DOCUMENTS).thenAccept(mUploadApp);
}

private void loadUserDocuments() {

/* List the user documents. */
Expand Down Expand Up @@ -337,6 +341,7 @@ private void updateStorageType(int position) {
@Override
protected void onResume() {
super.onResume();
loadAppDocuments();
loadUserDocuments();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -735,7 +735,7 @@ private void initEditText(int key, final int title, final String preferencesKey,
Log.w(LOG_TAG, "Couldn't find preference for key: " + key);
return;
}
preference.setSummary(MainActivity.sSharedPreferences.getString(preferencesKey, defaultValue));
preference.setSummary(getSummary(preferencesKey, defaultValue));
preference.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {

@Override
Expand All @@ -749,14 +749,14 @@ public boolean onPreferenceClick(final Preference preference) {
@Override
public void onClick(DialogInterface dialog, int which) {
listener.onSave(input.getText().toString());
preference.setSummary(MainActivity.sSharedPreferences.getString(preferencesKey, defaultValue));
preference.setSummary(getSummary(preferencesKey, defaultValue));
}
})
.setNeutralButton(R.string.reset, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
listener.onReset();
preference.setSummary(MainActivity.sSharedPreferences.getString(preferencesKey, defaultValue));
preference.setSummary(getSummary(preferencesKey, defaultValue));
}
})
.setNegativeButton(R.string.cancel, null)
Expand Down Expand Up @@ -874,6 +874,16 @@ private String getCrashesFileAttachmentSummary() {
return getString(R.string.appcenter_crashes_file_attachment_summary_empty);
}

private String getSummary(final String preferencesKey, final String defaultValue) {
String summary = MainActivity.sSharedPreferences.getString(preferencesKey, defaultValue);
if (summary == null) {
return getString(R.string.unset_summary);
} else if (summary.isEmpty()) {
return getString(R.string.empty_summary);
}
return summary;
}

private interface HasEnabled {

boolean isEnabled();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ public int getItemCount() {

public void upload(List<DocumentWrapper<Map>> list) {
if (list != null) {
mList.clear();
mList.addAll(list);
}
}
Expand Down
3 changes: 3 additions & 0 deletions apps/sasquatch/src/main/res/values/settings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,9 @@

<string name="property_saved" tools:ignore="MissingTranslation">Property saved</string>

<string name="unset_summary" tools:ignore="MissingTranslation">Unset</string>
<string name="empty_summary" tools:ignore="MissingTranslation">Empty</string>

<string name="save" tools:ignore="MissingTranslation">Save</string>
<string name="reset" tools:ignore="MissingTranslation">Reset</string>
<string name="cancel" tools:ignore="MissingTranslation">Cancel</string>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
import com.microsoft.appcenter.ingestion.models.properties.LongTypedProperty;
import com.microsoft.appcenter.ingestion.models.properties.StringTypedProperty;
import com.microsoft.appcenter.ingestion.models.properties.TypedProperty;
import com.microsoft.appcenter.utils.UUIDUtils;

import org.json.JSONException;
import org.junit.Assert;
Expand Down Expand Up @@ -82,14 +81,14 @@ public void someBatch() throws JSONException {
{
EventLog eventLog = new EventLog();
eventLog.setTimestamp(new Date());
eventLog.setId(UUIDUtils.randomUUID());
eventLog.setId(UUID.randomUUID());
eventLog.setName("subscribe");
logs.add(eventLog);
}
{
EventLog eventLog = new EventLog();
eventLog.setTimestamp(new Date());
eventLog.setId(UUIDUtils.randomUUID());
eventLog.setId(UUID.randomUUID());
eventLog.setName("click");
eventLog.setProperties(new HashMap<String, String>() {{
put("x", "1");
Expand Down Expand Up @@ -121,12 +120,12 @@ public void someBatch() throws JSONException {
properties.add(sp);
EventLog eventLog = new EventLog();
eventLog.setTimestamp(new Date());
eventLog.setId(UUIDUtils.randomUUID());
eventLog.setId(UUID.randomUUID());
eventLog.setName("event");
eventLog.setTypedProperties(properties);
logs.add(eventLog);
}
UUID sid = UUIDUtils.randomUUID();
UUID sid = UUID.randomUUID();
for (Log log : logs) {
log.setSid(sid);
log.setDevice(device);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
import com.microsoft.appcenter.ingestion.models.properties.StringTypedProperty;
import com.microsoft.appcenter.ingestion.models.properties.TypedProperty;
import com.microsoft.appcenter.utils.AppCenterLog;
import com.microsoft.appcenter.utils.UUIDUtils;
import com.microsoft.appcenter.utils.async.AppCenterFuture;
import com.microsoft.appcenter.utils.async.DefaultAppCenterFuture;
import com.microsoft.appcenter.utils.context.UserIdContext;
Expand All @@ -44,6 +43,7 @@
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.UUID;
import java.util.concurrent.TimeUnit;

/**
Expand Down Expand Up @@ -824,7 +824,7 @@ public void run() {
AppCenterLog.error(LOG_TAG, "Cannot track event using Analytics.trackEvent if not started from app, please start from the application or use Analytics.getTransmissionTarget.");
return;
}
eventLog.setId(UUIDUtils.randomUUID());
eventLog.setId(UUID.randomUUID());
eventLog.setName(name);
eventLog.setTypedProperties(properties);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
import com.microsoft.appcenter.ingestion.models.Log;
import com.microsoft.appcenter.ingestion.models.StartServiceLog;
import com.microsoft.appcenter.utils.AppCenterLog;
import com.microsoft.appcenter.utils.UUIDUtils;
import com.microsoft.appcenter.utils.context.SessionContext;

import java.util.Date;
Expand Down Expand Up @@ -123,7 +122,7 @@ private void sendStartSessionIfNeeded() {
if (mSid == null || hasSessionTimedOut()) {

/* New session: generate a new identifier. */
mSid = UUIDUtils.randomUUID();
mSid = UUID.randomUUID();

/* Update session storage. */
SessionContext.getInstance().addSession(mSid);
Expand Down
Loading

0 comments on commit e0ba412

Please sign in to comment.