本文整理汇总了Java中com.microsoft.onedrivesdk.BuildConfig类的典型用法代码示例。如果您正苦于以下问题:Java BuildConfig类的具体用法?Java BuildConfig怎么用?Java BuildConfig使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
BuildConfig类属于com.microsoft.onedrivesdk包,在下文中一共展示了BuildConfig类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: logout
import com.microsoft.onedrivesdk.BuildConfig; //导入依赖的package包/类
/**
* Log the current user out.
* @throws ClientException If the logout was unable to complete for any reason.
*/
@Override
public synchronized void logout() throws ClientException {
if (!mInitialized) {
throw new IllegalStateException("init must be called");
}
mLogger.logDebug("Starting logout");
if (mMSAAuthenticator.getAccountInfo() != null) {
mLogger.logDebug("Starting logout of MSA account");
mMSAAuthenticator.logout();
}
if (mADALAuthenticator.getAccountInfo() != null) {
mLogger.logDebug("Starting logout of ADAL account");
mADALAuthenticator.logout();
}
getSharedPreferences()
.edit()
.clear()
.putInt(VERSION_CODE_KEY, BuildConfig.VERSION_CODE)
.commit();
}
示例2: BaseRequest
import com.microsoft.onedrivesdk.BuildConfig; //导入依赖的package包/类
/**
* Create the request.
* @param requestUrl The url to make the request against.
* @param client The client which can issue the request.
* @param options The options for this request.
* @param responseClass The class for the response.
*/
public BaseRequest(final String requestUrl,
final IOneDriveClient client,
final List<Option> options,
final Class responseClass) {
mRequestUrl = requestUrl;
mClient = client;
mResponseClass = responseClass;
mHeadersOptions = new ArrayList<>();
mQueryOptions = new ArrayList<>();
if (options != null) {
for (final Option option : options) {
if (option instanceof HeaderOption) {
mHeadersOptions.add((HeaderOption) option);
}
if (option instanceof QueryOption) {
mQueryOptions.add((QueryOption) option);
}
}
}
final HeaderOption requestStatsHeader = new HeaderOption(REQUEST_STATS_HEADER_NAME,
String.format(REQUEST_STATS_HEADER_VALUE_FORMAT_STRING, BuildConfig.VERSION_NAME));
mHeadersOptions.add(requestStatsHeader);
}
示例3: logout
import com.microsoft.onedrivesdk.BuildConfig; //导入依赖的package包/类
/**
* Logs the current user out.
* @throws ClientException An exception occurs if the logout was unable to complete for any reason.
*/
@SuppressWarnings("deprecation")
@Override
public synchronized void logout() throws ClientException {
if (!mInitialized) {
throw new IllegalStateException("init must be called");
}
mLogger.logDebug("Starting logout");
mLogger.logDebug("Clearing ADAL cache");
mAdalContext.getCache().removeAll();
mLogger.logDebug("Clearing all webview cookies");
CookieSyncManager.createInstance(mActivity);
CookieManager cookieManager = CookieManager.getInstance();
cookieManager.removeAllCookie();
CookieSyncManager.getInstance().sync();
mLogger.logDebug("Clearing all ADAL Authenticator shared preferences");
final SharedPreferences prefs = getSharedPreferences();
prefs.edit()
.clear()
.putInt(VERSION_CODE_KEY, BuildConfig.VERSION_CODE)
.apply();
mUserId.set(null);
mResourceUrl.set(null);
}
示例4: setAccountTypeInPreferences
import com.microsoft.onedrivesdk.BuildConfig; //导入依赖的package包/类
/**
* Sets the AccountType from SharedPreferences
* @param accountType The account type, can be null
*/
private void setAccountTypeInPreferences(@Nullable final AccountType accountType) {
if (accountType == null) {
return;
}
getSharedPreferences()
.edit()
.putString(ACCOUNT_TYPE_KEY, accountType.toString())
.putInt(VERSION_CODE_KEY, BuildConfig.VERSION_CODE)
.commit();
}
示例5: login
import com.microsoft.onedrivesdk.BuildConfig; //导入依赖的package包/类
/**
* Starts an interactive login.
* @param emailAddressHint The hint for the email address during the interactive login.
* @return The account info.
* @throws ClientException An exception occurs if the login was unable to complete for any reason.
*/
@Override
public synchronized IAccountInfo login(final String emailAddressHint) throws ClientException {
if (!mInitialized) {
throw new IllegalStateException("init must be called");
}
mLogger.logDebug("Starting login");
final AuthenticationResult discoveryServiceAuthToken =
getDiscoveryServiceAuthResult(emailAddressHint);
if (discoveryServiceAuthToken.getStatus() != AuthenticationResult.AuthenticationStatus.Succeeded) {
final ClientAuthenticatorException clientAuthenticatorException
= new ClientAuthenticatorException("Unable to authenticate user with ADAL, Error Code: "
+ discoveryServiceAuthToken.getErrorCode()
+ " Error Message"
+ discoveryServiceAuthToken
.getErrorDescription(),
OneDriveErrorCodes.AuthenticationFailure);
mLogger.logError("Unsuccessful login attempt", clientAuthenticatorException);
throw clientAuthenticatorException;
}
// Get the resource information for the OneDrive services.
final ServiceInfo oneDriveServiceInfo =
getOneDriveServiceInfoFromDiscoveryService(discoveryServiceAuthToken.getAccessToken());
// Request a fresh auth token for the OneDrive service.
final AuthenticationResult oneDriveServiceAuthToken =
getOneDriveServiceAuthResult(oneDriveServiceInfo);
// Get the OneDrive auth token and save a reference to it.
final String serviceInfoAsString = mHttpProvider.getSerializer()
.serializeObject(oneDriveServiceInfo);
mLogger.logDebug("Successful login, saving information for silent re-auth");
final SharedPreferences preferences = getSharedPreferences();
mResourceUrl.set(oneDriveServiceInfo.serviceEndpointUri);
mUserId.set(discoveryServiceAuthToken.getUserInfo().getUserId());
mOneDriveServiceInfo.set(oneDriveServiceInfo);
preferences
.edit()
.putString(RESOURCE_URL_KEY, mResourceUrl.get())
.putString(USER_ID_KEY, mUserId.get())
.putString(SERVICE_INFO_KEY, serviceInfoAsString)
.putInt(VERSION_CODE_KEY, BuildConfig.VERSION_CODE)
.apply();
mLogger.logDebug("Successfully retrieved login information");
mLogger.logDebug(" Resource Url: " + mResourceUrl.get());
mLogger.logDebug(" User ID: " + mUserId.get());
mLogger.logDebug(" Service Info: " + serviceInfoAsString);
final ADALAccountInfo adalAccountInfo = new ADALAccountInfo(this,
oneDriveServiceAuthToken,
oneDriveServiceInfo,
mLogger);
mAccountInfo.set(adalAccountInfo);
return mAccountInfo.get();
}
示例6: testMinVersionNumber
import com.microsoft.onedrivesdk.BuildConfig; //导入依赖的package包/类
public void testMinVersionNumber() throws Exception {
Assert.assertTrue("Regression in version number, " + BuildConfig.VERSION_CODE, BuildConfig.VERSION_CODE >= 10102);
}