Skip to content
This repository has been archived by the owner on Oct 11, 2024. It is now read-only.

Commit

Permalink
Merge branch 'release/1.3.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
JM committed Jan 18, 2016
2 parents fee85ed + a9c4d87 commit 5201c3d
Show file tree
Hide file tree
Showing 396 changed files with 4,874 additions and 5,370 deletions.
44 changes: 43 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,22 @@
language: objective-c
osx_image: xcode611
osx_image: xcode7.1

cache:
- cocoapods

podfile: ios/Framework

before_install:

#Android installation (sdk, emulator, wait & unlock)
- export COMPONENTS=build-tools-23.0.2,android-19,android-23,extra-android-m2repository,extra-google-m2repository,sys-img-armeabi-v7a-android-19
- curl -L https://raw.github.com/embarkmobile/android-sdk-installer/version-2/android-sdk-installer | bash /dev/stdin --install=$COMPONENTS && source ~/.android-sdk-installer/env
- echo no | android create avd --force -n test -t android-19 --abi armeabi-v7a
- emulator -avd test -no-skin -no-audio -no-window &
- adb wait-for-device
- adb shell input keyevent 82 &

#iOS installation (gem, brew & pods)
- export LANG=en_US.UTF-8
- gem install cocoapods
- brew update > /dev/null
Expand All @@ -10,7 +25,34 @@ before_install:
- locale
- pod --version

before_script:
# - curl https://raw.githubusercontent.com/travis-ci/travis-cookbooks/62039b204699adcdf4b3365fac42d81246cb57fe/ci_environment/android-sdk/files/default/android-wait-for-emulator > android-wait-for-emulator
# - chmod u+x android-wait-for-emulator
# - ./android-wait-for-emulator

script:
- cd android/library/
- echo "sdk.dir=$ANDROID_HOME" > local.properties
# - ./gradlew -x javadocJar -x sourcesJar build test
- ./gradlew clean
- ./gradlew assembleDebug
- ./gradlew assembleDebugAndroidTest
- ./gradlew test

# - test-app tests
- cd ../samples/test-app/
- ./gradlew clean
- ./gradlew assembleDebug
- ./gradlew assembleDebugAndroidTest
- adb shell pm list packages
- adb install app/build/outputs/apk/app-debug.apk
- adb install app/build/outputs/apk/app-debug-androidTest-unaligned.apk
# - adb shell am instrument -w com.nhpatt.catalogodeactividadesasde/android.support.test.runner.AndroidJUnitRunner
- adb shell input keyevent 82 &
- ./gradlew connectedAndroidTest

# - iOS tests
- cd ../../..
- cd ios/Framework
- pod install
- ./run-tests.sh
Expand Down
13 changes: 7 additions & 6 deletions LiferayScreens.podspec
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Pod::Spec.new do |s|
s.name = 'LiferayScreens'
s.module_name = 'LiferayScreens'
s.version = '1.2.0'
s.version = '1.3.0'
s.summary = 'A family of visual components called screenlets that are connected to the Liferay Platform used as a backend'
s.homepage = 'https://www.liferay.com/liferay-screens'
s.license = {
Expand Down Expand Up @@ -36,7 +36,8 @@ Pod::Spec.new do |s|
s.exclude_files = [
'ios/Framework/Core/liferay-screens-bridge.h',
'ios/Framework/Tests/**/*.*',
'ios/Framework/Pods/**/*.*'
'ios/Framework/Pods/**/*.*',
'ios/Framework/Themes/Flat7/**/*.*'
]

s.resource_bundle = {
Expand All @@ -50,18 +51,18 @@ Pod::Spec.new do |s|
}

# Core
s.dependency 'Liferay-iOS-SDK', '6.2.0.17'
s.dependency 'Liferay-OAuth', '0.1.0'
s.dependency 'Liferay-iOS-SDK', '6.2.0.22'
s.dependency 'Liferay-OAuth', '0.1.1'
s.dependency 'MBProgressHUD', '0.9.1'
s.dependency 'SMXMLDocument', '1.1'
s.dependency 'ODRefreshControl', '1.2'
s.dependency 'YapDatabase', '2.6.5'

# Login & signup: save credentials
s.dependency 'KeychainAccess', '1.2.1'
s.dependency 'KeychainAccess', '2.3.1'

# UserPortrait
s.dependency 'CryptoSwift', '0.0.13'
s.dependency 'CryptoSwift', '0.1.1'

# DDLForm
s.dependency 'DTPickerPresenter', '0.2.0'
Expand Down
2 changes: 1 addition & 1 deletion android/library/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ subprojects {

subprojects {

version = '1.2.4'
version = '1.3.0'
group = 'com.liferay.mobile'

buildscript {
Expand Down
8 changes: 6 additions & 2 deletions android/library/core/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apply plugin: 'com.android.library'

android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
buildToolsVersion '23.0.2'

defaultConfig {
minSdkVersion 15
Expand All @@ -11,6 +11,10 @@ android {
versionName "1.0"
}

lintOptions {
abortOnError false
}

buildTypes {
release {
minifyEnabled false
Expand Down Expand Up @@ -73,7 +77,7 @@ dependencies {
compile 'com.pushtorefresh.storio:sqlite:1.4.0'

testCompile "junit:junit:4.12"
testCompile "org.robolectric:robolectric:3.0-rc2"
testCompile "org.robolectric:robolectric:3.0"
testCompile 'org.mockito:mockito-core:1.9.5'

}
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import com.liferay.mobile.screens.cache.OfflinePolicy;
import com.liferay.mobile.screens.context.LiferayServerContext;

import java.util.HashMap;
import java.util.Locale;

/**
Expand Down Expand Up @@ -101,11 +102,19 @@ public void storingToCache(Object object) {
}
}

public HashMap<String, Object> getCustomEntryQuery() {
return _customEntryQuery;
}

public void setCustomEntryQuery(HashMap<String, Object> customEntryQuery) {
_customEntryQuery = customEntryQuery;
}

@Override
protected void loadRows(AssetListInteractor interactor, int startRow, int endRow, Locale locale)
throws Exception {

interactor.loadRows(_groupId, _classNameId, _portletItemName, startRow, endRow, locale);
interactor.loadRows(_groupId, _classNameId, _portletItemName, _customEntryQuery, startRow, endRow, locale);
}

@Override
Expand Down Expand Up @@ -137,10 +146,10 @@ protected View createScreenletView(Context context, AttributeSet attributes) {
protected AssetListInteractor createInteractor(String actionName) {
return new AssetListInteractorImpl(getScreenletId(), _offlinePolicy);
}

private OfflinePolicy _offlinePolicy;
private long _classNameId;
private long _groupId;
private String _portletItemName;
private HashMap<String, Object> _customEntryQuery = new HashMap<>();

}
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

import com.liferay.mobile.screens.base.interactor.Interactor;

import java.util.HashMap;
import java.util.Locale;

/**
Expand All @@ -24,7 +25,8 @@
public interface AssetListInteractor extends Interactor<AssetListInteractorListener> {

void loadRows(
long groupId, long classNameId, String portletItemName, int startRow, int endRow, Locale locale)
long groupId, long classNameId, String portletItemName,
HashMap<String, Object> customEntryQuery, int startRow, int endRow, Locale locale)
throws Exception;

}
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import org.json.JSONException;
import org.json.JSONObject;

import java.util.HashMap;
import java.util.Locale;

import static com.liferay.mobile.screens.cache.DefaultCachedType.ASSET_LIST;
Expand All @@ -50,11 +51,13 @@ public AssetListInteractorImpl(int targetScreenletId, OfflinePolicy offlinePolic
}

public void loadRows(
long groupId, long classNameId, String portletItemName, int startRow, int endRow, Locale locale)
long groupId, long classNameId, String portletItemName,
HashMap<String, Object> customEntryQuery, int startRow, int endRow, Locale locale)
throws Exception {
this._groupId = groupId;
this._classNameId = classNameId;
this._portletItemName = portletItemName;
this._customEntryQuery = customEntryQuery;

processWithCache(startRow, endRow, locale);
}
Expand Down Expand Up @@ -98,8 +101,10 @@ protected BaseListCallback<AssetEntry> getCallback(Pair<Integer, Integer> rowsRa
@Override
protected void getPageRowsRequest(Session session, int startRow, int endRow, Locale locale) throws Exception {
if (_portletItemName == null) {


ScreensassetentryService service = new ScreensassetentryService(session);
JSONObject entryQueryAttributes = addQueryParams(_groupId, _classNameId);
JSONObject entryQueryAttributes = configureEntryQuery(_groupId, _classNameId);
entryQueryAttributes.put("start", startRow);
entryQueryAttributes.put("end", endRow);

Expand All @@ -110,22 +115,31 @@ protected void getPageRowsRequest(Session session, int startRow, int endRow, Loc
else {
session.setCallback(new FilteredAssetListCallback(getTargetScreenletId()));
ScreensassetentryService service = new ScreensassetentryService(session);
service.getAssetEntries(LiferayServerContext.getCompanyId(), _groupId, _portletItemName, locale.toString());
service.getAssetEntries(LiferayServerContext.getCompanyId(), _groupId, _portletItemName, locale.toString(), endRow);
}
}

@Override
protected void getPageRowCountRequest(Session session) throws Exception {
JSONObject entryQueryParams = addQueryParams(_groupId, _classNameId);
JSONObject entryQueryParams = configureEntryQuery(_groupId, _classNameId);
JSONObjectWrapper entryQuery = new JSONObjectWrapper(entryQueryParams);
new AssetEntryService(session).getEntriesCount(entryQuery);
}

protected JSONObject addQueryParams(long groupId, long classNameId) throws JSONException {
JSONObject entryQueryParams = new JSONObject();
entryQueryParams.put("classNameIds", classNameId);
entryQueryParams.put("groupIds", groupId);
entryQueryParams.put("visible", "true");
protected JSONObject configureEntryQuery(long groupId, long classNameId) throws JSONException {

JSONObject entryQueryParams =
_customEntryQuery == null ? new JSONObject() : new JSONObject(_customEntryQuery);

if (!entryQueryParams.has("classNameIds")) {
entryQueryParams.put("classNameIds", classNameId);
}
if (!entryQueryParams.has("groupIds")) {
entryQueryParams.put("groupIds", groupId);
}
if (!entryQueryParams.has("visible")) {
entryQueryParams.put("visible", "true");
}
return entryQueryParams;
}

Expand All @@ -148,4 +162,5 @@ protected void validate(int startRow, int endRow, Locale locale) {
private String _portletItemName;
private long _groupId;
private long _classNameId;
private HashMap<String, Object> _customEntryQuery;
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
public class ForgotPasswordScreenlet
extends BaseScreenlet<ForgotPasswordViewModel, ForgotPasswordInteractor>
implements ForgotPasswordListener {

public ForgotPasswordScreenlet(Context context) {
super(context);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
import com.liferay.mobile.screens.context.SessionContext;
import com.liferay.mobile.screens.context.User;

import static com.liferay.mobile.screens.context.storage.CredentialsStoreBuilder.StorageType;
import static com.liferay.mobile.screens.context.storage.CredentialsStorageBuilder.StorageType;

/**
* @author Silvio Santos
Expand Down Expand Up @@ -81,7 +81,7 @@ public void onLoginSuccess(User user) {

getContext().sendBroadcast(new Intent(LOGIN_SUCCESSFUL));

SessionContext.storeSession(_credentialsStore);
SessionContext.storeCredentials(_credentialsStorage);
}

public void sendOAuthResult(int result, Intent intent) {
Expand Down Expand Up @@ -113,12 +113,12 @@ public BasicAuthMethod getAuthMethod() {
return _basicAuthMethod;
}

public StorageType getCredentialsStore() {
return _credentialsStore;
public StorageType getCredentialsStorage() {
return _credentialsStorage;
}

public void setCredentialsStore(StorageType value) {
_credentialsStore = value;
public void setCredentialsStorage(StorageType value) {
_credentialsStorage = value;
}

public String getOAuthConsumerSecret() {
Expand Down Expand Up @@ -168,10 +168,10 @@ protected View createScreenletView(Context context, AttributeSet attributes) {
TypedArray typedArray = context.getTheme().obtainStyledAttributes(
attributes, R.styleable.LoginScreenlet, 0, 0);

int storeValue = typedArray.getInt(R.styleable.LoginScreenlet_credentialsStore,
int storeValue = typedArray.getInt(R.styleable.LoginScreenlet_credentialsStorage,
StorageType.NONE.toInt());

_credentialsStore = StorageType.valueOf(storeValue);
_credentialsStorage = StorageType.valueOf(storeValue);

_oauthConsumerKey =
typedArray.getString(R.styleable.LoginScreenlet_oauthConsumerKey);
Expand Down Expand Up @@ -250,7 +250,7 @@ protected void onUserAction(String userActionName, LoginInteractor interactor, O

private LoginListener _listener;
private BasicAuthMethod _basicAuthMethod;
private StorageType _credentialsStore;
private StorageType _credentialsStorage;

private String _oauthConsumerKey;
private String _oauthConsumerSecret;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public void onEvent(JSONObjectEvent event) {
}

if (event.isFailed()) {
SessionContext.clearSession();
SessionContext.logout();
getListener().onLoginFailure(event.getException());
}
else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,8 @@ protected void validate(String login, String password, BasicAuthMethod basicAuth

// NOTE: this interactor can store state because these attributes
// aren't used after the request is fired.
private String _login;
private String _password;
private BasicAuthMethod _basicAuthMethod;
protected String _login;
protected String _password;
protected BasicAuthMethod _basicAuthMethod;

}
Loading

0 comments on commit 5201c3d

Please sign in to comment.