-
Notifications
You must be signed in to change notification settings - Fork 131
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1444 from microsoft/develop
Version 3.3.0
- Loading branch information
Showing
28 changed files
with
1,003 additions
and
155 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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') | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
11
sdk/appcenter-distribute-play/src/main/AndroidManifest.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
193 changes: 193 additions & 0 deletions
193
...ppcenter-distribute-play/src/main/java/com/microsoft/appcenter/distribute/Distribute.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) { | ||
} | ||
} |
73 changes: 73 additions & 0 deletions
73
...distribute-play/src/main/java/com/microsoft/appcenter/distribute/DistributeConstants.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. */ | ||
} | ||
} |
Oops, something went wrong.