Skip to content

Commit

Permalink
Merge pull request #1444 from microsoft/develop
Browse files Browse the repository at this point in the history
Version 3.3.0
  • Loading branch information
MatkovIvan authored Jul 21, 2020
2 parents 7c4a7a0 + bf2705d commit a818570
Show file tree
Hide file tree
Showing 28 changed files with 1,003 additions and 155 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
- run: |
echo "Assemble modules"
./gradlew :sdk:appcenter:assemble :sdk:appcenter-analytics:assemble :sdk:appcenter-crashes:assemble :sdk:appcenter-distribute:assemble :sdk:appcenter-push:assemble
./gradlew :sdk:appcenter:assemble :sdk:appcenter-analytics:assemble :sdk:appcenter-crashes:assemble :sdk:appcenter-distribute:assemble :sdk:appcenter-distribute-play:assemble :sdk:appcenter-push:assemble
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
# App Center SDK for Android Change Log

## Version 3.3.0

### App Center

* **[Fix]** Fix an `IncorrectContextUseViolation` warning when calculating screen size on Android 11.
* **[Fix]** All SQL commands used in SDK are presented as raw strings to avoid any possible static analyzer's SQL injection false alarms.
* **[Fix]** Fix Distribute can't get updates for Realme devices which use Realme UI.

### App Center Distribute Play

App Center Distribute Play is a package with stubbed APIs for Distribute module to avoid Google Play flagging the application for malicious behavior. It must be used only for build variants which are going to be published on Google Play. See the [public documentation](https://docs.microsoft.com/en-us/appcenter/sdk/distribute/android) for more details about this change.

___

## Version 3.2.2

### App Center
Expand Down
27 changes: 15 additions & 12 deletions apps/sasquatch/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ evaluationDependsOn(':apps')

android {

flavorDimensions "dependency", "pushLibrary"
flavorDimensions "dependency", "distribute"

defaultConfig {
externalNativeBuild {
Expand All @@ -31,11 +31,11 @@ android {
dimension "dependency"
applicationIdSuffix ".jcenter"
}
vanilla {
dimension "pushLibrary"
appCenter {
dimension "distribute"
}
firebase {
dimension "pushLibrary"
googlePlay {
dimension "distribute"
}
}

Expand Down Expand Up @@ -68,25 +68,28 @@ dependencies {

projectDependencyImplementation project(':sdk:appcenter-analytics')
projectDependencyImplementation project(':sdk:appcenter-crashes')
projectDependencyImplementation project(':sdk:appcenter-distribute')
projectDependencyImplementation project(':sdk:appcenter-push')

def appCenterSdkVersion = "3.2.2"
jcenterDependencyImplementation "com.microsoft.appcenter:appcenter-analytics:${appCenterSdkVersion}"
jcenterDependencyImplementation "com.microsoft.appcenter:appcenter-crashes:${appCenterSdkVersion}"
jcenterDependencyImplementation "com.microsoft.appcenter:appcenter-distribute:${appCenterSdkVersion}"
jcenterDependencyImplementation "com.microsoft.appcenter:appcenter-push:${appCenterSdkVersion}"

def taskRequests = getGradle().getStartParameter().getTaskRequests().toString()
if (taskRequests.contains("GooglePlay")) {
projectDependencyImplementation project(':sdk:appcenter-distribute-play')
jcenterDependencyImplementation "com.microsoft.appcenter:appcenter-distribute-play:${appCenterSdkVersion}"
} else {
projectDependencyImplementation project(':sdk:appcenter-distribute')
jcenterDependencyImplementation "com.microsoft.appcenter:appcenter-distribute:${appCenterSdkVersion}"
}

androidTestImplementation 'com.android.support.test:rules:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation 'com.android.support.test.espresso:espresso-idling-resource:3.0.2'
}

// We are interested in excluding the plugin only for the vanilla sasquatch build variant.
def taskRequests = getGradle().getStartParameter().getTaskRequests().toString()
if (!taskRequests.contains("sasquatch") || taskRequests.contains("Firebase")) {
apply plugin: 'com.google.gms.google-services'
}
apply plugin: 'com.google.gms.google-services'

/*
* Project and jcenter conflict since they are not using same version of Push and
Expand Down
11 changes: 11 additions & 0 deletions sdk/appcenter-distribute-play/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License.
*/

project.description = 'This package contains functionalities to get in-app updates for your application.'
evaluationDependsOn(':sdk')

dependencies {
api project(':sdk:appcenter')
}
4 changes: 4 additions & 0 deletions sdk/appcenter-distribute-play/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# The following options are set by default.
# Make sure they are always set, even if the default proguard config changes.
-dontskipnonpubliclibraryclasses
-verbose
11 changes: 11 additions & 0 deletions sdk/appcenter-distribute-play/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright (c) Microsoft Corporation. All rights reserved.
~ Licensed under the MIT License.
-->

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.microsoft.appcenter.distribute">
<application>
</application>
</manifest>
Original file line number Diff line number Diff line change
@@ -0,0 +1,193 @@
/*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License.
*/

package com.microsoft.appcenter.distribute;

import android.app.Activity;
import android.content.Context;
import android.support.annotation.NonNull;
import android.support.annotation.VisibleForTesting;

import com.microsoft.appcenter.AbstractAppCenterService;
import com.microsoft.appcenter.channel.Channel;
import com.microsoft.appcenter.ingestion.models.json.LogFactory;
import com.microsoft.appcenter.utils.AppCenterLog;
import com.microsoft.appcenter.utils.async.AppCenterFuture;
import com.microsoft.appcenter.utils.async.DefaultAppCenterFuture;
import java.util.HashMap;
import java.util.Map;

import static com.microsoft.appcenter.distribute.DistributeConstants.LOG_TAG;
import static com.microsoft.appcenter.distribute.DistributeConstants.SERVICE_NAME;

/**
* Distribute service.
*/
public class Distribute extends AbstractAppCenterService {

private static Distribute sInstance;

private static final String DISTRIBUTE_GROUP = "group_distribute";

/**
* Get shared instance.
*
* @return shared instance.
*/
public static synchronized Distribute getInstance() {
if (sInstance == null) {
sInstance = new Distribute();
}
return sInstance;
}

/**
* Check whether Distribute service is enabled or not.
*
* @return future with result being <code>true</code> if enabled, <code>false</code> otherwise.
* @see AppCenterFuture
*/
public static AppCenterFuture<Boolean> isEnabled() {
DefaultAppCenterFuture appCenterFuture = new DefaultAppCenterFuture<>();
appCenterFuture.complete(true);
return appCenterFuture;
}

/**
* Enable or disable Distribute service.
*
* The state is persisted in the device's storage across application launches.
*
* @param enabled <code>true</code> to enable, <code>false</code> to disable.
* @return future with null result to monitor when the operation completes.
*/
public static AppCenterFuture<Void> setEnabled(boolean enabled) {
DefaultAppCenterFuture appCenterFuture = new DefaultAppCenterFuture<>();
appCenterFuture.complete(true);
return appCenterFuture;
}

/**
* Change the base URL opened in the browser to get update token from user login information.
*
* @param installUrl install base URL.
*/
public static void setInstallUrl(String installUrl) {
}

/**
* Change the base URL used to make API calls.
*
* @param apiUrl API base URL.
*/
public static void setApiUrl(String apiUrl) {
}

/**
* Get the current update track (public vs private).
*/
public static int getUpdateTrack() {
return UpdateTrack.PUBLIC;
}

/**
* Set the update track (public vs private).
*
* @param updateTrack update track.
*/
public static void setUpdateTrack(@UpdateTrack int updateTrack) {
}

/**
* Sets a distribute listener.
*
* @param listener The custom distribute listener.
*/
public static void setListener(DistributeListener listener) {
}

/**
* Set whether the distribute service can be used within a debuggable build.
*
* @param enabled <code>true</code> to enable, <code>false</code> to disable.
*/
public static void setEnabledForDebuggableBuild(boolean enabled) {
}

/**
* If update dialog is customized by returning <code>true</code> in {@link DistributeListener#onReleaseAvailable(Activity, ReleaseDetails)},
* You need to tell the distribute SDK using this function what is the user action.
*
* @param updateAction one of {@link UpdateAction} actions.
* For mandatory updates, only {@link UpdateAction#UPDATE} is allowed.
*/
public static void notifyUpdateAction(@UpdateAction int updateAction) {
}

/**
* Implements {@link #notifyUpdateAction(int)}.
*/
synchronized void handleUpdateAction(final int updateAction) {
}

/**
* Trigger a check for update.
* If the application is in background, it will delay the check for update until the application is in foreground.
* This call has no effect if there is already an ongoing check.
*/
public static void checkForUpdate() {
}

/**
* Disable automatic check for update before the service starts.
*/
public static void disableAutomaticCheckForUpdate() {
}

@Override
protected String getGroupName() {
return DISTRIBUTE_GROUP;
}

@Override
public String getServiceName() {
return SERVICE_NAME;
}

@Override
protected String getLoggerTag() {
return LOG_TAG;
}

@Override
protected int getTriggerCount() {
return 1;
}

@Override
public Map<String, LogFactory> getLogFactories() {
return new HashMap<>();
}

@Override
public synchronized void onStarted(@NonNull Context context, @NonNull Channel channel, String appSecret, String transmissionTargetToken, boolean startedFromApp) {
}

@Override
public synchronized void onActivityResumed(Activity activity) {
}

@Override
public synchronized void onActivityPaused(Activity activity) {
}

@Override
public void onApplicationEnterForeground() {
}

@Override
protected synchronized void applyEnabledState(boolean enabled) {
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
/*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License.
*/

package com.microsoft.appcenter.distribute;

import android.support.annotation.VisibleForTesting;

import com.microsoft.appcenter.AppCenter;

/**
* Distribute constants.
*/
public final class DistributeConstants {

/**
* Distribute service name.
*/
static final String SERVICE_NAME = "DistributePlay";

/**
* Log tag for this service.
*/
public static final String LOG_TAG = AppCenter.LOG_TAG + SERVICE_NAME;

/**
* Invalid download identifier.
*/
public static final long INVALID_DOWNLOAD_IDENTIFIER = -1;

/**
* Token used for handler callbacks to check download progress.
*/
public static final String HANDLER_TOKEN_CHECK_PROGRESS = SERVICE_NAME + ".handler_token_check_progress";

/**
* The download progress will be reported after loading this number of bytes.
*/
public static final long UPDATE_PROGRESS_BYTES_THRESHOLD = 512 * 1024;

/**
* The download progress will be reported not more often than this number of milliseconds.
*/
public static final long UPDATE_PROGRESS_TIME_THRESHOLD = 500;

/**
* 1 KiB in bytes (this not a kilobyte).
*/
public static final long KIBIBYTE_IN_BYTES = 1024;

/**
* Base key for stored preferences.
*/
private static final String PREFERENCE_PREFIX = SERVICE_NAME + ".";

/**
* Preference key to store the current/last download identifier (we keep download until a next
* one is scheduled as the file can be opened from device downloads U.I.).
*/
public static final String PREFERENCE_KEY_DOWNLOAD_ID = PREFERENCE_PREFIX + "download_id";

/**
* Preference key to store the downloading release file path.
*/
public static final String PREFERENCE_KEY_DOWNLOADED_RELEASE_FILE = PREFERENCE_PREFIX + "downloaded_release_file";

@VisibleForTesting
DistributeConstants() {

/* Hide constructor as it's just a constant class. */
}
}
Loading

0 comments on commit a818570

Please sign in to comment.