Skip to content

Commit

Permalink
Merge pull request #837 from redsolution/develop
Browse files Browse the repository at this point in the history
Release candidate version v2.4.1 (501)
  • Loading branch information
Str4tocaster committed Jul 27, 2018
2 parents 9b23396 + 10a09b0 commit 8a29a6f
Show file tree
Hide file tree
Showing 621 changed files with 10,646 additions and 2,252 deletions.
5 changes: 3 additions & 2 deletions xabber/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ android {
defaultConfig {
minSdkVersion 15
targetSdkVersion 27
versionCode 482
versionName '2.3.2(482)'
versionCode 501
versionName '2.4.1(501)'
}

lintOptions {
Expand Down Expand Up @@ -180,6 +180,7 @@ dependencies {
implementation 'com.github.bumptech.glide:glide:3.7.0'
implementation 'com.squareup.okhttp3:okhttp:3.5.0'
implementation 'org.greenrobot:eventbus:3.0.0'
implementation 'commons-io:commons-io:2.6'

// ui
implementation 'com.amulyakhare:com.amulyakhare.textdrawable:1.0.1'
Expand Down
11 changes: 11 additions & 0 deletions xabber/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
<uses-permission android:name="android.permission.READ_INTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS" />
<uses-permission android:name="android.permission.CAMERA" />

<application
android:name=".data.Application"
Expand Down Expand Up @@ -419,6 +420,8 @@
</activity>

<service android:name=".service.XabberService" />
<service android:name=".service.DownloadService" />
<service android:name=".service.UploadService" />

<receiver android:name=".receiver.BootReceiver">
<intent-filter>
Expand Down Expand Up @@ -503,6 +506,14 @@
android:name="android.support.PARENT_ACTIVITY"
android:value="com.xabber.android.ui.activity.AccountActivity" />
</activity>
<activity android:name=".ui.activity.ImageViewerActivity"
android:theme="@style/ThemeDark"
android:parentActivityName=".ui.activity.ChatActivity">
<!-- Parent activity meta-data to support 4.0 and lower -->
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="com.xabber.android.ui.activity.ChatActivity" />
</activity>
<activity android:name=".ui.activity.IntroActivity"
android:theme="@style/ThemeDark"/>
<activity android:name=".ui.activity.TutorialActivity"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,21 +17,21 @@
import android.support.annotation.NonNull;
import android.util.Log;

import com.xabber.android.data.SettingsManager;
import com.xabber.android.data.account.AccountErrorEvent;
import com.xabber.android.data.account.AccountItem;
import com.xabber.android.data.extension.httpfileupload.CustomDataProvider;
import com.xabber.android.data.log.AndroidLoggingHandler;
import com.xabber.android.data.log.LogManager;

import org.greenrobot.eventbus.EventBus;
import org.jivesoftware.smack.AbstractXMPPConnection;
import org.jivesoftware.smack.SmackException;
import org.jivesoftware.smack.XMPPException;
import org.jivesoftware.smack.provider.ProviderManager;
import org.jivesoftware.smack.sasl.SASLErrorException;
import org.jivesoftware.smack.tcp.XMPPTCPConnection;
import org.jivesoftware.smack.util.DNSUtil;
import org.jivesoftware.smack.util.dns.dnsjava.DNSJavaResolver;
import org.jivesoftware.smack.util.dns.minidns.MiniDnsResolver;
import org.jivesoftware.smackx.xdata.packet.DataForm;

import java.io.IOException;
import java.util.logging.Level;
Expand Down Expand Up @@ -133,6 +133,11 @@ void connectAndLogin() {

if (!connection.isAuthenticated()) {
connection.login();

// can be a cause of strange Smack behavior
// not authorization or not receiving a iq's
ProviderManager.addExtensionProvider(DataForm.ELEMENT,
DataForm.NAMESPACE, new CustomDataProvider());
} else {
LogManager.i(this, "Already authenticated");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import android.os.Looper;

import com.xabber.android.data.Application;
import com.xabber.android.data.database.messagerealm.Attachment;
import com.xabber.android.data.database.messagerealm.MessageItem;
import com.xabber.android.data.database.messagerealm.SyncInfo;
import com.xabber.android.data.database.sqlite.MessageTable;
Expand All @@ -29,7 +30,7 @@

public class MessageDatabaseManager {
private static final String REALM_MESSAGE_DATABASE_NAME = "xabber.realm";
static final int REALM_MESSAGE_DATABASE_VERSION = 15;
static final int REALM_MESSAGE_DATABASE_VERSION = 16;
private final RealmConfiguration realmConfiguration;

private static MessageDatabaseManager instance;
Expand Down Expand Up @@ -132,7 +133,7 @@ public void execute(Realm realm) {
}


@RealmModule(classes = {MessageItem.class, SyncInfo.class})
@RealmModule(classes = {MessageItem.class, SyncInfo.class, Attachment.class})
static class MessageRealmDatabaseModule {
}

Expand Down Expand Up @@ -260,6 +261,26 @@ public void migrate(DynamicRealm realm1, long oldVersion, long newVersion) {
oldVersion++;
}

if (oldVersion == 15) {
schema.create(Attachment.class.getSimpleName())
.addField("uniqueId", String.class,
FieldAttribute.PRIMARY_KEY, FieldAttribute.REQUIRED)
.addField("title", String.class)
.addField("filePath", String.class)
.addField("fileUrl", String.class)
.addField("fileSize", Long.class)
.addField("isImage", boolean.class)
.addField("imageWidth", Integer.class)
.addField("imageHeight", Integer.class)
.addField("duration", Long.class)
.addField("mimeType", String.class);

schema.get(MessageItem.class.getSimpleName())
.addRealmListField(MessageItem.Fields.ATTACHMENTS,
schema.get(Attachment.class.getSimpleName()));
oldVersion++;
}

}
})
.build();
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,138 @@
package com.xabber.android.data.database.messagerealm;

import android.support.annotation.Nullable;

import java.util.UUID;

import io.realm.RealmObject;
import io.realm.annotations.PrimaryKey;
import io.realm.annotations.Required;

public class Attachment extends RealmObject {

public static class Fields {
public static final String UNIQUE_ID = "uniqueId";
public static final String TITLE = "title";
public static final String FILE_PATH = "filePath";
public static final String FILE_URL = "fileUrl";
public static final String FILE_SIZE = "fileSize";
public static final String IS_IMAGE = "isImage";
public static final String IMAGE_WIDTH = "imageWidth";
public static final String IMAGE_HEIGHT = "imageHeight";
public static final String DURATION = "duration";
public static final String MIME_TYPE = "mimeType";
}

@PrimaryKey
@Required
private String uniqueId;

private String title;

private String fileUrl;

/**
* If message "contains" file with local file path
*/
private String filePath;

/**
* If message contains URL to image (and may be drawn as image)
*/
private boolean isImage;

@Nullable
private Integer imageWidth;

@Nullable
private Integer imageHeight;

private Long fileSize;

private String mimeType;

/** Duration in seconds */
private Long duration;

public Attachment() {
this.uniqueId = UUID.randomUUID().toString();
}

public String getUniqueId() {
return uniqueId;
}

public String getFilePath() {
return filePath;
}

public void setFilePath(String filePath) {
this.filePath = filePath;
}

public boolean isImage() {
return isImage;
}

public void setIsImage(boolean isImage) {
this.isImage = isImage;
}

@Nullable
public Integer getImageWidth() {
return imageWidth;
}

public void setImageWidth(@Nullable Integer imageWidth) {
this.imageWidth = imageWidth;
}

@Nullable
public Integer getImageHeight() {
return imageHeight;
}

public void setImageHeight(@Nullable Integer imageHeight) {
this.imageHeight = imageHeight;
}

public String getFileUrl() {
return fileUrl;
}

public void setFileUrl(String fileUrl) {
this.fileUrl = fileUrl;
}

public Long getFileSize() {
return fileSize;
}

public void setFileSize(Long fileSize) {
this.fileSize = fileSize;
}

public String getTitle() {
return title;
}

public void setTitle(String title) {
this.title = title;
}

public String getMimeType() {
return mimeType;
}

public void setMimeType(String mimeType) {
this.mimeType = mimeType;
}

public Long getDuration() {
return duration;
}

public void setDuration(Long duration) {
this.duration = duration;
}
}
Loading

0 comments on commit 8a29a6f

Please sign in to comment.