Skip to content

Commit 873ab9b

Browse files
authored
Merge pull request #577 from Microsoft/develop
Version 1.1.0
2 parents 11872b7 + 57dd901 commit 873ab9b

File tree

106 files changed

+3340
-1188
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

106 files changed

+3340
-1188
lines changed

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,3 +50,8 @@ google-services.json
5050
# Localization
5151
localization/*.zip
5252
localization/unzip/
53+
54+
# VS Code + Java extension follows Eclipse conventions
55+
.settings
56+
.project
57+
.classpath

README.md

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
[![Build Status](https://www.bitrise.io/app/78891228f9c6e6dc.svg?token=KQ6kVAci490XBjulCcQuGQ&branch=develop)](https://www.bitrise.io/app/78891228f9c6e6dc)
21
[![codecov](https://codecov.io/gh/Microsoft/AppCenter-SDK-Android/branch/develop/graph/badge.svg?token=YwMZRPnYK3)](https://codecov.io/gh/Microsoft/AppCenter-SDK-Android)
32
[![GitHub Release](https://img.shields.io/github/release/Microsoft/AppCenter-SDK-Android.svg)](https://github.com/Microsoft/AppCenter-SDK-Android/releases/latest)
43
[![Bintray](https://api.bintray.com/packages/vsappcenter/appcenter/appcenter/images/download.svg)](https://bintray.com/vsappcenter/appcenter)
@@ -26,8 +25,6 @@ It is super easy to use App Center. Have a look at our [get started documentatio
2625

2726
We are looking forward to your contributions via pull requests.
2827

29-
Please note that the test app named **Sasquatch** requires a **google-services.json** to compile. This file is git ignored as it contains secrets. You have to provide your own **google-services.json** file in the **app/sasquatch** folder if you want to build. This requires having your own Firebase Project.
30-
3128
### 2.1 Code of Conduct
3229

3330
This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments.

apps/appcenter-post-clone.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/usr/bin/env bash
2+
echo "Executing post clone script in `pwd`"
3+
echo $GOOGLE_SERVICES_JSON | base64 -D > $APPCENTER_SOURCE_DIRECTORY/apps/sasquatch/google-services.json
4+
echo "dimension.dependency=$DIMENSION_DEPENDENCY" >> $APPCENTER_SOURCE_DIRECTORY/local.properties

apps/build.gradle

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,14 @@ subprojects {
3131

3232
// Task to copy a specific APK from sub projects to current project, for App Center build to find it.
3333
def copyApkToProjectBuildTask(buildType) {
34+
Properties properties = new Properties()
35+
File file = rootProject.file('local.properties')
36+
if (file.exists()) {
37+
properties.load(file.newDataInputStream())
38+
}
39+
def dependency = properties.get("dimension.dependency", "jcenter")
3440
subprojects.each { project ->
35-
def dependency = "jcenter"
36-
def apkPath = "${project.buildDir}/outputs/apk/${dependency}Dependency/${buildType}/${project.name}-${dependency}Dependency-${buildType}"
41+
def apkPath = "${project.buildDir}/outputs/apk/${dependency}DependencyVanilla/${buildType}/${project.name}-${dependency}Dependency-vanilla-${buildType}"
3742
if ("release".equals(buildType)) {
3843
apkPath += "-unsigned"
3944
}
@@ -58,4 +63,8 @@ task assembleRelease() {
5863
}
5964

6065
// Empty task with task dependencies.
61-
task assemble(dependsOn: [assembleDebug, assembleRelease]) {}
66+
task assemble(dependsOn: [assembleDebug, assembleRelease]) {}
67+
68+
task clean() {
69+
delete project.buildDir
70+
}

apps/mobile-center-post-clone.sh

Lines changed: 0 additions & 3 deletions
This file was deleted.

apps/sasquatch/build.gradle

Lines changed: 48 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ evaluationDependsOn(':apps')
66

77
android {
88

9-
flavorDimensions "dependency"
9+
flavorDimensions "dependency", "pushLibrary"
1010

1111
productFlavors {
1212
projectDependency {
@@ -17,6 +17,20 @@ android {
1717
dimension "dependency"
1818
applicationIdSuffix ".jcenter"
1919
}
20+
vanilla {
21+
dimension "pushLibrary"
22+
}
23+
firebase {
24+
dimension "pushLibrary"
25+
}
26+
}
27+
28+
/* TODO remove that filter once we update the jcenter demo to include the no firebase push sdk. */
29+
variantFilter { variant ->
30+
def names = variant.flavors*.name
31+
if (names.contains("jcenterDependency") && names.contains("vanilla")) {
32+
setIgnore(true)
33+
}
2034
}
2135

2236
buildTypes {
@@ -30,28 +44,45 @@ android {
3044

3145
repositories {
3246
maven {
33-
url "https://dl.bintray.com/vsappcenter/appcenter-snapshot"
47+
url "https://dl.bintray.com/vsappcenter/appcenter-snapshot"
3448
}
3549
}
3650

3751
dependencies {
52+
implementation "com.android.support:support-v4:${rootProject.ext.supportLibVersion}"
53+
implementation "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}"
54+
55+
projectDependencyImplementation project(':sdk:appcenter-analytics')
56+
projectDependencyImplementation project(':sdk:appcenter-crashes')
57+
projectDependencyImplementation project(':sdk:appcenter-distribute')
58+
projectDependencyImplementation project(':sdk:appcenter-push')
59+
projectDependencyImplementation project(':sdk:appcenter-rum')
60+
3861
def version = "1.0.0"
39-
compile "com.android.support:support-v4:${rootProject.ext.supportLibVersion}"
40-
compile "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}"
41-
projectDependencyCompile project(':sdk:appcenter-analytics')
42-
projectDependencyCompile project(':sdk:appcenter-crashes')
43-
projectDependencyCompile project(':sdk:appcenter-distribute')
44-
projectDependencyCompile project(':sdk:appcenter-push')
45-
projectDependencyCompile project(':sdk:appcenter-rum')
46-
jcenterDependencyCompile "com.microsoft.appcenter:appcenter-analytics:${version}"
47-
jcenterDependencyCompile "com.microsoft.appcenter:appcenter-crashes:${version}"
48-
jcenterDependencyCompile "com.microsoft.appcenter:appcenter-distribute:${version}"
49-
jcenterDependencyCompile "com.microsoft.appcenter:appcenter-push:${version}"
62+
//noinspection GradleDependency
63+
jcenterDependencyImplementation "com.microsoft.appcenter:appcenter-analytics:${version}"
64+
//noinspection GradleDependency
65+
jcenterDependencyImplementation "com.microsoft.appcenter:appcenter-crashes:${version}"
66+
//noinspection GradleDependency
67+
jcenterDependencyImplementation "com.microsoft.appcenter:appcenter-distribute:${version}"
68+
//noinspection GradleDependency
69+
jcenterDependencyImplementation "com.microsoft.appcenter:appcenter-push:${version}"
70+
71+
firebaseCompile "com.google.firebase:firebase-core:${rootProject.ext.firebaseLibVersion}"
72+
firebaseCompile "com.google.firebase:firebase-messaging:${rootProject.ext.firebaseLibVersion}"
5073

5174
/* Force usage this version of support annotations to avoid conflict. */
52-
androidTestCompile "com.android.support:support-annotations:${rootProject.ext.supportLibVersion}"
53-
androidTestCompile 'com.android.support.test.espresso:espresso-core:3.0.1'
54-
compile 'com.android.support.test.espresso:espresso-idling-resource:3.0.1'
75+
androidTestImplementation "com.android.support:support-annotations:${rootProject.ext.supportLibVersion}"
76+
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
77+
implementation 'com.android.support.test.espresso:espresso-idling-resource:3.0.1'
5578
}
5679

57-
apply plugin: 'com.google.gms.google-services'
80+
/*
81+
* This will also bypass google-services.json if executing assembleDebug wildcard task.
82+
* This is needed to build from App Center build as we don't commit google-services.json and
83+
* App Center build cannot detect our gradle tasks so we make it execute assembleDebug with a
84+
* work around. We are interested in only a vanilla build variant (no Firebase) for such builds.
85+
*/
86+
if (getGradle().getStartParameter().getTaskRequests().toString().contains("Firebase")) {
87+
apply plugin: 'com.google.gms.google-services'
88+
}

apps/sasquatch/src/androidTest/java/com/microsoft/appcenter/sasquatch/activities/AnalyticsTest.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
import com.microsoft.appcenter.Constants;
88
import com.microsoft.appcenter.sasquatch.R;
9+
import com.microsoft.appcenter.sasquatch.listeners.SasquatchAnalyticsListener;
910

1011
import org.junit.Rule;
1112
import org.junit.Test;
@@ -78,8 +79,8 @@ public void sendPageTest() throws InterruptedException {
7879
}
7980

8081
private void waitAnalytics() {
81-
Espresso.registerIdlingResources(MainActivity.analyticsIdlingResource);
82+
Espresso.registerIdlingResources(SasquatchAnalyticsListener.analyticsIdlingResource);
8283
onView(isRoot()).perform(waitFor(CHECK_DELAY));
83-
Espresso.unregisterIdlingResources(MainActivity.analyticsIdlingResource);
84+
Espresso.unregisterIdlingResources(SasquatchAnalyticsListener.analyticsIdlingResource);
8485
}
8586
}

apps/sasquatch/src/androidTest/java/com/microsoft/appcenter/sasquatch/activities/CrashesTest.java

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,14 @@
1212
import android.support.v4.app.ActivityCompat;
1313
import android.view.View;
1414

15-
import com.microsoft.appcenter.Constants;
1615
import com.microsoft.appcenter.AppCenter;
16+
import com.microsoft.appcenter.Constants;
1717
import com.microsoft.appcenter.crashes.Crashes;
1818
import com.microsoft.appcenter.crashes.CrashesPrivateHelper;
1919
import com.microsoft.appcenter.crashes.model.ErrorReport;
2020
import com.microsoft.appcenter.crashes.utils.ErrorLogHelper;
2121
import com.microsoft.appcenter.sasquatch.R;
22+
import com.microsoft.appcenter.sasquatch.listeners.SasquatchCrashesListener;
2223
import com.microsoft.appcenter.utils.storage.StorageHelper;
2324

2425
import org.hamcrest.Description;
@@ -96,18 +97,23 @@ public void setUp() throws Exception {
9697
assertTrue(logFile.delete());
9798
}
9899

100+
/* Clear listeners. */
101+
MainActivity.sAnalyticsListener = null;
102+
MainActivity.sCrashesListener = null;
103+
MainActivity.sPushListener = null;
104+
99105
/* Launch main activity and go to setting page. Required to properly initialize. */
100106
mActivityTestRule.launchActivity(new Intent());
101107

102108
/* Register IdlingResource */
103-
Espresso.registerIdlingResources(MainActivity.crashesIdlingResource);
109+
Espresso.registerIdlingResources(SasquatchCrashesListener.crashesIdlingResource);
104110
}
105111

106112
@After
107113
public final void tearDown() {
108114

109115
/* Unregister IdlingResource */
110-
Espresso.unregisterIdlingResources(MainActivity.crashesIdlingResource);
116+
Espresso.unregisterIdlingResources(SasquatchCrashesListener.crashesIdlingResource);
111117
}
112118

113119
@Test
@@ -215,9 +221,18 @@ public void handle(Throwable error, Matcher<View> viewMatcher) {
215221
}
216222

217223
private void relaunchActivity() {
224+
225+
/* Destroy old instances. */
218226
ActivityCompat.finishAffinity(mActivityTestRule.getActivity());
219227
unsetInstance(AppCenter.class);
220228
unsetInstance(Crashes.class);
229+
230+
/* Clear listeners. */
231+
MainActivity.sAnalyticsListener = null;
232+
MainActivity.sCrashesListener = null;
233+
MainActivity.sPushListener = null;
234+
235+
/* Launch activity again. */
221236
Intent intent = new Intent();
222237
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
223238
mActivityTestRule.launchActivity(intent);

apps/sasquatch/src/main/java/com/microsoft/appcenter/sasquatch/activities/DeviceInfoActivity.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import android.support.annotation.NonNull;
55
import android.support.annotation.VisibleForTesting;
66
import android.support.v7.app.AppCompatActivity;
7+
import android.util.Log;
78
import android.view.View;
89
import android.view.ViewGroup;
910
import android.widget.ArrayAdapter;
@@ -14,7 +15,6 @@
1415
import com.microsoft.appcenter.ingestion.models.Device;
1516
import com.microsoft.appcenter.sasquatch.R;
1617
import com.microsoft.appcenter.utils.DeviceInfoHelper;
17-
import com.microsoft.appcenter.utils.AppCenterLog;
1818
import com.microsoft.appcenter.utils.NetworkStateHelper;
1919

2020
import java.lang.reflect.Method;
@@ -26,7 +26,7 @@ public class DeviceInfoActivity extends AppCompatActivity implements NetworkStat
2626
/**
2727
* TAG used in logging.
2828
*/
29-
private static final String TAG = "DeviceInfoActivity";
29+
private static final String LOG_TAG = "DeviceInfoActivity";
3030

3131
private static final String[] METHOD_BLACK_LIST = {"getClass"};
3232

@@ -108,7 +108,7 @@ private boolean isInBlackList(String name) {
108108
@Override
109109
public void onNetworkStateUpdated(boolean connected) {
110110
String message = "Network " + (connected ? "up" : "down");
111-
AppCenterLog.verbose(TAG, message);
111+
Log.v(LOG_TAG, message);
112112
Toast.makeText(this, message, Toast.LENGTH_SHORT).show();
113113
}
114114

0 commit comments

Comments
 (0)