Commit 1b154fb9 authored by Rafael Kellermann Streit's avatar Rafael Kellermann Streit Committed by GitHub

Merge pull request #296 from RocketChat/fix_251

Fix 251
parents 8f8d9816 f91727db
......@@ -7,7 +7,7 @@ before_script:
- echo y | android update sdk --no-ui --all --filter android-25
- echo y | android update sdk --no-ui --all --filter extra-android-m2repository,extra-android-support
- echo y | android update sdk --no-ui --all --filter extra-google-m2repository,extra-google-google_play_services
- echo y | android update sdk --no-ui --all --filter build-tools-25.0.2
- echo y | android update sdk --no-ui --all --filter build-tools-25.0.3
- ./gradlew dependencies
script:
......
......@@ -6,7 +6,7 @@ buildscript {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.1'
classpath 'com.android.tools.build:gradle:2.3.2'
classpath 'me.tatarka:gradle-retrolambda:3.6.1'
classpath 'me.tatarka.retrolambda.projectlombok:lombok.ast:0.2.3.a2'
}
......@@ -14,7 +14,7 @@ buildscript {
android {
compileSdkVersion 25
buildToolsVersion '25.0.2'
buildToolsVersion '25.0.3'
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
......@@ -35,7 +35,7 @@ android {
}
ext {
supportVersion = '25.1.1'
supportVersion = '25.3.1'
}
dependencies {
......
......@@ -10,7 +10,7 @@ buildscript {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.1'
classpath 'com.android.tools.build:gradle:2.3.2'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
......@@ -28,7 +28,7 @@ buildscript {
android {
compileSdkVersion 25
buildToolsVersion '25.0.2'
buildToolsVersion '25.0.3'
defaultConfig {
applicationId "chat.rocket.android"
minSdkVersion 16
......@@ -75,13 +75,13 @@ play {
}
ext {
supportVersion = '25.2.0'
playLibVersion = '10.2.0'
supportVersion = '25.3.1'
playLibVersion = '10.2.6'
stethoVersion = '1.4.2'
rxbindingVersion = '2.0.0'
rxlifecycleVersion = '2.0.1'
rxlifecycleVersion = '2.1.0'
icepickVersion = '3.2.0'
permissionsdispatcherVersion = '2.3.1'
permissionsdispatcherVersion = '2.4.0'
}
dependencies {
......@@ -101,7 +101,7 @@ dependencies {
compile "com.google.android.gms:play-services-gcm:$playLibVersion"
compile 'com.squareup.okhttp3:okhttp:3.6.0'
compile 'com.squareup.okhttp3:okhttp:3.8.0'
compile "com.facebook.stetho:stetho:$stethoVersion"
compile "com.facebook.stetho:stetho-okhttp3:$stethoVersion"
......
package chat.rocket.android.renderer;
import android.content.Context;
import android.support.annotation.Nullable;
import android.view.View;
import chat.rocket.android.renderer.optional.Condition;
......@@ -15,27 +16,28 @@ abstract class AbstractRenderer<T> {
this.object = object;
}
// TODO should we get rid of this simpler version of 'shouldHandle'?
protected boolean shouldHandle(View view) {
return object != null && view != null;
}
protected boolean shouldHandle(View target, Condition additionalCondition, Optional optional,
String key) {
if (target == null || object == null) {
if (optional != null) {
optional.onNoData(key);
}
protected boolean shouldHandle(View target,
@Nullable Condition additionalCondition,
Optional optional,
@Nullable String key) {
if (target == null) {
return false;
}
if (optional != null) {
if (!additionalCondition.isOK()) {
optional.onNoData(key);
return false;
} else {
if (object == null) {
optional.onNoData(key);
} else {
if (additionalCondition == null || additionalCondition.isOK()) {
optional.onDataExists(key);
return true;
} else {
optional.onNoData(key);
}
}
return true;
return false;
}
}
......@@ -26,10 +26,10 @@ dependencies:
- echo y | android update sdk --no-ui --all --filter android-25
- echo y | android update sdk --no-ui --all --filter extra-android-m2repository,extra-android-support
- echo y | android update sdk --no-ui --all --filter extra-google-m2repository,extra-google-google_play_services
- echo y | android update sdk --no-ui --all --filter build-tools-25.0.2
- echo y | android update sdk --no-ui --all --filter build-tools-25.0.3
cache_directories:
- /usr/local/android-sdk-linux/tools
- /usr/local/android-sdk-linux/build-tools/25.0.2
- /usr/local/android-sdk-linux/build-tools/25.0.3
test:
override:
......
......@@ -5,13 +5,13 @@ buildscript {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.1'
classpath 'com.android.tools.build:gradle:2.3.2'
}
}
android {
compileSdkVersion 25
buildToolsVersion '25.0.2'
buildToolsVersion '25.0.3'
defaultConfig {
minSdkVersion 16
......
......@@ -8,7 +8,7 @@ buildscript {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.1'
classpath 'com.android.tools.build:gradle:2.3.2'
classpath 'io.realm:realm-gradle-plugin:2.3.2'
classpath 'me.tatarka:gradle-retrolambda:3.5.0'
classpath 'me.tatarka.retrolambda.projectlombok:lombok.ast:0.2.3.a2'
......@@ -18,7 +18,7 @@ buildscript {
android {
compileSdkVersion 25
buildToolsVersion '25.0.2'
buildToolsVersion '25.0.3'
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
......@@ -39,7 +39,7 @@ android {
}
ext {
supportVersion = '25.2.0'
supportVersion = '25.3.1'
}
dependencies {
......@@ -50,10 +50,10 @@ dependencies {
compile "com.android.support:appcompat-v7:$supportVersion"
compile "com.android.support:design:$supportVersion"
compile 'io.reactivex.rxjava2:rxjava:2.0.6'
compile 'io.reactivex.rxjava2:rxjava:2.1.0'
compile 'io.reactivex.rxjava2:rxandroid:2.0.1'
compile 'com.github.akarnokd:rxjava2-interop:0.9.1'
compile 'com.github.akarnokd:rxjava2-interop:0.10.0'
compile 'com.parse.bolts:bolts-tasks:1.4.0'
......
......@@ -2,7 +2,9 @@ package chat.rocket.persistence.realm.repositories;
import android.os.Looper;
import android.support.v4.util.Pair;
import com.fernandocejas.arrow.optional.Optional;
import io.reactivex.Flowable;
import io.reactivex.Single;
import io.reactivex.android.schedulers.AndroidSchedulers;
......@@ -12,6 +14,7 @@ import io.realm.Sort;
import java.util.ArrayList;
import java.util.List;
import chat.rocket.core.models.Message;
import chat.rocket.core.models.Room;
import chat.rocket.core.models.User;
......@@ -75,10 +78,11 @@ public class RealmMessageRepository extends RealmRepository implements MessageRe
RealmUser realmUser = realmMessage.getUser();
if (realmUser == null) {
realmUser = new RealmUser();
realmUser = realm.where(RealmUser.class)
.equalTo(RealmUser.ID, message.getUser().getId())
.findFirst();
}
realmUser.setId(message.getUser().getId());
realmMessage.setUser(realmUser);
realm.beginTransaction();
......
......@@ -5,13 +5,13 @@ buildscript {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.1'
classpath 'com.android.tools.build:gradle:2.3.2'
}
}
android {
compileSdkVersion 25
buildToolsVersion '25.0.2'
buildToolsVersion '25.0.3'
defaultConfig {
minSdkVersion 16
......@@ -30,8 +30,8 @@ android {
}
ext {
supportVersion = '25.2.0'
frescoVersion = '1.1.0'
supportVersion = '25.3.1'
frescoVersion = '1.3.0'
rxbindingVersion = '2.0.0'
}
......@@ -49,7 +49,7 @@ dependencies {
compile 'com.amulyakhare:com.amulyakhare.textdrawable:1.0.1'
compile 'com.squareup.okhttp3:okhttp:3.6.0'
compile 'com.squareup.okhttp3:okhttp:3.8.0'
compile 'com.github.yusukeiwaki.android-widget:widget-fontawesome:0.0.1'
......
......@@ -12,6 +12,7 @@ import com.amulyakhare.textdrawable.TextDrawable;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import chat.rocket.android.widget.AbsoluteUrl;
import chat.rocket.android.widget.R;
import chat.rocket.android.widget.RocketChatAvatar;
......@@ -81,6 +82,7 @@ public class UserViewHolder extends AutocompleteViewHolder<UserItem> {
//REMARK! this is often SVG image! (see: Rocket.Chat:server/startup/avatar.coffee)
try {
final String avatarUrl = "/avatar/" + URLEncoder.encode(username, "UTF-8") + ".jpg";
// TODO why absoluteUrl is nullable? By allowing that, the app tries to load non-existing images
if (absoluteUrl == null) {
return avatarUrl;
}
......
......@@ -12,7 +12,7 @@ dependencies {
compile 'com.google.code.findbugs:jsr305:3.0.1'
compile 'io.reactivex.rxjava2:rxjava:2.0.6'
compile 'io.reactivex.rxjava2:rxjava:2.1.0'
compile 'com.fernandocejas:arrow:1.0.0'
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment